Cov txheej txheem:
- Kauj Ruam 1: Ntxiv Cov Tsev Qiv Ntawv rau Esp8266
- Kauj Ruam 2: Nruab MQTT Sever thiab Client ntawm Raspberry Pi
- Kauj ruam 3: Khiav Python Script
Video: RaspberryPi thiab NodeMCU (esp8266) -MQTT: 3 Cov Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:28
Peb tab tom teeb tsa MQTT server thiab cov neeg siv khoom ntawm Raspberry Pi siv Mosquitto thiab paho-mqtt tsev qiv ntawv. Peb yuav nyeem lub pob thiab yog nws raug nias peb yuav Toggle LED ntawm Arduino sab.
Whereas, ntawm Arduino peb yuav siv Adafruit MQTT lub tsev qiv ntawv. Peb yuav siv lub ntsuas zoo li LDR (Koj tuaj yeem siv lwm lub ntsuas), nyeem nws thiab tshaj tawm sai li sai tau thaum nws hloov pauv rau Raspberry Pi.
Peb xav tau:
Raspberry Pi
NodeMCU
Kauj Ruam 1: Ntxiv Cov Tsev Qiv Ntawv rau Esp8266
Mus rau "Tswj Cov Tsev Qiv Ntawv …" siv koj li Arduino IDE thiab tshawb rau "MQTT" los ntawm Adafruit.
Tom qab ua tiav kev teeb tsa, Ntxiv "MQTT_NodeMCU.ino" los ntawm qhov txuas hauv qab no:
Arduino Txoj Cai
Ua cov kev hloov hauv qab no los ntawm kev hloov wifi ssid, password thiab RPi IP Address.
#define WLAN_SSID " #397" #define WLAN_PASS "farmhouse397" #define MQTT_SERVER "192.168.0.108" #define "led_pin" #define "sensor_input"
Upload cov duab kos thiab qhib Serial Monitor ntawm 115200
Kauj Ruam 2: Nruab MQTT Sever thiab Client ntawm Raspberry Pi
Ua ntej, Nruab Mosquitto server siv:
sudo apt-tau nruab mosquitto
Nruab Mosquitto Client siv:
sudo apt-tau nruab mosquitto-cov neeg siv khoom
Koj tuaj yeem lees paub Kev Txhim Kho siv:
systemctl xwm txheej mosquitto.service
Tam sim no, peb yuav teeb tsa paho-MQTT siv:
sudo apt-tau nruab python python-pipsudo pip nruab RPi. GPIO paho-mqtt
Siv cov lus txib no tshaj tawm -messages los ntawm raspberry pi (-hostname) rau esp8266-leds (-topic).
mosquitto_pub -h raspberrypi -t "/leds/esp8266" -m "ON"
mosquitto_pub -h raspberrypi -t "/leds/esp8266" -m "OFF"
-h ==> host name ==> raspberrypi (tshwj tsis yog koj tau hloov nws)
-t ==> ntsiab lus
-m ==> lus
Kauj ruam 3: Khiav Python Script
Koj tuaj yeem rub tawm MQTT_Pi los ntawm
github.com/anuragvermaa/MQTT_NodeMCU
Yog tias txhua yam zoo, koj yuav tsum tuaj yeem pom cov ntaub ntawv sensor hauv lub davhlau ya nyob twg.
Nias Ctrl+C kom tawm mus.
Pom zoo:
Yuav Ua Li Cas Vaum Thiab Kub Tiag Tiag Cov Ntaub Ntawv Teev Npe Nrog Arduino UNO thiab SD-Card - DHT11 Cov ntaub ntawv-logger Simulation hauv Proteus: 5 Cov Kauj Ruam
Yuav Ua Li Cas Vaum Thiab Kub Tiag Tiag Cov Ntaub Ntawv Teev Npe Nrog Arduino UNO thiab SD-Card | DHT11 Cov ntaub ntawv-logger Simulation hauv Proteus: Taw qhia: nyob zoo, qhov no yog Liono Maker, ntawm no yog YouTube txuas. Peb tab tom tsim txoj haujlwm muaj tswv yim nrog Arduino thiab ua haujlwm ntawm cov kab ke. Cov ntaub ntawv-Logger: Cov ntaub ntawv logger (tseem cov ntaub ntawv-logger lossis cov ntaub ntawv kaw) yog cov cuab yeej siv hluav taws xob uas sau cov ntaub ntawv dhau sijhawm
Yuav Tsim Li Cas thiab Ntxig Ib Lub Rooj Thiab Ntxiv Kab Ntxiv Thiab/lossis Kab Rau Cov Lus Hauv Microsoft Office Word 2007: 11 Cov Kauj Ruam
Yuav Tsim Li Cas thiab Ntxig Cov Lus Thiab Ntxiv Kab Ntxiv Thiab/lossis Kab Rau Cov Lus Hauv Microsoft Office Word 2007: Koj puas tau muaj cov ntaub ntawv ntau uas koj ua haujlwm nrog thiab xav rau koj tus kheej … " Kuv yuav ua li cas ntawm cov ntaub ntawv no saib zoo dua thiab nkag siab yooj yim dua? " Yog tias yog, tom qab ntawd lub rooj hauv Microsoft Office Word 2007 yuav yog koj cov lus teb
Nkag Mus Cov Ntaub Ntawv thiab Npaj Cov Duab Online Siv NodeMCU, MySQL, PHP thiab Chartjs.org: 4 Cov Kauj Ruam
Nkag Mus Cov Ntaub Ntawv thiab Npaj Cov Duab Online Siv NodeMCU, MySQL, PHP thiab Chartjs.org: Cov lus qhia no piav qhia yuav ua li cas peb tuaj yeem siv Node MCU pawg thawj coj los sau cov ntaub ntawv los ntawm ntau lub ntsuas, xa cov ntaub ntawv no mus rau tus tswv PHP cov ntaub ntawv uas tom qab ntawd ntxiv cov ntaub ntawv rau MySQL database. Cov ntaub ntawv tuaj yeem pom online hauv kab ntawv, siv chart.js.A ba
Cov Cuab Yeej Siv Hluav Taws Xob thiab Cov Cuam Tshuam Xov: Ua LED Zaub thiab Npuag Hluav Taws Xob uas Rolls Up: 7 Cov Kauj Ruam (nrog Duab)
Cov Cuab Yeej Siv Hluav Taws Xob thiab Cov Cuam Tshuam: Ua kom pom LED thiab Cov Khoom Siv Hluav Taws Xob uas Rolls Up: Ua rau koj tus kheej cov ntaub ua hluav taws xob, xov, kua nplaum, thiab kab xev, thiab siv lawv los ua lub zog ntsuas hluav taws xob, tiv thaiv, hloov pauv, LED cov lus qhia thiab siv hluav taws xob. thiab cov xov hluav taws xob koj tuaj yeem ua cov lus qhia LED thiab cov kab hluav taws xob ntawm ib qho ntaub uas hloov pauv tau
Kaw Cov Suab rau Yeeb Yaj Kiab thiab Animations: Ob peb Cov Lus Qhia Ceev thiab Cov Lus Qhia: 8 Kauj Ruam
Kaw Cov Suab rau Yeeb Yaj Kiab thiab Animations: Ob peb Cov Lus Qhia Ceev thiab Ua Ntej: Yog tias koj yog tus kws kos duab, lossis tsuas yog menyuam yaus uas nyiam ua qee zaum ua cov yeeb yaj kiab rau youtube, tej zaum koj yuav muaj ob peb qhov teeb meem nrog kaw lub suab. Tsis muaj teeb meem li cas visually zoo cov vis dis aus lossis cov animation yuav yog, yog tias cov neeg saib nws tuaj yeem