Cov txheej txheem:

Tsim Koj Thawj IOT Siv Arduino Tsis Muaj Cov Qauv Ntxiv: 5 Kauj Ruam (nrog Duab)
Tsim Koj Thawj IOT Siv Arduino Tsis Muaj Cov Qauv Ntxiv: 5 Kauj Ruam (nrog Duab)

Video: Tsim Koj Thawj IOT Siv Arduino Tsis Muaj Cov Qauv Ntxiv: 5 Kauj Ruam (nrog Duab)

Video: Tsim Koj Thawj IOT Siv Arduino Tsis Muaj Cov Qauv Ntxiv: 5 Kauj Ruam (nrog Duab)
Video: Computer Vision with Python! Resizing Images 2024, Hlis ntuj nqeg
Anonim
Tsim Koj Thawj IOT Siv Arduino Tsis Muaj Cov Qauv Ntxiv
Tsim Koj Thawj IOT Siv Arduino Tsis Muaj Cov Qauv Ntxiv
Tsim Koj Thawj IOT Siv Arduino Tsis Muaj Cov Qauv Ntxiv
Tsim Koj Thawj IOT Siv Arduino Tsis Muaj Cov Qauv Ntxiv

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 sau ua ke ntawm Circuit thiab cuam tshuam nrog Arduino
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

Programming Nrog Arduino IDE
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

Tsim ib qho ThingSpeak Channel rau Cov Ntaub Ntawv Teev Npe
Tsim ib qho ThingSpeak Channel rau Cov Ntaub Ntawv Teev Npe
Tsim ib qho ThingSpeak Channel rau Cov Ntaub Ntawv Teev Npe
Tsim ib qho ThingSpeak Channel rau Cov Ntaub Ntawv Teev Npe
Tsim kom muaj ThingSpeak Channel rau Kev Txiav Txim Cov Ntaub Ntawv
Tsim kom muaj ThingSpeak Channel rau Kev Txiav Txim 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!;-)

Txhua yam ua tiav!;-)
Txhua yam ua tiav!;-)
Txhua yam ua tiav!;-)
Txhua yam ua tiav!;-)
Txhua yam ua tiav!;-)
Txhua yam ua tiav!;-)
Txhua yam ua tiav!;-)
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: