Tutorial ESP8266 and Node-RED MQTT GPIO (Mosquitto) # 1

To integrate the module ESP8266 with node-red IoT platform has been used MQTT protocol, there are client libraries for esp8266 as MQTT in this case I decided to use the library pubsubclient.

This example will receive Node Red that receives data from the ESP8266 and allow control a LED connected to GPIO 02 from a dashboard created in Node Red Dashboard .

 Test Led ESP8266 MQTT Mosquitto Node Red  IoT # 1

Arduino IDE add the pubsubclient library using the search engine libraries or manually by downloading the library and storing it in their respective folder for libraries.

Note: To successfully complete this tutorial you must perform the following tutorials.

Previous tutorials Recommended

icstation.com
Tutorial 1 : Install Lubuntu (Ubuntu)
Tutorial 2 : Installation node red platform
Tutorial 3: Installation Node Red Dashboard
Tutorial 4: Installation Modbus TCP IP in Node Red
Tutorial 5: Installation of Mosquitto Broker MQTT in Lubuntu
Tutorial 6: Program ESP8266 con Arduino IDE





Arduino IDE code

Arduino IDE code performs several steps but definire major, Broker connection with MQTT, function post (send messages) even specific topic and subscribe function (receive messages) even specific topic.
Note: At the bottom of the post code Full IDE arduino

1 .Parameters Network 

Set parameters network  PASSWORD  and SSID is required to have previously installed a MQTT Broker server which performs the function server broker, in this case I use Mosquitto MQTT.

2. Function publish (“topic” message)

3. subscribe Function (“topic”)

the subscribe function makes a call to the callback function for data reception

4. callback function

This function enter 3 personal parameters of the library pubsubclient.h topic, payload (load) and size, performs printing  of the topic and the message, to turn on the LED diode sweeps payload in a specific position to determine the state 1 or 0.

 

Node-RED

1 Node client receiving messages MQTT (subscribe) from ESP8266 through the topic “event” node debugging and debug.
2 Building 2 button “On” “Off” for sending node values MQTT (publish) to ESP8266 topic “event
3 Node text text output to display status LED diode.
Note: At the bottom of the post code on Github Import Nodes

Design Node Red Dashboard 

Organization Tabbed Widgets and Groups

Visualization Node red Dashboard 

 

                                            Configure Led ESP8266 MQTT Mosquitto Node Red  IoT # 2

Conections ESP8266

VIDEO : Programming ESP8266 with Arduino IDE

Where to buy?

icstation.com 
ESP8266 01 (ESP 01)





 Downloads:

References

icstation.com
Tutorial 1 : Install Lubuntu (Ubuntu)
Tutorial 2 : Installation node red platform
Tutorial 3: Installation Node Red Dashboard
Tutorial 4: Installation Modbus TCP IP in Node Red
Tutorial 5: Installation of Mosquitto Broker MQTT in Lubuntu
Tutorial 6: Program ESP8266 con Arduino IDE

arduino controlled digital camera via modbus

node-red-dashboard
Nodered.org
github.com/node-red
Nodejs.org

Youtube Channel:

PDAControl

 

You may also like...

Leave a Reply