Showing posts with label MQTT on ESP8266. Show all posts
Showing posts with label MQTT on ESP8266. Show all posts

Sunday, November 6, 2016

Mqtt broker on ESP8266 #5

[Later edit]. On iotcentral.eu you will find instructions on how to install the ESP8266 MQTT broker on your EPS8266 and how to use the MQTT service provided by iotcentral.eu

I've accepted Anthony's challenge to squeeze more from the ESP8266 as MQTT broker so I managed to increase the maximum number of simultaneous subscribers on a single ESP8266. 

Now instead of 9 like I had before ( plus bridge to/from cloud and websockets to connect my mobile app to ESP8266 MQTT broker) I have 20 stable subscribers.

Top was 30 but the heap memory was too low to have flawless connections to all subscribers.

Also a good news is that this is not limiting the number of topics a device can subscribe to the broker ( in a reasonable number of 4 or 5 topics per device).

A picture with 25 connections and one with websocket.



ESP8266 as MQTTbroker 

At the beginning I have 35Kb and after 25+1+1 connections I am ending with 11 to 12 Kb of heap memory which is plenty even for bigger payloads.


Related links:
Mqtt broker on ESP8266 #4
Mqtt broker on ESP8266 #3
Mqtt broker on ESP8266 #2
Mqtt broker on ESP8266 #1







Friday, August 5, 2016

Mqtt broker on ESP8266 #4


[Later edit]. On iotcentral.eu you will find instructions on how to install the ESP8266 MQTT broker on your EPS8266 and how to use the MQTT service provided by iotcentral.eu


I have more progress in ESP8266 as MQTT broker.


What I have for now on this ESP8266 module:



  • MQTT broker functionality
  • Bridging data to/from and another MQTT broker ( usually a cloud MQTT instance)
  • websockets connectivity ( I can now connect with my Homy application directly to the ESP8266 acting as an MQTT broker)
  • OTA (Over The Air) updates. Every time I have a new software update the ESP8266 is updating itself so, I can say that I have continuous integration (CI) and continuous deployment(CD). Also all the modules are activated over the air.
With all those function in place I still have 34kb of heap available for other features and yes is running on an ESP with a minimum 1Mb of memory. ESP8285 is a good candidate for running the broker.

Is working also on and old ESP-01 with 512kb but without OTA functionality.

Previous posts on the same subject:


IoT with ESP8266: Mqtt broker on ESP8266 #1


Friday, April 22, 2016

Architecture of my Homy IoT platform

Since I received a lot of questions about the my IoT home control system, here is a description of it.

All the ESPs are sending  MQTT messages to an MQTT broker (I have an ESP8266 acting as a broker) inside the house. The MQTT broker is also bridging all the data to another MQTT broker instance that I have in a cloud.  From now there are two cases:

1. If I am in my WiFi coverage, my mobile app is connecting over the websokets to the MQTT broker and sees all the devices, control them etc.

2. If I am not in my Wifi coverage my mobile app is connecting to the cloud MQTT broker over websockets and sees all the devices, control them etc.

I've chosen to have connection between the mobile application and both MQTT brokers, instead to have one connection to the cloud broker, because if you are at home and your internet connection is down you can not control any device. Having a connection directly to your home MQTT broker is covering this scenario.

The mobile application first is connecting to the local MQTT broker and if is not succeed ( means you are not at home) it connecting to the cloud MQTT broker. This is done automatically and is transparent to the user.

As you can see no port forwarding, nothing to do in your router.

My IoT home control system

Thursday, April 21, 2016

Mqtt broker on ESP8266 #3

[Later edit]. On iotcentral.eu you will find instructions on how to install the ESP8266 MQTT broker on your EPS8266 and how to use the MQTT service provided by iotcentral.eu

Good news today !! In my previous post I've said that I'll add the noPoll for websockets, but I've decided that will be better to write my own websocket part. And it works !!! 


So, to recap what I have for now on this ESP8266 module:



  • MQTT broker functionality
  • Bridging data to/from and another MQTT broker ( usually a cloud MQTT instance)
  • websockets connectivity ( I can now connect with my Homy application directly to the ESP8266 acting as an MQTT broker)

To do list:

  • webconfig interface.  Done!

Previous posts:



Thursday, March 10, 2016

Mqtt broker on ESP8266 #2

[Later edit]. On iotcentral.eu you will find instructions on how to install the ESP8266 MQTT broker on your EPS8266 and how to use the MQTT service provided by iotcentral.eu 

 Working on MQTT broker on ESP8266 has reached the first milestone. Until now functionality  includes MQTT broker and bridging to another instance of MQTT broker cloudmqtt.com or mosquitto. It should work also on AWS IoT but I didn't tested yet.


After more then one million of seconds uptime and hundreds of thousands of transported messages I can declare it in 1.0 version.


Next to implement:


  • websocket server using the noPoll   my own library (work in progress  Done )
  • web interface configuration