Cov txheej txheem:

Snap Circuits thiab IoT: 3 Cov Kauj Ruam
Snap Circuits thiab IoT: 3 Cov Kauj Ruam

Video: Snap Circuits thiab IoT: 3 Cov Kauj Ruam

Video: Snap Circuits thiab IoT: 3 Cov Kauj Ruam
Video: Koj mus ua neej zoo li cas lawm 11/16/2018 2024, Kaum ib hlis
Anonim
Snap Circuits thiab IoT
Snap Circuits thiab IoT
Snap Circuits thiab IoT
Snap Circuits thiab IoT

Hauv qhov haujlwm no cov menyuam yuav kawm paub yuav ua li cas IoT tuaj yeem pab txhawb kev ua haujlwm tau zoo ntawm lub tsev.

Lawv yuav teeb tsa lub tsev me me uas siv cov kab hluav taws xob sib txuas, thiab yuav tsim cov khoom siv sib txawv ntawm ESP32, tshwj xeeb rau:

saib xyuas ib puag ncig ib puag ncig (ntsuas cua sov) hauv lub sijhawm tswj cov cuab yeej nyob deb ntawm Blynk

QHIA

Kev siv hluav taws xob tuaj yeem cuam tshuam los ntawm txoj haujlwm ntawm lub tsev nrog kev hwm rau lub hnub, huab cua thoob plaws, thiab lwm yam. tuaj yeem muab lub teeb pom kev zoo ib yam.

Lwm yam los txiav txim siab txhawm rau txhawm rau ua kom muaj zog ntau tshaj yog cuam tshuam ncaj qha nrog cov cuab yeej siv koj siv.

Nov yog qee qhov lus qhia:

siv cov cuab yeej ntse, piv txwv li lub teeb qhov muag uas pom thaum hmo ntuj thiab txiav tawm thaum nruab hnub siv cov ntse ntsaws nruab nrog lub khawm tawm uas tuaj yeem ua haujlwm kom qhib thiab tua ntawm lub sijhawm tshwj xeeb. nqes koj cov khoom siv hauv is taws nem kom koj tuaj yeem tswj lawv nyob deb ntawm txhua qhov chaw.

Khoom siv

  • 1x ESP32 board + usb cable
  • khej kab
  • 1 x DHT11 sensor
  • 1 x LDR sensor
  • 1 x 10 kohm resistor
  • Cov qhob cij
  • jumper cov xov hlau
  • snap circuits
  • tsev me me

Kauj Ruam 1: Teeb Lub Tsev Me Me

Txhawm rau pib nrog, cov menyuam yuav tsum tau tsim lossis teeb tsa lub tsev me me. Lawv tuaj yeem tsim ib qho siv duab los qhia, lossis koj tuaj yeem laser txiav lawv ua ntej, siv piv txwv li 3 hli tuab MDF board. Nov yog kev tsim lub tsev me me, npaj rau kev txiav laser.

Kauj Ruam 2: Saib Xyuas Kub, Vaum thiab Lub Teeb Nrog Blynk

Saib Xyuas Kub, Vaum thiab Lub Teeb Nrog Blynk
Saib Xyuas Kub, Vaum thiab Lub Teeb Nrog Blynk
Saib Xyuas Kub, Vaum thiab Lub Teeb Nrog Blynk
Saib Xyuas Kub, Vaum thiab Lub Teeb Nrog Blynk
Saib Xyuas Kub, Vaum thiab Lub Teeb Nrog Blynk
Saib Xyuas Kub, Vaum thiab Lub Teeb Nrog Blynk

menyuam yaus yuav teeb tsa Blynk qhov haujlwm uas ua rau lawv saib xyuas qhov ntsuas tsis tau kaw los ntawm qhov kub thiab txias thiab lub teeb pom kev nyob hauv lawv lub tsev me me.

Ua ntej, nqes LDR snap thiab DHT snap rau ESP32 pawg thawj coj. txuas Cov Ntaub Ntawv tus lej ntawm DHT sensor rau tus pin 4 ntawm ESP32 pawg thawj coj. Txuas LDR snap rau tus pin 34 ntawm ESP32.

Tom ntej no, koj yuav tsum tsim Blynk qhov haujlwm thiab teeb tsa nws kom pom cov txiaj ntsig tau teev tseg los ntawm qhov ntsuas kub/hum.

ZOO TSHAJ PLAWS TSHIAB hauv BLYNK APP

Tom qab koj tau ua tiav kev nkag mus rau hauv koj tus as khauj, pib los ntawm kev tsim txoj haujlwm tshiab.

Xaiv koj lub HARDWARE

Xaiv tus qauv kho vajtse uas koj yuav siv. Yog tias koj ua raws cov lus qhia no koj yuav zaum siv ESP32 pawg thawj coj.

AUTH TOKEN

