Cov txheej txheem:

IOT - ib Tshaj Tawm Cov Ntaub Ntawv rau Thingspeak Siv ESP8266: 3 Cov Kauj Ruam
IOT - ib Tshaj Tawm Cov Ntaub Ntawv rau Thingspeak Siv ESP8266: 3 Cov Kauj Ruam

Video: IOT - ib Tshaj Tawm Cov Ntaub Ntawv rau Thingspeak Siv ESP8266: 3 Cov Kauj Ruam

Video: IOT - ib Tshaj Tawm Cov Ntaub Ntawv rau Thingspeak Siv ESP8266: 3 Cov Kauj Ruam
Video: Plab Plab Ntswg..(Pluav Pluav Ntswg) Maiv Twm New Song 2023-2024 2024, Kaum ib hlis
Anonim
IOT | ib Tshaj Tawm Cov Ntaub Ntawv rau Thingspeak Siv ESP8266
IOT | ib Tshaj Tawm Cov Ntaub Ntawv rau Thingspeak Siv ESP8266
IOT | ib Tshaj Tawm Cov Ntaub Ntawv rau Thingspeak Siv ESP8266
IOT | ib Tshaj Tawm Cov Ntaub Ntawv rau Thingspeak Siv ESP8266

Tam sim no, IoT tab tom nthuav dav thiab ntau lub tshuab muaj cov ntaub ntawv rub tawm hla huab thiab txheeb xyuas cov ntaub ntawv. Cov ntsuas me me hloov kho cov ntaub ntawv ntawm huab thiab tus ua haujlwm ntawm lwm qhov kawg ua rau nws. Kuv yuav piav qhia ib qho piv txwv ntawm IoT.

Kuv tsab xov xwm no thiab kuv yuav qhia thiab qhia kom tshaj tawm cov ntaub ntawv rau Thingspeak siv ESP8266.

Kauj Ruam 1: Yuav Tsum Muaj Kev Koom Tes

Yuav tsum muaj Cheeb Tsam
Yuav tsum muaj Cheeb Tsam
Yuav tsum muaj Cheeb Tsam
Yuav tsum muaj Cheeb Tsam

ESP8266ESP8266 hauv Is Nrias teb-

ESP8266 hauv UK -

ESP8266 hauv Asmeskas -

MLX90614MLX90614 hauv Is Nrias teb-

MLX90614 hauv UK -

MLX90614 hauv Asmeskas -

BreadBoard

BreadBoard hauv Is Nrias teb-

BreadBoard hauv Asmeskas- https://amzn.to/2MW0Opb BreadBoard hauv tebchaws Askiv-

Kauj ruam 2: Code

#include #include #include

Txoj hlua apiKey = "7CDCTE2767Z8AUIL"; // Nkag mus rau koj Sau API tus yuam sij los ntawm ThingSpeak

const char *ssid = "zais"; // hloov nrog koj tus wifi ssid thiab wpa2 tus yuam sij

const char *pass = "qwerty12"; const char* neeg rau zaub mov = "api.thingspeak.com";

WiFiClient tus thov kev pab;

Adafruit_MLX90614 mlx = Adafruit_MLX90614 ();

int obTemp;

koj ambTemp;

void teeb tsa ()

{Serial.begin (115200); ncua (10); Serial.println ("Txuas rau"); Serial.println (ssid); WiFi.begin (ssid, dhau); thaum (WiFi.status ()! = WL_CONNECTED) {ncua (500); Serial.print ("."); } Serial.println (""); Serial.println ("Txuas nrog WiFi"); mlx.begin (); Wire.begin (D1, D2); } void voj () {

yog (client.connect (server, 80)) // "184.106.153.149" lossis api.thingspeak.com

{objTemp = mlx.readObjectTempC (); ambTemp = mlx.readObjectTempC (); Txoj hlua postStr = apiKey; postStr += "& field1 ="; postStr += Txoj hlua (objTemp); postStr += "\ r / n / r / n";

client.print ("POST /hloov tshiab HTTP /1.1 / n");

client.print ("Tus tswv tsev: api.thingspeak.com / n"); client.print ("Kev sib txuas: kaw / n"); client.print ("X-THINGSPEAKAPIKEY:"+apiKey+"\ n"); client.print ("Cov ntsiab lus-Hom: thov/x-www-form-urlencoded / n"); client.print ("Cov ntsiab lus-Ntev:"); client.print (postStr.length ()); client.print ("\ n / n"); client.print (postStr);

Serial.print ("Ambient ="); Serial.print (ambTemp);

Serial.print ("*C / tObject ="); Serial.print (objTemp); Serial.println ("*C");

}

client.stop (); cov. ncua (2000); }

Pom zoo: