Cov txheej txheem:
- Kauj Ruam 1: Cov Khoom Siv Tseem Ceeb Peb Xav Tau
- Kauj Ruam 2: Khoos Phis Tawj Sib Txuas los Muab Ua Ke Hauv Circuit
- Kauj Ruam 3: Raspberry Pi Programming hauv Python
- Kauj Ruam 4: Kev Xyaum Ua Haujlwm ntawm Txoj Cai (Xeem)
- Kauj Ruam 5: Cov ntawv thov thiab Nta
- Kauj Ruam 6: Xaus
Video: Qhov siab, Siab thiab Kub Siv Raspberry Pi Nrog MPL3115A2: 6 Cov Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:25
Suab nthuav. Nws muaj peev xwm ua tau nyob rau lub sijhawm no thaum peb txhua tus tab tom mus rau IoT tiam. Raws li cov khoom siv hluav taws xob tsis zoo, peb tau ua si nrog Raspberry Pi, thiab txiav txim siab los ua cov phiaj xwm nthuav dav siv qhov kev paub no. Hauv txoj haujlwm no, peb yuav ntsuas qhov siab, huab cua siab, ntsuas kub siv Raspberry Pi. Yog li ntawm no mus cov ntaub ntawv (ib txwm raug hloov kho, thiab nthuav dav). Peb pom zoo kom pib nrog ua raws cov lus qhia thiab theej cov cai. Koj tuaj yeem sim tom qab. Yog li cia peb pib.
Kauj Ruam 1: Cov Khoom Siv Tseem Ceeb Peb Xav Tau
1. Raspberry Pi
Thawj kauj ruam yog tau txais Raspberry Pi board. Peb tau yuav peb li thiab yog li koj tuaj yeem ua tau. Pib kawm los ntawm cov lus qhia, peb nkag siab cov ntawv sau thiab cov ntsiab lus sib txuas thiab kawm tom qab. Qhov kev txawj ntse me me no muaj ntau rau cov nyiam ua haujlwm, cov kws qhia ntawv thiab hauv kev tsim kho ib puag ncig ib puag ncig.
2. I²C Shield rau Raspberry Pi
INPI2 (I2C adapter) muab Raspberry Pi 2/3 ib qho I²C chaw nres nkoj rau siv nrog ntau I2C khoom siv. Nws muaj nyob ntawm Dcube Store
3. Altimeter, Siab thiab Kub Sensor, MPL3115A2
MPL3115A2 yog MEMS lub siab ntsuas nrog I²C interface los muab Cov ntaub ntawv Siab/Qhov Siab thiab Kub. Qhov ntsuas no siv I²C cov txheej txheem rau kev sib txuas lus. Peb tau yuav qhov ntsuas no los ntawm Dcube Store
4. Txuas Cable
Peb muaj I2C txuas txuas muaj nyob ntawm Dcube Store
5. Micro USB cable
Lub micro USB cable Lub hwj chim muab yog qhov kev xaiv zoo tshaj plaws rau lub zog Raspberry Pi.
6 Txhim Kho Kev Siv Internet - Ethernet Cable/WiFi Adapter
Hauv lub sijhawm no, nkag mus rau txhua yam xav tau kev sib txuas hauv is taws nem (yuav luag zoo li muaj lub neej nyob offline ib yam nkaus). Yog li peb mus coj cov lus qhia ntawm LAN cable lossis Wireless Nano USB Adapter (WiFi) los tsim kev sib txuas hauv is taws nem kom peb tuaj yeem siv peb Rasp Pi tau yooj yim thiab tsis muaj teeb meem hlo li.
7. HDMI Cable (Yeem, Koj Xaiv)
Nws yog qhov nyuaj me ntsis. Koj tuaj yeem muaj lub zog txuas lwm Tus Saib Xyuas yog tias koj xav tau lossis nws muaj txiaj ntsig zoo rau koj tus kheej los ntawm kev ua lub taub hau Pi txuas nrog koj lub PC/Laptop.
Kauj Ruam 2: Khoos Phis Tawj Sib Txuas los Muab Ua Ke Hauv Circuit
Ua qhov Circuit Court raws li qhov qhia pom hauv qhov dav, kev sib txuas yog yooj yim heev. Ua raws cov lus qhia thiab cov duab, thiab koj yuav tsum tsis muaj teeb meem.
Thaum npaj, peb tau saib xyuas kho vajtse thiab coding nrog rau cov khoom siv hluav taws xob pib. Peb xav tsim cov txheej txheem hluav taws xob yooj yim rau txoj haujlwm no. Hauv daim duab, koj tuaj yeem pom qhov sib txawv, cov khoom siv hluav taws xob thiab I²C sensor tom qab I²C cov txheej txheem kev sib txuas lus. Vam tias, qhov no qhia qhov yooj yim ntawm cov khoom siv hluav taws xob rau txoj haujlwm no.
Kev sib txuas ntawm Raspberry Pi thiab I2C Shield
Ua ntej tshaj plaws coj Raspberry Pi thiab tso I²C Shield rau nws. Nias lub Shield maj mam (Saib daim duab).
Kev sib txuas ntawm Sensor thiab Raspberry Pi
Coj lub sensor thiab Txuas I²C cable nrog nws. Nco ntsoov tias I²C Cov Zis Ib Leeg txuas rau I²C Cov Tswv Yim. Tib yam yuav tsum ua raws los ntawm Raspberry Pi nrog I²C daim ntaub thaiv npog nws. Peb muaj I²C Shield thiab I²C txuas cov xov hluav taws xob ntawm peb sab raws li qhov txiaj ntsig zoo heev raws li peb tau tsuas yog ntsaws thiab ua si xaiv. Tsis muaj tus pin thiab qhov teeb meem txuas ntxiv thiab yog li, tsis meej pem ploj mus. Dab tsi yog kev nplij siab tsuas yog xav txog koj tus kheej hauv lub vev xaib ntawm xov hlau thiab nkag mus rau qhov ntawd. Tsuas yog cov txheej txheem yooj yim uas peb tau hais txog.
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
Koj muaj kev xaiv ntawm no tiag. Koj tuaj yeem Txuas Raspberry Pi nrog LAN cable lossis wireless Nano USB Adapter rau WiFi Txuas. Txawm li cas los xij, nws tau ua lub hom phiaj tseem ceeb uas yog txuas rau internet.
Kev ua kom muaj zog ntawm Circuit Court
Txuas lub Micro USB cable rau hauv lub hwj chim nkaus ntawm Raspberry Pi. Teeb nws thiab peb zoo mus.
Kev Sib Txuas rau Screen
Peb tuaj yeem muaj HDMI cable txuas nrog tus saib tshiab lossis peb tuaj yeem ua rau peb lub taub hau Pi uas muaj tswv yim thiab muaj txiaj ntsig zoo siv kev nkag mus deb xws li-SSH/PuTTY. (Kuv paub peb tsis tau pab nyiaj zoo li lub koom haum zais cia)
Kauj Ruam 3: Raspberry Pi Programming hauv Python
Python code rau Raspberry Pi thiab MPL3115A2 Sensor. Nws muaj nyob hauv peb Github chaw cia khoom.
Ua ntej mus rau txoj cai, nco ntsoov koj tau nyeem cov lus qhia muab hauv Readme cov ntaub ntawv thiab teeb tsa koj li Raspberry Pi raws li nws. Nws yuav siv sijhawm ib pliag los ua li ntawd.
Qhov siab yog xam los ntawm kev siab siv cov zauv hauv qab no:
h = 44330.77 {1 - (p / p0) ^ 0.1902632} + OFF_H (Sau Tus Nqi)
Qhov twg p0 = qib siab hiav txwv (101326 Pa) thiab h yog hauv meters. MPL3115A2 siv tus nqi no txij li cov npe offset tau txhais tias yog 2 Pascals ib LSB.
Txoj cai tau hais meej nyob rau hauv pem hauv ntej ntawm koj thiab nws nyob hauv daim ntawv yooj yim tshaj plaws uas koj tuaj yeem xav txog thiab koj yuav tsum tsis muaj teeb meem.
Koj tuaj yeem luam qhov ua haujlwm Python code rau lub ntsuas no los ntawm no ib yam nkaus.
# 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. # MPL3115A2 # Txoj cai no yog tsim los ua haujlwm nrog MPL3115A2_I2CS I2C Mini Module muaj los ntawm ControlEverything.com. #
ntshuam smbus
lub sij hawm ntshuam
# Tau I2C npav
npav = smbus. SMBus (1)
# MPL3115A2 chaw nyob, 0x60 (96)
# Xaiv tswj kev sau npe, 0x26 (38) # 0xB9 (185) Hom ua haujlwm, OSR = 128, Altimeter hom bus.write_byte_data (0x60, 0x26, 0xB9) # MPL3115A2 chaw nyob, 0x60 (96) # Xaiv cov ntaub ntawv sau npe, 0x13 (19)) # 0x07 (07) Cov ntaub ntawv npaj tau qhib rau qhov siab, siab, ntsuas kub.write_byte_data (0x60, 0x13, 0x07) # MPL3115A2 chaw nyob, 0x60 (96) # Xaiv tswj npe, 0x26 (38) # 0xB9 (185) Hom ua haujlwm, OSR = 128, Altimeter hom bus.write_byte_data (0x60, 0x26, 0xB9)
sijhawm.sleep (1)
# MPL3115A2 chaw nyob, 0x60 (96)
# Nyeem cov ntaub ntawv rov qab los ntawm 0x00 (00), 6 bytes # xwm txheej, tHeight MSB1, tHeight MSB, tHeight LSB, temp MSB, temp LSB data = bus.read_i2c_block_data (0x60, 0x00, 6)
# Hloov cov ntaub ntawv mus rau 20-ntsis
tHeight = ((cov ntaub ntawv [1] * 65536) + (data [2] * 256) + (data [3] & 0xF0)) / 16 temp = ((data [4] * 256) + (data [5] & 0xF0)) / 16 qhov siab = tHeight / 16.0 cTemp = temp / 16.0 fTemp = cTemp * 1.8 + 32
# MPL3115A2 chaw nyob, 0x60 (96)
# Xaiv tswj kev sau npe, 0x26 (38) # 0x39 (57) Hom nquag, OSR = 128, Barometer hom bus.write_byte_data (0x60, 0x26, 0x39)
sijhawm.sleep (1)
# MPL3115A2 chaw nyob, 0x60 (96)
# Nyeem cov ntaub ntawv rov qab los ntawm 0x00 (00), 4 bytes # xwm txheej, pres MSB1, pres MSB, pres LSB cov ntaub ntawv = bus.read_i2c_block_data (0x60, 0x00, 4)
# Hloov cov ntaub ntawv mus rau 20-ntsis
pres = ((data [1] * 65536) + (data [2] * 256) + (data [3] & 0xF0)) / 16 siab = (pres / 4.0) / 1000.0
# Cov ntaub ntawv tso tawm rau lub vijtsam
print "Siab: %.2f kPa" %siab sau "Qhov siab: %.2f m" %qhov siab tshaj sau "Kub hauv Celsius: %.2f C" %cTemp luam "Kub hauv Fahrenheit: %.2f F" %fTemp
Kauj Ruam 4: Kev Xyaum Ua Haujlwm ntawm Txoj Cai (Xeem)
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 hauv lub davhlau ya nyob twg thiab pom cov khoom tso tawm ntawm Saib. Tom qab ob peb feeb, nws yuav tso tawm txhua qhov ntsuas. Tom qab ua kom ntseeg tau tias txhua yam ua haujlwm tau zoo, koj tuaj yeem coj txoj haujlwm no mus rau hauv qhov haujlwm loj dua.
Kauj Ruam 5: Cov ntawv thov thiab Nta
Kev siv ntau ntawm MPL3115A2 Precision Altimeter I²C sensor yog siv hauv daim ntawv thov xws li Daim Ntawv Qhia (Daim Ntawv Qhia Kev Pabcuam, Kev Taw Qhia), Sib Nqus Sib Nqus, lossis GPS (GPS Tuag Txheeb Xyuas, GPS Txhim Kho Rau Kev Pabcuam Thaum Muaj Xwm Ceev), Siab Zoo Tshaj Plaws, Smartphone/Ntsiav Tshuaj, Tus Kheej Siv Hluav Taws Xob thiab Satellites (Cov Khoom Siv Chaw Huab Cua/Huab Cua).
Rau xws li ib txoj haujlwm los ua Tus Kheej Cov Hluav Taws Xob Altimeter uas ntsuas qhov siab, huab cua, ntsuas kub siv Raspberry Pi. Tus Kheej Cov Hluav Taws Xob Altimeter yog tag nrho txoj haujlwm zoo nkauj tsim los. Nws yuav siv sijhawm me ntsis yog tias koj muaj txhua ntu thiab tsis tsim kho (tau kawg koj tuaj yeem!). Lub ntsuas siab siab yog qhov ntsuas pom nyob hauv ntau lub dav hlau, thiab skydivers siv lub dab teg-txhim kho cov qauv rau lub hom phiaj zoo sib xws. Cov neeg taug kev thiab cov neeg nce toj siab siv lub dab teg los yog tes tuav qhov siab.
Kauj Ruam 6: Xaus
Vam tias txoj haujlwm no txhawb nqa kev sim ntxiv. Qhov ntsuas I²C no muaj ntau yam tsis txaus ntseeg, pheej yig thiab siv tau. Txij li nws yog txoj haujlwm hloov pauv tsis tau, muaj ntau txoj hauv kev koj tuaj yeem txuas ntxiv txoj haujlwm no thiab ua kom nws zoo dua. Piv txwv li, lub ntsuas qhov siab yog ib qho cuab yeej xaiv tau hauv cov tsheb uas tsis yog txoj hauv kev los pab hauv kev taw qhia. Qee lub tsheb zoo ua tau zoo uas tsis tau npaj siab yuav tawm ntawm txoj hauv kev, siv cov thev naus laus zis no. Txhawm rau kom yooj yim rau koj, peb muaj cov vis dis aus nthuav qhia hauv YouTube uas tuaj yeem qiv tes rau koj qhov kev tshawb nrhiav. Vam tias txoj haujlwm no txhawb nqa kev sim ntxiv.
Pom zoo:
Ua Koj Tus Kheej Txuas Cov Cua Kub Kub thiab Txuag Nrog Cua Kub: 53 Cov Kauj Ruam (nrog Duab)
Ua Koj Tus Kheej Txuas Cov Cua Kub Kub thiab Txuag Nrog Cua Kub: Lub hom phiaj yog dab tsi? Ua kom yooj yim dua los ntawm kev ua kom sov koj lub tsev raws nraim qhov koj xav Ua kom txuag nyiaj thiab txo cov pa roj carbon tsev tso cua sov los ntawm cua sov koj lub tsev tsuas yog thaum koj xav tau Kev tswj hwm koj cov cua sov nyob txhua qhov chaw koj zoo siab koj tau ua nws y
ESP32 Raws M5Stack M5stick C Huab Cua Saib Nrog DHT11 - Saib Xyuas Qhov Kub Kub & Qhov Kub Kub ntawm M5stick-C Nrog DHT11: 6 Cov Kauj Ruam
ESP32 Raws M5Stack M5stick C Huab Cua Saib Nrog DHT11 | Saib Xyuas Qhov Kub thiab Qhov Ntsuas Kub ntawm M5stick-C Nrog DHT11: Nyob zoo cov neeg, hauv cov lus qhia no peb yuav kawm paub yuav ua li cas cuam tshuam DHT11 ntsuas kub nrog m5stick-C (pawg tswj hwm kev txhim kho los ntawm m5stack) thiab tso tawm ntawm cov zaub ntawm m5stick-C. Yog li hauv qhov kev qhia no peb yuav nyeem qhov ntsuas kub, av noo & heat kuv
Siv Raspberry Pi, Ntsuas Qhov Siab, Siab, thiab Kub Nrog MPL3115A2: 6 Cov Kauj Ruam
Siv Raspberry Pi, Ntsuas Qhov Siab, Siab, thiab Kub Nrog MPL3115A2: Paub tias koj yog leej twg, thiab paub vim li cas koj thiaj yog tus tswv! Nws yog qhov txaus nyiam. Peb nyob hauv lub hnub nyoog ntawm Internet Automation raws li nws plunges rau hauv plethora ntawm cov ntawv thov tshiab. Raws li lub khoos phis tawj thiab khoom siv hluav taws xob, peb tau kawm ntau yam nrog Raspberry Pi a
Yuav Ua Li Cas Siv DHT11 Kub Sensor Nrog Arduino thiab Luam Kub Kub thiab Vaum: 5 Kauj Ruam
Yuav Ua Li Cas Siv DHT11 Kub Sensor Nrog Arduino thiab Luam Kub Kub thiab Vaum: Lub DHT11 sensor tau siv los ntsuas kub thiab av noo. Lawv yog cov khoom siv hluav taws xob nrov tshaj plaws.Qhov DHT11 cov av noo thiab ntsuas kub ua rau nws yooj yim ntxiv cov av noo thiab ntsuas kub rau koj li DIY cov phiaj xwm hluav taws xob. Nws yog rau
ESP32 NTP Kev Ntsuas Kub Ua Haujlwm Kub Kub Nrog Steinhart-Hart Kho thiab Tswb Kub: 7 Kauj Ruam (nrog Duab)
ESP32 NTP Kev Ntsuas Kub Ua Haujlwm Ntsuas Kub nrog Steinhart-Hart Kev Kho thiab Tswb Kub: Tseem tab tom taug kev kom ua tiav "qhov haujlwm yuav los tom ntej", "ESP32 NTP Kev Ntsuas Kub Kev Ntsuas Kub Ua Noj Nrog Steinhart-Hart Kev Kho thiab Tswb Kub" yog Cov Ntawv Qhia qhia yuav ua li cas kuv ntxiv NTP ntsuas kub, piezo b