ESP8266 + Arduino Uno + Eclipse Ponte HTTP Bridge = MQTT Magic

Esp8266 Arduino Uno

In my last two posts I covered how I setup the Eclipse Ponte Bridge locally and how my Arduino Yun was reading a MQTT topic from the Ponte Bridge using HTTPClient. In this post I will cover how I used an ESP8266 with Arduino Uno to publish a MQTT message with RGB values.

Esp8266 Arduino Uno
Esp8266 Arduino Uno

ESP8266 + Arduino Uno

I ordered the ESP8266 during this road test because my initial plans of using an Arduino Uno with a CC3200 Simple Link Launchpad didn’t work out very well. For $7 it provides bang for the buck as long as you tolerate the initial getting to know you phase. Most of the frustration is because of the different versions and the lack of official documentation.

That though seem to be improving of late as the firmware seem to have stabilized somewhat and updated SDK seem to have been released this month. I was lucky in that the ESP8266 I got already had the latest firmware and i had the version v0.91 board.  I didn’t have to update the firmware. The following is the pin definition of my ESP8266:

ESP8266 V091 Pinout
ESP8266 V091 Pinout

Initially I tried to use the UNO as a FTDI driver by connecting the ESP8266 to Uno with level shifters. But that didn’t work. No response at all from the ESP8266. Then I bought a FTDI breakout board with a 3.3v output and i was able to talk to ESP8266 using CoolTerm. Except for the Arduino, i am using all these different tools for the first time. That added to frustration levels sometimes. But it was well worth it as it helped me learn so many new things.

Once I become comfortable with the AT commands, I hooked the ESP8266 back to Arduino Uno using level shifters.

Again nothing from Uno.

One of the major misconceptions out there seem to be around using level shifters. Every one (including much respected AdaFruit) keeps saying you need to use level shifter to connect the RX pin of the ESP8266 to Uno’s TX pin since Uno operates at 5V. But the data sheet i found here says this in page 15.

All digital IO pins are protected from over-voltage with a snap-back circuit connected between the pad and ground. The snap back voltage is typically about 6V, and the holding voltage is 5.8V. This provides protection from over-voltages and ESD. The output devices are also protected from reversed voltages with diodes.

I am not an electrical or electronics engineer. But that statement seemed to me that it might be OK to connect the ESP8266 directly to my Uno. So i just did that and it worked.

  1. Arduino 3.3v power to bread board red power rail
  2. Arduino Ground to bread board ground (black rail)
  3. ESP8266 Ground to bread board ground (black rail)
  4. ESP8266 CH_PD to bread board red power rail ( This is the reset pin. I was not brave enough to connect it to Uno’s reset pin. So every time i loaded my sketch, i had to pull this out and push it back in. A veritable stress test i would say.)
  5. ESP8266 TX to Arduino Uno Digital Pin# 2 ( i will be using software serial library to designate this pin as RX for arduino)
  6. ESP8266 RX to Arduino Uno Digital Pin#3 ( designated as TX pin using software serial library)
  7. ESP8266 Vcc to bread board power rail

That’s all. I have been using this setup for a few days now. It has gone through couple of power surges (too much bad weather with lightning here) and still working.


I have already set up Ponte MQTT/HTTP/Coap Bridge locally. ESP8266 has a TCP stack that can be accessed via AT commands. So all i had to do is prepare the proper AT commands for the ESP8266 and make it send PUT requests to the Ponte HTTP bridge for publishing MQTT topics. Other clients irrespective of whether they use MQTT libraries or HttpClient GET were able to receive the messages.

Since I started working on the AT commands I ended up creating a helper library to do HTTP GET and POST as well.  The ESP8266RESTHelper library is available at Github. The helper library has 2 overloaded begin() methods: begin(String WifiNetworkNameSSID, String WifiPassword) to pass in WiFi credentials and begin() to use the wifi credentials already set with AT commands. If you are interested, take a look and use it as you see fit. Please note apart from the sendMQTTMessage other functionalities are not fully tested. But it might give you a starting point.

Here is the sketch that’s running on my Arduino Uno. Visit the Github library to see the API and the AT command sequence.

#include <SoftwareSerial.h>
#include "ESP8266RESTHelper.h"
ESP8266RESTHelper esp8266=ESP8266RESTHelper();
void setup() {
void loop() {
  //Send Red -- topic name starts with "/resources/" because the Ponte http bridge expects PUTS to be sent that way. The actual topic for clients is just "FromArduinoUnoESP/RGB"
]  //send Green
  //Send blue

Here is a video of the Arduino Uno with ESP8266 sending MQTT messages and the Arduino Yun receiving the mqtt messages through HTTPClient and changing the led strip using Infineon RGB Shield (note that blue led on the ESP8266 go on and off when TCP send happens)

  1. Software Serial Library:I am using Arduino Ide version 1.5.8 beta. This includes a SoftwareSerial Library as part of the core ide libraries. You can get the latest IDE from here.Arduino – SoftwareIf you need the Github location for the core libraries, its here:
  2. My ESPRESTHelper library is using String object. I have come to realize String is not the ideal thing to use. I am running into weird memory issues once the code becomes bigger and the dynamic memory becomes full. It is ok for simple proof of concepts. I will update the library soon to remove Strings from it.

3 thoughts on “ESP8266 + Arduino Uno + Eclipse Ponte HTTP Bridge = MQTT Magic”

Leave a Reply

Your email address will not be published. Required fields are marked *