Cov txheej txheem:
- Kauj Ruam 1: Cheeb Tsam
- Kauj ruam 2: Kev sib txuas
- Kauj ruam 3: CODING
- Kauj Ruam 4: NTUJ
- Kauj ruam 5: Teeb duab
- Kauj Ruam 6: Nov yog Video Qhia Txog Breif
Video: Motion Detector Siv Thingsai.io Iot Cloud Platform: 6 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:27
Hauv qhov kev qhia no kuv yuav piav qhia txog kev txav mus los los ntawm kev siv lub PIR sensor thiab Esp32 nrog rau IOT huab platform Thingai.io
Kauj Ruam 1: Cheeb Tsam
HARDWARE COMPONENTS;
1.esp32 Pawg Thawj Coj Loj Hlob
2. PIR Sensor
3. Jumper Wires
SOFTWARE:
1. Arduino IDE
2. Accountai.io tus account
Kauj ruam 2: Kev sib txuas
Cov kev sib txuas yog ntsiag to yooj yim.
PIR PINS ------------ ESP32 PINS
VCC ------------------- 3V3 ntawm esp32
GND ------------------ GND ntawm esp32
OUT ------------------- D22 ntawm esp32
Kauj ruam 3: CODING
Muab cov cai no tso rau hauv koj li Arduino IDE nrog qee qhov kev hloov kho tshiab, koj lub Motion sensor yuav muab cov txiaj ntsig tau zoo.
#suav nrog
#suav nrog
#suav nrog
int suav = 0, i, m, j, k;
int t, t1, t2, t3;
int pin = 22;
//////////////////////////////////////// Txhua qhov kev txiav txim rau CLOUD ////// //////////////////////////
const char* tus tswv = "api.thingsai.io"; // LOS YOG host = devapi2.thethingscloud.com
const char* post_url = "/devices/deviceData"; // LOS YOG/api/v2/thingscloud2/_table/data_ac
const char* time_server = "baas.thethingscloud.com"; // qhov no yog los hloov lub sijhawm
const int httpPort = 80;
ua int httpsPort = 443;
const char* neeg rau zaub mov = "api.thingsai.io"; // Neeg rau zaub mov URL
timestamp char [10];
WiFiMulti WiFiMulti;
// Siv chav kawm WiFiClient los tsim kev sib txuas TCP
WiFiClient tus thov kev pab;
/////////////////////////////////////// TIMESTAMP CALCULATION muaj nuj nqi //////// ///////////////////////////////////
muab GiveMeTimestamp ()
{
unsigned ntev timeout = millis ();
// WiFiClient tus thov kev pab;
thaum (client.available () == 0)
{
yog tias (millis () - sijhawm>> 50000)
{
client.stop (); cov.
rov 0;
}
}
thaum (client.available ())
{
Txoj hlua kab = client.readStringUntil ('\ r'); // indexOf () yog qhov ua haujlwm los tshawb rau smthng, nws rov qab -1 yog tias tsis pom
int pos = line.indexOf ("\" timestamp / ""); // tshawb rau "\" timestamp / "" txij thaum pib teb tau txais thiab theej tag nrho cov ntaub ntawv tom qab ntawd, nws yuav yog koj lub sijhawm
yog (pos> = 0)
{
int j = 0;
rau (j = 0; j <10; j ++)
{
timestamp [j] = kab [pos + 12 + j];
}
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////
void teeb tsa ()
{
Serial.begin (115200);
ncua (10);
pinMode (tus pin, INPUT);
// Peb pib los ntawm kev txuas mus rau WiFi network
WiFiMulti.addAP ("wifi_name", "Wifi_password");
Serial.println ();
Serial.println ();
Serial.print ("Tos WiFi โฆ");
thaum (WiFiMulti.run ()! = WL_CONNECTED) {
Serial.print (".");
ncua (500);
}
Serial.println ("");
Serial.println ("Txuas nrog WiFi");
Serial.println ("IP chaw nyob:");
Serial.println (WiFi.localIP ());
ncua (500);
}
void lub voj ()
{
int analogValue = analogRead (tus pin);
{
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Xa tsuas yog lus nug thiab tau txais cov lus teb //// /////////////////////
{
bool isDetected = digitalRead (tus pin);
yog (isDetected) {
Serial.println ("Kev kuaj pom muaj");
}
ncua (500);
}
Serial.print ("txuas rau");
Serial.println (tus tswv tsev); // txhais tau ib sab:- host = devapi2.thethingscloud.com lossis 139.59.26.117
///////////////////////////////////// TIMESTAMP CODE SNIPPET ////////// /////////////////
Serial.println ("sab hauv tau txais timestamp / n");
yog (! client.connect (time_server, {
rov qab; //*-*-*-*-*-*-*-*-*-*
}
client.println ("Tau txais/api/timestamp HTTP/1.1"); // Qhov haujlwm no ua dab tsi, kuv tsis tau txais
client.println ("Tus tswv tsev: baas.thethingscloud.com");
client.println ("Cache-Control: tsis-cache");
client.println ("Postman-Token: ea3c18c6-09ba-d049-ccf3-369a22a284b8");
client.println (); cov.
GiveMeTimestamp (); // nws yuav hu lub luag haujlwm uas yuav tau txais lub sijhawm timestamp los ntawm cov neeg rau zaub mov
Serial.println ("timestamp tau txais");
Serial.println (timestamp);
Serial.println ("hauv ThingsCloudPost");
Txoj hlua PostValue = "{" device_id / ": 61121695839, \" slave_id / ": 2";
PostValue = PostValue + ", \" dts / ":" + timestamp;
PostValue = PostValue +", \" data / ": {" PIR / ":" +pin +"}" +"}";
Serial.println (PostValue);
/ * tsim qhov piv txwv ntawm WiFiClientSecure */
WiFiClientSecure tus neeg siv khoom;
Serial.println ("Txuas rau server ntawm chaw nres nkoj 443");
yog (! client.connect (server, 443)) {
Serial.println ("Kev sib txuas tsis tau ua tiav!");
lwm yam {
Serial.println ("Txuas rau server!");
/ * tsim kev thov HTTP */
client.println ( POST/pab kiag li lawm/deviceData
client.println ("Tus tswv: api.thingsai.io");
//client.println("Connection: kaw ");
client.println ("Cov ntsiab lus-Hom: thov/json");
client.println ("cache-control: tsis-cache");
client.println ("Kev tso cai: Tus neeg nqa khoom eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9. IjVhMzBkZDFkN2QwYjNhNGQzODkwYzQ4OSI.kaY6OMj5cYlWNqC2PNTkXs9Jy9j9"
client.print ("Cov ntsiab lus-Ntev:");
client.println (PostValue.length ());
client.println (); cov.
client.println (PostValue);
////////////////////////////////// POSTING cov ntaub ntawv rau ntawm huab tau ua tiav thiab tam sim no tau txais daim ntawv teb huab neeg rau zaub mov ////////////////////
Serial.print ("Tos kom teb");
thaum (! client.available ()) {
ncua (50); //
Serial.print (".");
}
/ * yog tias muaj cov ntaub ntawv ces tau txais thiab luam tawm rau Terminal */
thaum (client.available ()) {
char c = client.read (); cov.
Serial.write (c);
}
/ * yog tias tus neeg rau zaub mov raug txuas, nres tus neeg siv khoom */
yog (! client.connected ()) {
Serial.println ();
Serial.println ("Server txiav tawm"); javascript:;
client.stop (); cov.
}
}
Serial.println ("////////////////////// Qhov kawg /////////////////////// ");
ncua (3000);
}
}
Kauj Ruam 4: NTUJ
Nov yog kab ntawv kab lus sawv cev ntawm qhov muaj txiaj ntsig nyeem los ntawm lub ntsuas pa hauv yam khoom, io huab platform,
Kauj ruam 5: Teeb duab
Qhov no yog cov duab sawv cev ntawm qhov muaj txiaj ntsig los ntawm lub sensor. Los ntawm daim duab saum toj no peb tuaj yeem tshuaj xyuas daim ntawv thov ntawm lub ntsuas. Ua Tsaug
Pom zoo:
DHT Kev Ntsuas Kub thiab Vaum Siv ESP8266 thiab AskSensors IoT Platform: 8 Cov Kauj Ruam
DHT Kev Ntsuas Kub thiab Vaum Siv ESP8266 thiab AskSensors IoT Platform: Hauv cov lus qhia yav dhau los, Kuv nthuav qhia ib qib zuj zus qhia kom pib nrog ESP8266 nodeMCU thiab AskSensors IoT platform Hauv qhov kev qhia no, Kuv txuas DHT11 sensor mus rau qhov chaw MCU. DHT11 yog ib txwm siv Kub thiab noo
IoT Base Platform Nrog RaspberryPi, WIZ850io: Platform Device Driver: 5 Kauj Ruam (nrog Duab)
IoT Base Platform Nrog RaspberryPi, WIZ850io: Platform Device Driver: Kuv paub RaspberryPi platform rau IoT. Tsis ntev los no WIZ850io tau tshaj tawm los ntawm WIZnet. Yog li kuv tau siv daim ntawv thov RaspberryPi los ntawm Ethernet SW kev hloov pauv vim tias kuv tuaj yeem lis tus lej yooj yim. Koj tuaj yeem sim Platform Device Driver los ntawm RaspberryPi
Tsis Siv Neeg Kev Hla Hla Kev Siv Hluav Taws Xob Siv Arduino Raws Kev Nkag Nkag Platform: 9 Cov Kauj Ruam
Tsis Siv Neeg Kev Hla Hla Kev Siv Hluav Taws Xob Siv Arduino Raws Kev Nkag Siab Platform: Christmas tsuas yog ib lub lim tiam xwb! Txhua leej txhua tus tibneeg hu tauj coob nrog kev ua koob tsheej thiab tau txais khoom plig, uas, los ntawm txoj kev, tau txais txhua qhov nyuaj dua kom tau nrog qhov tsis muaj peev xwm nyob ib puag ncig peb. Yuav ua li cas mus los ntawm khoom plig qub thiab ntxiv qhov kov ntawm DIY rau
Motion Detector Siv NodeMCU: 5 Kauj Ruam
Motion Detector Siv NodeMCU: Hauv txoj haujlwm no, los ntawm kev siv lub suab txav txav koj tuaj yeem kuaj pom tias muaj tib neeg lossis tsiaj txhu nyob. Thiab los ntawm lub platform hu ua thingsio koj tuaj yeem saib xyuas hnub thiab sijhawm uas qhov pom muaj tshwm sim
LDR Siv Thingsai Cloud: 13 Kauj Ruam
LDR Siv Thingsai Cloud: HEY โฆ.. hnub no peb yuav kawm txog kev ntsuas qhov pom kev ntawm lub teeb thiab tshaj tawm qhov txiaj ntsig rau hauv THINGSAI IOT huab platform los ntawm kev siv ESP32. Cov tseev kom ua qhov haujlwm no yog 1. ESP32 Development Board (Kuv tau siv ESP32 DEVKIT V1) 2. LD