Cov txheej txheem:

Esp32-Ubidots-Wireless-long-range Kub-Thiab-Vaum: 6 Kauj Ruam
Esp32-Ubidots-Wireless-long-range Kub-Thiab-Vaum: 6 Kauj Ruam

Video: Esp32-Ubidots-Wireless-long-range Kub-Thiab-Vaum: 6 Kauj Ruam

Video: Esp32-Ubidots-Wireless-long-range Kub-Thiab-Vaum: 6 Kauj Ruam
Video: #291 External antennas and ESP32 Long-Range mode 2024, Hlis ntuj nqeg
Anonim
Esp32-Ubidots-Wireless-long-range Kub-Thiab-Vaum
Esp32-Ubidots-Wireless-long-range Kub-Thiab-Vaum

Hauv qhov kev qhia no, peb yuav ntsuas qhov sib txawv ntawm qhov kub thiab txias cov ntaub ntawv siv Temp thiab humidity sensor. Koj tseem yuav kawm paub yuav xa cov ntaub ntawv no mus rau Ubidots li cas. Yog li koj tuaj yeem txheeb xyuas nws los ntawm txhua qhov chaw rau cov ntawv thov sib txawv

Kauj ruam 1: Kho vajtse thiab Software xav tau

Kho vajtse thiab Software yuav tsum tau
Kho vajtse thiab Software yuav tsum tau
Kho vajtse thiab Software yuav tsum tau
Kho vajtse thiab Software yuav tsum tau
Kho vajtse thiab Software yuav tsum tau
Kho vajtse thiab Software yuav tsum tau

Yuav tsum tau kho vajtse:

  • NCD ESP32 IoT WiFi BLE Module nrog Kev Sib Txuas USB
  • NCD IoT Ntev Ntau Yam Wireless Kub thiab Vaum Sensor
  • NCD Ntev Ntau Yam Wireless Mesh Modem nrog USB Interface

Yuav tsum tau Software:

  • Arduino IDE Cov
  • LabView Utility
  • Ubidots

Tsev qiv ntawv siv:

  • PubSubClient Library
  • Hlau.h

Kauj Ruam 2: Cov Kauj Ruam Xa Cov Ntaub Ntawv mus rau LabVIEW Kub thiab Vaum Platform Siv IoT Ntev Ntau Wireless Wireless Kub thiab Vaum Sensor thiab Ntev Ntau Wireless Mesh Modem Nrog USB Interface-

  • Ua ntej, peb xav tau Labview cov ntawv thov siv uas yog ncd.io Wireless Kub Thiab Vaum Sensor.exe cov ntaub ntawv uas tuaj yeem saib.
  • Qhov Labview software no yuav ua haujlwm nrog ncd.io wireless Kub Kub sensor nkaus xwb
  • Txhawm rau siv UI no, koj yuav tsum teeb tsa cov tsav tsheb hauv qab no Teeb tsa lub sijhawm ua haujlwm cav ntawm no 64 ntsis
  • 32 bit ib
  • Nruab NI Visa Tsav Tsheb
  • Nruab LabVIEW Khiav Sijhawm Cav thiab NI-Serial Runtime
  • Pib qhia rau cov khoom no.

Kauj Ruam 3: Tshaj Tawm Txoj Cai rau ESP32 Siv Arduino IDE:

Raws li esp32 yog ib feem tseem ceeb tshaj tawm koj li kev co thiab kub cov ntaub ntawv rau Ubidots.

Rub tawm thiab suav nrog PubSubClient Library thiab Wire.h Library

#suav nrog

#suav nrog

#suav nrog

#suav nrog

Koj yuav tsum muab koj tus kheej tshwj xeeb Ubidots TOKEN, MQTTCLIENTNAME, SSID (WiFi Lub Npe) thiab Lo lus zais ntawm lub network muaj

#define WIFISSID "xyz" // Muab koj WifiSSID tso rau ntawm no

#define PASSWORD "xyz" // Muab koj tus password rau ntawm no

#define TOKEN "xyz" // Muab koj cov Ubidots 'TOKEN

#define MQTT_CLIENT_NAME "xyz" // MQTT tus thov lub npe

Txheeb xyuas qhov sib txawv thiab lub npe khoom siv uas cov ntaub ntawv yuav xa mus rau Ubidots

#define VARIABLE_LABEL "Kub" // Txheeb xyuas cov ntawv sib txawv

#define VARIABLE_LABEL2 "Roj teeb"

#define VARIABLE_LABEL3 "Vaum"

#define DEVICE_LABEL "esp32" // Txheeb cov ntawv cim ntaus ntawv

Qhov chaw khaws cov txiaj ntsig xa:

char them [100];

lub ntsiab lus [150]; char nqe 2 [150]; char topic3 [150]; // Qhov chaw khaws cov txiaj ntsig kom xa char str_Temp [10]; char str_sensorbat [10]; char str_humidity [10];

Txoj cai los tshaj tawm cov ntaub ntawv rau Ubidots:

sprintf (ntsiab lus, "%s", ""); // Ntxuav cov ntsiab lus ntsiab lus

sprintf (ntsiab lus, "%s%s", "/v1.6/devices/", DEVICE_LABEL); sprintf (payload, "%s", ""); // Ntxuav cov ntsiab lus them nyiaj sprintf (payload, "{"%s / ":", VARIABLE_LABEL); // Ntxiv cov ntawv sib txawv sprintf (payload, " %s {" value / ": %s", payload, str_Temp); // Ntxiv tus nqi sprintf (payload, "%s}}", payload); // Kaw cov phau ntawv txhais lus brackets client.publish (ntsiab lus, them nyiaj);

  • Sau thiab xa cov cai temp_humidity.ino.
  • Txhawm rau txheeb xyuas qhov kev sib txuas ntawm lub cuab yeej thiab cov ntaub ntawv xa mus, qhib lub ntsuas saib. Yog tias tsis pom cov lus teb, sim tshem koj lub ESP32 thiab tom qab ntawd txuas nws dua. Nco ntsoov tias tus nqi baud ntawm Serial monitor tau teeb tsa rau tib qho uas tau teev tseg hauv koj tus lej 115200.

Kauj ruam 4: Serial Monitor Output

Serial Monitor Output
Serial Monitor Output

Kauj Ruam 5: Ua Ubidot Ua Haujlwm:

Ua Ubidot Ua Haujlwm
Ua Ubidot Ua Haujlwm
Ua Ubidot Ua Haujlwm
Ua Ubidot Ua Haujlwm
Ua Ubidot Ua Haujlwm
Ua Ubidot Ua Haujlwm
Ua Ubidot Ua Haujlwm
Ua Ubidot Ua Haujlwm
  • Tsim tus as khauj ntawm Ubidots.
  • Mus rau kuv qhov profile thiab sau cia tus cim token uas yog tus yuam sij tshwj xeeb rau txhua tus as khauj thiab muab nws tso rau koj tus lej ESP32 ua ntej rub tawm.
  • Ntxiv ib lub cuab yeej tshiab rau koj lub Ubidots dashboard lub npe esp32.
  • Nyem rau ntawm cov cuab yeej thiab xaiv cov cuab yeej hauv Ubidots.
  • Tam sim no koj yuav tsum pom cov ntaub ntawv tshaj tawm hauv koj tus lej Ubidots, sab hauv lub cuab yeej hu ua "ESP32".
  • Sab hauv lub cuab yeej tsim qhov hloov pauv lub npe tshiab uas koj qhov ntsuas kub yuav pom.
  • Tam sim no koj tuaj yeem saib Qhov Kub thiab lwm yam ntaub ntawv ntsuas uas tau pom yav dhau los hauv cov ntawv saib. Qhov no tau tshwm sim vim tias tus nqi ntawm kev nyeem ntawv sib txawv tau dhau los ua txoj hlua thiab khaws cia hauv qhov sib txawv thiab tshaj tawm rau qhov sib txawv sab hauv ntaus ntawv esp32.

Pom zoo: