Cov txheej txheem:

Tsim kom muaj Hygrometer hauv Tsev Siv Raspberry Pi thiab SI7021: 6 Cov Kauj Ruam
Tsim kom muaj Hygrometer hauv Tsev Siv Raspberry Pi thiab SI7021: 6 Cov Kauj Ruam

Video: Tsim kom muaj Hygrometer hauv Tsev Siv Raspberry Pi thiab SI7021: 6 Cov Kauj Ruam

Video: Tsim kom muaj Hygrometer hauv Tsev Siv Raspberry Pi thiab SI7021: 6 Cov Kauj Ruam
Video: Nkauj mos ab ib txhia tub sab 7/25/2018 2024, Kaum ib hlis
Anonim
Image
Image
Xav Tau Kev Pab Cuam
Xav Tau Kev Pab Cuam

Puas yog hnub no ntub? Nws hnov me ntsis ntub rau kuv

Qee zaum rau peb, cov av noo siab ua pov thawj tias tsis xis nyob thiab tsis zoo. Rau tsev neeg, nws tuaj yeem ua rau muaj kev puas tsuaj ib yam nkaus. Rau ib lub tsev, cov av noo siab ua rau cov ntoo hauv tsev thiab cov rooj tog nrog txhawb kom muaj kev loj hlob nyob ib puag ncig peb. Los ntawm hmoov zoo, muaj cov hauv kev uas tso cai rau koj los tshuaj xyuas thiab tswj cov av hauv tsev.

Hauv kev ua tsov rog no peb yuav ua Hygrometer, lub kaw lus siv rau ntsuas cov dej noo hauv huab cua, siv Raspberry Pi thiab SI7021, Vaum thiab ntsuas kub. Peb lub hom phiaj yog txhawm rau txheeb xyuas qhov txheeb ze thiab qhov kub nyob hauv chav tsev (qhov zoo tshaj qhov txheeb ze yog kwv yees li 40-50%, chav sov zoo tshaj yog kwv yees li ntawm 15 ° C (59 ° F) thiab 30 ° C (86 ° F)) thiab ib txoj hauv kev yog siv lub hygrometer. Peb tuaj yeem, tau kawg, tau yuav ib qho, tab sis muaj Raspberry Pi thiab Humidity & Kub sensor hauv tes, peb xav tias peb yuav ua ib qho (Vim li cas tsis!).

Kauj Ruam 1: Yuav Tsum Tau Siv Lub Cev

Xav Tau Kev Pab Cuam
Xav Tau Kev Pab Cuam
Xav Tau Kev Pab Cuam
Xav Tau Kev Pab Cuam

Tsis paub txog qhov tseeb, qhov muaj txiaj ntsig thiab qhov twg hauv ntiaj teb kom tau lawv, nws yog qhov txaus siab heev. Tsis txhob txhawj. Peb tau txheeb qhov ntawd rau koj. Thaum koj tau txais cov khoom txhua qhov sib nrug deb, nws yuav tsum yog qhov ua kom tiav qhov haujlwm no.

1. Raspberry Pi

Thawj kauj ruam yog tau txais Raspberry Pi board. Raspberry Pi yog tib lub rooj tsav xwm Linux raws lub khoos phis tawj. Lub PC me me no tau ntim rau hauv kev suav lub zog, siv hauv cov phiaj xwm hluav taws xob, thiab kev ua haujlwm yooj yim xws li daim ntawv nthuav dav, ua cov lus, tshawb xyuas lub vev xaib, thiab e-mail, thiab kev ua si.

2. I²C Shield rau Raspberry Pi

Hauv peb qhov kev xav, tsuas yog qhov Raspberry Pi 2 thiab Pi 3 tsis muaj qhov tseeb yog I portC chaw nres nkoj. INPI2 (I2C adapter) muab Raspberry Pi 2/3 ib qho I²C chaw nres nkoj rau siv nrog ntau I²C khoom siv. Nws muaj nyob ntawm Dcube Store.

3. SI7021 Vaum thiab Kub Sensor

SI7021 I²C Vaum thiab 2-Zone Kub Sensor yog monolithic CMOS IC sib xyaw ua ke cov av noo thiab ntsuas qhov ntsuas kub, qhov sib piv-rau-digital hloov pauv, teeb liab ua haujlwm, ntsuas cov ntaub ntawv, thiab I²C Interface. Peb tau yuav qhov ntsuas no los ntawm Dcube Store.

