Arduino IDE Support For The ESP8266

Despite a wealth of tutorials for setting up and writing code for the ESP8266 WiFi module, there has not been much of anything on programming this cheap wireless module with the Arduino IDE. Finally, this has changed. After many months of coding, the Arduino IDE supports the ESP8266 module.

The Arduino IDE support was announced on the ESP8266 community forum. Setup is fairly simple with downloads for Linux, OS X, and Windows. This isn’t an ESP8266 shield, either: you can write code for the ESP module, connect the serial pins, and hit the program button.

The basic functions of the Arduino IDE – pinMode, digitalRead, digitalWrite, and analogRead – are available. Most of the WiFi functions work just like the WiFi shield library.

There are a few things that aren’t written yet; PWM doesn’t work, as the ESP8266 only has one hardware PWM source. SPI and I2C slave mode aren’t done yet, and uploading sketches via WiFi needs a little bit of thought. That said, this is a great introduction to programming the ESP module. If the Arduino IDE isn’t your thing, you could always do it the cool way with [CNLohr]’s programming tutorial we featured last week.

64 thoughts on “Arduino IDE Support For The ESP8266

          1. There are more lead and higher of the old TV that you have to throw out when they (as in FCC and similar government bodies in other countries) remove the analog broadcast than tiny amount of lead in Arduino. Likely the old TV use a solder with higher percentage lead for cost reason too.

          1. I get Arduino Nanos from singapore (eBay) for £2.50 a pop, with a USB cable, whereas ESP8266 is about £3.50 ish, so that coupled with the extra functionality on a Nano, would prefer that over an ESP (depending on the project)

          2. Hi,
            here is a review of the Arduino nano clone : http://nagashur.com/blog/2015/08/06/arduino-nano-clone-chinois/
            (in french, but you can googletranslate). The main difference is the USB chip : instead of an FTDI, there is a CH340G. On linux, it works out of the box, on windows and macos, it requires drivers (links are given on the link i gave)

            If you compare it to an ESP module, it’s the same price (aproximately 2€ both), the nano clone is slightly larger, and of course has no wifi, but 13 digital in/output an 7 analog inputs. The ESP8266-01 has only 2 or 3 GPIO, none of whom are analog ones. However, there are other ESP boards that have more GPIO, for more money.
            You may as well buy both however, and connect them via serial, and let the nano do the arduino stuff, and let the ESP do the network stuff. To keep it simple, a 3.3V nano would make both modules able to comunicate directly without logic level conversion.

    1. Im curious why everyone adores the Arduino IDE… While the hardware is useful for many things, the Arduino IDE is one of the worst IDEs available. So much time and energy is spent making products compatible with the under-featured and over-simplified Arduino IDE, when we could be using much better IDEs. Eclipse based IDEs are just one of many possibilities that are way better than the Arduino IDE.

      Just seems like we are hinging so many new innovative products around one shitty piece of software. Think what could be accomplished if these products were used with much more capable software.

      /rant

      1. I totally agree with you here! However for my part, the arduino IDE and its libraries are a great way of just hacking up a prototype or test something. There is an arduino eclipse plugin but have not got it to work yet.

        –Androiders

        1. I am a profesional C++ & Java Developer, Integration Specialist and earn just over $50 an hour. I think Eclipse is the worst IDE known to man. The only reason people us it is because they don’t know better and they don’t want to pay for a decent tool.

      2. I totally disagree, Sir.

        The amount of people using the Arduino IDE everyday, in an astounding number of different hacks and projects, proves your are ignoring one fact: EVEN a shitty piece of software can change the world, if used right!.

        And apart from that, I myself am not a programmer (I’m more of a hardware guy) and I love the simplicity and speed of Arduino IDE.

        1. @Clovis @Phreaknik:

          I agree the for a software development IDE, it is painfully out dated. I think this goes more to the intent of the Arduino. I see Arduino more as a hardware platform with some software capabilities. Where has RPi is the opposite, software (computer) platform with hardware capabilities.

      3. Well, think of what projects could be accomplished if everyone had a Bridgeport mill in their garage, instead of using a piddly little hand-drill for things!

        But given the choice between trying to drill a hole using one’s finger, a hand-drill, and a Bridgeport, I think the vast majority of people who are *not* skilled machinists would be better served by the less-capable, but much simpler, option. Use enough tool, but not so much that the tool becomes its own project.

        For me, an Eclipse-based IDE is simply not a good option, for the same reason a Bridgeport isn’t a good option — by the time I get it installed and learn how to use it, I could’ve done my project ten times over with the hand-drill, or the Arduino IDE.

        If you ARE a skilled machinist, or software dev, I’m happy for you. It took you a lot of time to develop those skills and now everything is easier for you, when you combine those skills with advanced, complex, powerful tools. But I’d appreciate it if you recognize that not everyone shares your specialty, and not everyone cares to even wrap their head around those tools to just get a simple job done.

    1. Another option – WS2811 chip – and a FET on each RGB channel. I use that to drive 12v LED strips up to a few amps. If it’s just RGB led’s then you can’t really go wrong with WS2812’s in a chain.

    2. Assuming a timer and the associated interrupt is supported, you can always implement software PWM. It’s much easier if a separate timer/interrupt is available for each PWM needed. Multiple PWMs per timer are possible, but the code complexity rises to the point where you might consider MIBAM (Mirror Imaged Bit Angle Modulation) instead; which is a software technique that specifically lends itself to efficiently dimming lots of LEDs using only one timer/interrupt. (See http://www.picbasic.co.uk/forum/showthread.php?t=10564 for a description if interested. The thread contains a Java demo there that lets you interactively generate a MIBAM waveform, with that visual example I was able to code it from scratch in an evening.)

        1. Ah, that’s disappointing. I looked for a reason, and found a few references suggesting that while WiFi is being serviced, software PWM is typically disrupted. Perhaps timers/interrupts aren’t properly supported yet. Maybe in a few weeks or months that might change, though.

  1. This is a huge deal for ubiquitous IoT development. The one thing that was seriously missing from the Arduino toolbox was an ultra-cheap, easy way of building a simple Wi-Fi connected object…and here it is.

  2. So this sounds to me like arduino LLC is taking a shot at the competitor company who builds the branded atmel boards. They are saying that they don’t need arduino boards by supporting non arduino boards. This will definitely get interesting.

    1. This isn’t really being developed by Arduino LLC — it’s a third-party project that functions as an add-in to the Arduino IDE. There have been for a while a number of other extensions that do a similar thing, allowing you to use the IDE and toolchain to program discrete AVRs, ATTinys, the Teensy boards, and so on.

    1. It seems after I wrote that comment, the article was updated to point to Ivan’s Arduino/esp8266 build instead of Jeroen’s Arduino patch for the esp8266 at arduinesp.com. Also on the 29th, Jeroen updated his patch to use Ivan’s core. Now the only difference between the two seems to be Jeroen’s 50MB patch can be applied to an existing Arduino 1.6.1 (and possibly 1.6.2) IDE install, while Ivan’s is the whole IDE with the esp8266 core included (350MB zip).

    1. I2C and SPI can easily be bit-banged (done in software), especially if you’re not transferring much data (like on a temp sensor), and those two serial protocols cover a lot of sensors and peripherals. I’m not an Arduino guy, but I’d be shocked if there wasn’t already ready-to-use Arduino code for this, which would need only the pinMode, digitalRead, and digitalWrite functions to work.

    2. I’ve been using nodeMCU on several ESP8266s, reading temperature data from both DHT11/22s and DS18B20s. Works just fine, no Arduino needed. The DS18B20 is much better supported than the DHT sensors, everything does work.

        1. *facepalm*. Looks like you aren’t totally getting the point. You can’t compare scratch and ada to lua. Each language has its own set of applications. Lua is one of the most popular _embedded_ _scripting_ language. You use it in environments when the core of the project is C/C++ and you need some simple glue for highlevel logic that’s fast to develop with and easy to integrate. Especially it’s popular in game development, e.g. WoW, Jericho, Angry birds. That’s the titles I can remember without looking anywhere using lua. And I’m quite far from gamedev right now. Unlike js or python, lua is just a small bunch of C files that’s easy to compile literary for any platform that has an ANSI C compiler, so it pretty much leaves no choice.

    1. Bleh, ignore the report. HaD, why do you put the “report” button in the same place the entire rest of the internet puts “reply”?

      Anyway, it’s not a hack, strictly. The IDE has for a long time supported a variety of target devices — even the official Arduinos have used more than a handful of different processors and communication methods over the years. This group has just put together a set of cores and tools that let the Arduino IDE talk to the ESP8266 as well.

  3. We all thank Arduino for the inital standard board and shields idea but to be honest, its more benefitial to use other arduino compatible boards(still with open source tools). This was done for those already and lots of tutorials exist. I prefer writing C code, using tools like Processor Expert from Freescale and adopting their freedom boards. I dont entirely understand/appreciate the kind of abstraction Arduino IDE offers. May be its because I work in a teaching environment and there is need to undertstand C programming for hardware as a real programming language. Plus, you dont have to wait for the Arduino IDE to add support.

  4. So Rad, Thank you for this!

    Now I’m not very knowledgeable with wifi and just discovered the esp8266

    What would be the limiting factor to the maximum number of these in a wifi network ?

    Given a powerful router (I have a WNDR3700) – would 128 of these connected to the same router allow for transmission of, say, a 32 Byte data packet 10 times a second?

    Or would it require a network simulator to estimate this?

  5. Tried it with Win 8.1. Does not work..

    “Cannot run program “C:\Users\xxxx\Documents\Arduino\hardware\arduino-esp8266-master/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-g++”: CreateProcess error=216, This version of %1 is not compatible with the version of Windows you’re running. Check your computer’s system information and then contact the software publisher”

    Anybody else have any luck?

  6. Hey HUB, igrr, and/or anyone else … please post a step by step on this forum, the Arduino playground, or the ESP forums so that noobs like me can enjoy your excellent work.
    Thanks!

  7. No. This does not work flawlessly. At 8:30 this morning, I began installing the arduino program designed to work with the esp8266 on my Mac (Yosemite). Kept getting an error message saying “warning: espcomm_sync failed
    error: espcomm_open failed”. I read through others attempts to fix this, and ultimately decided that since the github page does not list OSX as tested and passed, it must not work with OSX, as it says. So, I tried switching to my Raspberry Pi, because Linux is tested and passed. First, my Raspberry Pi didn’t have enough room to download the file, so I spent HOURS setting this up. Finally get to download the file, can’t get it to run on my Raspberry Pi. At one point when trying to run it through the command line, I received an error saying something like Processing.app missing? It’s now about 1:15am. sooo… yeah.

    1. espcomm_open failed seems to indicate the ESP module isn’t responding. Be sure you’ve got GPIO #0 grounded, then reset or power cycle the module, THEN attempt to upload.

  8. Seeing this project, and hearing about how easy arduino is to just set-up and use has forced my hand at installing it.
    And well, as someone who prefers to work with PICASM, its nice to have a platform to just throw together.
    I’m a hobbyist and a new father, and there is no way I am going to get time to learn how to code at an ASM level with the ESP8266, AS much as I would love to code in ASM for any device, there are more important things anyone should be doing with my life. And libraries like this fit my situation just fine.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.