ESP8266 Arduino

From ElectroDragon
(Redirected from ESP8266 arduino setup)
Jump to: navigation, search

Install in Arduino IDE


Esp8266 arduino selection.png

Supported Board - Choose correct board

  • Adafruit HUZZAH ESP8266 (ESP-12)
  • NodeMCU 0.9
  • NodeMCU 1.0
  • Olimex MOD-WIFI-ESP8266-DEV
  • Olimex MOD-WIFI-ESP8266
  • SparkFun ESP8266 Thing
  • SweetPea ESP-210
  • Generic ESP8266 modules

Board Config

Board CPU frequency Flash frequency Flash size upload speed Flash mode Debug mode / level Reset method
ESP-12F, ESP-12S 80mhz 40mhz 4M (3M SPIFFS) 921600 DIO Disable / none nodemcu


  • enter into bootloader mode of the board first

Code Examples

Default arduino sketch

  • WifiScan - find close by wifi spot
  • WifiClient - connect to wifi
  • Wifiwebserver - build a simple web server
http://server_ip/gpio/0 - address to set gpio 2 to low
http://server_ip/gpio/1 - address to set gpio 2 to high

Other sketch - 1 - ESP8266-Arduino via serial, control GPIO

Other sketch - ESP8266-Arduino via serial, send TCP data

  • Connect WIFI, Send Data
  • In this case, the wifi module still connect to hardware serial (software serial port can not higher than 19200 baud rate), and another software serial port should be created on arduino and print out via another serial port
  • So the connection should be
Wifi's uart to arduino hardware uart; 
arduino's software UART to another serial port device, for example like FTDI basic, CP2102 breakout, etc, and this serial port device can connect to PC to read data

Demo code - [[* More esp8266 arduino library, demo code find on our github|D1 Mini example code]]

Arduino Serial Extension Shield Configuration

  • Flash -> ON | OFF -> Set flash mode, flash LED will turn on
  • Arduino Serial -> D1/D0 | D3/D2 - Arduino serial switch between softserial or hardware serial
  • Serial Switch -> Arduino or standalone output

Common Used Arduino ESP8266 Library

Library Description
ESP8266 Arduino Main
Arduino Wifi-Manager easy config esp8266 board to your wifi
FS FS esp8266 file system
PubSubClient MQTT client
Ticker run like RTOS task
RemoteDebug debug via telnet, easy for high power project for example
ESP8266 Multicast DNS DNS resolving
ESP8266WebServer web server
ESP8266HTTPUpdateServer ESP OTA update via HTTP more information