ESP8266 as Arduino

So this Lazy Old Geek (L.O.G.) heard about this ESP8266 IC. Basically, it’s a microcontroller that does WiFi. There are many Instructables with this chip and many with an Arduino. But most of these are using the ESP8266 as a sensor/WiFi connected to a standard Arduino.

Well, what I wanted to do was use the ESP8266 as an Arduino without having to use a standard Arduino.

The ESP8266 is a microcontroller similar to the AtMega328 used in the standard Arduino, e.g., Arduino UNO.

Now there is already a lot of information on doing this but I found it confusing, hard to figure out, sometimes misleading so I hope to simplify and clarify the process.

Special thanks to Lady Ada, Adafruit and the Adafruit HUZZAH ESP8266 breakout module. As usual she provides thorough, useful information.

Also, much of my information comes from this website:


There are many versions of ESP8266s. Some of the cheaper ones are ESP-01, ESP-03. I think right now they go up to ESP-12. Plus there are other variations.

ESP-01 $2.88 ebay

ESP-03 $2.25 ebay

Cheaper on aliexpress.com

Step 1: Hardware Problems

Most communications with the ESP8266 is serial. Most computers use USB to serial converters, like FTDI chips.

PROBLEM: The ESP8266 IC requires 3.3Vdc instead of the more common 5Vdc. Also, it may need up to 250mA of current.

SOLUTION1: So some ESP8266 modules have built in 3.3Vdc regulators and are compatible with 5Vdc USB to serial devices.