Auth Token yog tus cim tshwj xeeb uas xav tau los txuas koj lub cuab yeej rau koj lub xov tooj. Txhua qhov haujlwm tshiab koj tsim yuav muaj nws tus kheej Auth Token. Koj yuav tau txais Auth Token txiav ntawm koj tus email tom qab tsim qhov project. Koj tseem tuaj yeem luam nws ntawm tus kheej. Nyem rau ntu khoom siv thiab xaiv cov cuab yeej xav tau

YUAV TSUM MUAJ ZOO TSHAJ PLAWS WIDGETS

Luag thiab poob 3 tus nqi Zaub widgets.

teeb tsa lawv raws li hauv qab no:

1) teeb cov tswv yim li V5, los ntawm 0 txog 1023. Teem sijhawm ncua sijhawm tshiab li Push2) teeb tsa ua V6, los ntawm 0 txog 1023. Teem sijhawm ncua sijhawm tshiab li Push

3) teeb cov tswv yim li V0, los ntawm 0 txog 1023. Teem sijhawm ncua sijhawm tshiab li Push

Thawj lub vijtsam nthuav dav yuav tau txais qhov ntsuas qhov ntsuas los ntawm DHT sensor, thiab tso tawm rau ntawm lub app; lub vijtsam thib ob yuav tau txais qhov ntsuas kub ntau dua li Wi-nkaus, lub vijtsam thib peb yuav nthuav tawm qhov tseem ceeb ntawm lub teeb kaw los ntawm LDR sensor.

PROGRAM LUB ESP32 BOARD

Tua tawm Arduino IDE, xaiv lub rooj tsav xwm raug thiab chaw nres nkoj -raws li "Cuab Yeej" tshuab raj-. Muab tshuaj txhuam cov cai hauv qab no tso rau hauv software thiab xa nws mus rau ntawm lub rooj tsavxwm.

#define BLYNK_PRINT Serial

#include #include #include #include

// Koj yuav tsum tau txais Auth Token hauv Blynk App. // Mus rau Qhov Chaw Haujlwm (icon txiv ntoo). char auth = "726e035ec85946ad82c3a2bb03015e5f";

// Koj li ntawv pov thawj WiFi. // Teeb tus password rau "" rau qhib tes hauj lwm. char ssid = "TISCALI-301DC1"; char pass = "ewkvt+dGc1Mx";

const int analogPin = 34; // Analog input pin 0 (GPIO 36) int sensorValue = 0; // Tus nqi nyeem los ntawm ADC

#define DHTPIN 4 // Tus lej digital twg peb txuas nrog

// Tsis pom zoo yam twg koj tab tom siv! #define DHTTYPE DHT11 // DHT 11 //#define DHTTYPE DHT22 // DHT 22, AM2302, AM2321 //#define DHTTYPE DHT21 // DHT 21, AM2301

