An ESP8266 for Arduino Game Changer?

Arduino(updated 2/4/2015)

Here we go again – just as you thought it was safe to start coding, another game-changer comes along.

This time not only do we have an Arduino IDE for the ESP8266 (which isn’t a stunningly good IDE but it’s awfully familiar to many developers) but also what looks like Arduino library integration.

Do you remember way back in the distance when programming life was simple?

void setup() {
  // initialize digital pin 13 as an output.
  pinMode(13, OUTPUT);

void loop() {
  digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
            // wait for a second
  digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW

Yes, that long ago.. well that was when programming Arduinos was a doodle, before we discovered the ESP8266-type boards and the unbelievably cryptic commands for port control.

Could all of that be about to change? I just STUMBLED on an article about programming the ES8266 in an Arduino environment. At first this sounded like a backward step, after all the IDE isn’t a patch on the Eclipse environment (IMHO). Anyway I thought I’d investigate. They’ve recently released a new version of the Arduino IDE so I downloaded that and started to investigate. I then found this link

It seems there are a small number of people involved in the development of this – Sandeem Minstry and ivan Grokhotkov – I hope I’ve not missed any names out – but I have to say WELL DONE CHAPS!!!.

In the link above there it seems some had some issues with installation or maybe wanted to use this new tool with their existing Arduino, so a fellow called Roger Clark made a variation – check out his link in the link above. I downloaded the rather large zip file – took out the folder within – and dumped it in the ARDUINO/HARDWARE folder in MY DOCUMENTS.  I restarted the Arduino IDE and went to change the programmer and the device and…

My God it’s Full of Stars

Yup, that worked. I took the standard blink sketch and changed the reference from pin 13 to pin 0 as I was about to test this on an ESP-01.

I can’t tell you how nervous I got as it came to pressing the compile button. I did – and it compiled in about 1 second flat. I put my programming link in, reset the board and…. VOILA – a working BLINK sketch.

But there is FAR MORE to it than this – APPARENTLY it will run the standard Arduino WIFI library – now I CANNOT confirm that as I’ve lost the example code – but if that works – then our struggles with making setup pages are over. And if the MQTT library for Arduino works – well – the SKY is the limit.  I’ve already tried analogWrite(0,128) and that doesn’t work so the NEXT thing is to find some documentation to discover what works and what does not. DELAY() works – at least, it works without setting off the watchdog timer – so those who like LOOPS with DELAYS might be in luck!! No guarantees whatsoever because if you are reading this for the first time, I am only one step ahead of you.

The power, memory and WIFI capacity of the ESP8266 with the vast collection of libraries for the Arduino…  I can tell you… I’m shaking already.

Please do come back with your experiences on this – let’s find out just what we can and what we cannot do with this great new opportunity.

First stop – LCD libraries – I have a GREAT little LCD 240*160 colour display I use for everything but there was no way to convert the library over to ESP8266 – is it even remotely possible I can get this to work in this new environment? The WIFI library works and apparently MQTT works along with simple web page serving – check this out –

Ok so here’s the original link… and instructions as to what works and what doesn’t. They’ve no cracked analogWrite yet but  serial DHT11, onewire, SPI, i2c master… the list goes on.

This just gets better… and better….


33 thoughts on “An ESP8266 for Arduino Game Changer?

    1. There’s a modified version of that library. If you’re using the latest Arduino environment and have pulled in the ESP stuff via the link you should have all the tools and examples – seems to work a treat but I’ve not long-term tested this yet to see how it handles loss of WIFI etc.. you might want to try that.

  1. It’s now a month since the last comments –
    Any fresh info on this exciting topic?
    How about an updated overview of what is working and what patches etc. are needed?

    1. I’ve not done anything more with the Arduino IDE for ESP8266. I tried the only MQTT out there and it seemed buggy, whereas TUANPM’s MQTT is rock solid on the ESP8266. I have also been looking at his SLIP code which makes it easy for an Arduino to talk to the ESP8266 and hence let you all of your development on the Arduino… more on that later, right now I’m concentrating on getting basics right for my setup here in Spain – like reliable Raspberry Pi in the face of power cuts etc…. so I can leave some working kit here monitoring and controlling.

      1. If I recall there was some question mark over whether that function would stay in future SDKs…. I tried it, it crashed, I stopped. I guess it is time to look again – I’m just waiting for the 1.01 version of the SDK as the 1.00 would not work for me and I know they’ve fixed some issues – but it’s still in beta and I try to avoid beta (a lifetime of experience of using Microsoft Betas – you learn after a while).

  2. Spent a bit of time yesterday playing around with this, and so far it seems to be pretty impressive. Although I’m not a big fan of the Arduino IDE, there’s other options as already mentioned.

    I’ve managed to get MQTT publishing working using the the same library – and void * __dso_handle; fix you mentioned – and so far that seems to be working well. Not tried subscribing yet, but will hopefully have a play with that over the next couple of days.

    Also managed to I2C working well with GPIO 2 and 0. Created and uploaded a small sketch to read the temperature from a DS1631 i2c ic and send it over mqtt and all seems to be working well (though I had to increase the mqtt keep alive time as I’m only sending temperature readings every 60 seconds).

    As a little test, I also tried change the tx and rx pins as outputs and that seems to be working well, which opens a few things for me (using the same esp board to sense the temperature in an LED growbox, as well as turning lights on and off).

    1. Here’s a test to try… got the MQTT all working… turn your router off then on as if there was a power failure. I’m guessing the pubsub client won’t recover?

      1. Yep. Just did a quick try and as expected, the pubsub didn’t automatically recover.

        1. That is what I expected. So I sense a rush here – great – now we have a familiar environment… BUT the code on the Eclipse setup with Tuan’s MQTT works – and works reliably. I think it might be prudent to wait a little white before rushing back to safety. I wonder how many other packages which “work” are in a similar state. I’m sure these things are fixable but might be worth just keeping an eye out. Personally, once I deploy something like this I need it to keep working regardless.

  3. Peter, do you have any ESP’s set up to transfer data between two or more ESP’s just as a serial wireless link, i.e. just to replace a wire? How would such a set up be coded?


    1. Hi

      I did look at that at one time but then you’re limited by the range from one to the other… and I don’t see the point of that. If you do see such code especially for the new Arduino environment do let us know in here.

  4. Hi Peter,

    “I have a GREAT little LCD 240*160 colour display I use for everything”

    Is that ONE that you keep reusing (!?), or a particualr make/model you use when needed? In any case, care to share the details- there’s a world of ‘cheap’ displays out there so anything that helps home in on a reliable, tested model is appreciated.

    1. I don’t have any displays working on the ESP8266 yet, but we did start to make great use of a little 240*160 display that costs just a few pounds and gives full colour – if you look up home control in here you’ll see I use it as a thermostat display. My friend Aidan is right now looking to see if we can get this working on the ESP8266 but there is much to learn about this Arduino environment yet – for example how to store the fonts in FLASH as they are in the original Arduino code. If we get anywhere with this I’ll be sure to blog about it – a little wireless ESP-12 stuck on the back of one of those displays would truly be wonderful and cheap.

        1. Hi- I bought the same display but can’t make it work. Looked on the web and there are to many different libs and example for it and I can’t get them to work properly.
          For now I can only control the bright and to same strips.
          Can you please send me the libs you use for this display and maybe some example code.
          My mail is ranhaber gmail com.

          1. We made some very messy cluges to the library for that display – Banggood in China supplied the library I believe. I’m fairly sure there was some tight bit-banging of the Arduino and SPI settings etc all of which would be fairly useless on the ESP8266. Also there’s an issue I’m not sure how to resolve in that the fonts were fairly big and there’s a directive for the Arduino to store them in Flash – not at ALL sure how you’d do that with the Arduino setup for the ESP8266.

  5. Peter, I downloaded Arduino IDE 1.6.3 and tried it late last night with Sandeep’s package. I tried several sketches that work with the complete 1.6.1 package and they all came up ‘Error compiling. I do not these frequent changes to the IDE and the location of certain files is helping the developers of the ESP8266 packages for the Arduino IDE.
    I’ll interested to see your findings and perhaps a stable set up.

    1. I’m using 1.6.2 – I just went the day before yesterday to Arduino and that’s the version that was out – so if you’re using 1.6.3 it must’ve just come out. Maybe if you show the error message in here someone might know what it means. I was getting complaints about missing dso_handle and I was advised this will be fixed but for now to put:

      void* __dso_handle;

      in the top of my files – that worked.

      Then today I realised that there was something wrong with the Mosquitto PUBSUB example… and thanks to another helpful chap – if you get the PUBSUB original code with the mod above, that works for publish – but it’s useless for subscribe. So you subscribe, you need a non-lossy delay – that delay(5000) is no good – use millis() and a variable – and include client.loop() in your loop – it has to poll that function in order to read subscribes. Then THAT works – so that’s a good thing.

      I need to get the so-called EEPROM code to work now – because what we’re missing is the ability to save the settings for WIFI and MQTT – so my plan would be to try to make a web page to collect such info (using the ESP8266 as an access point) and then once collected and stored in FLASH using the EEPROM routine, use that to connect up…. that is do-able on the original ESPRESSIF setup but a bit messy – now we have the Arduino setup I’m hoping it will be a little easier… that is of course assuming that this software is reliable…

  6. Peter, I found the answer to where to put the include. Just downloaded Sandeep’s stuff from his GITHUB so maybe he has fixed the bugs in Roger’s version. Download is bigger than Roger’s and it looks as though there are more examples.

  7. Peter, I have downloaded the 1.6.1 package for the Arduino with all the ESP8266 code included and for all the tests I have done it seems to work OK with a few examples I downloaded off the ESP website. I also downloaded Roger Clarke’s variation, initially it had a problem with a missing DLL, I fixed that based on information on the ESP website. I then got the dso problem, where do you put the ‘include void*_dso_handle’ please. No rude answers!

    I also have SMING but I have not yet has chance to play with it. I do not seem to have much lick getting Eclipse to work properly and for beginners with little programming experience the Arduino IDE is straight forward albeit lacking whistles and bells.

    Thanks for your blog which is a source of inspiration and how I wish they would include the DTR pulse when programming the ESP.


    1. They did – they just didn’t enable it…. somewhere in here is a change to a flag which makes it work. It looks narrower than the one in Eclipse but there is definitely a pulse. My initial thought was to us a cap on that for reset – and a diode on GPIO0 – not tested that theory yet but anything is better than this reset/manual short GPIO0 nonsense…

      1. Peter, if the DTR pulse is available could you not use the Attiny programmer you developed instead of the Cap / diode? Where is flag to enable the DTR located please?

        1. Bob- we are looking to use that Attiny mod… my friend Aidan is looking at that now – but it would be so neat if one could get away with just a couple of diodes 🙂

  8. I hade asked the question if they can resurrect the DTR line control that is present in the Eclipse environment as this can be used toward automatically resetting the ESP and putting it into program mode. In the current Arduino setup this is not used at all (which is odd because when programming actual Arduinos that’s exactly what is used…)

    1. Hi Peter,

      Could you succesfully compile one of the Wifi8266i examples ?
      I’m consistently getting a compile error with Arduino IDE 1.6.1

      Rgds. Jan

      1. I’m using 1.6.2 – fresh install – works. I cannot get PubSub to work – it says it has logged into an MQTT broker despite the wrong password… and for webserver I had to add in a clude void* __dso_handle;

        Other than that, fine up to now.

    1. If you came across any issues, please do let us know Dave – that’s exactly what I plan to do next. You might save me some hardship.

    2. Ok, spill the beans – I got the pubsubbroker from here as per instruction…

      and it’s not working… I get some warnings then the killer – an error…

      mqtt_auth.cpp.o:(.text.startup+0xc): undefined reference to `__dso_handle’

      Others have commented similarly – so what did you do differently Dave?

Comments are closed.