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
- To flash your ESP8266 module, first check that the GPIO0 pin on the ESP8266 is connected to the FLASH button on the breadboard.
- 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.
- Open the attached Arduino project and replace the SSID and PASSWORD at the top with your WiFi-network info
- Open your serial monitor (ctrl+shift+m), set the baud rate to 115200, and the line formatting option to "Both NL & CR"
- 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.
- Now, compile and upload code (see video for procedure and expected results).
- 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).