ESP-12E (ESP8266) With Arduino Uno: Getting Connected

73,087

38

48

WORK IN PROGRESS, LEAVE COMMENTS SO WE CAN IMPROVE IT TOGETHER

This tutorial is the first of three parts meant for people who want to connect their ESP8266 through an Arduino UNO board. More specifically, I will be using the ESP-12E version of these wifi modules.

I personally had a lot of trouble when I started exploring ESP8266 boards. There is a lot of information out there but parsing through it is quite daunting for a beginner and I never found a tutorial to my liking on how to use them with Arduino Uno. I therefore decided to create my own tutorial with the knowledge I gathered from endless hours of looking on sites, blogs, forums, etc. so others don't have to go through the same tedious process.

Here's what the different parts will cover:

  1. How to connect the ESP-12E to the UNO for basic operation and serial communication;
  2. How to flash new firmware to the module;
  3. How to upload your own sketches to your ESP-12E.

I'm assuming you already have some sort of breakout board for your module or a way to attach wires to the different pins. This series of tutorials will not cover how to build a breakout board. ankitdaf has a good tutorial on this subject HERE -- I'm using something very similar to his build.

I'm also not going to cover installing the Arduino IDE since you probably have it installed if you have an UNO. Here's the official link in case you don't have it.

Let me tell you from the start, THIS CONFIGURATION WORKS! I have used it successfully for a while now and it hasn't let me down (no resets or anything).

What you'll need:

  • Arduino UNO board
  • ESP-12E module (have not tested this on other versions but it might work, give it a try)
  • 3.3V power source, don't use Arduino 3.3V pin
    • I'm using a 5V USB phone charger and a step-down voltage converter
    • use something that's capable of providing at least 500mA just to be sure as some people have been noticing spikes of up to 420mA in ESP modules
    • EDIT: I'm actually using mine just under 3.6V and it seems to perform better than it did at 3.3V.
  • jumper wires
  • 4 x 10kΩ resistors
  • a breadboard
  • 2 push buttons (optional but recommended for ease of use)
  • a 470uF capacitor (optional but recommended for stability)

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Make the Connections

Start with the diagram and refer to the description below if something is not clear.

Here's a nice, large diagram that hasn't been compressed if you need it: WIRING DIAGRAM.

WARNING: Again, do not use the 3.3V pin on the Arduino UNO to power your ESP module. The ESP draws more current than the 3.3V pin can provide.

-------------------------------------------------------------

FROM POWER SOURCE TO BREADBOARD:

+3.3V to positive rail of breadboard

GND/Negative to negative rail of breadboard

There is also a 470μF capacitor connected between the positive and negative rails of the breadboard. This is a polarized capacitor so be careful with the wiring: the side with the stripe usually indicates the negative pole, so connect this to the negative rail and the other to the positive rail.

-------------------------------------------------------------

FROM ESP TO BREADBOARD:

VCC to positive rail of breadboard

GND to negative rail of breadboard

EN (or CH_PD) pulled high (to 3.3V) with a 10kΩ resistor

RST normally pulled high with a 10kΩ resistor but connected to GND when "RESET" button is pushed

GPIO15 pulled down (to GND) with a 10kΩ resistor

GPIO0:

  • Normal operation: pulled high with 10kΩ resistor OR floating (not connected to anything)
  • Flashing/uploading: Connected to GND when "FLASH" button is pushed

If you don't want to use the buttons:

  • RST should be pulled high; manually connect-and-disconnect to GND when a reset of the ESP is required; alternative: leave RST pulled high and power off/on the ESP by disconnecting and reconnecting the VCC line
  • GPIO0 should not be connected to anything for normal operation but manually connect it to GND when you want to flash firmware or upload sketches

-------------------------------------------------------------

FROM ESP TO ARDUINO:

TX on ESP to TX pin on Arduino (pin #1)

RX on ESP to RX pin on Arduino (pin #0)

-------------------------------------------------------------

ON ARDUINO

RESET pin must be connected to GND pin (this disables board resetting on serial com initialization in Arduino)

-------------------------------------------------------------

If you've connected everything correctly, you should at least see the blue LED on the ESP flash when you reset/reboot it.

Step 2: Open Arduino IDE and the Serial Monitor

You should now be all set to communicate with your ESP through the Arduino UNO from the Serial Monitor.

All my ESPs have come preloaded with the AT commands library. That being said, there are people out there saying that their ESPs came with nothing on them initially and that they had to flash one firmware or another. We'll find out either way in this step

Open the Arduino IDE, select the Port to which your Arduino UNO is connected and then open the Serial Monitor.

In the bottom-right corner of the Serial Monitor select 115200 as the baud rate. You should also have "Both NL & CR" selected.

Make sure all the connections from the previous step are correct -- we're aiming for basic operation here, not flashing, so GPIO0 should be pulled high or left disconnected.

Reset/reboot the ESP module. If everything is in order, in the serial monitor you should see some mumbo-jumbo characters at first followed by "ready". If it shows this, you're ready to test a few commands so proceed to the next step.

Step 3: AT Commands

Now we're ready to type a few commands in the serial monitor. Just type the desired command

Here's a list of the most common commands used.

AT check if the module is connected properly and its functioning, the module will reply with an acknowledgment.
AT+RST reset the wifi module. It's good practice to reset it before or after it has been programmed.

AT+GMR list the firmware version installed on the ESP8266.

AT+CWLAP detect the Access points (wifi networks) available in the area and their signal strengths. LAP means List Access Points

AT+CWJAP=”SSID”,”PASSWORD connects the ESP8266 to the specified SSID in the AT command mentioned in the previous code. JAP means Join Access Point

AT+CWJAP="","" disconnect from all access points

AT+CIFSR display the obtained IP address and the MAC address of the ESP.

AT+CWMODE= sets the wifi mode. Reset with AT+RST after changing wifi mode.

AT+CWMODE? will tell you which wifi mode the module is set to. 1 is STATION (used to connect to other networks, this is what you use to measure sensor data and send it to a website), 2 is Access Point (a wifi network in itself), and 3 is a hybrid STATION-ACCESS POINT.

If you want to go more in-depth with AT commands, here is the official documentation with all the possible AT instructions. And just in case they decide to move it, I've attached the 2016 document below.

-------------------------------------

In the next tutorial, we'll see how we can use this setup to flash firmware to the ESP-12E with the ESP Flash Tool 2.4.

WORK IN PROGRESS, LEAVE COMMENTS SO WE CAN IMPROVE IT TOGETHER

2 People Made This Project!

Recommendations

  • Indoor Lighting Contest

    Indoor Lighting Contest
  • Make It Fly Challenge

    Make It Fly Challenge
  • Growing Beyond Earth Maker Contest

    Growing Beyond Earth Maker Contest

48 Discussions

0
None
m.saadlala

24 days ago

should i leave Atmel ATmega328p in arduinoUno board or i have to take it out from arduino bourd

0
None
m.saadlala

24 days ago

hi,
i use esp adapter on which i sold my esp8266 12e Ai thinker should i follow the same method or i need something else to do ?

0
None
lberntzon

4 months ago on Step 3

I could never make it work by wiring the RX directly together. It seems the ESP is very sensitive for over voltage on that pin. Using a voltage divider like: Arduino RX -> 5.6K -> 3.3K -> GND. The ESP RX is then connected to the middle point of the resistors.

0
None
Satyaranjan Sahoo

4 months ago

after connecting you will never able to upload a new program until the RX ,TX pins are connected .

1 reply
0
None
TstefSatyaranjan Sahoo

Reply 4 months ago

That is correct. Uploading sketches to the ESP should be a whole, separate tutorial. This is just to get the ESP connected to the Arduino, being able to send AT commands.

0
None
medalaechn

10 months ago

Hi, thank you, it's very helpful. I followed the steps, I got the mumbo-jumbo characters and "ready" in my serial monitor, but after that, the AT commands don't work for me ie when I send AT I get no respond just an empty screen.

2 replies
0
None
Tstefmedalaechn

Reply 10 months ago

Hmm, sounds to me like the AT firmware wasn't flashed on the chip. You can get it from the espressif website. Or just do a quick google search for "flash AT firmware". From what I remember, it was pretty easy to do.

0
None
medalaechnTstef

Reply 10 months ago

Thank you for your reply, I actually did some researches and found that the expression "ready" means that the esp is ready to receive AT commands, then I thought that the problem could come from my Arduino, so I used an FTDI board instead and it worked and my esp could respond to AT commands... I still have to figure out why my Arduino didn't work, I think I'm gonna use another Arduino and see what will happen.

0
None
Maley X

Question 1 year ago

Hello, thank you very much for the post. Great!!! But, until step AT + GMR everything OK, then nothing else, do not find the SSID or anything else. You help me??? Thank you very much

1 answer
0
None
mkr.krajewskiMaley X

Answer 11 months ago

try switching to station mode before searching for networks: AT+CWMODE=1

and then reset with AT+RST, then it should find networks and be able to connect

1
None
GobiN4

1 year ago

I made the connections as above, but my serial monitor doesn't display any jumbo characters once the RST is pressed.I am using Ai thinker esp 12e board.What may be the fault?

3 replies
0
None
TstefGobiN4

Reply 1 year ago

Hmmm, I'm not sure. Does the blue LED on the ESP flash when you connect it?

0
None
askoutaris

1 year ago

Excellent tutorial!

Follow every step what is saying, and everything will work!

Thank you very much!

1 reply
0
None
stefanied

1 year ago

At first it never uploaded so i moved the negative wire on the flash tactile button to the other leg as the way they work is diaogaly, as soon as i did that i had no trouble uploading, i tried so many tutorials and was about to give up, then i found this one and it worked :)