4. I²C Txuas Cable

Peb muaj I²C txuas cov xov hluav taws xob muaj nyob ntawmDcubeStore.

5. Micro USB cable

Qhov nyuaj tshaj plaws, tab sis nruj tshaj plaws ntawm kev xav tau lub zog yog Raspberry Pi! Txoj hauv kev yooj yim tshaj plaws rau lub zog Raspberry Pi yog los ntawm Micro USB cable.

6 Ethernet (LAN) Cable/ USB WiFi Adapter

Koj puas tau saib koj lub neej thiab xav, Internet tau ua dab tsi rau kuv?

Txoj hauv kev kom tau txais koj li Raspberry Pi txuas nrog yog siv Ethernet cable thiab ntsaws nws rau hauv koj lub network router. Ib qho ntxiv, Kev sib txuas WiFi tuaj yeem ua los ntawm kev ntsaws rau hauv WiFi dongle thiab sab laug-nyem lub network icon kom coj los ua cov npe ntawm WiFi muaj nyob.

7. HDMI Cable/ Kev Nkag Mus Rau Tej Chaw

Nrog HDMI cable ntawm lub nkoj, koj tuaj yeem txuas nws mus rau TV digital lossis rau Monitor. Xav tau txoj kev txuag nyiaj! Raspberry Pi tuaj yeem nkag mus tau yooj yim siv txoj hauv kev sib txawv xws li-SSH thiab Kev Nkag Mus Hauv Is Taws Nem. Koj tuaj yeem siv PuTTY qhib qhov software.

Kuv ntxub kev ua lej, tab sis kuv nyiam suav nyiaj

Kauj Ruam 2: Ua Kev Kho Vajtse Txuas

Ua Kev Sib Txuas Kho Vajtse
Ua Kev Sib Txuas Kho Vajtse
Ua Kev Sib Txuas Kho Vajtse
Ua Kev Sib Txuas Kho Vajtse

Feem ntau, lub voj voog yog ncaj ncaj rau pem hauv ntej. Ua lub Circuit Court raws li qhov schematic qhia. Cov txheej txheem yog qhov yooj yim, thiab koj yuav tsum tsis muaj teeb meem.

Hauv peb qhov xwm txheej, peb tau hloov kho qee qhov pib ntawm cov khoom siv hluav taws xob tsuas yog kho lub cim xeeb rau kho vajtse thiab software. Peb xav kos cov txheej txheem hluav taws xob yooj yim rau txoj haujlwm no. Kev kos duab hluav taws xob zoo li lub phiaj xwm rau hluav taws xob. Kos ib daim qauv thiab ua tib zoo tsim.

Raspberry Pi thiab I²C Shield Txuas

Ua ntej tshaj plaws coj Raspberry Pi thiab tso I²C Shield rau nws. Nias lub Shield maj mam mus rau GPIO tus pin. Ua qhov yog, tsis yog yam yooj yim (Saib daim duab saum toj no).

Sensor thiab Raspberry Pi Kev Sib Txuas

Coj lub sensor thiab txuas I²C Cable nrog nws. Kom ua haujlwm tau zoo ntawm cov kab no, thov nco ntsoov I²C Cov Tawm Ib Leeg txuas rau I²C Cov Tswv Yim. Tib yam yuav tsum tau ua raws rau Raspberry Pi nrog I²C daim ntaub thaiv npog nws.

Qhov txiaj ntsig loj ntawm kev siv I²C Shield/Adapter thiab cov txuas txuas yog tias peb tsis muaj teeb meem txuas xov ntxiv uas tuaj yeem ua rau muaj kev ntxhov siab thiab siv sijhawm los kho, tshwj xeeb tshaj yog thaum koj tsis paub meej tias yuav pib daws teeb meem qhov twg. Tsuas yog cov txheej txheem yooj yim uas peb tau hais txog. Nws yog ntsaws thiab ua si xaiv.

Nco tseg: Cov xaim xim av yuav tsum ib txwm ua raws hauv av (GND) kev sib txuas ntawm cov khoom siv ntawm ib lub cuab yeej thiab cov tswv yim ntawm lwm lub cuab yeej

