Cov txheej txheem:
- Kauj Ruam 1: Cov khoom siv
- Kauj ruam 2: Kev thaiv kab
- Kauj ruam 3: Code
- Kauj ruam 4: MQTT Chaw
- Kauj Ruam 5: Tshaj tawm thiab Sau Npe
Video: MQTT Raws li MicroPython ESP32: 5 Cov Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:25
Kuv nyiam khaws cov miv miv. Tom qab ib hnub ntawm kev ua haujlwm hnyav, miv tuaj yeem so kuv thaum kuv mus txog tsev. Tom qab kev qhia nyuaj, tus miv no muaj tus cwj pwm zoo ntawm kev noj zaub mov tsis tu ncua hauv "tsev noj mov" txhua hnub. Tab sis tsis ntev los no kuv yuav tsum tau mus ob peb hnub thiab tsis muaj leej twg saib xyuas miv hauv tsev, yog li kuv xav siv MQTT rau kev tswj chaw taws teeb pub mis. Yog tias miv tau noj, qhov no tuaj yeem ua rau kuv nco thiab cia kuv tso siab rau
MQTT
MQTT yog tus neeg siv khoom-server raws cov lus tshaj tawm / sau npe yuav hloov pauv raws tu qauv. MQTT raws tu qauv yog qhov hnyav, yooj yim, qhib, thiab yooj yim rau siv, thiab cov yam ntxwv no ua rau nws siv tau dav.
Tshaj tawm thiab sau npe yuav
MQTT raws tu qauv txhais ob hom kev sib koom hauv lub network: tus tshaj tawm xov xwm thiab qee tus neeg siv khoom. Tus neeg sawv cev yog tus neeg rau zaub mov uas tau txais tag nrho cov lus los ntawm tus neeg siv khoom thiab tom qab ntawd xa cov lus no mus rau cov neeg siv khoom sib xws. Tus neeg siv khoom yog txhua yam uas tuaj yeem cuam tshuam nrog tus neeg sawv cev xa thiab tau txais cov lus. Tus neeg siv khoom tuaj yeem yog tus nyob ntawm qhov chaw IoT sensor lossis daim ntawv thov uas ua cov txheej txheem IoT hauv cov ntaub ntawv chaw.
Kauj Ruam 1: Cov khoom siv
Kho vajtse:
MakePython ESP32 Cov
MakePython ESP32 yog ESP32 pawg thawj coj nrog kev sib xyaw SSD1306 OLED zaub.
servo tsav
HC-SR04
Software:
uPyCraft IDE
Nyem rub tawm uPyCraft IDE rau Windows
Kauj ruam 2: Kev thaiv kab
MakePython ESP32 - Servo
- 3V3 - VCC (kab liab)
- GND - GND (kab xim av)
- IO14 - Teeb liab (kab kab kab)
MakePython ESP32-HC-SR04
- 3V3 - VCC
- IO13 - Tus lej
- IO12 - Echo
- GND - NCO
Kauj ruam 3: Code
Rub tawm thiab khiav cov cai tau muab ntawm no.
Ua cov kev hloov hauv qab no rau cov ntaub ntawv main.py, tom qab ntawd txuag thiab khiav.
Hloov kho SSID thiab PSW txhawm rau txuas WiFi
SSID = 'Makerfabs' #REPLACE_WITH_YOUR_SSID
PSW = '20160704' #REPLACE_WITH_YOUR_PASSWORD
Hloov kho tus IP ntawm koj tus broker MQTT thiab txiav txim siab cov ncauj lus rau kev tshaj tawm thiab kev tso npe
mqtt_server = '39.106.151.85 '#REPLACE_WITH_YOUR_MQTT_BROKER_IP
topic_sub = b'feed 'topic_pub = b'state'
Txuas thiab sau npe yuav cov ncauj lus
def txuas_and_subscribe ():
global client_id, mqtt_server, topic_sub client = MQTTClient (client_id, mqtt_server) client.set_callback (sub_cb) client.connect () client.subscribe (topic_sub) print ('Txuas rau %s MQTT broker, subscribed rau %s topic' %(mqtt_s, topic_sub)) rov qab cov neeg siv khoom
tshaj tawm cov lus
client = txuas_and_subscribe ()
client.publish (topic_pub, msg)
Kauj ruam 4: MQTT Chaw
Koj tuaj yeem rub tawm thiab teeb tsa MQTT tus neeg siv khoom ntawm no, tso cai rau koj los tswj chaw taws teeb ntawm koj lub xov tooj ntawm tes lossis khoos phis tawj.
- Qhib thiab nyem rau Tsim MQTT Client
- Lub npe input pub
- Cov txheej txheem xaiv mqtt / tcp
- Tswv yim tswv yim: 39.106.151.85:1883
- Nyem tseg
Kauj Ruam 5: Tshaj tawm thiab Sau Npe
Tom qab txuas, cov ncauj lus los tshaj tawm cov tswv yim: pub. Cov nyiaj them poob haujlwm: nyob rau, thiab tom qab ntawd nyem tshaj tawm
Lub cav servo tig thiab pib pub mis.
Cov ncauj lus kom sau npe nkag lub xeev, thiab tom qab ntawd nyem rau npe
Thaum tus miv nyob ze tus neeg pub zaub mov noj, cov npe teev npe tau txais: miv tau noj …, miv tau txais tom qab tawm mus: Tus miv tawm mus.
Txawm hais tias koj tso tus miv tom tsev, koj tsis tas yuav txhawj xeeb tias nws tshaib plab.
Pom zoo:
Arduino Raws li ISP -- Hlawv Hex Cov Ntaub Ntawv hauv AVR -- Fuse hauv AVR -- Arduino Raws li Programmer: 10 Kauj Ruam
Arduino Raws li ISP || Hlawv Hex Cov Ntaub Ntawv hauv AVR || Fuse hauv AVR || Arduino As Programmer: ……………………… Please SUBSCRIBE To my YouTube channel for more videos …….. Kab lus no yog txhua yam hais txog arduino li isp. Yog tias koj xav xa cov ntawv hex lossis yog tias koj xav teeb tsa koj lub fuse hauv AVR ces koj tsis tas yuav yuav tus programmer, koj tuaj yeem ua
Lora Gateway Raws Li MicroPython ESP32: 10 Cov Kauj Ruam (nrog Duab)
Lora Gateway Raws li MicroPython ESP32: Lora tau nrov heev nyob rau xyoo tas los no. Kev sib txuas lus wireless siv cov thev naus laus zis no feem ntau pheej yig (siv dawb spectrum), qhov loj me me, kev siv hluav taws xob zoo thiab muaj kev sib txuas lus ntev, thiab feem ntau yog siv rau kev sib txuas lus
Huab Cua Raws Li Lub Tshuab Hluav Taws Xob (ESP8266 Raws Li Midi Generator): 4 Cov Kauj Ruam (nrog Duab)
Huab Cua Raws Li Lub Tshuab Hluav Taws Xob (ESP8266 Raws Li Midi Generator): Nyob zoo, hnub no kuv yuav piav qhia yuav ua li cas thiaj ua rau koj tus kheej me ntsis Huab cua raws li lub tshuab hluav taws xob. thiab lub teeb pom kev zoo.Tsis txhob cia siab tias nws yuav ua txhua zaj nkauj lossis chord progr
Kev Nkag Mus Rau Cov Hauv Paus Cov Hauv Paus Cov Ntaub Ntawv Siv DB410 Raws Li Ethernet Dongle: 6 Cov Kauj Ruam
Kev Nkag Mus Rau Cov Hauv Paus Cov Hauv Paus Cov Ntaub Ntawv Siv DB410 Raws Li Ethernet Dongle: Lub Hom Phiaj: Txhim kho cov cuab yeej cuab tam thiab rov ua dua cov ntsiav kom ntxig USB Ethernet CDC Gadget txhawb nqa; Rov tsim boot.img los ntawm Linaro rau khau raj USB Ethernet CDC; Tsim NFS server los tuav lub hauv paus cov ntaub ntawv system; IP teeb tsa hauv DEVICE thiab HOST
DIY Ntse Ua Raws Kuv Drone Nrog Lub Koob Yees Duab (Arduino Raws): 22 Cov Kauj Ruam (nrog Duab)
DIY Ntse Ua Raws Kuv Drone Nrog Lub Koob Yees Duab (Arduino Raws): Drones yog cov khoom ua si nrov heev thiab cov cuab yeej niaj hnub no. Koj tuaj yeem pom cov kws tshaj lij thiab txawm tias pib ua haujlwm drones thiab cov khoom siv ya hauv khw. Kuv muaj plaub lub drones (quadcopters thiab hexcopters), vim tias kuv nyiam txhua yam uas ya, tab sis lub davhlau 200th tsis yog