Tuesday, February 2, 2016

Mqtt broker on ESP8266 #1

[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

First tries on Esp8266 with MQTT broker.

I was able to send and receive up to 1000 messages in few seconds before the heap run out.

Next to do is to optimize the memory usage, use a memory pool allocator, do some profiling to determin the optimum values for memory chunks....a lot of work to do.

Then do the bridging  (bridgind is done and is working fine)  and websockets, if there is any memory left.

And a video with 1000 messages sent from and to my phone using ESP as broker. Don't forget that there are very small messages.


  1. Hi,
    I just found your ESP blog, and really like it. I was looking for an MQTT broker for a while, but not found for ESP8266 only for RaspberryPi. Today I am using Thingspeak to communicate between two IoT devices at home (humidity monitor + fan switch), but it is a little bit overkill to switch the fan via internet ...
    Do you have any "alpha" release for your code? I would also test it and give feed-back. I have never used MQTT so far, but the concept looks very interesting.

  2. Hi, I am still tuning the LwIp and the FreeRTOS to gain more heap memory, so the code is changing every day. I can give you some binary file to try, so just flash them into your ESP .

    1. Thank you! It would be fine. If I get the binary, not source, how to config the Wifi credentials?

  3. Give me an email, I'll explain you over there.

    1. Can you send me the binary file? I'm in the same boat of Tóth András. I need a mqtt broker on esp8266, cause, this is the only circuit board that i have in my project. I'm expanding the i/o ports with a MCP23017, so, i don't want use a Rasp or something like this to be the mqtt broker.

      If you can say something about the bibliography or where can i study about this, i'll be grateful to you.

      Sorry about my english.

      Best regards,

      J Moura.

  4. Looks awesome! if you need any testing help let me know

  5. Dear Catalin,
    Your blog is really good. I would say outstanding work. I have been looking out for something like this where I can run small broker on micro controller. Running MQTT broker on raspi and other SBC can create lot of maintenance issues and hence I thought if we can use some micro. Do you have any sample code for running MQTT broker on micro. Appreciate any inputs on this from your end.

  6. It would be og great value, to See this Code on github as Open source. One would not have to implementiert things twice, also more people could bringen this Forward.

    I would love to add some classes doing magical stuff noone actually could imagine this would be possible...

  7. I love the idea of running a broker on an esp8266. I don't have a lot of money to buy abother RasPi to run mosquitto for what will only be a few dozen messages per minute at Most. This is exactly what I am looking for! Do you have any published files or code that is available to the public?

  8. Thanks for all your hard work on a MQTT broker on esp8266.
    I too have been looking for a MQTT broker for esp8266. I want to build a timer that publishes 1 or 0 (on or off) to the clients to turn on and off remote loads (lights). I don't think I need a large stack to do this. Can you flush out previous messages and responses to keep memory space down?
    Where can I find your esp8266 code?


  9. This comment has been removed by the author.

  10. Go to iotcentral.eu for public version.