Cov txheej txheem:
- Kauj Ruam 1: Sib sau ua ke ntawm Circuit thiab cuam tshuam nrog Arduino
- Kauj ruam 2: Programming Nrog Arduino IDE
- Kauj Ruam 3: Tsim Ib YamSpeak Channel rau Kev Teev Cov Ntaub Ntawv
- Kauj Ruam 4: Tsim Python Server rau Cov Ntaub Ntawv Nkag Mus Rau Hauv Internet
- Kauj ruam 5: Txhua yam ua tiav!;-)
Video: Tsim Koj Thawj IOT Siv Arduino Tsis Muaj Cov Qauv Ntxiv: 5 Kauj Ruam (nrog Duab)
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:27
Lub ntiaj teb tau ntse dua txhua hnub thiab qhov laj thawj loj tshaj plaws tom qab qhov no yog kev hloov pauv ntawm
ntse tshuab. Raws li tus kws tshaj lij koj yuav tsum tau hnov txog lo lus IOT uas txhais tau tias yog Internet ntawm Yam. Internet ntawm txhua yam txhais tau tias tswj hwm thiab pub cov ntaub ntawv ntawm cov khoom siv hauv is taws nem lossis txhua lub network yam tsis muaj tib neeg rau tshuab sib cuam tshuam. Yog li hauv qhov kev qhia no peb yuav tsim IOT Project siv cov phooj ywg zoo Arduino UNO. Lub hom phiaj ntawm txoj haujlwm no yog pub cov ntaub ntawv sau los ntawm LDR (Lub Teeb Pom Kev) thiab LM35 (Kub ntsuas) rau hauv internet thiab cov ntaub ntawv no koj tuaj yeem dhau los ntawm txhua qhov chaw hauv ntiaj teb.
Koj yuav xav tau cov khoom hauv qab no rau txoj haujlwm no: Yuav Tsum Tau Kho Vajtse
Arduino UNO
Txhawm rau tshem tawm cov teeb meem los ntawm lub khoos phis tawj PC
Arduino Serial USB cable
LM35 (Kub Sensor)
LDR (Lub Teeb Ntsuas Tus Kws Tiv Thaiv)
Txuas xov hlau
Kev Xav Tau Software
Arduino IDE
Nab hab sej 3.4
Kauj Ruam 1: Sib sau ua ke ntawm Circuit thiab cuam tshuam nrog Arduino
Sib dhos lub Circuit Court raws li tau hais hauv daim duab hauv qab no.
LM35
(Pin 1)- 5v ntawm Arduino
(Pin 2)- A0 tus pin ntawm Arduino
(Pin 3)- Hauv av ntawm Arduino
DR LDR tau
Ib lub davhlau ya nyob twg- 5v ntawm Arduino
Lub davhlau ya nyob twg thib ob - 220Ω Kev Tiv Thaiv - Hauv av ntawm Arduino
Kev sib tshuam ntawm LDR & Kev Tiv Thaiv A1 tus pin ntawm Arduino
Kauj ruam 2: Programming Nrog Arduino IDE
Rub tawm thiab Nruab Arduino IDE los ntawm no "https://www.arduino.cc/en/Main/Software"
Tam sim no txuas Arduino UNO pawg thawj coj mus rau txuas USB txuas ntawm koj lub PC.
Qhib Arduino IDE
Hloov Cov Cuab Yeej-> Pawg Thawj Coj -> “Arduino/Genuino Uno”
Hloov Cov Cuab Yeej-> Chaw Nres Nkoj -> #Nco tseg qhov chaw nres nkoj no., nws yuav xav tau yav tom ntej.
Muab tshuaj txhuam lossis rub tawm cov cai hauv qab no thiab muab tso rau hauv koj li Arduino.
// teeb tsa kev ua haujlwm ib zaug thaum koj nias rov pib dua: tsis muaj teeb tsa () {// pib ua haujlwm sib txuas lus ntawm 9600 khoom ib ob: Serial.begin (9600); } // lub voj kev niaj hnub sau ntau thiab ntau dua ib si: void loop () {// nyeem cov tswv yim ntawm analog pin 0 uas yog ntsuas qhov ntsuas tus nqi: int sensorValue1 = analogRead (A0); // hloov tus nqi los ntawm kev ntsuas lub ntsuas cua hauv qib calcius int temp = (int (sensorValue1) * ntab (4.8824) -500)/10; // nyeem cov tswv yim ntawm analog pin 1 uas yog lub teeb pom kev zoo tus nqi: int sensorValue2 = analogRead (A1); // hloov tus nqi ntawm lub teeb sensor mus rau lux int Lux = 1024.0 * 10 / sensorValue2 - 10; // luam tawm tus nqi koj nyeem: Serial.print (temp); Serial.print (""); Serial.print (Lux); Serial.print ("\ n"); // Hloov cov ntaub ntawv hauv hom "temp_readinglight_intensity" ncua (1000); // ncua nyob nruab nrab ntawm kev nyeem rau kev ruaj ntseg}
Thaum rub tawm tiav, nws txhais tau tias koj Arduino tau npaj rau huab cua.
Tam sim no qhib Cov Cuab Yeej-> Saib Xyuas Serial
Teeb tus nqi baud ntawm 9600 Koj yuav tsum pom qee yam zoo li hauv daim duab
Tam sim no kaw Arduino IDE
Kauj Ruam 3: Tsim Ib YamSpeak Channel rau Kev Teev Cov Ntaub Ntawv
Tam sim no txhawm rau tshaj tawm cov ntaub ntawv xov xwm no mus rau huab huab hauv internet peb yuav xav tau cov kwj rau huab ntawd.
ThingSpeak yog huab nrov npe rau IOT daim ntawv thov. Ua raws cov theem no
Mus rau www.thingspeak.com
Sau npe rau yam Hais Lus
Tam sim no mus rau "Pib Pib"
Tsim "Channel Tshiab" Sau cov ntaub ntawv rau cov channel no raws li qhia hauv daim duab txuas. (Saib daim duab thib 2)
Tam sim no "Txuag" Channel no
Will Koj yuav raug xa mus rau nplooj ntawv hauv qab no uas yog huab tiag thiab koj yuav pom cov duab thiab qhov chaw ntawm koj cov ntaub ntawv huab cua.
Tam sim no mus rau “API Keys” raws li qhia hauv qab no (Saib daim duab thib 4)
Nco tseg ob qho "Channel ID" & "Sau & Nyeem API's" koj yuav xav tau lawv tom qab
Kauj Ruam 4: Tsim Python Server rau Cov Ntaub Ntawv Nkag Mus Rau Hauv Internet
Tam sim no rub tawm thiab teeb tsa nab nab los ntawm https://www.python.org/download/releases/2.7/ Tsis quav ntsej cov kauj ruam no yog tias koj twb muaj nab hab sej teeb tsa lawm.
Qhib start_menu/notepad ntawm koj lub PC pc.
Luam lossis rub tawm & muab tshuaj txhuam tus lej nab npawb hauv qab no mus rau notepad.
ntshuam ntshuam
ntshuam lub sij hawm ntshuam urllib suav = 0 arduino = serial. Serial ('COM19', 9600, sijhawm tas =.1) thaum Tseeb: cov ntaub ntawv = arduino.readline () [:-1] #qhov kawg tau tshem ntawm kab-tshiab chars yog cov ntaub ntawv: yog suav == 0: tshiab = [0, 0] suav = 1 ntxiv: tshiab = data.split () temp = int (tshiab [0]) lub teeb = int (tshiab [1]) f = urllib.urlopen ('https://api.thingspeak.com/update?key=NIJW2KFLALYDFNZE&field1=%s&field=%s'% (temp, light)) print "temp =%d & light =%d are updated"%(temp, lub teeb) sijhawm.sleep (3)
Ua qhov kev kho hauv qab no hauv cov cai no
1. Hloov 'COM19' mus rau Port uas koj Arduino txuas nrog.
2. https://api.thingspeak.com/update?key=NIJW2KFLALY… hloov “key =”
Txuag_as koj cov ntaub ntawv nrog npe "weather.py".
Kauj ruam 5: Txhua yam ua tiav!;-)
Tam sim no ua raws cov theem no kom pom koj thawj IOT uas koj nyuam qhuav tsim …
Txuas Arduino nrog koj lub PC ntawm tib lub chaw nres nkoj, yog tias qhov chaw nres nkoj txuas tau hloov pauv tom qab ntawd ua kho hauv cov ntaub ntawv huab cua.py "COM19 COM"
Koj lub PC yuav tsum muaj internet txuas
Qhib “weather.py” cov ntaub ntawv nrog sej.exe uas koj tau teeb tsa ua ntej.
1. Txoj cai nyem rau ntawm weather.py
2. Nyem rau “Qhib nrog…”
3. Xauj "Python.exe" thiab qhib nrog nws.
Koj yuav tsum pom qee yam zoo li no
Tam sim no qhib qhov browser hauv koj lub xov tooj- Ntaus qhov URL hauv qab no hauv hom https://thingspeak.com/channels/?key= piv txwv:
Koj yuav pom cov ntaub ntawv huab cua ntawm lub sijhawm tiag tiag los ntawm koj Arduino
Hehh! Koj thawj qhov haujlwm IOT tau ua tiav
Pom zoo:
Ntxiv Lights thiab Spooky Music rau Koj Jack-O-Lantern-Tsis Siv Tshuaj lossis Kev Tsim Kho (tshwj tsis yog koj xav tau): 9 Cov Kauj Ruam (nrog Duab)
Ntxiv Lights thiab Spooky Music rau Koj Jack-O-Lantern-Tsis Siv Tshuaj lossis Kev Tsim Kho (tshwj tsis yog koj xav tau): Muaj qhov txaus ntshai Jack-O-Lantern ntawm koj txoj kev los ntawm kev ntxiv cov teeb ci ci thiab suab paj nruag txaus ntshai! Qhov no kuj yog txoj hauv kev zoo los sim tawm Arduino thiab cov khoom siv hluav taws xob vim tias tag nrho txoj haujlwm tuaj yeem ua tiav yam tsis tau sau cov cai lossis siv tshuaj txhuam - txhua yam
Tsim kom muaj Dual 15V Cov Khoom Siv Hluav Taws Xob Siv Tawm Cov Txee Modules rau Hauv $ 50: 10 Cov Kauj Ruam (nrog Duab)
Tsim kom muaj Dual 15V Lub Hwj Huam Siv Tawm Tawm Cov Qauv Qauv rau Hauv $ 50: Taw Qhia: Yog tias koj yog tus nyiam ua haujlwm uas cuam tshuam nrog suab, koj yuav paub nrog cov khoom siv hluav taws xob ob tog. Feem ntau cov hwj huam suab qis xws li pre-amps xav tau qhov twg los ntawm +/- 5V txog +/- 15V. Muaj lub zog siv hluav taws xob ob zaug ua rau nws tsuas yog
Yuav Ua Li Cas Tau Txais Cov Nkauj Los Ntawm Txhua Qhov (Haha) Lub Vev Xaib (Ntev Li Koj Tau hnov Nws Koj Yuav Tau Txais Nws Ok Zoo Yog Nws Tau Ntxig Hauv Flash Koj Yuav Tsis Muaj Peev Xwm) EDITED !!!!! Ntxiv Info: 4 Cov Kauj Ruam
Yuav Ua Li Cas Tau Txais Cov Nkauj Los Ntawm Txhua Qhov (Haha) Lub Vev Xaib (Ntev Li Koj Tau hnov Nws Koj Yuav Tau Txais Nws … Ok Zoo Yog Nws Tau Ntxig Hauv Flash Koj Yuav Tsis Muaj Peev Xwm) EDITED !!!!! Ntxiv Cov Lus Qhia: yog tias koj tau mus rau lub vev xaib thiab nws ua nkauj nkauj uas koj nyiam thiab xav tau nws ntawm no yog cov lus qhia rau koj tsis yog kuv qhov txhaum yog tias koj cuam tshuam qee yam (tsuas yog txoj hauv kev nws yuav tshwm sim yog tias koj pib tshem cov khoom yam tsis muaj laj thawj. ) Kuv tuaj yeem tau txais cov nkauj rau
Saib zoo li koj tus yeeb ncuab: Tsim cov cim uas tsis meej pem, tsis txaus ntseeg thiab tsis sib luag !: 6 Cov kauj ruam (nrog Duab)
Saib zoo li koj tus yeeb ncuab: Tsim cov cim uas tsis meej pem, Tsis txaus ntseeg thiab tsis sib luag!: Hauv cov lus qhia no koj yuav kawm Tsim Camouflage. Hauv cov phiaj xwm yav dhau los Kuv tau tsim nyog thiab ua kom zoo ntau yam txheej txheem kom ua raws tsoomfwv lossis cov npe tuam txhab. Kev siv cov txheej txheem uas tau hais tseg hauv cov kauj ruam hauv qab no yuav tso cai rau koj mus ib ntus
Tsim kom muaj suab paj nruag tsis xwm yeem thiab lub teeb tsim hluav taws xob thiab pom qhov pov thawj ntawm Vajtswv: 4 Cov Kauj Ruam
Tsim kom muaj Kev Nyuaj Siab Suab Nkauj thiab Lub Teeb Hluav Taws Xob thiab Nyeem Ntawv Pov Thawj ntawm Vajtswv: Tsim cov lej tsis raug zoo zoo li tsis yooj yim sua. Txawm li cas los xij, nws yooj yim siv microcontroller los tsim cov lej tsis raug thiab tom qab ntawd siv lawv los tso saib cov suab thiab cov xim sib txawv. Thaum cov nkauj uas tau tsim tawm yog n