Arduino UNO + ESP8266 WiFi Module

41,588

21

17

Introduction: 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).

3 People Made This Project!

Recommendations

  • Puzzles Speed Challenge

    Puzzles Speed Challenge
  • "Can't Touch This" Family Contest

    "Can't Touch This" Family Contest
  • CNC Contest 2020

    CNC Contest 2020

17 Discussions

0
PeterAC
PeterAC

Question 2 months ago on Step 2

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

0
BinY2
BinY2

2 months ago

it worked fine for the first couple of minutes, but lost control after. Did I do something wrong?

0
JaiS45
JaiS45

Reply 2 months ago

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!

0
BinY2
BinY2

Reply 2 months ago

I'll try that, thank you!

0
hkathait1
hkathait1

Question 1 year ago on Step 3

everything is fine , I upload the program successfully. but serial monitor is not showing anything.

Screenshot from 2019-07-10 10-46-32.png
0
AkshayaS13
AkshayaS13

Answer 7 months ago

Faced the same issue; ensure that you start the serial monitor before the code is completely uploaded.

0
JaiS45
JaiS45

Answer 1 year ago

Did you make sure your baudrate and line endings are set properly? (See step 2, part 4)

0
ChrissyP11
ChrissyP11

Reply 1 year ago

Ive got the same issue, no serial monitor, double checked connection, baudrate and the other setting are fine aswell

0
SharadD3
SharadD3

Question 1 year ago on Step 2

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.

Capture2.JPG
0
JaiS45
JaiS45

Answer 1 year ago

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).

1
Rutuja95
Rutuja95

1 year ago

I need ESP8266WIFI.h library. I am getting error that esp8266wifi.h - No such library is found

0
JaiS45
JaiS45

Reply 1 year ago

Added a link at the top of the guide with instructions!

0
bivekgris
bivekgris

1 year ago

I need ESP8266WIFI library.

0
AliebiL
AliebiL

Question 2 years ago

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.

Screenshot (10).png
0
tpaulraj
tpaulraj

2 years ago

Nice project.successfully done uploading

1
Shuvagata
Shuvagata

2 years ago

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

0
Swansong
Swansong

2 years ago

Thanks for sharing :)