In this tutorial we will show how to program ESP8266 directly in Arduino IDE. That's how we will get Arduino simplicity and power of ESP8266. In tihs case we do not need Arduino, just ESP8266 module. For start we will create blink example.
We can program ESP8266 native code or use ESP8266 NodeMCU. But there is better way. Recently there was released ESP8266 Arduino IDE. Thanks to guys behind this great work.
EDIT: updated manual is available at Arduino ESP8266 IDE.
|ESP8266 ESP-01 Serial WIFI Wireless Transceiver Module|
|ESP8266 ESP-03 Serial WIFI Wireless Transceiver Module|
|ESP8266 ESP-12 Serial WIFI Wireless Transceiver Module|
|ESP8266 ESP-05 Serial WIFI Wireless Transceiver Module|
|ESP8266 ESP-07 Serial WIFI Wireless Transceiver Module|
-FT232RL FTDI USB to TTL Serial Adapter
|FT232RL FTDI USB to TTL Serial Adapter 5V, 3.3V|
|400X 0.25w 1/4w Metal Film Resistor Pack Kit 1% 20 Value Each 20 Pcs 10 ~ 1M ohm|
|100PCS 3mm Red Round LED Bright Light-Emitting Diodes|
First we download ESP8266 Arduino IDE. Latest version can be found on GitHub. Just download latest version and unpack it in Arduino ESP folder on your computer. Run Arduino.exe. Before we start programming we connect ESP8266 module to our computer. Connection is similar as if update firmware on ESP8266. For programming we need need FT232RL FTDI USB to TTL Serial+Adapter. Set FTDI programmer to 3.3V. See buying guide for details.
Warning: Some versions of FT232 USB serial adapters do not provide enough current for ESP8266. In this case use external 3.3V power supply connected to ESP8266 only.
Next we need to change some settings in Arduino IDE. Select right COM port (Tools->Port), set programmer (Tools->Programmer->esptool)
and board (Tools->Board->Generic ESP8266 board).
Now we can load program. Basically this is standard Blink example program. Because we will use ESP8266 instead of Arduino we change pin number in standard program. Replace pin 13 with pin 2 which is PIN02 in ESP8266 GPIO.
Here is modified program. It can be also downloaded on GitHub.
When you modify program just press upload button. If everything is correct program will compile and upload to ESP8266 module. After you finish programming disconnect GND wire on GPIO0.
To see our blink example working connect LED and 1K resistor to GPIO2 pin. On picture below VCC connection to CH_PD is missing - add also this wire.
In next post we will show how to build sensor with Arduino IDE.
See more tutorials at http://iot-playground.com/build
To support this site and EasyIoT framework development please buy in our store.