Downloading and installing the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By ima747
#37576 I seem to have gotten it working thanks to phrend's last post in viewtopic.php?f=26&t=6845, yelling, and poking things with electricity until it worked. Here is my totally unverified and barely tested rundown on how to use the arduino IDE with ESP8266 on Mac OS X 10.11.2 (padding keywords for someone searching later, i.e. future me, because that guy is forgetful as hell).

1) Use Arduino 1.6.5: 1.6.6 is known to have issues, 1.6.7 may work (seems to work for me...) but is not yet officially supported. (I got it working under 1.6.5 and the just tried 1.6.7 without making any changes and had no issues... but 1.6.5 is the recommended version across the board)

2) Install ESP8266 board support version 2.0.0 through board manager. Plenty of places show how to do this, dead simple, just add the URL in the preferences dialog then go to board manager, search, install.

3) Install and configure esptool.py per phrend's 3rd post at viewtopic.php?f=26&t=6845. I used his tools.esptool.upload.pattern rather than the one on the esptool.py page, it appears he trimmed off some extra fields, I don't know if this fixes a typo with the original or what, but it worked for me. Another important note, make sure you're using the FULL path to the esptool.py, it doesn't might not like shortcuts such as ~. Be explicit.

4) Connect it correctly. I am using an ESP-12E, your particular board may be different. If you have doubts about your connections then resolve that first. I am connecting through an arduino uno as my USB/Serial adapter and using a bread board to simplify the connections with the following layout:
ESP Pins: GND and GPIO15 to GND on the UNO
ESP Pins: RX and TX to RX and TX on the Uno. These might need to be reversed depending on how your USB/Serial adapter works/is labeled. If you can't get stuff in your Serial monitor then you don't have it set right, or something else isn't connected right.
ESP Pins: VCC and EN (CH_PD on most boards I believe, but labeled EN on mine) to UNO 3.3v (I believe it works on 5v as well, some sources say it's 5v tolerant, others say not... a critical thing is your power source must have enough amperage, a lot of serial programmers, and other 3.3v sources aren't strong enough but the uno seems to work for me... power is a big problem people bring up a lot, so make sure it's solid. I know the 3.3v pin on a teensy doesn't have enough oomph to make it happy...)
ESP Pins: GPIO0 and RST floating with wires (this is the weird part, you will have to move both of them around to upload and run so make sure you have some way of moving them between GND and 3.3v...)

5) Select and configure board in the tools menu. I'm just using the default stuff for a generic board so far for mine and it seems to work. No idea what many of the configurations do yet, so can't advise there.

6) Get ready and program. Make sure the serial monitor window is closed, it won't work with it open since it needs to take over the serial port with the external esptool.py and so forth. Connect GPIO0 to GND. Hit upload and watch the status text just above the output at the bottom. As soon as it changes from "Compling" to "Uploading" briefly connect RST to GND (just tap it) to reset the ESP8266 and put it into programming mode (thanks to GPIO0 being connected to GND). Don't touch anything and hold your breath, you should see programming progress scroll by (on 1.6.7 it doesn't appear to follow the progress so you have to manually scroll, it doesn't have this issue with 1.6.5, but it's non critical).

7) Reset and test. Disconnect GPIO0 from GND and connect it to 3.3v to put it into normal operational mode. Open your serial monitor if you like. Pulse RST to GND again to reset and you should be executing your code.


Important Notes:
The really critical things were: You can't boot directly into flash mode, it has to be powered on and then reset into flash mode. This is not true 100% of the time, but it is FAR more reliable to reset it into flash. I have to reset (or boot when I'm lucky) AFTER the programming starts trying to upload. If I boot in before then it almost never connects... but again this isn't 100% of the time. Since you have to pulse reset low as well as switch GPIO0 from GND to 3.3v regularly to reprogram and test I found it by far easier to just leave them as loose wires I can stuff wherever than to formally say they belong in any given place. I may make a little dev board with a program/execute switch and a reset button to make life easier in the future, but a breadboard and some floating wires works well enough for now. GPIO2 is *supposed* to be high but I found no difference between high and just not connected so in the interest of having fewer wires in the way I just ignored it, as with everything here YMMV.

Hopefully this helps someone else get things running. I think the issue is just buggy software (arduino) on top of buggy software (ESP8266 board manager) on top of buggy software (esptool.py, which replaces broken software of esptool) all on a platform that gets less direct focus (Mac vs Windows, just fewer users) and all running on boards that come in a zillion configurations, it's not surprising that things are going to work less than perfectly.

My first serial testing example I uploaded worked well for quite a while, re-uploaded it and it worked for a while then crashed, so there may be some other stability problems, so I would again urge using Arduino 1.6.5 since it's more tested than 1.6.7 but the boards could be iffy, the compiler could be iffy, my programming could be iffy, the programmer, the individual upload, my configuration, etc. etc. etc. Problem for another day.
User avatar
By ima747
#38021 An update on my progress. 1.6.5 definitely works more reliably than 1.6.7 for me. Sometimes my code would crash shortly after executing with 1.6.7, doesn't happen with 1.6.5. Ensure you have stable connections and proper voltage. Wonky connections and power fluctuations can cause crashes and other nastiness. After programming a few times I started to be able to boot into flash mode successfully, no reset needed. Then that stopped working, and resetting also stopped working, but if I plug in power to the board right when arduino starts to try to upload it works fine and has been for a number of days... too early or too late and it misses the window. It's like booting into safe mode in windows on an old computer, press the key at just the right time or no dice. But I've gotten the hang of it and when I fails I just hit upload again and replug again. Some of this may be universally useful info, some may only apply to the ESP-12E.

Lastly to use the built in LED on the ESP-12E, it is pin 2, and it has to be set LOW instead of HIGH like other boards I've used with built in LEDs. Very strange, but at least it has it and it doesn't conflict with the TX pin like it apparently does on some other ESP8266 boards so no complaints.
User avatar
By bobcroft
#38414 ima, as an alternative to the later versions 1.6.6 /1.6.7 of the Arduino IDE to get 74880 com speed you can use Coolterm or Putty to view serial data. In Coolterm you can add a file called 'baudrate.ini' which simply contains 74880. This file is added into the same folder as the .exe file. It then allows you to select that baudrate to view serial output from the ESP8266.
The ESP8266 ONLY uses that baud rate whilst it boots up, once booted it uses 115,200. In the case of some early versions of ESP's the post boot up baud rate was 9600.
User avatar
By ima747
#38415 Thanks but I'm using a Mac and don't want to use yet another program when the functionality is *almost* built in to what I'm already running. Good advice for those on Windows who are less picky :). On Mac Linux btw you can use "screen" in a terminal to monitor at whatever rate you want. It is very very good to know that it only uses the funky baud rate for boot up post data basically though. You never operate under that, only troubleshoot. But more complicated troubleshooting is annoying obviously so still looking forward to being able to select "wtf was that" from a drop down rather than external source. My current workaround is just to run 1.6.6 for serial monitoring and 1.6.5 for code and uploading. It's not elegant but since arguing treats the terminal window essentially as a sub program anyway it's not too big of a deal.