Cov txheej txheem:
- Kauj Ruam 1: Cov Khoom Uas Peb Xav Tau
- Kauj Ruam 2: Khoos Phis Tawj Sib Txuas los Muab Ua Ke Hauv Circuit
- Kauj Ruam 3: Raspberry Pi Programming hauv Java
- Kauj Ruam 4: Kev Xyaum Ua Haujlwm ntawm Txoj Cai (Ua Haujlwm)
- Kauj Ruam 5: Cov ntawv thov thiab Nta
- Kauj Ruam 6: Xaus
Video: Siv Raspberry Pi, Ntsuas Qhov Siab, Siab, thiab Kub Nrog MPL3115A2: 6 Cov Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:26
Paub tias koj yog leej twg, thiab paub vim li cas koj thiaj li muaj nws
Nws yog qhov txaus ntshai. 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 thiab txiav txim siab muab peb cov kev nyiam. Txoj haujlwm no siv sijhawm li ib teev yog tias koj tshiab rau I²C kev sib txuas thiab teeb tsa Software, thiab nws yog txoj hauv kev zoo los nthuav lub peev xwm ntawm MPL3115A2 nrog Raspberry Pi hauv Java.
Kauj Ruam 1: Cov Khoom Uas Peb Xav Tau
1. Raspberry Pi
Thawj kauj ruam yog tau txais Raspberry Pi board. Qhov ntse me me no yog siv los ntawm hobbyists, cov kws qhia ntawv thiab hauv kev tsim kho ib puag ncig ib puag ncig.
2. I2C 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²2 raws tu qauv rau kev sib txuas lus. Peb tau yuav qhov ntsuas no los ntawm Dcube Store.
4. Txuas Cable
Peb siv I²C txuas cov xov hluav taws xob muaj nyob ntawm Dcube Store.
5. Micro USB cable
Raspberry Pi tau siv los ntawm micro USB khoom.
6. Kev Txhim Kho Kev Siv Internet - Ethernet Cable/WiFi Module
Ib qho ntawm thawj yam uas koj yuav xav ua yog kom tau txais koj li Raspberry Pi txuas nrog rau Internet. Koj tuaj yeem txuas nrog siv Ethernet cable lossis nrog Wireless USB Nano WiFi adapter.
7. HDMI Cable (Yeem, Koj Xaiv)
Koj tuaj yeem txuas Raspberry Pi mus rau tus saib xyuas siv HDMI cable. Tsis tas li, koj tuaj yeem nkag mus rau koj li Raspberry Pi los ntawm kev siv SSH/PuTTY.
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 saum toj no, 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
Txog qhov no, 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. Yooj yim li qhov no!
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. Hauv qhov no, koj muaj kev xaiv xws li txuas Ethernet (LAN) cable. Tsis tas li, raws li kev xaiv tab sis txoj hauv kev zoo los siv WiFi adapter.
Kev ua kom muaj zog ntawm Circuit Court
Txuas lub Micro USB cable rau hauv lub hwj chim nkaus ntawm Raspberry Pi. Qhib nws thiab voila, peb zoo mus!
Kev Sib Txuas rau Screen
Peb tuaj yeem muaj HDMI cable txuas nrog tus saib lossis peb tuaj yeem hloov kho me ntsis los ua peb lub taub hau Pi (siv -SSH/PuTTY) uas pab txiav tus nqi ntxiv vim tias peb yog qee yam nyiam ua haujlwm.
Thaum tus cwj pwm pib them nyiaj, nws hu ua kev nyiam ua
Kauj Ruam 3: Raspberry Pi Programming hauv Java
Java 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 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 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 theej Java txoj haujlwm ua haujlwm rau lub ntsuas no los ntawm no thiab.
// Tshaj tawm nrog daim ntawv tso cai pub 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 com.pi4j.io.i2c. I2CBus;
ntshuam com.pi4j.io.i2c. I2CDevice; ntshuam com.pi4j.io.i2c. I2CFactory; ntshuam java.io. IOException;
pej xeem chav kawm MPL3115A2
{pej xeem zoo li qub tsis muaj dab tsi tseem ceeb (Txoj hlua sib cav ) cuam tshuam kev zam {// Tsim I2C npav I2CBus Bus = I2CFactory.getInstance (I2CBus. BUS_1); // Tau txais I2C ntaus ntawv, MPL3115A2 I2C chaw nyob yog 0x60 (96) I2CDevice ntaus ntawv = Bus.getDevice (0x60); // Xaiv tswj kev sau npe // Ua haujlwm nquag, OSR = 128, hom ntsuas qhov siab ntaus ntawv.write (0x26, (byte) 0xB9); // Xaiv cov ntaub ntawv teeb tsa sau npe // Cov ntaub ntawv npaj tau tshwm sim qhib rau qhov siab, siab, ntsuas kub.write (0x13, (byte) 0x07); // Xaiv tswj kev sau npe // Ua haujlwm nquag, OSR = 128, hom ntsuas qhov siab ntaus ntawv.write (0x26, (byte) 0xB9); Xov.sleep (1000);
// Nyeem 6 bytes ntawm cov ntaub ntawv los ntawm chaw nyob 0x00 (00)
// xwm txheej, tHeight msb1, tHeight msb, tHeight lsb, temp msb, temp lsb byte cov ntaub ntawv = tshiab byte [6]; device.read (0x00, cov ntaub ntawv, 0, 6);
// Hloov cov ntaub ntawv mus rau 20-ntsis
int tHeight = (((data [1] & 0xFF) * 65536) + ((data [2] & 0xFF) * 256) + (data [3] & 0xF0)) / 16); int temp = ((cov ntaub ntawv [4] * 256) + (data [5] & 0xF0)) / 16; ob qhov siab = tHeight / 16.0; ob cTemp = (temp / 16.0); ob fTemp = cTemp * 1.8 + 32;
// Xaiv tswj sau npe
// Hom ua haujlwm, OSR = 128, hom ntsuas cua ntsuas ntaus ntawv.write (0x26, (byte) 0x39); Xov.sleep (1000); // Nyeem 4 bytes ntawm cov ntaub ntawv los ntawm chaw nyob 0x00 (00) // xwm txheej, pres msb1, pres msb, pres lsb device.read (0x00, cov ntaub ntawv, 0, 4);
// Hloov cov ntaub ntawv mus rau 20-ntsis
int pres = (((cov ntaub ntawv [1] & 0xFF) * 65536) + ((data [2] & 0xFF) * 256) + (data [3] & 0xF0)) / 16; ob npaug siab = (pres / 4.0) / 1000.0; // Cov ntaub ntawv tso tawm rau lub vijtsam System.out.printf ("Siab: %.2f kPa %n", siab); System.out.printf ("Qhov siab: %.2f m %n", qhov siab); System.out.printf ("Kub hauv Celsius: %.2f C %n", cTemp); System.out.printf ("Kub hauv Fahrenheit: %.2f F %n", fTemp); }}
Kauj Ruam 4: Kev Xyaum Ua Haujlwm ntawm Txoj Cai (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 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 sensor yog nyob rau 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 Ze, Kev Txhim Kho GPS Rau Kev Pabcuam Thaum Muaj Xwm Ceev), Kev Ua Tau Zoo Tshaj Plaws, Smartphones/Tablets, Tus Kheej Cov Khoom Siv Hluav Taws Xob thiab Satellites (Cov Khoom Siv Hauv Chaw Huab Cua/Huab Cua).
Rau xws li Siv lub ntsuas no thiab Rasp Pi, koj tuaj yeem tsim Digital Visual Altimeter, qhov tseem ceeb tshaj plaws ntawm cov cuab yeej dhia saum ntuj, uas tuaj yeem ntsuas qhov siab, huab cua siab, thiab kub. Koj tuaj yeem ntxiv cua ntsuas cua thiab lwm yam kev ntsuas kom ua rau muaj qhov ntxim nyiam dua.
Kauj Ruam 6: Xaus
Txij li qhov kev zov me nyuam tuaj yeem hloov kho tau zoo, muaj ntau txoj hauv kev txaus siab uas koj tuaj yeem txuas ntxiv txoj haujlwm no thiab ua kom nws zoo dua. Piv txwv li, Ib qho altimeter/interferometer yuav suav nrog ob peb qhov siab tau teeb tsa ntawm masts uas yuav tau txais kev ntsuas ib txhij, yog li muab kev txuas mus tas li, ib leeg-lossis ntau-altimeter dav-npog thaj tsam. Peb muaj cov vis dis aus nthuav qhia hauv YouTube uas tuaj yeem pab koj kom nkag siab zoo txog txoj haujlwm no.
Pom zoo:
Qhov siab, Siab thiab Kub Siv Raspberry Pi Nrog MPL3115A2: 6 Cov Kauj Ruam
Qhov siab, Siab thiab Kub Siv Raspberry Pi Nrog MPL3115A2: Suab nrov. 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 qhov haujlwm no, peb xav tau
Siv Smartphone Raws Li Tsis Siv Tus Kheej Ntsuas Kub / Tus Ntsuas Ntsuas Kub: 8 Kauj Ruam (nrog Duab)
Siv Smartphone Raws Li Tsis Siv Tus Kws Ntsuas Kub / Tus Ntsuas Kub Portable: Ntsuas lub cev kub nrog qhov tsis sib cuag / tsis sib cuag zoo li rab phom thermo. Kuv tsim txoj haujlwm no vim tias Thermo Gun tam sim no kim heev, yog li kuv yuav tsum tau txais lwm txoj hauv kev los ua DIY. Thiab lub hom phiaj yog ua nrog cov peev txheej qis .SuppliesMLX90614Ardu
Kev Ntsuas thiab Kev Ntsuas Kub Siv HTS221 thiab Raspberry Pi: 4 Cov Kauj Ruam
Kev Ntsuas thiab Kev Ntsuas Kub Siv HTS221 thiab Raspberry Pi: HTS221 yog lub ntsuas hluav taws xob me me uas muaj peev xwm ntsuas tau rau qhov txheeb ze thiab qhov kub thiab txias. Nws suav nrog lub hauv paus ntsiab lus thiab cov teeb liab sib xyaw daim ntawv thov tshwj xeeb kev sib txuas (ASIC) los muab cov ntaub ntawv ntsuas los ntawm cov lej
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
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