ESP8266 Basic Setup and Program using Arduino IDE

Contents:

Introduction:

Add Internet to your next project with an adorable, bite-sized WiFi microcontroller, at very low price. The ESP8266 processor from Espressif is an 80 MHz microcontroller with a full WiFi front-end (both as client and access point) and TCP/IP stack with DNS support as well.

Features:

  • Low cost
  • Builtin WiFi support
  • Flash memory to store variables (Supperior than Eeprom)
  • Ten interrupt enabled I/O pins
  • Analog to Digital converter
  • Power saving by Deep Sleep mode with as low as 60 µA consumption

Hardware needed:

Following components are required to setup this little module

  • 5v, 1A power supply
  • 3.3v linear voltage regulator such as AMS-1117 3.3v
  • 22 µF capacitors (2 pieces)
  • 0.1 µF capacitors (2 pieces)
  • 10 KΩ resistors (4 pieces)
  • PCB board
  • Adapter plate
  • Push buttons (2 pieces) — Firmware Install only
  • USB-TTL Serial Cable — Firmware Install only

Procedure:

Step-1) Power Supply:

ams1117_pinoutESP8266 draws handsome amount of current during transmission of data through WiFi, hence needs a stable 3.3v, 1A power supply for it’s proper functioning. A 5v DC power supply capable of 1A current supply per hour is sufficient to feed stable power to ESP8266.

AMS-1117 3.3v is fed 5.0v on using 22µF capacitor on pin “3” (V IN) and pin “1” is grounded. Output is filtered using two 0.1 µF and one 22µF capacitors to avoid any ripple during data transmission. Now we have a good power supply for our ESP8266 to go.

Step-2) Schematics:

Let’s have a look on pin-out diagram of ESP8266 ESP-12E, We can see numerous pins. Normal functioning of ESP8266 requires use of few pull-up and pull-down resistors tied to certain gpio pins.

ESP8266-serial-WIFI-model-ESP-12E-Authenticity-Guaranteed-Upgraded-version

RST, EN (Labeled as CH_PD on certain builds of ESP8266 12E), gpios “0”, “2” are pulled high to 3.3v while gpio “15” is pulled low to ground using 10 KΩ resistors. However VCC is connected to stable 3.3v and GND is grounded as shown in Figure below.

ESP12e Normal Function

However, for installing firmware such as ESP8266 Arduino Core or NodeMCU for the first time, few additional hardware setup is required. RST is connected to GROUND via Press button which is used as RESET SWITCH. GPIO “0” is also connected to GROUND via press button which is used as BOOTLOAD SWITCH. To connect ESP8266 to PC through serial, either CP2102 or FTDI based TTL UART Serial Module are used. In case of CP2102, TX of ESP8266 is connected to RX of Serial module and so on while FTDI based serial modules have opposite connection as in CP2102  i.e. RX to RX and TX to TX. GROUND of Serial adapters is also connected with GROUND of ESP8266 as shown in figure below. Never connect 5v or 3v of Serial module with ESP8266.

ESP8266 Firmware Upgrade

Step-3) Programming ESP8266 with Arduino IDE:

ESP8266 modules can be programmed similar to other Famous Arduino Boards such as Arduino UNO, NANO, MEGA using our beloved Arduino IDE. However, it needs an ESP8266 Arduino Core to be installed at first. It is really easy to make Arduino IDE up for running ESP8266 Arduino Core, just follow the instruction given below.

Install latest Arduino IDE from the Arduino website. Start Arduino and open Preferences window. Enter following URL into Additional Board Manager URLs field.

http://arduino.esp8266.com/stable/package_esp8266com_index.json

Board Manager Add URLOpen Boards Manager from Tools > Board menu and install esp8266 platform according to the instruction given in picture below.

Installing ESP in board manager

After successful installation, Arduino Core version is displayed. Now select your ESP8266 board from Tools > Board menu. Numerous ESP8266 boards are displayed here, Don’t worry these are just variants of ESP8266 using almost the same chip with different pin layouts. If you are using ESP8266 generic modules, select Generic ESP8266 Module, if you are using NodeMCU board which has all above mentioned hardware setup builtin, select NodeMCU with your particular version and so on.

Aaaand! We have set all the things up to program our sweet ESP8266 with our beloved Arduino IDE  😎 . So let’s upload our first sketch to ESP8266. Connect ESP8266 to PC, press and hold BOOTLOAD SWITCH and press RESET SWITCH slightly afterwards. Now you are ready to push any sketch you made in Arduino IDE to ESP8266 and have fun ;-).

In the next tutorial, we’ll learn How to perform Over the Air (OTA) firmware update using our ESP8266 modules, Stay tuned  😀

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x