Cov txheej txheem:
- Kauj ruam 1: Yuav tsum tau ua
- Kauj ruam 2: Blynk
- Kauj Ruam 3: Arduino IDE
- Kauj ruam 4: Tsim Nws
- Kauj ruam 5: Code
Video: Kev Saib Xyuas Cog Siv ESP32 Yam thiab Blynk: 5 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:25
Txheej txheem cej luam
Lub hom phiaj ntawm txoj haujlwm no yog txhawm rau tsim cov cuab yeej siv tau uas tuaj yeem saib xyuas qhov xwm txheej ntawm kev cog ntoo hauv tsev. Cov cuab yeej ua rau tus neeg siv tshuaj xyuas qib av noo, qib av noo, ntsuas kub, thiab "zoo li" kub los ntawm lub xov tooj smartphone siv Blynk App. Ib qho ntxiv, tus neeg siv yuav tau txais email ceeb toom thaum cov xwm txheej tsis zoo rau tsob ntoo. Piv txwv li, tus neeg siv yuav tau txais kev ceeb toom rau ywg dej cov nroj tsuag thaum cov av noo noo qis dua qib uas tsim nyog.
Kauj ruam 1: Yuav tsum tau ua
Txoj haujlwm no siv Sparkfun ESP32 yam, DHT22 lub ntsuas hluav taws xob, thiab Hluav Taws Xob Hluav Taws Xob Av noo noo. Ib qho ntxiv, yuav tsum muaj wifi network thiab Blynk app. Ua ntej tshaj, lub thawv thaiv dej yuav tsum tsim kom muaj ESP32 yam. Thaum qhov piv txwv no siv tus qauv hluav taws xob rau lub zog siv hluav taws xob, ntxiv cov roj teeb uas them rov qab tau, lub hnub ci vaj huam sib luag, thiab tus tswj kev them nqi yuav ua rau lub cuab yeej siv tau los ntawm lub zog tauj dua tshiab.
Kauj ruam 2: Blynk
Txhawm rau ua, rub tawm Blynk app thiab tsim txoj haujlwm tshiab. Nco tseg ntawm daim ntawv pov thawj kev lees paub-nws yuav raug siv hauv cov cai. Tsim cov cuab yeej tshiab tso rau hauv Blynk app thiab xaiv cov pins virtual uas tau hais tseg hauv txoj cai. Teem caij ncua sijhawm tshiab kom thawb. Txhua lub widget yuav tsum tau muab nws tus kheej tus lej pin.
Kauj Ruam 3: Arduino IDE
Rub tawm Arduino IDE. Ua raws li cov lus qhia rub tawm rau ESP32 yam tsav tsheb thiab qhov ua piv txwv kom ntseeg tau kev sib txuas wifi. Rub tawm Blynk thiab DHT cov tsev qiv ntawv suav nrog hauv txoj cai. Sau daim ntawv pov thawj kev lees paub, tus password wifi, lub npe siv wifi, thiab email hauv tus lej kawg. Siv tus lej demo rau qhov ntsuas av noo kom pom qhov tsawg kawg thiab qhov siab tshaj plaws rau hom av. Sau thiab hloov cov txiaj ntsig no hauv tus lej kawg. Hloov qhov tseem ceeb yam tsawg kawg nkaus rau qhov kub thiab txias, av noo, thiab av noo rau tsob ntoo hauv kab lus kawg. Upload cov cai.
Kauj ruam 4: Tsim Nws
Ua ntej tshaj, txuas cov av noo sensor mus rau 3.3V, hauv av, thiab tus pin nkag 34. Nco tseg, nws yog ib qho tseem ceeb hloov pauv tau teeb tsa rau A vim tias kev teeb tsa analog rau lub ntsuas ntsuas no yuav raug siv. Tom ntej no, txuas DHT sensor rau 3.3V, hauv av, thiab tus pin nkag 27. DHT22 sensor xav tau 10K Ohm resistor ntawm VCC thiab cov ntaub ntawv tawm tus pin. Nco ntsoov xyuas daim duab DHT kom ntseeg tau tias nws tau siv kab kom raug. Kho ESP32 sab hauv lub thawv tsis muaj dej nrog lub ntsuas dej noo hauv cov av thiab DHT sensor siab dua saum npoo av. Txuas mus rau lub hwj chim thiab txaus siab rau cov ntaub ntawv ntawm koj cov chaw ib puag ncig.
Kauj ruam 5: Code
// Muaj cov tsev qiv ntawv
#define BLYNK_PRINT Serial
#include #include #include #include "DHT.h"
// DHT sensor cov ntaub ntawv
#define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321 #define DHTPIN 27 // Cov lej pin txuas nrog DHT sensor DHT dht (DHTPIN, DHTTYPE); // Pib DHT sensor.
// txhais cov pins input thiab outputs
int av_sensor = 34; // txhais analog input tus lej txuas nrog lub ntsuas dej noo
int output_value; // txhais raws li cov zis
int moisturelevel; // txhais raws li cov zis
int ceeb toom = 0; // txhais notifed li 0
int timedelay = 60000L; // teeb tsa lub sijhawm ua haujlwm kom tau txais cov ntaub ntawv ib zaug txhua feeb lossis 60, 000 miliseconds
// teeb tsa yam tsawg kawg nkaus rau tsob ntoo
int min_moisture = 20; int min_temperature = 75; int min_cov = 60;
// Koj yuav tsum tau txais Auth Token hauv Blynk App.
char auth = "Auth_Token_Here";
// Koj li ntawv pov thawj WiFi.
char ssid = "Wifi_Network_Here"; char pass = "Wifi_Password_Here";
BlynkTimer timer;
// Lub luag haujlwm no xa Arduino lub sijhawm txhua txhua ob rau Virtual Pin (5).
// Hauv app, Widget's nyeem zaus yuav tsum tau teeb tsa rau PUSH. Qhov no txhais tau tias // uas koj txheeb xyuas ntau npaum li cas xa cov ntaub ntawv mus rau Blynk App.
void Sensors () // lub luag haujlwm tseem ceeb los nyeem cov cim thiab thawb rau blynk
{output_value = analogRead (av_sensor); // Nyeem analog teeb liab los ntawm av_sensor thiab txhais raws li output_value // Daim ntawv qhia output_vlaue los ntawm min, max qhov tseem ceeb rau 100, 0 thiab txwv ntawm 0, 100 // Siv cov qauv coj mus kuaj thiab saib xyuas kom pom min thiab qhov tseem ceeb tshaj plaws rau tus kheej lub ntsej muag thiab hom av kom zoo dua ntsuas dej noo qib = txwv (daim ntawv qhia (cov txiaj ntsig tawm, 1000, 4095, 100, 0), 0, 100); ntab h = dht.readHumidity (); // Nyeem cov av noo t = dht.readTemperature (); // Nyeem kub li Celsius (lub neej ntawd) ntab f = dht.readTemperature (muaj tseeb); // Nyeem qhov ntsuas kub raws li Fahrenheit (isFahrenheit = true) // Suav qhov ntsuas cua sov hauv Fahrenheit (lub neej ntawd) ntab hif = dht.computeHeatIndex (f, h); // Txheeb xyuas yog tias ib qho twg nyeem tsis tau zoo thiab tawm ntxov (sim dua). yog (isnan (h) || isnan (t) || isnan (f)) {Serial.println (F ("Ua tsis tau tejyam nyeem los ntawm DHT sensor!")); rov qab; } // Qhov no txuas tus nqi mus rau tus lej pins uas tau hais tseg hauv cov cuab yeej hauv Blynk app Blynk.virtualWrite (V5, moisturelevel); // Xa qib dej noo mus rau tus lej virtual 5 Blynk.virtualWrite (V6, f); // Xa qhov kub mus rau virtual tus pin 6 Blynk.virtualWrite (V7, h); // Xa cov av noo mus rau tus lej virtual 7 Blynk.virtualWrite (V8, hif); // Xa cov ntsuas cua sov mus rau tus lej pin 8
yog (ceeb toom == 0)
{yog (moisturelevel <= min_moisture) // Yog tias cov av noo sib npaug los yog qis dua tus nqi {Blynk.email ("Email_Here", "Plant Monitor", "Water Plant!"); // Xa email rau cov dej cog} ncua (15000); // Blynk email yuav tsum yog 15 vib nas this sib nrug. Ncua 15000 millisecons yog tias (f <= min_temperature) // Yog tias qhov kub sib npaug los yog qis dua tus nqi {Blynk.email ("Email_Here", "Plant Monitor", "Temperature Low!"); // Xa email tias qhov ntsuas kub qis
}
ncua (15000); // Blynk email yuav tsum yog 15 vib nas this sib nrug. Ncua 15000 millisecons yog tias (h <= min_humidity) // Yog cov av noo sib npaug los yog qis dua tus nqi {Blynk.email ("Emial_Here", "Plant Monitor", "Humidity Low!"); // Xa email tias cov av noo tsawg} ceeb toom = 1; timer.setTimeout (timedelay *5, resetNotified); // multipy timedelay los ntawm tus lej xav tau ntawm rov ceeb toom email}}
void resetNotified () // muaj nuj nqi hu rau rov pib dua email zaus
{ceeb toom = 0; }
void teeb tsa ()
{Serial.begin (9600); // Debug console Blynk.begin (auth, ssid, dhau); // txuas rau blynk timer.setInterval (timedelay, Sensors); // Teeb tsa lub luag haujlwm kom raug hu ua txhua feeb lossis lub sijhawm twg yog teem rau dht.begin (); // khiav DHT sensor}
// Lub voj void yuav tsum tsuas yog muaj blynk.run thiab timer
lub voj void () {Blynk.run (); // Khiav blynk timer.run (); // Pib BlynkTimer}
Pom zoo:
WiFi Tsis Siv Neeg Tsob Nroj Tsiaj Pub Nrog Cov Chaw Tso Dej - Sab Hauv Tsev/Sab Nraud Kev Cog Qoob Loo - Cov Nroj Tsuag Dej Tuaj Nrog Kev Saib Xyuas Chaw Nyob: 21 Kauj Ruam
WiFi Tsis Siv Neeg Cog Tsob Nroj Tsiaj Nrog Cov Chaw Tso Dej - Sab Hauv Tsev/Sab Nraud Kev Cog Qoob Loo - Cov Nroj Tsuag Dej Tuaj Nrog Kev Saib Xyuas Tej Zaum: Hauv qhov kev qhia no peb yuav nthuav qhia yuav ua li cas teeb tsa kev cai nyob sab hauv tsev/sab nraum zoov cog cog cog uas tuaj yeem tso dej nroj tsuag thiab tuaj yeem saib xyuas nyob deb ntawm kev siv Adosia platform
Arduino Neeg Hlau Nrog Kev Nyob, Kev Qhia thiab Qib Kev Sib Hloov (Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) Tswj los ntawm Lub Suab Siv Bluetooth Module thiab Kev Siv Tus Neeg Siv Hluav Taws Xob: 6 Kauj Ruam
Arduino Neeg Hlau Nrog Kev Nyob, Kev Qhia thiab Qib Kev Sib Hloov (Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) Tswj los ntawm Lub Suab Siv Bluetooth Module thiab Kev Siv Tus Neeg Siv Hluav Taws Xob: Cov lus qhia no piav qhia yuav ua li cas thiaj tsim tau Arduino Robot uas tuaj yeem txav mus raws qhov xav tau (Forward, Backward) , Sab laug, Txoj Cai, Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) xav tau Kev nrug deb hauv Centimeters siv lub suab hais kom ua. Neeg hlau kuj tseem tuaj yeem txav tau tus kheej
Kev Saib Xyuas Cog thiab Kev Ceeb Toom Nrog ESP8266 thiab AskSensors IoT Huab: 6 Cov Kauj Ruam
Kev Saib Xyuas Cov Cog thiab Kev Ceeb Toom Nrog ESP8266 thiab AskSensors IoT Cloud: Txoj haujlwm no muaj lub hom phiaj txhawm rau txhim kho cov txheej txheem cog cog ntse siv ESP8266 thiab AskSensors IoT Platform. uas pab ua kom dej nyab
Kev Nyuaj Siab: Kev Saib Xyuas thiab Saib Xyuas Ntxiv rau Kev Teeb Meem: 9 Cov Kauj Ruam
Hard Drive: Kev Saib Xyuas thiab Kev Saib Xyuas Ntxiv Teeb Meem: Daim duab saum toj no yog Hard Drive ib txwm muaj. Cov no yog cov tsav tsheb feem ntau siv niaj hnub no, tab sis tsis tas yuav nrawm tshaj. Tib neeg siv tus tsav no rau nws tus nqi qis dua gigabyte thiab lub neej ntev dua. Phau ntawv qhia no yuav qhia koj txog qhov sib txawv
Cov cog cog zoo tshaj - Cov cog cog uas ntse tshaj plaws uas koj tau pom dua: 6 kauj ruam
Cov cog cog zoo tshaj plaws - Cov cog cog uas ntse tshaj plaws uas koj tau pom dua: Cov cog ntoo no tej zaum yog ib tus cog cog uas koj pom tshaj plaws. Txhua yam nyob hauv nws lub ntsej muag zoo nkauj thiab niaj hnub tsim, tus cog ntoo no khav theeb av uas pom thaum koj cov av qhuav. Thaum nws qhuav, lub twj tso kua mis peristaltic tig rau thiab txiav dej