Arduino UNO + ESP8266 WiFi Module

66K2738

Intro: Arduino UNO + ESP8266 WiFi Module

This instructable will show you how to connect an ESP8266 WiFi Module to an Arduino UNO.

EDIT: For info on how to install the ESP8266 library, see here.

STEP 1: Wiring

Wire the ESP8266 Module, the Arduino UNO, and the breadboard as seen in the image.

When complete the pins should be connected as follows (ESP8266 pin-out is shown for reference):

  • ESP8266 TX --> Arduino UNO TX
  • ESP8266 GND --> Breadboard GND
  • ESP8266 CH-PD --> Breadboard 3.3V
  • ESP8266 GPIO2 --> Breadboard LED
  • ESP8266 RST --> Breadboard RST button --> Arduino UNO GND
  • ESP8266 GPIO0 --> Breadboard 3.3V/Breadboard FLASH button --> Arduino UNO GND
  • ESP8266 VCC --> Breadboard 3.3V
  • ESP8266 RX --> Arduino UNO RX

STEP 2: Flashing

  1. To flash your ESP8266 module, first check that the GPIO0 pin on the ESP8266 is connected to the FLASH button on the breadboard.
  2. If there is a program currently running on your Arduino, upload an empty project file to the Arduino to avoid interference while flashing WiFi module.
  3. Open the attached Arduino project and replace the SSID and PASSWORD at the top with your WiFi-network info
  4. Open your serial monitor (ctrl+shift+m), set the baud rate to 115200, and the line formatting option to "Both NL & CR"
  5. Press the RST button while holding down the FLASH button on the breadboard - you should see a blue light on the Wi-Fi module and the TX led on the Arduino will light up. You must upload code while the TX led is lit.
  6. Now, compile and upload code (see video for procedure and expected results).
  7. Record the IP printed in the serial monitor for use in step 3. If the flash fails try the above steps again. If the serial monitor is printing "." repeatedly, you have entered your WiFi information incorrectly.

Note: the RST button connects the RST pin on the Wi-Fi module to ground. The FLASH button connects the GPIO0 pin on the Wi-Fi module to ground.

STEP 3: Usage

Now, for normal operation, connect GPIO0 to the 3.3V rail on the breadboard. This can be done by moving the wire connecting GPIO0 to the button over to the positive rail of the breadboard.

To connect to your ESP8266 module, ensure you are connected to the same network as it is, and go to the IP address from step 2 in your browser. Alternatively, connect directly to the ESP8266's WiFi network on your laptop and navigate to IP 192.168.4.1 in your browser (in my experience this is far less reliable, using a shared network is preferred).

20 Comments

Where can I find the ESP8266WIFI library? Could you give a link to .zip file for the library?

I have a few of those programing devices, what I did to make a flash switch was to solder a couple of long header pins to the bottom and bend them so I could place a jumper on them if I wanted to flash. Makes for a quick modification, I had to use a 3 pin header and pull the middle pin, then bend them inward so they fit both the proper location on the board and allowed for the jumper.
the tx light is not lighting up? please help
Hello I am new to WiFi and UNO and I like to know how things work. In order to be able to change it and make it behave the way I like.
I do not understand step 5 of the flashing :
Press the RST button while holding down the FLASH button on the
breadboard - you should see a blue light on the Wi-Fi module and the TX
led on the Arduino will light up. You must upload code while the TX led
is lit.
Is this the right sequence: ?
press and hold flash button (On)
then press the reset button (On)
Release the Restet button (Off)
wait for the Arduino to program over USBasp and to finish the programming and verification.
Then release the flash button (Off).
I have had a working led on/ led of html page and UNO, but I do not know how It happend and why. After loading Blink to the ardunio UNO the WiFi dit not work on the Serial monitor nor on the wifi html page.
I like to know how to make the UNO send a lightintencity value from de ADC A0 to the ESP8266 over WiFi to a phone with P2P wifi connection each 1ms.
Can someone please share this knowledge here? Or maybe you know a place to look for further information about this kind of topics.
Thanks in advance.
Peter

it worked fine for the first couple of minutes, but lost control after. Did I do something wrong?
sounds like your wifi connection is dropping! the script i provided will not attempt a reconnect after a dropped connection, but you could pretty easily add in some logic for that in the loop(). i'd do a little googling to see what functionality the esp8266 package offers and add a check/reconnect step!
I'll try that, thank you!
everything is fine , I upload the program successfully. but serial monitor is not showing anything.
Faced the same issue; ensure that you start the serial monitor before the code is completely uploaded.
Did you make sure your baudrate and line endings are set properly? (See step 2, part 4)
Ive got the same issue, no serial monitor, double checked connection, baudrate and the other setting are fine aswell
how should I resolve the following error


Arduino: 1.8.9 (Windows 10), Board: "Generic ESP8266 Module, 80 MHz, Flash, Disabled, All SSL ciphers (most compatible), ck, 26 MHz, 40MHz, DOUT (compatible), 512K (no SPIFFS), 2, nonos-sdk 2.2.1 (legacy), v2 Lower Memory, Disabled, None, Only Sketch, 115200"
Sketch uses 274872 bytes (55%) of program storage space. Maximum is 499696 bytes.
Global variables use 27184 bytes (33%) of dynamic memory, leaving 54736 bytes for local variables. Maximum is 81920 bytes.
esptool.py v2.6
2.6
esptool.py v2.6
Serial port COM5
Connecting........_____....._____....._____....._____....._____....._____.....____Traceback (most recent call last):
File "C:\Users\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.1/tools/upload.py", line 25, in
esptool.main(fakeargs)
File "C:/Users/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.5.1/tools/esptool\esptool.py", line 2653, in main
esp.connect(args.before)
File "C:/Users/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.5.1/tools/esptool\esptool.py", line 468, in connect
raise FatalError('Failed to connect to %s: %s' % (self.CHIP_NAME, last_error))
esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header
_
the selected serial port _
does not exist or your board is not connected
Invalid library found in C:\Users\Documents\Arduino\libraries\Arduino-master: no headers files (.h) found in C:\Users\Documents\Arduino\libraries\Arduino-master
Invalid library found in C:\Users\Documents\Arduino\libraries\Arduino-master: no headers files (.h) found in C:\Users\Documents\Arduino\libraries\Arduino-master
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
I haven't done this installation in quite a while now, and no longer have access to the hardware to test, but that error message looks like an issue with the library you installed. Did you install via the link in the guide? You should also make sure nothing else is running on the board when flashing, you can do that by flashing an empty project to the board (another program using the pins required for flashing would interrupt the process).
I need ESP8266WIFI.h library. I am getting error that esp8266wifi.h - No such library is found
Added a link at the top of the guide with instructions!
I need ESP8266WIFI library.

Hi there, I've problem, when I try to upload sketch to board, it showing error compiling? how to solve it? thanks a lot for help.

Nice project.successfully done uploading

Thanks for sharing :)