DHT dht (DHTPIN, DHTTYPE); 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 sendSensor () {ntab h = dht.readHumidity (); ntab t = dht.readTemperature (); // lossis dht.readTemperature (muaj tseeb) rau Fahrenheit

yog (isnan (h) || isnan (t)) {Serial.println ("Ua tsis tau tejyam nyeem los ntawm DHT sensor!"); rov qab; } // Koj tuaj yeem xa tus nqi txhua lub sijhawm. // Thov tsis txhob xa ntau tshaj 10 qhov nqi ib pliag. Blynk.virtualWrite (V5, h); Blynk.virtualWrite (V6, t); }

void teeb () {// Debug console Serial.begin (9600);

Blynk.begin (auth, ssid, dhau); // Koj tseem tuaj yeem hais qhia server: //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80); //Blynk.begin(auth, ssid, dhau, IPAddress (192, 168, 1, 100), 8080);

dht.begin ();

// Teeb lub luag haujlwm kom raug hu ua txhua lub sijhawm thib ob.setInterval (1000L, sendSensor); timer.setInterval (250L, AnalogPinRead); // Khiav sensor scan 4 zaug ib pliag

}

void AnalogPinRead () {sensorValue = analogRead (analogPin); // Nyeem qhov sib piv hauv tus nqi: Serial.print ("sensor ="); // Luam cov txiaj ntsig… Serial.println (sensorValue); //… mus rau qhov ntsuas saib: Blynk.virtualWrite (V0, sensorValue); // Xa cov txiaj ntsig rau Gauge Widget}

lub voj void () {Blynk.run (); timer.run (); }

Kauj Ruam 3: Tswj Cov Khoom Siv Hluav Taws Xob Me Me Los Ntawm Blynk

Tswj Cov Khoom Siv Me Me Los Ntawm Blynk
Tswj Cov Khoom Siv Me Me Los Ntawm Blynk
Tswj Cov Khoom Siv Me Me Los Ntawm Blynk
Tswj Cov Khoom Siv Me Me Los Ntawm Blynk
Tswj Cov Khoom Siv Me Me Los Ntawm Blynk
Tswj Cov Khoom Siv Me Me Los Ntawm Blynk

Qhov kawg ntawm kev ua haujlwm yuav yog hais txog kev tswj hwm cov khoom siv hluav taws xob ib qho los ntawm ib qho chaw deb ntawm blynk app.

Txhua lub tsev me me yuav tsum suav nrog tsawg kawg ib lub teeb me me ntxiv rau lwm yam khoom siv (piv txwv li lub tshuab luam ntawv me me 3D, lub qhov cub me me).

Muaj peev xwm tswj tau ib qho khoom siv hauv tsev tau muab rau tus neeg siv kom muaj txiaj ntsig zoo ntawm kev tuaj yeem xaiv thaum lawv tab tom khiav thiab thaum lawv tsis ua, yog li pab txhawb kev txuag hluav taws xob thiab ua rau lub tsev me me ua kom muaj zog siv tau.

Peb tau tsim tus lej 3D luam tawm cov khoom siv hluav taws xob me me uas tuaj yeem tso rau sab saum toj ntawm cov khoom siv snap. Koj tuaj yeem piv txwv xav txog qhov tso lub qhov cub me me rau saum lub Led lossis lub tshuab luam ntawv 3D me me nyob rau sab saum toj ntawm lub tshuab hluav taws xob me me vibrating, yog li ua raws li kev ua haujlwm tiag tiag ntawm cov khoom siv ntawd.

Pom txhua yam khoom siv muaj rau 3D luam ntawv los ntawm txhaj rau kab ntawv txuas hauv qab no:

Snap TV TV

Snap Circuit qhov cub

Snap Circuit 3D tshuab luam ntawv

Snap Circuit Tov Khoom

Snap tshuab ntxhua khaub ncaws

Cov haujlwm no yuav xav tau daim ntawv thov Blynk. Yog li, xub rub tawm Blynk ntawm koj lub smartphone.

ZOO TSHAJ PLAWS TSHIAB hauv BLYNK APP

Tom qab koj tau ua tiav kev nkag mus rau hauv koj tus as khauj, pib los ntawm kev tsim txoj haujlwm tshiab.

Xaiv koj lub HARDWARE

Xaiv tus qauv kho vajtse uas koj yuav siv. Yog tias koj ua raws cov lus qhia no koj yuav zaum siv ESP32 pawg thawj coj.

AUTH TOKEN

Auth Token yog tus cim tshwj xeeb uas xav tau los txuas koj lub cuab yeej rau koj lub xov tooj. Txhua qhov haujlwm tshiab koj tsim yuav muaj nws tus kheej Auth Token. Koj yuav tau txais Auth Token txiav ntawm koj tus email tom qab tsim qhov project. Koj tseem tuaj yeem luam nws ntawm tus kheej. Nyem rau ntu khoom siv thiab xaiv cov cuab yeej xav tau, Thiab koj yuav pom token

PROGRAM LUB ESP32 BOARD

Lub taub hau rau lub vev xaib no, xaiv koj lub khoos phis tawj, hom kev txuas (piv txwv li wi-fi) thiab xaiv Blynk Blink piv txwv.

Luam cov cai thiab muab tso rau ntawm Arduino IDE (ua ntej ntawd, xyuas kom tseeb tias koj xaiv lub rooj tsav xwm raug thiab qhov chaw nres nkoj raug - hauv "Cov Cuab Yeej" -).

Hloov "YourAuthtoken" nrog lub cim muaj nyob hauv app, hloov "YourNetworkName" thiab "YourPassword" nrog koj li ntawv pov thawj wi-fi. Thaum kawg, upload cov cai rau ntawm lub rooj tsavxwm.

Teem lub BLYNK APP

Hauv koj txoj haujlwm Blynk, xaiv khawm widgets, muaj ntau lub khawm zoo li koj muaj snaps los tswj kev nyob deb. Hauv peb qhov piv txwv peb yuav ntxiv ob lub khawm widgets txij li peb muaj ob ntu snap los tswj (ob qho tib si yog LEDs).

Tom ntej xaiv thawj lub pob thiab, hauv qab qhov tsim tawm, xaiv qhov chaw nres nkoj uas ib qho ntawm koj lub snap txuas nrog ESP32 pawg thawj coj (ex. GP4). Nco ntsoov kom muaj 0 thiab 1 nyob ze rau GP4, ib yam li hauv daim duab hauv qab no. Koj kuj tseem tuaj yeem xaiv seb lub pob puas yuav ua haujlwm hauv nqaij lossis hloov hom.

Ua tib yam rau khawm thib ob, tsuas yog lub sijhawm no txuas rau tus lej ESP32 tus lej (piv txwv. GP2).

Pom zoo: