Вы находитесь на странице: 1из 8

instructables

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

by Tstef

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.

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


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)

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:

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


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.

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


Step 2: Open Arduino IDE and the Serial Monitor

You should now be all set to communicate with your 115200 as the baud rate. You should also have "Both
ESP through the Arduino UNO from the Serial NL & CR" selected.
Monitor.
Make sure all the connections from the previous step
All my ESPs have come preloaded with the AT are correct -- we're aiming for basic operation here,
commands library. That being said, there are people not flashing, so GPIO0 should be pulled high or left
out there saying that their ESPs came with nothing on disconnected.
them initially and that they had to flash one firmware
or another. We'll find out either way in this step Reset/reboot the ESP module. If everything is in
order, in the serial monitor you should see some
Open the Arduino IDE, select the Port to which your mumbo-jumbo characters at first followed by "ready".
Arduino UNO is connected and then open the Serial If it shows this, you're ready to test a few commands
Monitor. so proceed to the next step.

In the bottom-right corner of the Serial Monitor select

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


Step 3: AT Commands

Now we're ready to type a few commands in the MAC address of the ESP.
serial monitor. Just type the desired command
AT+CWMODE= sets the wifi mode. Reset with
Here's a list of the most common commands used. AT+RST after changing wifi mode.

AT check if the module is connected properly and its AT+CWMODE? will tell you which wifi mode the
functioning, the module will reply with an module is set to. 1 is STATION (used to connect to
acknowledgment. other networks, this is what you use to measure
AT+RST reset the wifi module. It's good practice to sensor data and send it to a website), 2 is Access
reset it before or after it has been programmed. Point (a wifi network in itself), and 3 is a hybrid
STATION-ACCESS POINT.
AT+GMR list the firmware version installed on the
ESP8266. If you want to go more in-depth with AT commands,
here is the official documentation with all the possible
AT+CWLAP detect the Access points (wifi networks) AT instructions. And just in case they decide to move
available in the area and their signal strengths. LAP it, I've attached the 2016 document below.
means List Access Points
-------------------------------------
AT+CWJAP=”SSID”,”PASSWORD” connects the
ESP8266 to the specified SSID in the AT command In the next tutorial, we'll see how we can use this
mentioned in the previous code. JAP means Join setup to flash firmware to the ESP-12E with the ESP
Access Point Flash Tool 2.4.

AT+CWJAP="","" disconnect from all access points WORK IN PROGRESS, LEAVE COMMENTS SO
WE CAN IMPROVE IT TOGETHER
AT+CIFSR display the obtained IP address and the

Download
https://www.instructables.com/ORIG/FIU/AIG9/IYKFWLSC/FIUAIG9IYKFWLSC.pdf

Done :)

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.
ESP-12E (ESP8266) With Arduino Uno: Getting Connected: Page 5
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.
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.
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?
Hmmm, I'm not sure. Does the blue LED on the ESP flash when you connect it?

Yes, it does.

Same problem here. not working for me

great job! works like a charm :)

Excellent tutorial!
Follow every step what is saying, and everything will work!
Thank you very much!
Thank you, happy making!

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 :)
The button terminals work across the gap. The two on the upper side and the two on the lower side
of the breadboard are always connected together. When you press the button, that connects the
two sides. So whether the connection is made diagonally or not, it should work.
Does it work with esp-07

It should, yss.

hi.thanks for this amazing tutorial.i was wondering what program do u use to make the picture in
step1???
It's called Fritzing and it's free and open-source. Check it out.

Hello, thank you for the tutorial! I need some help, the esp blinks when i power it and reset it but i
dont get anything in the monitor. I tried different baud rates but nothing prints. Any suggestions?
Is there a tutorial for uploading sketch using this connection , thank you

thanks a lot for this instructables.


i ve a question :
can i use the same connections as shown in Step 1 ?
knowing that i have ESP-12F and an Arduino UNO R3 (see the picture)

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


Yes, same connections.

thank's for the answer again,