Adafruit HUZZAH ESP8266 Breakout(https://www.adafruit.com/products/2471)(see picture)

SOLUTION2: So many FTDI converters have the option of converting logic to 3.3Vdc. And most have a 3.3Vdc supply. The problem is that most of the power supplies are in the FT232 IC and are only capable of supplying about 50mA of current. (see picture) This is also true of the PL2303 serial converters that I use a lot of.

So a separate 3.3Vdc power source is needed.

PROBLEM: The ESP-01 module has 2x4 header that is not compatible with breadboards.(see first picture)

SOLUTION: I took some long lead female headers and bent them with a little S-curve so that they will fit in a breadboard. (see pictures)

PROBLEM: The ESP-03 module has 2mm spacing on connectors which are not compatible with 0.1” breadboards.

SOLUTION: I have some 2mm headers so I soldered some male pins to the ESP-03. (see picture), then I took some 2mm female headers and wired them to some 0.1” headers. In this case I soldered them to a 2x4 headers so that I could plug them into the connector for the ESP-01.

Well, this works pretty good for breadboarding. (see picture) but I wanted something more permanent so I may make it into a PCB.

Step 2: ESP8266 As Arduino

Okay, there are many articles on how to do this. Most are very confusing. One of the better ones is:


The one I used the most is:


ESP8266 Requirements


3.3Vdc supply 250mA or greater. I used an AMS1117 3.3 regulator. This is powered by USB 5V. (The USB requirement is that the 5Vdc has a minimum 500mA of current.)

USB to Serial 3.3Vdc. I use a PL2303 device.


WARNING: Some newer PL2303 modules have 5Vdc on TX. This could damage the ESP8266 modules.



Arduino Environment v 1.6.4 or greater

ESP8266 Setup


These are instructions from https://github.com/esp8266/arduino

Installing with Boards Manager

Starting with 1.6.4, Arduino allows installation of third-party platform packages using Boards Manager. We have packages available for Windows, Mac OS, and Linux (32 and 64 bit).

Install Arduino 1.6.4 (or greater) from the Arduino website. Start Arduino and open Preferences window. Enter http://arduino.esp8266.com/package_esp8266com_ind... into Additional Board Manager URLs field. You can add multiple URLs, separating them with commas. Open Boards Manager from Tools > Board menu and install esp8266 platform (and don't forget to select your ESP8266 board from Tools > Board menu after installation).



UTXD RXD of USB-Serial

CH_PD 3.3V

Reset Pushbutton to Gnd

URXD TXD of USB-Serial

GPIO0 Pushbutton to Gnd



TIPS: Make sure TX from serial goes to ESP-01 URXD and RX goes to UTXD

On my breadboard setup, instead of pushbuttons, I used two pin jumpers.


Connect USB-serial to PC and ESP-01, connect power if separate

Start Arduino 1.6.4

Select ‘Tools’ ‘Port’ whatever # your USB-serial is on

Select ‘Tools’ ‘Board’ ‘Generic ESP8266 Module’

Select ‘Tools’ ‘CPU Frequency’ ‘80MHz’ Not sure why

Select ‘Tools’ ‘Flash Size’ ‘512K (64K SPIFFS)

Select ‘Tools’ ‘Upload Speed’ ‘115200’ Some ESPs may be 9600

Put ESP8266 into Flash mode:

Ground GPIO0

Briefly ground Reset

Release GPIO0

(If you have an LED on GPIO0, it should be about ½ intensity)

Load a sketch. (You can use Blink if you change it from D13 to D2)

If it works, In the Arduino environment bottom window, you will see a string of red dots as it is programming.

TIPS: While the sketch is programming, the blue LED on the ESP-01 will flash. If you have an LED on GPIO0, it will turn off when programming is complete.

So if you’re lucky and followed my instructions you should have successfully programmed the ESP-01 with Arduino

For the ESP-03, you would expect the same procedure to work but not quite.

First you have to connect a 10K resistor from GPIO15 to ground.

Second it doesn’t have an easily accessed Reset pin.

Well, I did some research and apparently the CH_PD pin when pulled to GND will work as a Reset.



UTXD RXD of USB-Serial

CH_PD 1K resistor to 3.3V

CH_PD Pushbutton to Gnd

URXD TXD of USB-Serial

GPIO0 Pushbutton to Gnd



GPIO15 10K to ground

Put ESP8266 into Flash mode:

Ground GPIO0

Briefly ground CH_PD (Reset)

Release GPIO0

(If you have an LED on GPIO0, it should be about ½ intensity)

So this also works for the ESP-01.

Here is a schematic of my breadboard setup.

Step 3: Firmware

What I discovered was that loading sketches overwrites the original software which is used by many of the basic Instructables and probably with a lot used when the ESP8266 is connected to a standard Arduino.

So I needed a way to reflash it back to ‘original’ software.

The one I use is ESP8266_flasher.exe


This is on Google Drive. Up at the top there is a little icon down arrow that will say Download. Load it to your PC.

Now there is a version of firmware there but it’s not the latest.

Official version?


Again, this is Google Drive.

What I did is click on 0.952 support Smar

Then click on v0.9.5.2 AT Firmw

Then click on Download and save it to your PC remembering where it is.


Run ESP8266_Flasher

Click on ‘Bin’ , select bin file

Select correct COM port

Now setup ESP8266 into flash mode as above.

Click on ‘Download’

Program should start Writing. This takes a while

Says Leaving… Failed to leave Flash mode

Ignore message, should be finished.


Easy way to Test is to use Arduino, select port, open serial monitor

Set it to 115200 baud rate and Both NL & CR

On command line enter AT+RST

NOTE: I just noticed it says SPI Speed: 40MHz,( though crystal is 26MHz)

On command line enter AT+GMR

SDK version: 0.9.5

Step 4: Conclusions

So this seems to work pretty reliably.

You don’t have to load a bootloader onto the ESP8266.

It does seem to take a little longer to program/flash.

It’s a little harder to set it up for flashing. But I’m looking into automating some of that with an FT232 module. (My old USB-BUB doesn’t work anymore.)

I need to explore some of the WiFi capabilities of the ESP8266.

<p>Can you plz look at this</p><p><a href="https://www.instructables.com/community/security-system-not-responding-after-combinin-ultr/" rel="nofollow">https://www.instructables.com/community/security-s...</a></p><p>small help thanks</p>
<p>useful, thank you</p>
<p>ok , good</p>
<p>Would it be possible to connect the FTDI DTR pin to the ESP8266 RST in the same way it is in the Arduino Uno in order to automatiize the flashing process?</p>
<p>I believe it is possible. I was just looking and found that Sparkfun is doing this with the ESP8266 Thing. Apparently with a capacitor.</p><p>h<a>ttps://learn.sparkfun.com/tutorials/esp8266-thing-hookup-guide/hardware-overview</a></p><p>I haven't tried this yet,but it looks promising.</p><p>LOG</p>
<p>Hej,</p><p>I tried and it worked (not with capacitor but with help of RTS pin on USB-TTL chip - soldering plus wire to nRST)</p><p>2 wire:</p><p>[USB-TTL chips] DTR --&gt; ESP-GPIO</p><p>[USB-TTL chips] RST --&gt; ESP-RST</p><p>Jumpers: switch between normal and bootloader mode Unfortunately it must be removed manually after programming</p><p>Arduino IDE: works, but under flashing don't open and use terminal monitor window </p>
<p>I have to reset the esp a lot... it doesn't seem to load the code on it correctly. I have to reset it often and it will randomly work. Once it works once, it'll keep going until you turn it off.. any ideas what might be causing this?</p>
maybe decoupling capacitor, poor power suply, etc
<p>I had a lot of problems when I first started with these.</p><p>I had problems with FTDI 232 USB adapters. If you have different types, I would try them. </p><p>You will have probably have better luck if you have at least 200mA 3.3v source. </p><p>If you have several different ESP8622s, try them.</p><p>If you're using ESP-03s like I did, make sure the pins are soldered to the PCB.</p><p>For some reason, I had trouble with the PCB I made that could program ESP-01 and ESP-03s. It worked fine with ESP-01s but not ESP-03. I made a separate PCB just for ESP-03s and that worked fine.</p><p>If you have 01s and 03s, I found it a lot easier to program ESP-01s.</p><p>Make sure your USB adapter is 3.3V and not 5V.</p><p>Hope this helps.</p><p>LOG</p>
<p>Hey. I started testing them and it seems to work when I upload the code but the more you reset/power cycle it.. the worse it gets. To a point where it won't even boot the code at all... unless you re-upload the sketch. I'm guessing the memory in the microcontroller might be faulty. I ordered a nodemcu dev board.. it has a ESP-12 on it. Gonna try my luck with that and see if the problem persists...</p>
<p>Yes, I've had some intermittent problems with my IP Clock. Mostly it just stops working until I recycle power.</p><p>By the way, I'm pretty sure the memory and program are stored on a separate RAM chip and not on the ESP8266 microcontroller. (Not that that makes much difference).</p><p>LOG</p>
good job
<p>Hello sir, can I make use of arduino uno as USB to serial converter to program the esp8266?</p><p>If yes, can you explain how.. Thanks a lot..</p>
<p>yes, you can use arduino uno as a USB to serial converter to program the esp. i've been using arduno uno to upload sketches to a custom arduino a company i work with built and i've tried it on my esp8266 and it works perfectely. basically you'll just have to remove the ATmega chip from the uno connect tx of the uno to the rx of the esp; rx of the uno to the tx of the esp; 3.3V of the uno to the esp; GND of uno to the GND of the esp and your connection is done. now you can connect the arduino to PC and start uploading :)</p>
<p>You're probably correct. I did some further research on this. Apparently, the ESP8266 has a snapback circuit that will handle 5Vdc (at least it won't be damaged). Also the newer UNOs have a 3.3Vdc regulator that is good for up to 150mA which should be fine for programming. </p><p>(I did see some documentation for older UNOs which said that 3.3Vdc is limited to 50mA)</p><p>LOG</p>
<p>While some Arduinos like the UNO have a USB to serial converter in them, the circuitry is not readily accessible. I wouldn't try to use one and wouldn't recommend it. USB converters like the PL2303 are relatively cheap on ebay. My current favorite is the even cheaper CP2102, which does work with the ESP8266.</p><p>LOG</p>
<p>Thanks for your response sir. But I don't understand what you mean about &quot;the circuitry is not readily accessible&quot; since the RX and TX of UNO's USB to serial converter is accessible through pin 0 and pin 1. And we can remove the Atmega chip from the board (assuming DIP version).<br><br>Sorry for insisting to use Arduino as USB to serial converter 'cause it will take me a month to receive the product from ebay.<br><br>P.S.: I tried browsing the internet for a project that uses arduino as usb-serial converter to program esp8266 but i haven't seen yet</p>
<p>I didn't think about removing the AtMega. That's a big help. Does this have an FTD 232 chip on it? One other problem is that most are set up for 5V operation. I think some have a 1K resistor in series with TX and RX and this might be enough but to be sure, you should probably put a voltage resistor divider on the FTD232 TX line. The RX line should work fine with the ESP8266. </p><p>Another problem is the 3.3Vdc needed by the ESP8266. The Arduino has a pin for that but it is usually connected to the FTD232 3.3Vdc output which only has about 50mA available. This might be enough to flash ESP8266 but might not. I think the ESP8266 needs up to 250mA.</p><p>Also, another warning: I had problems using the FTDI232 when flashing it back to original. Apparently other people have done this successfully but I had three that didn't work.</p><p>Voltage divider. Connect Arduino serial TX to a 1K resistor (this may already be there). Then connect that to a 2K resistor tied to ground. The signal between the two resistors should be about 3.3Vdc.</p><p>Might work. Good luck.</p><p>LOG</p>
<p>Thank you for the info, it's a big help. I'll notify you about this soon.</p>
<p>The newer ESP-01 require even less to program using Arduino but stick to IDE 1.6.5 not 1.6.6. I use one of the chinese breadboard PSU adaptors so I can have both 3.3 V and 5 V. Adaptors are pretty easy to make for breadboard too. Attached some pics of adaptor and a small flash jig that works great for the newer ESP's which are black and in most cases have a little more memory. The switch is just for flash or run position that's all it needs. no resistors or anything</p>
<p>you may also buy the electrodragon little SMD bread that give ESP 12E a standard Pin OUT size and accept 5V input :-)</p>
<p>it also have reset &amp; falsh button that is usefull</p>
<p>Can ESP 12 be used as Arduino too?</p><p>Is the process of using it as Arduino the same as using other ESPs?</p>
<p>All of the ESP series are based on ESP8266s so theoretically the ESP-12 should work. I don't have any so can't verify. I did have some problems with the ESP-03 that I didn't have with the ESP-01. The Adafruit HUZZAH ESP8266 has an ESP-12 in it.</p><p>LOG</p>
<p>yes esp12 can work with arduino ide too</p>
<p>yes, it can </p><p>if your want it and you are in USA, you can place order on this link, it is very fast:</p><p>http://www.amazon.com/Diymall-Esp8266-Serial-Wireless-Transceiver/dp/B00O34AGSU/ref=sr_1_1?ie=UTF8&amp;qid=1439427134&amp;sr=8-1&amp;keywords=ESP8266</p>
<p>I am sure your tutorial is awesome, but something else caught my eye in it. I swear this is the most genius way to make a radiator for a component, which has only a SMD pad for that purpose. Awesome thinking!</p>
<p>Thanks. I noticed it was getting a little hot and wanted something quick. The tab is pretty small but nut and bolt did the job.</p><p>LOG</p>
Msuzuki777<br><br>Excellent tutorial!<br>Could you clarify what exact software you used to draw the scheme?<br>Thanks.
<p>I use Cadsoft Eagle (free) to make my schematics.</p><p>LOG</p>
<p>Thank you!</p><p>You made my day!</p>
<p>Glad to help.</p><p>LOG</p>
<p>Now that I have this working, has anyone located an I2C library that I can load/include from the Arduino IDE, in order to implement I2C on ESP8266? I want to interface to BMP180 temp/humidity sensor without Arduino hardware.</p>
<p>According to the latest documentation, I2C is supported:<br><a href="https://github.com/esp8266/Arduino/blob/esp8266/hardware/esp8266com/esp8266/doc/reference.md" rel="nofollow">https://github.com/esp8266/Arduino/blob/esp8266/ha...</a></p><p>I haven't tried it.</p><p>LOG</p>
<p>Thanks, msuzuki777,</p><p>I see guidance that before using, call &quot;Wire.begin(int sda, int scl), i.e. Wire.begin(0, 2) on ESP-01&quot; to define which pins to use.</p><p>However, when I try this, my sketch doesn't compile. I get an error suggesting that TwoWire::begin() takes just one parameter: </p><p>&quot;espa_thingspeak_v03.ino: In function 'void setup()':<br>espa_thingspeak_v03:195: error: no matching function for call to 'TwoWire::begin(int, int)'<br>espa_thingspeak_v03.ino:195:18: note: candidates are:<br>In file included from espa_thingspeak_v03.ino:8:0:<br>C:\Users\Donatech\Documents\Arduino\hardware\esp8266com\esp8266\libraries\Wire/Wire.h:53:10: note: void TwoWire::begin()<br> void begin();<br> ^<br>C:\Users\Donatech\Documents\Arduino\hardware\esp8266com\esp8266\libraries\Wire/Wire.h:53:10: note: candidate expects 0 arguments, 2 provided&quot;</p><p>Any thoughts?</p>
<p>I don't know anything about thingspeak but it looks like the Wire.h, Wire.cpp in your library are not compatible with the sketch. You might try looking for the correct library.</p><p>It might be this one:</p><p><a href="https://github.com/sandeepmistry/esp8266-Arduino/tree/master/esp8266com/esp8266/libraries/Wire" rel="nofollow">https://github.com/sandeepmistry/esp8266-Arduino/t...</a></p><p>but I'm just guessing.</p><p>LOG</p>
<p>Are you sure? It looks to me as if the Wire.cpp has 2 parameters, which is what my sketch is providing. It looks as if the Arduino compiler is expecting only one parameter. Perhaps the Wire.cpp that has 2 parameters is not in the correct folder? Where does the esp8266 board manager (json) expect libraries to be located? Is it any different from standard Arduino IDE?</p><p>In other words, when my sketch #includes &lt;Wire.h&gt;, where does the IDE look for it, and link it to my sketch? Perhaps there are 2 versions of this library, and the IDE is finding the wrong one...</p>
<p>I am not sure. And I don't know what the IDE does with duplicate libraries.</p><p>I wondered myself where the libarires were going when you use board manager and found this:</p><p><a href="https://github.com/arduino/Arduino/wiki/Boards-Manager-FAQ" rel="nofollow">https://github.com/arduino/Arduino/wiki/Boards-Man...</a></p><p>which says it's going into something called %APPDATA% which is not easy to access.</p><p>However, in your case, I would look at the error message you posted which says something about:</p><p>C:\Users\Donatech\Documents\Arduino\hardware\esp8266com\esp8266\libraries\Wire/Wire.h</p><p>which is not what I would have expected.</p><p>Anyway, hope this helps.</p><p>LOG</p>
<p>looks great. Was just wondering your incoming TX signal, isnt that 5 Volt? or do you get the voltage for the FT232 from your 3V3?</p>
<p>Good question. I am using a PL2303 to convert USB to serial and it is 3.3V logic. And most of the FT232 converters have an option to switch it to 3.3V signals. Usually most 5V Arduinos will work with the 3.3V signals so I'm pretty sure it should work with either 5V or 3.3V Arduinos and ESP8266s.</p><p>LOG</p>
<p>tnx, so the level on yr Tx is 3.3 Volt</p>
<p>I have a warning for you. While the PL2303 modules I've been using are set to 3.3Vdc Tx, I just got a batch of new PL2303s from ebay and their Txs are set for 5Vdc.</p><p>LOG</p>
<p>That is good to know. Tnx. My module has both voltages, but seems the TX is also set for 5 Volt. Have been using a voltage divider for my ESP8266 module and that worked well</p>
<p>I've been using CP2102 modules I get for about US$3 from ebay. The advantages are that they bring all the handshaking signals that aren't on the FTDI-style header out to other header pin pads, and there's a solder jumper that can set them to either 3V3 or 5V for Vcc. The logic outputs are always 3V3, regardless of the Vcc settings. </p><p>The CP2102 has an onboard regulator that's good for up to 100mA of 3V3, _but_ it appears the maker left out the recommended bypass cap to save a few cents, so you might want to add one if you're connecting to gadgets that don't already have them.</p>
<p>Good to know. I used to have one but don't know where it is. Just checked and ebay has a listing for $1.58.</p><p>Thanks.</p><p>LOG</p>
<p>Thanks. I know that module (or a comparable) pretty well as I have it. Didnt really check for a bypass capacitor, but i will keep that in mind. Tnx</p>
<p>If you have PL2303s there is a way to convert them to 3.3Vdc. You have to cut or lift pin 4 of the PL2303 and solder the pin to 3.3Vdc. I haven't tried it yet as my eyes are pretty bad and have to use a magnifier to see. By the way, I bought 3 FTDI232 modules and they couldn't complete a flash download ESP8266. </p><p>Right now I'm having some trouble with ESP-03s, I can flash v9.52 but they won't respond to AT commands.</p><p>LOG</p>
<p>Yes, it is.</p><p>LOG</p>
<p>Props for a very thoroughly and comprehensively written 'ible! </p>

About This Instructable




Bio: Lazy Old Geek
More by msuzuki777:Senior Moments Weather Station 5 IP Time Clock Part 2 
Add instructable to: