Cov txheej txheem:
- Khoom siv
- Kauj Ruam 1: Pib teeb tsa ntawm Arduino IDE
- Kauj ruam 2: Ubidots API Cov Ntawv Pov Thawj
- Kauj Ruam 3: Txoj Cai.
- Kauj Ruam 4: Txuas, Sau & Tso Cai.
- Kauj Ruam 5: Kuaj Kawg.
Video: NodeMCU ESP8266 - MQTT - Ubidots: 5 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:24
MQTT yog OASIS tus qauv txheej txheem xa xov rau Internet ntawm Yam (IoT). Nws tau tsim los ua qhov hnyav tshaj tawm tshaj tawm/sau npe xa xov uas yog qhov zoo tshaj plaws rau kev txuas cov khoom siv tej thaj chaw deb nrog tus lej me me hneev taw thiab tsawg network kev sib kis. MQTT niaj hnub no tau siv ntau yam lag luam, xws li tsheb, tsim khoom, sib txuas lus, roj thiab roj, thiab lwm yam.
Vim li cas MQTT: MQTT cov neeg siv khoom tsawg heev, xav tau cov peev txheej tsawg kawg thiaj li tuaj yeem siv rau ntawm cov tswj me me. MQTT cov ntawv xov xwm lub taub hau me me los ua kom muaj kev sib txuas zoo hauv network.
Kev Sib Txuas Lus Ob Directional: MQTT tso cai rau kev xa xov ntawm lub cuab yeej mus rau huab thiab huab rau ntaus ntawv. Qhov no ua rau yooj yim tshaj tawm cov lus rau pawg ntawm yam.
Nplai rau Ntau lab Yam: MQTT tuaj yeem ntsuas txuas nrog ntau lab ntawm IoT cov cuab yeej.
Kev ntseeg tau ntawm kev xa xov: Nws yog qhov tseem ceeb rau ntau qhov IoT siv rooj plaub. Qhov no yog vim li cas MQTT muaj 3 qhov kev txhais tau zoo ntawm qib kev pabcuam:
- 0 - feem ntau ib zaug,
- 1- tsawg kawg ib zaug,
- 2 - raws nraim ib zaug
Kev txhawb nqa rau Kev Sib Txuas Tsis Txaus Siab: Ntau IoT cov cuab yeej txuas nrog cov xov tooj ntawm tes tsis txaus ntseeg. MQTT kev txhawb nqa rau ntu ntu txuas ntxiv txo lub sijhawm rov txuas tus neeg siv khoom nrog tus tswv lag luam.
Kev Nyab Xeeb Kev Nyab Xeeb: MQTT ua kom yooj yim rau encrypt cov lus siv TLS thiab txheeb xyuas cov neeg siv siv cov txheej txheem kev lees paub niaj hnub no, xws li OAuth.
Khoom siv
- NodeMCU ESP8266 (lossis) lwm lub Rooj Sib Tham ESP8266
- Kev Sau Npe Ubidots
- Txhawb nqa lub tsev qiv ntawv los ntawm GitHub.
- Arduino IDE txhawm rau upload cov cai.
Kauj Ruam 1: Pib teeb tsa ntawm Arduino IDE
- Rub tawm UbidotsMQTTESP8266 lub tsev qiv ntawv los ntawm GIT Repository
- Qhib Arduino IDE, mus rau "nyiam" los ntawm "ntawv" ntawv qhia zaub mov.
- Hauv kab ntawv "Tus Thawj Saib Xyuas Lub Rooj Sib Tham Ntxiv URLs", sau cov hauv qab no: https://arduino.esp8266.com/stable/package_esp8266… & nias rau Ok mus txuas ntxiv.
- Nkag mus rau "Ntxiv. ZIP Library" los ntawm "Sketch> Include Library" ntawv qhia zaub mov thiab qhia txoj hauv kev ntawm rub tawm cov ntawv zip.
- Tos tshwj tsis yog IDE tau txais cov lus: Lub tsev qiv ntawv ntxiv rau koj lub tsev qiv ntawv. Txheeb xyuas "suav nrog Lub Tsev Qiv Ntawv" cov ntawv qhia zaub mov.
- Nkag mus rau "suav nrog Lub Tsev Qiv Ntawv" los ntawm "Sketch" & kos rau "Ubidots MQTT rau ESP8266"
Kauj ruam 2: Ubidots API Cov Ntawv Pov Thawj
Nkag mus rau Ubidots thiab sau ntawv ceeb toom ntawm API Cov Ntawv Pov Thawj. Thov nco ntsoov tias peb tsuas xav tau tus nqi ntawm "Default Token".
Kauj Ruam 3: Txoj Cai.
#suav nrog "UbidotsESPMQTT.h"
#define TOKEN "********************************************** *** "// Koj Ubidots TOKEN
#define WIFINAME "*********" // Koj SSID
#define WIFIPASS "******************" // Koj Wifi Pass
Ubidots tus thov kev pab (TOKEN);
tsis muaj dab tsi hu rov qab (char* ntsiab lus, byte* them nyiaj, tsis tau kos npe ntev)
{
Serial.print ("Cov lus tuaj txog [");
Serial.print (ncauj lus);
Serial.print ("]");
rau (int kuv = 0; kuv <ntev; kuv ++)
{
Serial.print ((char) payload );
}
void teeb tsa ()
{
client.setDebug (muaj tseeb);
Serial.begin (115200);
client.wifiConnection (WIFINAME, WIFIPASS);
client.begin (hu rov qab);
}
void lub voj ()
{
yog (! client.connected ())
{
client.reconnect ();
}
ntab tus nqi 1 = analogRead (A0);
client.add ("kub", tus nqi 1);
client.ubidotsPublish ("kuv-tshiab-ntaus ntawv");
client.loop (); cov.
}
Nco tseg: Thov xa mus rau cov screenshots kom pom zoo dua ntawm kab.
Kauj Ruam 4: Txuas, Sau & Tso Cai.
Nws tsis yog lub sijhawm los txuas koj NodeMCU ESP8266 rau koj lub PC/Laptop, txheeb xyuas nws qhov chaw nres nkoj, suav sau thiab xa cov cai.
Thov ua qhov kev pab tsim nyog los ntawm cov ntawv txuas nrog kom nkag siab cov txheej txheem yog tias koj tshiab rau Arduino IDE.
Kauj Ruam 5: Kuaj Kawg.
Yog tias txhua yam mus tau zoo, koj yuav tsum muaj peev xwm soj ntsuam zoo ib yam uas tau sawv cev hauv lub screenshot.
Kab no hauv txoj cai "client.ubidotsPublish (" kuv-tshiab-ntaus ntawv ");" tau luam tawm.
Nco tseg: Yog tias tsis muaj dab tsi tau sawv cev hauv Ubodots dashboard, nws tau hais kom tshem tawm thiab txuas dua ntawm NodeMCU.
Khaws koj tus kheej mloog. Kuv sim tshaj tawm ob peb ntxiv nrog Ubidots & NodeMCU ESP8266.
Pom zoo:
Arduino Tsheb Rov Qab Chaw Nres Tsheb Ceeb Toom - Cov Kauj Ruam ntawm Kauj Ruam: 4 Kauj Ruam
Arduino Tsheb Rov Qab Chaw Nres Tsheb Ceeb Toom | Cov kauj ruam ib kauj ruam: Hauv txoj haujlwm no, kuv yuav tsim qhov yooj yim Arduino Tsheb Rov Qab Tsheb Nres Tsheb Nres Sensor Siv Arduino UNO thiab HC-SR04 Ultrasonic Sensor. Qhov no Arduino raws Lub Tsheb Rov Qab ceeb toom tuaj yeem siv rau Kev Tshawb Fawb Txog Tus Kheej, Robot Ranging thiab lwm yam
Tsev Automation Kauj Ruam ntawm Kauj Ruam Siv Wemos D1 Mini Nrog PCB Tsim: 4 Kauj Ruam
Tsev Automation Kauj Ruam Ib Leeg Siv Wemos D1 Mini Nrog PCB Tsim: Tsev Automation Kauj Ruam los ntawm Kauj Ruam siv Wemos D1 Mini nrog PCB Tsim cov tub ntxhais kawm ntawv qib siab. Tom qab ntawd ib tus ntawm peb cov tswv cuab tuaj
RC Taug Qab Neeg Hlau Siv Arduino - Kauj Ruam Ib kauj ruam: 3 Kauj Ruam
RC Tracked Robot Siv Arduino - Kauj Ruam Ib Nrab: Hav guys, Kuv rov qab los nrog lwm tus neeg hlau txias chassis los ntawm BangGood. Vam tias koj tau dhau los ntawm peb cov phiaj xwm yav dhau los - Spinel Crux V1 - Tus Cwj Pwm Tswj Tus Neeg Hlau, Spinel Crux L2 - Arduino Xaiv thiab Muab Neeg Hlau nrog Robotic caj npab thiab Badland Braw
Kawm Yuav Ua Li Cas Kos Tus Tswm Ciab - Kauj Ruam Ib Kauj Ruam: 6 Kauj Ruam
Kawm Yuav Ua Li Cas Thiaj Li Tswmciab - Kauj Ruam Ib kauj ruam: Cov tswm ciab no siv sijhawm 10 feeb los kos yog tias koj ua raws kuv cov kauj ruam ua tib zoo
DIY Arduino Robotic Arm, Kauj Ruam ntawm Kauj Ruam: 9 Kauj Ruam
DIY Arduino Robotic Arm, Kauj Ruam ntawm Kauj Ruam: Cov ntawv qhia no yog qhia koj yuav tsim lub Caj Npab Caj Npab ntawm koj tus kheej li cas