MQTT network with ESP8266

It’s possible to generate a network of ESP8266 and ESP32 using the MQTT protocol without using a RaspberryPI such as a broker.

On a ESP8266 is installed a micro broker called uMQTT-broker:https://github.com/martin-ger/esp_wifi_repeater/tree/uMQTT_broker

UPDATE=> A new version has been developed https://github.com/martin-ger/esp_mqtt with a dedicated Git.

This node could be considered the Master or the Server and it’s called Broker in the MQTT protocol.
The Server node is a Access Point (AP) with address 192.168.4.1 but also it is able to connect to a local Wifi network as a Station (STA).
The Server node shares together the MQTT messagges coming from the 2 networks.

The precompiled binaries are available at:
https://github.com/martin-ger/esp_wifi_repeater/tree/uMQTT_broker/firmware
They can be flashed with:
esptool.py --port /dev/ttyUSB0 write_flash -fs 32m 0x00000 0x00000.bin 0x10000 0x10000.bin
For ESP-01:
esptool.py --port /dev/ttyUSB0 write_flash -fs 8m 0x00000 0x00000.bin 0x10000 0x10000.bin

The Server node could be configurated by the UART console or a telnet connection:
nc 192.168.4.1 7777
or using the local wifi network:
nc 192.168.xxx.yyy 7777

When the connection is started sending “help” is possible to see all the commands to log or set the server.
More details are available at:
https://github.com/martin-ger/esp_wifi_repeater/blob/master/README.md#usage

A MQTT client for ESP8266 is:
https://github.com/256dpi/arduino-mqtt
The MQTT library for Arduino IDE is based on the Eclipse Paho projects

Another MQTT client for ESP8266 is:
https://github.com/knolleary/pubsubclient
http://pubsubclient.knolleary.net/
The MQTT clients uses the MQTT V3.1.1

To test the MQTT broker on the PC I suggest MQTT-Spy GUI:
https://github.com/eclipse/paho.mqtt-spy/wiki

A more complex system could be built using a RaspberryPI (RPI) where is installed the Monsquitto MQTT broker:
https://github.com/mqtt/mqtt.github.io/wiki
Some instruction how to install Monsquitto on RPI:
https://oshlab.com/install-mqtt-mosquitto-raspberry-pi/
Node-Red could run inside the RPI
Node-Red manages the MQTT messagges and generate actions between the IoT objects (RPI, ESP8266s. ESP32s, Arduinos, Telegram Bots..):
https://nodered.org/
http://noderedguide.com/tag/mqtt/

There is MQTT broker for Node-Red:
https://flows.nodered.org/node/node-red-contrib-mqtt-broker

Annunci

Rispondi

Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione / Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione / Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione / Modifica )

Google+ photo

Stai commentando usando il tuo account Google+. Chiudi sessione / Modifica )

Connessione a %s...