Espressif ESP32

ESP8266, ESP32 and ESP32-S2 comparison

Currently, there are 2 types of MCU from Espressif on the market: ESP8266 from 2014, ESP32 from 2016 and ESP32-S2 that debuted in the second half of 2019. Although ESP32-S2 is not yet very popular, it is expected it will replace ESP8266 as a cheaper, more powerful and more secure alternative in the upcoming years.

The table below compares the main features of ESP8266, ESP32 and ESP32-S2

ESP8266 ESP32 ESP32-S2
MCU Xtensa L106 Xtensa LX6 Xtensa LX7
Number of cores 1 2 1
Number of bits 32 32 32
Clock frequency 80MHz 160MHz 240MHz
Coprocessor No Yes Yes (RISC-V)
WiFi 802.11 b/g/n 802.11 b/g/n 802.11 b/g/n
Bluetooth No BT 4.2 BR/EDR & BLE No
RAM 160kB 520kB 320KB
Internal flash No ESP32‑D2WD Only – 2MB No
External SPIFlash Up to 16MB Up to 16MB Up to 1GB
GPIO 17 36 43
SPI 2 4 4
I2C 1 (software) 2 2
I2S 2 2 1
UART 2 3 2
ADC 1 18 20
ADC resolution 10-bit 12-bit 12-bit
DAC No 2 2
DAC resolution 8-bit 8-bit
Software PWM 8 16 8
SDMMC interface No Yes No
Temperature sensor No Yes Yes
Touch sensors No Yes Yes
CAN No 1 No
Ethernet MAC No 1 No
Espressif ESP32

Espressif ESP32-S2

When Espressif release ESP32 WiFi & Bluetooth capable MCUs back in 2016, many things changed in the DIY and tinkerers community. We finally had a cheap MCU that could do real IoT stuff and was easy to use. However, the cheap ESP32 is not really cheap in relative terms. Sure, it is cheap, but there are cheaper solutions. ESP8266 for example.

Yes, the old ESP8266 that lacks any built-in security and which power consumption is not that low even in a deep sleep mode. It was expected that Espressif would, sooner or later, offer an improved replacement for ESP8266. Cheaper than ESP32, but with features that ESP8266 lacked. Continue reading “Espressif ESP32-S2” »

ESP32 vs ESP8266

ESP8266 and ESP32 – the main differences

ESP8266 and ESP32 are the next best thing that happened to DIY world since Arduino itself. Thanks to development boards based on those MCUs brand new possibilities opened in front of all DIY and tinkering enthusiasts. With those two, not only we have cheap and powerful microcontrollers, but we can also make them talk to other devices via WiFi and Bluetooth.

ESP32 development board

Continue reading “ESP8266 and ESP32 – the main differences” »

How to connect GPS to ESP32

Thanks to a very versatile Input/Output matrix, it is quite simple to connect NMEA GPS modules to ESP32 MCUs. Not only ESP32 boards have 3 serial ports you can choose from, they can be assigned to almost any pin you want.

ESP32 with GPS and OLED display

In this example we will connect a popular Ublox NEO-M8N like Beitian BN-880 or BN-220 to a ESP32 development board and output current position on a USB serial port using Arduino IDE and TinyGPS++ library. Let’s begin

Continue reading “How to connect GPS to ESP32” »

Espressif ESP32

ESP32, Arduino and EEPROM memory

ESP32 MCUs can be a great replacement for popular ATmega328 Arduino boards, but they are somewhat different. Even if ESP32 Espressif Arduino core is used, some of the libraries will not work out of the box.

Just like EEPROM will not work without changes. Mainly because ESP32 does not have EEPROM memory. An external flash is used instead.

Good thing, ESP32 EEPROM library distributed together with Espressif ESP32 Arduino core solves this problem in a quite nice way. All you have to do is to call EEPROM.begin with a size of emulated storage size in bytes as an argument. From there, everything goes as before.

ESP32 and GPS with a help of TinyGPS++ library

One of the first projects I did with ESP32 development boards is a simple GPS tracker. OK, it's not really a tracker since it does not store the position anywhere, more like distance meter with a UBLOX Neo-8M Beitian BN-880 GPS unit and small SSD1306 OLED display.

This ESP32 GPS Thingy as I call it uses one button to store current position and then report straight line distance, speed and altitude compared to "Home Point". GPS communication is handled by TinyGPS++ library.

Oh, one the best things about ESP32 is that you can map ports to almost any pin you want. It's not like on ATmega328 where UART and I2C are always the same pins. Here you can choose them. How nice is that?

Code is available on GitHub.

Espressif ESP32

Getting started with ESP32 development boards and Arduino

However fond of good old Arduinos based on ATmega328 and ATmega32u4 we might be, no one can now say they are state of the art. Sure, they might be the first choice to do something cheap and simple, but compared to most more modern designs, they are just too old and too weak. Slow, little flash memory, little RAM, no built-in connectivity: no Bluetooth or WiFi.

When a few years ago ESP8266 started to appear, everything changed. The tinkers finally got something small and cheap with WiFi. And then, the world has changed, since ESP32 it the market.

Geekcreit ESP32 development board

Continue reading “Getting started with ESP32 development boards and Arduino” »

ESP32, Arduino and 3 hardware serial ports

When working with ESP32 WiFi/Bluetooth MCU under Arduino SDK for ESP32, you will notice that Serial work just fine. But Serial1 and Serial2 do not. ESP32 has 3 hardware serial ports that can be mapped to almost any pin. But, Serial1 and Serial2 will not work. In case of ESP32 this just has to be done in a slightly different way:

The trick is to use HardwareSerial library to access UART 1 and 2 instead of Serial1 and Serial2

ESP32 board with 3 hardware serial ports

  • Class HardwareSerial accepts one parameter in constructor, it is a number of UART. Values from 0 (UART 1) to 2 (UART 3)
  • HardwareSerial(0) is the same as Serial so be aware
  • begin method accepts 4 parameters
    • baud speed
    • UART mode
    • RX pin
    • TX pin

The real beauty of this solution is that almost any pin can be used as TX or RX pin for any serial port. Most ESP32 dev boards have labels like TX2 or RX2, but you really do not have to exactly those pins. Every other GPIO pin can act as Serial RX, but only the ones between GPIO0 and GPIO31 can be used as TX. Still, that gives plenty of pins to choose from…

More about ESP32 can be read in Getting Started With ESP32 and Arduino post.

Here you can find the selection of the most interesting ESP32 Arduino compatible boards.

QuadMeUp Crossbow LRS: introduction

Few days ago I mentioned that I'm working on my own DIY long range radio system (LRS) that I named QuadMeUp Crossbow LRS. Today I will share some more details about it.

First of all, I'm not creating anything new or "amazing". There are plenty of "DIY" or OpenSource LRS systems. OpenLRS for example. Or QCZEK LRS that is made from almost nothing at all. And amazing commercial systems like TBS Crossfire.

Is there a place for something else? I think there is. For example, I was so pissed of by complexity of OpenLRS. So many options, so hard to understand. Or do you know how much micro RX for Crossfire costs? And that you do not need 2W of power to fly up to 5km? And most of pilots owning Crossfire never flied > 2km?

This is why, my idea for DIY LRS is:

Continue reading “QuadMeUp Crossbow LRS: introduction” »