Wiring an ESP8266
This is a practical guide to wiring up an ESP8266 and implementing the subsequent initialization sequence. A lot of people talk about using libraries to control their friendly Wifi peripherals, but what if you just want to send some serial commands and be done with it? Well, this guide is for you! I can confirm the following sequence has worked for me in real-world projects. Let us suppose you have a microcontroller and it is equipped with some standard serial and digital IO pins.
Wiring Guide
Wiring it up is pretty straightforward. We need access to the EN
and RST
pins, so configure those against some digital IO ports. Then hook up the serial communnication and supply power/ground.
TX -> RX
RX -> TX
RST -> D1
EN -> D2
GND -> GND
Initialization
Now let's talk about the power-on initialization sequence.
setup() {
// Configure pins
pinMode(D1, OUTPUT);
pinMode(D2, OUTPUT);
// Enable module
digitalWrite(D2, LOW);
digitalWrite(D2, HIGH);
// Reset module
digitalWrite(D1, LOW);
digitalWrite(D1, HIGH);
// Appease watchdog
pinMode(D1, INPUT);
}
The gist of the code above is this:
- Pull the
EN
pin LOW then HIGH - Pull the
RST
pin LOW then HIGH - Finally, release the
RST
pin by making it an input, thus causing it to float.
You are now ready to send commands to the ESP8266!