Cov txheej txheem:

Siv Raspberry Pi, Txheeb Xyuas Cov Vaum thiab Kub Nrog SI7006: 6 Cov Kauj Ruam
Siv Raspberry Pi, Txheeb Xyuas Cov Vaum thiab Kub Nrog SI7006: 6 Cov Kauj Ruam

Video: Siv Raspberry Pi, Txheeb Xyuas Cov Vaum thiab Kub Nrog SI7006: 6 Cov Kauj Ruam

Video: Siv Raspberry Pi, Txheeb Xyuas Cov Vaum thiab Kub Nrog SI7006: 6 Cov Kauj Ruam
Video: Saib Mis paub Poj niam (hluas nkauj) tus yam ntxwv lub siab 2024, Kaum ib hlis
Anonim
Image
Image
Cov Khoom Siv Tseem Ceeb Peb Xav Tau
Cov Khoom Siv Tseem Ceeb Peb Xav Tau

Ua tus neeg mob siab rau Raspberry Pi, peb xav txog qee qhov kev sim zoo tshaj plaws nrog nws.

Hauv qhov phiaj xwm no, peb yuav ntsuas ntsuas kub thiab av noo uas xav tau kev tswj hwm, siv Raspberry Pi thiab SI7006, Vaum thiab ntsuas kub. Yog li cia saib ntawm txoj kev taug no txhawm rau tsim cov kab ke txhawm rau ntsuas cov dej noo.

Kauj Ruam 1: Cov Khoom Siv Tseem Ceeb Peb Xav Tau

Cov Khoom Siv Tseem Ceeb Peb Xav Tau
Cov Khoom Siv Tseem Ceeb Peb Xav Tau
Cov Khoom Siv Tseem Ceeb Peb Xav Tau
Cov Khoom Siv Tseem Ceeb Peb Xav Tau

Tsis paub qhov tseeb, qhov muaj nqis 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 koj txhais tes ntawm txhua ntu, txoj haujlwm yuav nrawm dua li Bolt hauv 100m kev sib tw.

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 hom phiaj dav dav mini PC uas nws me me, muaj peev xwm thiab tus nqi qis ua rau nws siv tau rau hauv kev ua haujlwm hauv PC yooj yim, kev siv niaj hnub zoo li IoT, Tsev Automation, Lub Nroog Ntse thiab ntau ntxiv.

2. I2C 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. SI7006 Vaum thiab Kub Sensor

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

4. I2C Txuas Txuas Cable

Peb muaj I²C txuas txuas muaj nyob ntawm DCUBE Store.

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 Dongle

"ua kom muaj zog" Kuv ntxhi rau kuv lub teeb liab wifi. Ua koj li Raspberry Pi txuas nrog Ethernet (LAN) cable thiab ntsaws rau hauv koj lub network router. Ib qho ntxiv, saib rau WiFi adapter thiab siv ib qho ntawm USB chaw nres nkoj txhawm rau nkag mus rau lub wireless network. Nws yog qhov kev xaiv ntse, yooj yim, me me thiab pheej yig!

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 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.

Nyiaj feem ntau raug nqi ntau dhau

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 kev tshuaj xyuas, peb tau kho qee qhov pib ntawm cov khoom siv hluav taws xob tsuas yog kho peb 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. Txog kev tshawb fawb ntxiv hauv hluav taws xob, YouTube yuav tuav koj qhov kev txaus siab (qhov no yog qhov tseem ceeb!).

Raspberry Pi thiab I2C Shield Txuas

Ua ntej tshaj plaws coj Raspberry Pi thiab tso I²C Shield rau nws. Nias daim ntaub thaiv npog maj mam muab. Thaum koj paub tias koj tab tom ua dab tsi, nws yog ib qho khoom qab zib. (Saib daim duab saum toj no).

Sensor thiab Raspberry Pi Kev Sib Txuas

Coj lub sensor thiab txuas I²C Cable rau nws. Txog qhov ua tau zoo tshaj plaws ntawm cov kab no, thov nco ntsoov I²C Cov Zis Txuas nrog I²C Cov Lus Qhia. Tib yam yuav tsum ua tiav rau Raspberry Pi nrog I²C daim ntaub thaiv hla nws. Qhov loj dua ntawm kev siv I²C Shield/Adapter thiab txuas cov xov tooj yog tias peb tsis muaj teeb meem teeb meem uas tuaj yeem ua rau ntxhov siab thiab siv sijhawm los kho, tshwj xeeb tshaj yog thaum koj tsis paub meej tias yuav pib daws teeb meem qhov twg. Nws qhov kev xaiv ntsaws thiab ua si (Qhov no yog ntsaws, ntsaws thiab ua si. Nws yooj yim heev rau siv, nws tsis txaus ntseeg).

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

Networking yog ib qho tseem ceeb

Txhawm rau kom peb txoj haujlwm tiav, peb xav tau kev txuas internet rau peb Raspberry Pi. Txog qhov no, koj muaj kev xaiv xws li txuas Ethernet (LAN) cable nrog lub network hauv tsev. Tsis tas li, raws li lwm txoj hauv kev tab sis txoj hauv kev yooj yim yog siv WiFi adapter. Qee zaum rau qhov no, koj xav tau tus tsav tsheb kom nws ua haujlwm. Yog li nyiam qhov nrog Linux hauv qhov kev piav qhia.

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.

Nrog lub hwj chim loj los daim nqi hluav taws xob loj

