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”
This is a _bad_ time for the two waring Arduino factions…..
Agreed. As the ESP8266 support in the IDE grows and matures, simple to mid complexity projects may migrate to the ESP8266 and away from the Arduino boards.
I disagree. I only ever buy the cheap Arduino clones from China.
Has everybody seen a clone that is RoHS compliant?
There 100000 times more lead in your car battery than on a clone Arduino board. Cars aren’t ROHS compliant.
Yes but car batteries are (or should be) recycled. Arduinos are not.
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.
Does anybody really care whether it is RoHS compliant? I don’t.
Andrew – What do your Chinese clones typically cost and how does that compare to the ESP8266 modules?
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)
It is roughly $3 http://www.ebay.com/itm/311152649003
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.
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.
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.
Check out SMING – https://github.com/anakod/Sming
Arduino codebase, running in Eclipse. It’s pretty cool.
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.
Mooi man knapie
And you are writing this comment on a Tuesday at 11:35 AM? Shouldn’t you be working to deserve your $50 per hour?
@abdullah: do you about the concept of Time zones?
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.
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.
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.
I would love to use these for wireless LED dimming, but PWM doesn’t work yet. Does anyone know how probable it is that PWM will eventually work with these chips?
it’s possible. you should google your question for tutorials….
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.
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.)
The GitHub page says, “Software PWM is also an option, but apparently it causes issues with WiFi connectivity.”
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.
Readers new to the ESP forum would welcome a tutorial.
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.
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.
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.
And there is the gotcha.
Its a good start. The analog functions haven’t been implemented yet though.
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).
I have tinkered with the Pi, but not yet with Arduino. Can the ESP8266 talk to say a temp sensor all by itself without an Arduino or another board?
It would depend on the specific sensor you used, but in general, yes. I’ll bet the Arduino DHT library works just fine on the ESP8266 without any major modifications.
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.
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.
Finally. No need to use an obscure,obsolete language to program them. Bye Bye LUA!
TIOBE Index for March
33 Scratch 0.472%
34 Ada 0.468%
35 Scala 0.456%
36 Groovy 0.413%
37 Lua 0.409%
Scratch and Ada beat Lua. I stand by my statement.
*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.
This is absolutely amazing news! I’ve been wanting this for so long. I can’t wait to try it out!
With Arduino IDE 1.6.2 there is a new “add board” feature. Perhaps these guys will make it that easy to add ESP to the list rather than via hacks?
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.
I think it would be appropriate to thank the “guys” who made this happen.
Thank you for whoever is involved in this “port”! I get more and more impressed every time with the power and capabilities of the Arduino platform (here show by its IDE).
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.
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?
The ESP8266 behaves like any other wifi client. If your router can handle 128 laptops or 128 cell phones, it can also handle 128 ESP8266s.
Ok, great – thanks for confirming :)
For those of you who haven’t see it yet, here’s a video showing the range of these
spoiler – some configurations can maintain <5% packet loss BEYOND 4KM!
Tested. It works flawlessly. Thanks to everyone who make this happen!
Great to hear that, and thanks for trying it out!
If they can make the IDE works over WiFi, it would be great!
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?
I designed a Arduino-compatible ATMEGA32U4 board that has an ESP-8266 and Li-ion charging support on it. We will have them available soon if anyone is interested Details are here:
https://hackaday.io/project/4981-wiot-wireless-internet-of-things-esp-8266 and https://cockrum.net/electronics.html#WIOT_final
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.
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.
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.
Has anyone been able to get this to work in OS X? I think I’ve tried every permutation and keep getting “espcomm_sync failed”…
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.
Please be kind and respectful to help make the comments section excellent. (Comment Policy)