Sunday, May 14, 2017

Introduction to ESP32

1. ESP32
1.1 About
ESP32 is a series of low cost, low power system on a chip microcontrollers with integrated Wi-Fi & dual-mode Bluetooth. The ESP32 series employs a Tensilica Xtensa LX6 microprocessor in both dual-core and single-core variations. ESP32 is created and developed by Espressif Systems, a Shanghai-based Chinese company, and is manufactured by TSMC using their 40 nm process.[2] It is a successor to the ESP8266 micro controller.
1.2 Features of the ESP32 include the following
- CPU: Xtensa Dual-Core 32-bit LX6 microprocessor, operating at 160 or 240 MHz and performing at up to 600 DMIPS
- Memory: 520 KiB SRAM
- Wireless connectivity:
    + Wi-Fi: 802.11 b/g/n/e/i
    + Bluetooth: v4.2 BR/EDR and BLE
- Peripheral interfaces:
    + 12-bit SAR ADC up to 18 channels
    + 2 × 8-bit DACs
    + 10 × touch sensors
    + Temperature sensor
    + 4 × SPI
    + 2 × I²S
    + 2 × I²C
    + 3 × UART
    + SD/SDIO/MMC host
    + Slave (SDIO/SPI)
    + Ethernet MAC interface with dedicated DMA and IEEE 1588 support
    + CAN bus 2.0
    + IR (TX/RX)
    + Motor PWM
    + LED PWM up to 16 channels
    + Hall effect sensor
    + Ultra low power analog pre-amplifier
- Security:
    + IEEE 802.11 standard security features all supported, including WFA, WPA/WPA2 and WAPI
    + Secure boot
    + Flash encryption
    + 1024-bit OTP, up to 768-bit for customers
   + Cryptographic hardware acceleration: AES, SHA-2, RSA, elliptic curve cryptography (ECC), random number generator (RNG)

Figure: ESP32 block digram
If you need more information please refer ESP32 datasheet here 
1.3 ESP8266 vs ESP32

Figure: ESP8266 vs ESP32
2. Module boards

ESP32 module boards are small PCBs which directly contain the ESP32 SoC and are designed to be easily used by other circuit boards. Meandered inverted-F antenna designs are used for the PCB trace antennas on the modules listed below. 2 popular module boards same features but different pinout and Vendor.

                                    Figure: ESP32S module

Figure: ESP32 WROOM module

3. Development environment
Programming languages, frameworks, platforms, and environments used for ESP32 programming:
  • Arduino IDE with the ESP32 Arduino Core
  • Espressif IoT Development Framework - Official Espressif development framework for ESP32.
  • Lua RTOS for ESP32
  • Mongoose OS
  • PlatformIO Ecosystem and IDE
  • Pymakr
  • Simba Embedded Programming Platform
  • Whitecat Ecosystem Blockly Based Web IDE
In this tutorial we just focus on Arduino IDE with ESP32 Arduino Core because it is easy for beginner (certainly user must know about Arduino). And we will look a little on Espressif IoT Development Framework.
3.1 FreeRTOS
The ESP32 comes with a light operating system - FreeRTOS. The following methods to program this chip don’t replace the FreeRTOS firmware, but rather deploy applications for it to run.

Espressif IoT Development Framework is a set of open source libraries and tools to facilitate deployment of apps to ESP32s FreeRTOS. The esp-idf framework is based on the FreeRTOS Real-Time Operating System.
3.3 ESP32 Arduino Core
Espressif have also been hard at work to get the maker community happy and makers love Arduino. The ESP32 arduino core integrates ESP-IDF deeply into the arduino tools. This includes providing a WiFi API that is almost 100% compatible with existing wifi shields for arduino.
Note: The Arduino program is about 65% slower than the lower level FreeRTOS program.
4. ESP32 Bootloader
If you want to know more about ESP32 startup flow, please refer here
5. Setup ESP32 Arduino Core
Note: This is for Windows OS
Step 1: Download and install the latest Arduino IDE Windows Installer from
Step 2: Download and install Git from
Step 3: Start Git GUI and run through the following steps:
- Select Clone Existing Repository

- Select source and destination
+ Source Location:
+ Target Directory:
C:/Users [YOUR_USER_NAME]/Documents/Arduino/hardware/espressif/esp32
+ Click Clone to start cloning the repository
- Open C:/Users/[YOUR_USER_NAME]/Documents/Arduino/hardware/espressif/esp32/tools and double-click get.exe

- When get.exe finishes, you should see the following files in the directory
- Plug your ESP32 board and wait for the drivers to install (or install manually any that might be required)
We finished introduction part, we will play with ESP32 in next sections. Please prepare an ESP32 module. I will use the module which I got at here  :)