Kev Sib Txuas Internet yog qhov tseem ceeb

Txhawm rau kom peb txoj haujlwm tiav, peb xav tau kev siv internet rau peb Raspberry Pi. Koj muaj ob txoj kev xaiv ntawm no. Xwb Koj tuaj yeem txuas Raspberry Pi mus rau lub network siv Ethernet cable lossis siv USB rau WiFi Adapter rau WIFI Kev Sib Txuas. Ua li cas los xij, tsuav nws txuas nrog internet uas koj tau npog.

Kev ua kom muaj zog ntawm Circuit Court

Txuas lub Micro USB cable rau hauv lub hwj chim nkaus ntawm Raspberry Pi. Fais fab nws thiab peb tawm ntawm txoj kev.

Peb tiam neeg tau npaj zoo dua rau Zombie apocalypse tshaj li ib teev tsis muaj hluav taws xob

Kev Txuas Mus Saib Xyuas

Peb tuaj yeem muaj HDMI cable txuas nrog tus saib/TV tshiab lossis peb tuaj yeem txuas Raspberry Pi nyob deb siv cov cuab yeej nkag tau zoo ib yam li-SSH/PuTTY uas raug nqi. Nws yog me ntsis ntawm txoj hauv kev muaj tswv yim yog tias koj pom siv cov peev txheej ib puag ncig.

Kauj Ruam 3: Programming Raspberry Pi hauv Python

Programming Raspberry Pi hauv Python
Programming Raspberry Pi hauv Python

Koj tuaj yeem saib Python code rau Raspberry Pi thiab SI7021 hauv pebGithubrepository.

Ua ntej mus rau qhov haujlwm, nco ntsoov tias koj tau saib rau cov lus qhia muab hauv Readme cov ntaub ntawv thiab teeb tsa koj li Raspberry Pi raws li nws.

Hws noo hais txog qhov muaj cov kua, tshwj xeeb tshaj yog dej, feem ntau hauv kab ntawv. Cov dej me me tuaj yeem pom, piv txwv li, hauv huab cua (av noo), hauv zaub mov, thiab hauv ntau yam khoom lag luam. Hws noo tseem hais txog qhov muaj cov pa dej nyob hauv huab cua.

Hauv qab no yog tus nab npawb nab npawb thiab koj tuaj yeem clone nws thiab tuaj yeem tsim kho yog tias xav tau.

# Faib nrog daim ntawv tso cai yuav dawb.# Siv nws txhua txoj hauv kev koj xav tau, muaj txiaj ntsig lossis pub dawb, muab nws haum rau hauv daim ntawv tso cai ntawm nws cov haujlwm ua haujlwm. # SI7021 # Txoj cai no yog tsim los ua haujlwm nrog SI7021_I2CS I2C Mini Module muaj los ntawm ControlEverything.com. #

ntshuam smbus

lub sij hawm ntshuam

# Tau I2C npav

npav = smbus. SMBus (1)

# SI7021 chaw nyob, 0x40 (64)

# 0xF5 (245) Xaiv Tus Txheeb Ze Vaum Tsis HOLD tus tswv hom bus.write_byte (0x40, 0xF5)

sijhawm.s pw (0.3)

# SI7021 chaw nyob, 0x40 (64)

# Nyeem cov ntaub ntawv rov qab, 2 bytes, Vaum MSB thawj cov ntaub ntawv0 = bus.read_byte (0x40) data1 = bus.read_byte (0x40)

# Hloov cov ntaub ntawv

av noo = ((data0 * 256 + data1) * 125 / 65536.0) - 6

sijhawm.s pw (0.3)

# SI7021 chaw nyob, 0x40 (64)

# 0xF3 (243) Xaiv qhov kub tsis muaj HOLD tus tswv hom bus.write_byte (0x40, 0xF3)

sijhawm.s pw (0.3)

# SI7021 chaw nyob, 0x40 (64)

# Nyeem cov ntaub ntawv rov qab, 2 bytes, Kub MSB thawj cov ntaub ntawv0 = bus.read_byte (0x40) data1 = bus.read_byte (0x40)

# Hloov cov ntaub ntawv

cTemp = ((data0 * 256 + data1) * 175.72 / 65536.0) - 46.85 fTemp = cTemp * 1.8 + 32