it's been a while since I loged in to instructables.
I was very busy with my study.
picture:
https://i.ebayimg.com/images/g/aF4AAOSwoydWsmLD/s-l300.jpg
Thanks for the awesome tut. I am able to send the AT commands through the serial monitor, but I
cant upload my sketch. How can I upload my sketch to esp-12e and how to communicate with
arduino?
ok I got it. I have to press reset and flash to flash some skatches to esp 8266

i made the connections as above,initially its worked properly


but some time later i cant send AT comd and whn i reseting serial moritor showing garbage valule
what may be the fault i checked mor
pls help me its urgent
Try connecting a 100nF capacitor between the VCC and GND pads of the ESP module (as close
to the pads as possible). Also, try changing the baud rate to 57600 or 76800 and look for error
codes when the ESP resets. These are debug baud rates.
Thank you for the tutorial! Very interesting. This setup works for me with Arduino Uno as
described: can use Serial Monitor and send AT command. But would ask for the advise on how to
flash ESP with CH340G. With the same setup I cannot connect to ESP and send any AT
commands in Serial Monitor. And upload does not work either: ESP blinks but ends with a
standard error: "error: espcomm_open failed".
You mentioned that you were able successfully flash ESP with TTL adapter. Can you please post
the instruction on how to do it right?
Unfortunately, I don't have any experience with the CH340G chip. I was using an FT232RL adapter
(like in the image). The connections were as follows:

ESP...FT232RL
---------------------
RX...TX
TX...RX

Pull both GND to a common ground (battery/source negative).


GPIO0 (zero) on the ESP needs to be pulled to GND (if you see flashing on the ESP but you get
the connection error it might be because GPIO0 is not pulled to GND).

Oh, and the FT232RL supports both 3.3 and 5V logic -- so if you still have issues with the
CH340G, maybe it's because you're trying to work with 3.3V logic on 5V. Sometimes there's a
jumper or a switch where you can change this.

As this is mean't to be for beginners, you should add photo's of the actual board's you're using and
connectivity, because if you're using the ESP v12E *DEV* board, it supports 5V for Vin.

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


Normally I would put actual pictures but in this case I don't think they would add any value to the
tutorial -- the module is fairly tiny and all those wires would get very confusing. Not to mention that I
don't have a camera that would take a good picture, especially not better than the diagram.
Thanks alot, it really worked.
One question, can i replace arduino with CH340G.
Second thing is, I am able to run AT commands but unable to flash a sketch using Arduino IDE, do
i have keep the flash button pressed while flasing or just press it once.
I think I misunderstood your first question. Did you mean Arduino clones with CH340G instead of
an FTDI chip? If yes, then yes, you should have no issues replacing it -- just be sure to have the
appropriate drivers installed.
Flashing sketches is a whole other can of worms. I've uploaded sketches straight to the ESP via
an FT232RL module (https://www.aliexpress.com/item/Free-Shipping-FT23...
I know it's possible to do it through an Arduino Uno. Have a look here:
https://arduino.stackexchange.com/questions/26709/...
It looks like you need to use the SoftwareSerial library.
Then what you do before uploading the sketch is this chicken dance: (1) hold down the FLASH
button (don't let go :P), (2) while holding FLASH, press and release the RESET button, (3) release
the FLASH button, (4) upload sketch.
Thanks for sharing! I'm rather new in ESP8266. I follow the steps but the mumbo-jumpo characters
in serial monitor don't be followed by "ready". Is this an indication that the AT command library isn't
preloaded in my ESP?
Do the mumbo-jumbo characters stop printing at some point?

I would start by making sure that the baud rate is 115200. If that doesn't work, try 9600 as well.
Also try, 57600 or 76800, these are the debugging baud rates -- you should be able to get some
legible info from this. This is where it'll tell you if your module is running intro some kind of error.

Let me know what happens.


Thanks

Thanks for sharing :)

You're welcome. Hope it helps.

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

Вам также может понравиться