#534 ESP-12 Programming
The basics of programming an ESP-12 with the ESP8266 core for Arduino.
Here’s a quick demo..
Notes
I bought some ESP-12E ESP8266 modules a while back, along with some adapter boards but they’ve been sitting in a drawer ever since. Time to crack them open!
These notes cover the basics of programming the devices with ESP8266 core for Arduino, using the Arduino IDE.
ESP-12 Features
- 20 active pins
- GPIO 0-15 all have a built-in pull-up resistor, just like in an Arduino.
- GPIO16 has a built-in pull-down resistor.
- GPIO2 has a built-in LED (may be on GPIO1 on other boards)
- 4Mib flash
- Requires 3.3V supply
- PCB trace antenna
Construction
I’m using a breadboard layout with:
- the ESP-12 on an adapter board
- separate 3.3V power supply for the ESP
- CH340 USB to TTL adapter
- level-shifter for 5V signals to/from the USB to TTL adapter
Demo Sketch
The ESP12Programming.ino sketch is a simple demonstration of GPIO input and output:
- button press (GPIO13)
- sequences output on GPIO 2, 4, 5, 12, 14, 16.
An LED bargraph module is used for display of the GPIO output.
Programming with ESP8266 core for Arduino
My selected settings in the Arduino IDE:
The adapter boards have fixed pull-up/down resistors included:
- 10kΩ pull-down on GPIO15
- 10kΩ pull-up on CH_PD
Externally (on the breadboard):
- 10kΩ pull-up on RESET (with pushbotton to pull-down)
- 10kΩ on GPIO0 (switchable as pullup/pull-down)
Programming mode is engaged by:
- set GPIO0 to pull-down
- toggle reset
Run mode is engaged by:
- set GPIO0 to pull-up
- toggle reset
Compile and push the code with the Arduino IDE:
Credits and References
- ESP-12E - aliexpress seller
- ESP-7/12 adapter boards - aliexpress seller
- ESP8266 Arduino Core - boards doc
- ESP-01/07/12 Series Modules User’s Manual
- Simple Arduino Web Server on ESP-07/ESP-12 Tutorial
- Ai-Thinker modules