# Cov ntaub ntawv tso tawm rau lub vijtsam

luam "Cov txheeb ze vaum yog: %.2f %%" %av noo luam tawm "Kub hauv Celsius yog: %.2f C" %cTemp luam "Kub hauv Fahrenheit yog: %.2f F" %fTemp

Kauj ruam 4: Hom Ua Haujlwm

Hom Ua Haujlwm
Hom Ua Haujlwm

Tam sim no, rub tawm (lossis git rub) cov cai thiab qhib nws hauv Raspberry Pi.

Khiav cov lus txib kom Sib Sau thiab Tshaj Tawm cov cai ntawm lub davhlau ya nyob twg thiab pom cov khoom tso tawm ntawm Saib. Tom qab ob peb lub sijhawm, nws yuav tso tawm txhua qhov hloov pauv. Pib tawm nrog ob peb qhov kev xav lossis cov ntsiab lus thiab pom dab tsi koj tuaj yeem tuaj nrog.

Kauj Ruam 5: Cov ntawv thov thiab Nta

SI7021 muab qhov tseeb, siv hluav taws xob tsawg, lub Hoobkas ntsuas ntsuas cov cuab yeej daws teeb meem zoo tshaj plaws rau ntsuas cov av noo, lwg taw tes, thiab ntsuas kub, hauv daim ntawv thov xws li HVAC/R, Thermostats/Humidistats, Kev kho mob ua pa, Khoom dawb, Sab hauv huab cua, Micro-Ib puag ncig /Cov Chaw Cov Ntaub Ntawv, Kev Tiv Thaiv Kev Nyab Xeeb Hauv Tsheb thiab Defogging, Cov Khoom Siv thiab Cov Khoom Nrhiav thiab Xov Tooj Ntawm Tes thiab Xov Tooj.

Rau xws li Koj tuaj yeem txhim kho txoj haujlwm no mus rau hauv HVAC Qhov Taw Qhia rau Sab Hauv Tsev thiab Tsheb Thauj Khoom Ib Leeg. Nws tswj cov cua sov ib puag ncig txiav txim siab tswj qhov kub thiab txias, ntxiv oxygen, thiab tshem tawm cov dej noo, tsw ntxhiab, pa luam yeeb, cua sov, hmoov av, kab mob hauv cov pa, carbon dioxide, thiab lwm yam pa. Sib nrug los ntawm cov av noo thiab ntsuas qhov kub, koj tuaj yeem pab txoj haujlwm no nrog cov ntsuas ntsuas los ntawm kev ntsuas siab, Huab cua Zoo, Cov pa luam yeeb mus rau Lub Teeb & Kev Sib Haum Xeeb. Koj tuaj yeem txhim kho cov cai raws li qhov xav tau kho vajtse thiab tom qab ntawd koj tuaj yeem muaj koj tus kheej teeb tsa los ua koj tus kheej kom sov. Txoj haujlwm no zoo rau menyuam yaus, thiab koj xav qhia lawv qee yam khoom txaus, koj paub kev kawm thaum ua si. Ib txoj haujlwm me me zoo li qhov no tuaj yeem zoo nkauj txaus rau menyuam yaus.

Kauj Ruam 6: Xaus

Yog tias koj tau xav tsis thoob los saib rau hauv lub ntiaj teb ntawm Raspberry Pi, tom qab ntawd koj tuaj yeem ua rau koj xav tsis thoob los ntawm kev siv cov khoom siv hluav taws xob pib, coding, tsim qauv, soldering thiab dab tsi tsis. Hauv cov txheej txheem no, tej zaum yuav muaj qee qhov haujlwm uas yuav yooj yim, thaum qee qhov yuav sim koj, twv koj. Tab sis koj tuaj yeem ua ib txoj hauv kev thiab ua kom tiav nws los ntawm kev hloov kho thiab tsim kev tsim ntawm koj li. Txog koj txoj kev pab, peb muaj cov vis dis aus zoo kawg hauv YouTube uas yuav pab koj tshawb nrhiav thiab piav qhia ntxiv txog txhua yam ntawm txoj haujlwm. Peb vam tias koj pom qhov no zoo kawg thiab muaj txiaj ntsig. Thov teb peb rau ib qho kev hloov kho.

Pom zoo: