ESP32 and FreeRTOS: IoT game changers

A top-notch system on a chip for highly-connected, low-cost systems

Bluetooth

The brand-new ESP32 is a high-end, low-cost SoC (system on a chip) with awesome capabilities, including, but not limited to Bluetooth 4.2, Wi-Fi (Wi-Fi Alliance Certified), RoHS certification, onboard 40 MHz crystal, GPIO interface, integrated ADC/DAC, capacitive touch sensor driver, and much more.

But that’s not all, it also can interface, just out of the box, an SD card, UART, SPI, SDIO, I2C, PWM LED or Motors, I2S and IR devices. Consuming just 80 mA with no energy saving options enabled.

The “ESP32 WROOM-32” includes its own power supply and is able to deliver 500 mA at 3.3 V to extra peripherals you might connect to it. The full datasheet can be downloaded here.

Espressif Systems, the manufacturer, says the following:

At the core of this module is the ESP32-D0WDQ chip, designed to be scalable and adaptive.

There are two CPU cores that can be individually controlled, and the CPU clock frequency is adjustable from 80 MHz to 240 MHz. The user may also power off the CPU and make use of the low-power co-processor to constantly monitor the peripherals for changes or crossing of thresholds. ESP32 integrates a rich set of peripherals, ranging from capacitive touch sensors, Hall sensors, SD card interface, Ethernet, high-speed SPI, UART, I2S and I2C.

Amazing, right? Wait until you see the price: starting at just $USD 2.4 / € 3.0 (grab it here, from Aliexpress). Development kits start at $USD 5.0/€ 6.0.

Let’s get started

Now that we know what ESP32 is about, we’re all set! Wait, are we? How can I even start? Relax. It’s easier than you think. Well, it actually depends.

There are two ways to do this:

  • The marshmallow way: Arduino IDE programming (using Espressif’s libraries)
  • The hard-rock way: Espressif ESP-IDF toolchain

The main keys: how to decide

Both of the methods have been developed by Espressif, the SoC designer and manufacturer. But there are some important differences we need to take into account before making a decision.

Arduino IDE advantages and drawbacks

  • Easy to use and learn
  • Familiar environment
  • You can program it (almost) as if it were an Arduino
  • Not all the functions and hardware are implemented yet
  • It’s a little bit weird to program a multi-thread system on a single-thread oriented IDE and language (micro C)

Espressif ESP-IDF

  • You can get all the juice from the chip
  • Linux-friendly
  • Multi-thread programming makes sense
  • It is difficult to setup, configure and learn
  • It is roughly impossible to get it to work on a Windows environment (there’s a tutorial here but don’t waste your time)
  • Hard to debug and little documentation is available

Setting our environment up

The first one is pretty straightforward: you just have to download, install the Arduino IDE, and follow the instructions that you can find here (Espressif’s GitHub Repository).

Aerospace Engineer
Aeronautical Engineer. My dream is to work for a leading company in the aerospace field to develop projects that can make the world a better place; improving people's life, safety, and comfort. I am interested in Aerospace Engineering, big data, CFD, photography, automatic control, maths and electronics.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.