ESP8266 & Public "Free" MQTT Broker HiveMQ & Node-RED

by Jhon_Control in Circuits > Electronics

31422 Views, 45 Favorites, 0 Comments

ESP8266 & Public "Free" MQTT Broker HiveMQ & Node-RED

esp8266_MQTT_Hivemq_instrubtable.jpg

The MQTT protocol has taken great strength in recent years since it is simple, safe, practical and lightweight perfect for IoT and M2M applications.

Thanks to the contribution of developers and developers of MQTT applications, there are public MQTT Broker for Internet monitoring and control tests, are available to connect from any MQTT client in this case we will use HIVEMQ, which has dashboard to view MQTT connections and Web sockets, since it is public should have some considerations that we will see below.

Oficial Website: HiveMQ
Dashboard MQTT: HiveMQ

Connections Broker MQTT

  • Broker: broker.hivemq.com
  • TCP Port: 1883
  • Websocket Port: 8000

Test

Then we will do 2 tests:

  1. Connection Broker MQTT HIVEMQ with Node-RED.
  2. Connection Broker MQTT HIVEMQ with ESP8266 & Node-RED.

Complete tutorial and downloads

For more info, please visit: http://pdacontrolen.com/esp8266-public-mqtt-broke...

Para mas información visita: http://pdacontroles.com/esp8266-broker-publico-mq...

Install Node-RED

Simple installation Node-RED IoT Platform connections: PDAControl

​Some of the Components Required for Building & Testing

ESP8266_Onewire.jpg
MQTT_HiveMQ.JPG
DS18B20 modif.JPG

Some of the components required for building & testing:

  • 3 Resistor 10k

Test 1: Connection Broker MQTT HIVEMQ With Node-RED

Public MQTT Broker HiveMQ & Node-RED : PDAControl
Node_RED_Broker.JPG
Node_RED01.JPG

Using Node-RED previously installed on a local server in my network, we will make the MQTT connection with HIVEMQ to validate the connection from any MQTT client.

Architecture

Mqtt_HIVE.png

Sensor Connections

The ESP8266 module is configured as an MQTT client and performs the periodic temperature reading of the DS18B20 sensor, connected to the D4 pin (Gpio 02), supply to 5v, with its respective recommended resistance in the maxim datasheet.

Requires libraries:

  • PubSubClient.h
  • OneWire.h
  • DallasTemperature.h

Test 2: Connection Broker MQTT HIVEMQ With ESP8266 & Node-RED

Public MQTT Broker HiveMQ & ESP8266 DS18B20  (Onewire) + Node-RED : PDAControl

In this case the module ESP8266 12E NodeMCU configured as client MQTT read a temperature sensor DS18B20 Protocol (Onewire) sends the temperature via MQTT to the Broker HIVEMQ and Node-RED installed in the local network requests the value of temperature and graph On Node-RED Dashboard.

MQTT Topic
"temperature/PDAControl/sensor"

Message

Temperature value examples "28.9"

Conclusions and More Info

HIVEMQ_MQTT_ESP8266.jpg
esp8266_ds18b20.jpg

We consider that although technically the broker is public we do not realize applications that are constantly connected to this broker, and since it is free public HIVE has several legal aspects that must be taken into account.

We only perform fast tests, although it should be noted that they have mounted their IoT applications with this broker without any apparent inconvenience the service is active and public.

With a broker in the cloud (intenet) from anywhere we could connect our devices and applications without limits of IP addresses and other restrictions, currently research plans and services of MQTT servers.

In next tutorials we will try other public MQTT servers and interactions with FRED (Node-RED).

Other publics Broker's

Complete tutorial and downloads

Website pdacontrolen.com