Kev Sib Txuas rau Screen

Peb tuaj yeem muaj HDMI cable txuas nrog tus saib xyuas/TV tshiab lossis peb tuaj yeem peb muaj txuj ci me me los ua kom muaj kev sib txuas nrog Raspberry Pi nyob deb uas yog kev lag luam siv cov cuab yeej nkag tau zoo xws li-SSH thiab PuTTY.

Nco ntsoov, txawm tias Batman yuav tsum txo qis hauv kev lag luam no

Kauj Ruam 3: Python Programming Raspberry Pi

Python Programming Raspberry Pi
Python Programming Raspberry Pi

Koj tuaj yeem saib Python Code rau Raspberry Pi thiab SI7006 Sensor ntawm peb Github chaw cia khoom.

Ua ntej nkag mus rau qhov haujlwm, xyuas kom tseeb tias koj nyeem cov lus qhia muab rau hauv Readme file thiab teeb tsa koj li Raspberry Pi raws li nws. Nws yuav tsuas yog siv sijhawm me ntsis yog tias koj tshem nws tawm ntawm txoj kev ua ntej. Qhov av noo yog cov dej ua pa hauv huab cua. Cov pa dej yog cov pa roj av theem thiab pom tsis tau. Cov av noo qhia tau tias yuav muaj nag lossis daus, lossis pos huab. Txheeb ze cov av (sau luv RH) yog qhov sib piv ntawm ib nrab siab ntawm cov pa dej mus rau qhov sib npaug vapor siab ntawm cov dej ntawm qhov ntsuas kub. Tus txheeb ze cov av nyob ntawm qhov kub thiab qhov siab ntawm cov txheej txheem kev txaus siab.

Hauv qab no yog tus nab npawb nab npawb thiab koj tuaj yeem clone thiab kho cov cai hauv txhua txoj kev uas koj nyiam.

# 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. # SI7006-A20 # Txoj cai no yog tsim los ua haujlwm nrog SI7006-A20_I2CS I2C Mini Module muaj los ntawm ControlEverything.com. #

ntshuam smbus

lub sij hawm ntshuam

# Tau I2C npav

npav = smbus. SMBus (1)

# SI7006_A20 chaw nyob, 0x40 (64)

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

sijhawm.s pw (0.5)

# SI7006_A20 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 = (125.0 * (data0 * 256.0 + data1) / 65536.0) - 6.0

# SI7006_A20 chaw nyob, 0x40 (64)

# 0xF3 (243) Xaiv qhov kub tsis TSIS MASTER hom bus.write_byte (0x40, 0xF3)

sijhawm.s pw (0.5)

# SI7006_A20 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 = (175.72 * (data0 * 256.0 + data1) / 65536.0) - 46.85 fTemp = cTemp * 1.8 + 32

# Cov ntaub ntawv tso tawm rau lub vijtsam

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

Kauj Ruam 4: Hom Kev Coj Ua

Xyaum Ua Haujlwm
Xyaum Ua Haujlwm

Tam sim no, rub tawm (lossis git rub) cov cai thiab qhib nws ntawm 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 Monitor. Tom qab ob peb lub sijhawm, nws yuav tshuaj xyuas txhua qhov ntsuas. Tom qab ua kom ntseeg tau tias txhua yam ua haujlwm tau zoo, koj tuaj yeem tsim kho thiab txav mus ntxiv nrog txoj haujlwm coj nws mus rau qhov chaw nthuav dua.

Kauj Ruam 5: Cov ntawv thov thiab Nta

Si7006 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, Chaw Nyob Sab Hauv Tsev, Micro-Ib puag ncig /Cov Chaw Cov Ntaub Ntawv, Automotive Kev Nyab Xeeb Kev Nyab Xeeb Thiab Defogging, Cov Khoom thiab Cov Khoom Taug Qab Thiab Cov Xov Tooj Ntawm Tes.

Rau xws li Kuv nyiam kuv qe li cas? Ummm, in a cake!

Koj tuaj yeem tsim ib qhov haujlwm Tub Ntxhais Kawm Chav Ua Haujlwm, lub cuab yeej uas siv rau ib puag ncig ib puag ncig, xws li qhov kub thiab txias uas xav tau kev tswj hwm, siv Raspberry Pi thiab SI7006-A20. Hatching qe hauv chav kawm! Nws yuav yog qhov txaus siab thiab qhia txog txoj haujlwm tshawb fawb thiab tseem yog thawj tes ntawm kev paub rau cov tub ntxhais kawm los saib lub neej nyob hauv nws qhov yooj yim. Cov Tub Ntxhais Kawm Hauv Chav Kawm Ua Haujlwm yog qhov haujlwm zoo nkauj tsim los. Cov hauv qab no yuav tsum ua kom muaj kev lom zem thiab muaj kev vam meej rau koj thiab koj cov tub ntxhais kawm. Cia peb pib nrog cov cuab yeej zoo tshaj ua ntej peb hov qe nrog cov hluas lub siab.

Kauj Ruam 6: Xaus

Ntseeg qhov kev lees paub no ua rau muaj kev sim ntxiv. 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. Txhawm rau kom yooj yim rau koj, peb muaj cov vis dis aus nthuav qhia hauv YouTube uas yuav qhib qhov rooj rau koj lub tswv yim. 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. Muaj kev lom zem thiab tshawb nrhiav ntxiv!

Pom zoo: