Arduino Full Stack
  • Preface
  • Part 1 - Introduction
  • Chapter 1. Getting Started with Arduino
    • 1.1 Arduino UNO R3
    • 1.2 LVR Arduino Exntesion Board
    • 1.3 Sensor Kits for Arduino
    • 1.4 Race Car Chassis Model
    • 1.5 Arduino Online Resource
    • 1.6 Arduino IDE for Prototyping
    • 1.7 FIRST Arduino Project - Hello World
  • Chapter 2. Programming Grammar
    • 2.1 AVR C
    • 2.2 Digital IO
    • 2.3 Analog IO
    • 2.4 More About IO
    • 2.5 Time Functions
    • 2.6 Interrupt Functions
    • 2.7 Communication Classes
    • 2.8 Arduino Libraries
  • Part 2 - Sensors
  • Chapter 3. LED Sensors
    • 3.1 LED Blinking
    • 3.2 LED SMD RGB
    • 3.3 Mini LED Red Green GND-Shared
    • 3.4 LED RGB GND-Shared
    • 3.5 Photoresistor
    • 3.6 LED Light Cup
    • 3.7 LED Red Green GND-Shared
    • 3.8 LED 7 Colors
  • Chapter 4. Infrared Sensors
    • 4.1 Infrared Emitter and Receiver
    • 4.2 Laser Emitter
    • 4.3 Infrared Remote Control
    • 4.4 IR Obstacle Avoidance
    • 4.5 IR Line Tracking
  • Chapter 5. Audio Sensors
    • 5.1 Passive Buzzer
    • 5.2 Active Buzzer
    • 5.3 Microphone Big Sound
    • 5.4 Microphone
  • Chapter 6. Magnetic Sensors
    • 6.1 Hall Magnetic Sensor
    • 6.2 Mini Reed
    • 6.3 Linear Hall Magnetic Sensor
    • 6.4 Reed
    • 6.5 Analog Hall
  • Chapter 7. Touch Sensors
    • 7.1 Tap Sensor
    • 7.2 Shock Sensor
    • 7.3 Touch Sensor
  • Chapter 8. Thermist Sensors
    • 8.1 Temperature Sensor - DS18B20
    • 8.2 Analog Thermister
    • 8.3 Digital Temperature
    • 8.4 Temperature and Humidity Sensor
  • Chapter 9. Switches
    • 9.1 Button
    • 9.2 Switch -Mercury Tilt
    • 9.3 Switch - Ball
    • 9.4 Relay
  • Chapter 10. Other Sensors
    • 10.1 Joystick
    • 10.2 Flame
    • 10.3 Pulse Monitor
    • 10.4 Rotary Encoders
  • Chapter 11. More Discussions on Sensors
    • 11.1 Arducam
    • 11.2 IMU - BNO055
  • Part 3 - Motors
  • Chapter 12. Motors
    • 12.1 DC Motor
    • 12.2 AC Motor
    • 12.3 Stepper Motor
    • 12.4 Servo Motor
  • Part 4 - Display
  • Chapter 13. Display
    • 13.1 Nixie Light LG5011B
    • 13.2 Crystal Display 1602A
    • 13.3 Crystal Display 12864
  • Part 5 - Communication
  • Chapter 14. Communication
    • 14.1 Serial
    • 14.2 Wifi - ESP8266
    • 14.3 Bluetooth
    • 14.4 Integrate Wifi & Bluetooth - ESP32
  • Part 6 - Arduino Based Mini Automated Vehicle
  • Chapter 15. Assemble a Mini Automated Vehicle
    • 15.1 4-Wheel DC-Motor Driven
    • 15.2 Arduino UNO and LVR Arduino Extension Board
    • 15.3 Speed Sensors
    • 15.4 Servo Motor for Pan Tilt Control
    • 15.5 Tracking Sensor
  • Chapter 16. Remote Control
    • 16.1 IR Remote Control
    • 16.2 Bluetooth Remote Control
    • 16.3 Wifi Remote Control
    • 16.4 Automatic Control
Powered by GitBook
On this page
  • Option 1: Use ESP8266 With Arduino UNO R3
  • Hardware Wiring
  • Sketch
  • Mobile APPs
  • Option 2: Use ESP8266 without Arduino Board
  • Preparation
  • STEP 1 - Install Arduino Core for ESP8266
  • STEP 2 - Add Additional Boards Manager URLs
  • STEP 3 - Board Manager
  • STEP 4 - Sketch Upload ERROR
  • STEP 5 - Flash ESP8266
  • Option 3: Official Arduino Wifi Shield
  1. Chapter 14. Communication

14.2 Wifi - ESP8266

Previous14.1 SerialNext14.3 Bluetooth

Last updated 7 years ago

Option 1: Use ESP8266 With Arduino UNO R3

As in , an ESP8266 Wifi module has been connected to the virtual serial pin 10 and pin 11 on Arduino UNO. In this section, we'll talk about how to use this ESP8266 Wifi module a bit more.

Note: A lot of pictures in this section are directly cited from .

An ESP8266 wifi module is provided in our Arduino course on-site, which looks like:

And its pins are defined as:

Hardware Wiring

Sketch

Mobile APPs

Option 2: Use ESP8266 without Arduino Board

It is also possible to run the sketch on the ESP8266 program without using an Arduino UNO board, for ESP8266 comes with a MCU inside the module itself.

  • Students are encouraged to finish all examples after class.

Both websites adopt Arduino IDE to implement/verify/compile the sketch, and flash/download the binary code onto an ESP8266 via Arduino UNO R3 board. Let's just see how it goes.

Note: You do need a FD232RS as a proxy/bridge, which looks as follows:

Preparation

STEP 1 - Install Arduino Core for ESP8266

Note: Make sure you enabled python2, instead of python3.

$ cd /opt/arduino/hardware
$ mkdir esp8266com
$ cd esp8266com
$ git clone https://github.com/esp8266/Arduino.git esp8266
$ cd esp8266/tool6s
$ python get.py
Platform: x86_64-pc-linux-gnu
Tool esptool-0.4.9-linux64.tar.gz already downloaded
Extracting dist/esptool-0.4.9-linux64.tar.gz
Renaming esptool-0.4.9-linux64 to esptool
Tool linux64-xtensa-lx106-elf-gb404fb9.tar.gz already downloaded
Extracting dist/linux64-xtensa-lx106-elf-gb404fb9.tar.gz
Tool mkspiffs-0.1.2-linux64.tar.gz already downloaded
Extracting dist/mkspiffs-0.1.2-linux64.tar.gz
Renaming mkspiffs-0.1.2-linux64 to mkspiffs

STEP 2 - Add Additional Boards Manager URLs

STEP 3 - Board Manager

Then, restart Arduino IDE. Click Tools->Board->Board Manager, then we search esp, make sure Arduino AVR Boards and esp8266 are installed. Please refer to the following image:

Note: Without the installed Arduino AVR Boards, you will possibly meet the following ERROR message:

SPIFFS Not Supported on avr

Afterwards, we select Tools->Board->Generic ESP8266 Module.

STEP 4 - Sketch Upload ERROR

After we selected Board: "Generic ESP8266 Module", we are now trying to upload (after verify/compile) any sketch (here, the default EMPTY sketch for testing) to Arduino board with ESP8266 connected. You will see the following ERROR messages:

warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
SPIFFS Upload failed!

By clicking Tools->ESP8266 Sketch Data Upload, you will see the following dialog:

By clicking Yes, the same ERROR messages will be given as:

[SPIFFS] data   : /tmp/untitled321754874.tmp/sketch_mar24a/data
[SPIFFS] size   : 64
[SPIFFS] page   : 256
[SPIFFS] block  : 4096
[SPIFFS] upload : /tmp/arduino_build_782393/sketch_mar24a.spiffs.bin
[SPIFFS] address: 0x6B000
[SPIFFS] reset  : ck
[SPIFFS] port   : /dev/ttyACM0
[SPIFFS] speed  : 115200

warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
SPIFFS Upload failed!

STEP 5 - Flash ESP8266

  • Flash Mode: “DIO”

  • Flash Frequency: “40MHz”

  • CPU Frequency: “80 MHz”

  • Flash Size: “1M (64K SPIFFS)”

  • Debug Port: “Disabled”

  • Debug Level: “None”

  • Reset Method: “ck”

  • Upload Speed: “115200”

Option 3: Official Arduino Wifi Shield

You can also purchase an Arduino Wifi Shield recommended by official Arduino website(s), and accomplish Wifi communication. Please refer to the following official Arduino webpages:

We still use the same hardware wiring way as in to wire the Arduino UNO and ESP8266.

The same sketch in is also adopted here.

detailedly explained how to do that step by step. Three cannonical examples are given on :

You can also refer to .

In order to flash sketch onto ESP8266 via an Arduino board, we need to follow the steps on .

Start Arduino IDE, then click File->Preferences->Settings, fill into Additional Boards Manager URLs, as:

What is SPIFFS? For short, it is SPI Flash Filing System. For details, please refer to .

So, it seems we failed to flash our ESP8266 Wifi module. But, we have to do something. This website is just to solve this problem.

In fact, 4 different methods have been summarized in to fulfill the task how to flash ESP8266.

14.1 Serial
14.1 Serial
http://www.arduinesp.com/
http://www.arduinesp.com/examples
Blink
Wifiwebserver
Thingspeak Temperature Sensor
https://www.geekstips.com/esp8266-arduino-tutorial-iot-code-example/
https://github.com/esp8266/Arduino
http://arduino.esp8266.com/stable/package_esp8266com_index.json
http://www.instructables.com/id/Using-ESP8266-SPIFFS/
https://www.forward.com.au/pfod/ESP8266/GPIOpins/index.html
https://www.diyhobi.com/flash-program-esp-01-using-usb-serial-adapter/
https://store.arduino.cc/usa/arduino-wifi-shield
https://www.arduino.cc/en/Guide/ArduinoWiFiShield
https://www.arduino.cc/en/Tutorial/WiFiWebServer
https://www.arduino.cc/en/Reference/WiFi
14.1 Serial
https://www.geekstips.com/esp8266-arduino-tutorial-iot-code-example/
Espressif ESP8266
Espressif ESP8266 Pin Definitions
FTDI FT232RL USB to TTL Serial Adapter 3.3V/5V switch
Additional Boards Manager
Arduino ESP8266
espcomm Errors
Create SPIFFS image
SPIFFS Upload Failed!