The ESP 32 was the most fun side project for me in 2022. For those who don’t know: the ESP32 is a small, cheap and wifi-enabled microchip. Many smart devices that you buy on Amazon have an ESP32 inside. It’s really amazing what you can do with a board that costs less than a good sandwich.

  • You can build a small, low power WebCam for $7 (shipping from China included).
  • You can build a wireless temperature and humidity sensor, that sends you your current room temperature for $10 (again shipping included).
  • You can even run a small neural network on it to detect whether cat faces are running through your camera for $19.

Have I sparked your interest? Good. That’s why I’m excited about these chips.

What the heck is the difference between ESP8266, ESP32-C3, ESP32-S2, ESP32-S3,…?

If you go on AliExpress, you will find a variety of ESP32 microcontroller boards. Which one should you buy?

ESP8266 vs ESP32

If you go shopping, you will find boards with an ESP8266 and an ESP32-xx. They belong to different microprocessor families. Strictly speaking, the ESP8266 is not a family, but only a single processor.

Note: There are Boards with an ESPxx Module on them, but they have nothing to do with the ESP32. They are only a packaged version of an ESP8266.

The important differences are:

Therefore, I would recommend buying a mikrocontroller based on the ESP32. It’s the successor of the ESP8266 and comes with some fascinating processor varieties.
The ESP32 also supports the ESP-IDF development framework, which could be interesting for more professional projects.

I wouldn’t recommend to mix between the ESP32 and the ESP8266 as these are not (fully) code compatible. It’s possible to develop code that works on the ESP32 and the ESP8266, but it’s tedious.

ESP32-S2, ESP32-S3, ESP32-C3, ESP32-C6, …

These processors all belong to the ESP32 family. They differ in their features set and in their area of application.

  • ESP32-S2 Lower-cost/feature version of the ESP32-S3.
  • ESP32-S3 Low power. Dual-core. Wi-Fi and Bluetooth LE. 45 GPIOs. Camera Support. AI Support. Native USB Support (This let’s you develop your own USB rubber ducky or USB keyboard with the ESP32).
  • ESP32-C2 Lower-cost/feature version of the ESP32-C3. Not released yet.
  • ESP32-C3 Ultra Low Power. Single core. Wi-Fi and Bluetooth LE. 16 GPIOs. Not as powerful as the S-Variants (e.g. the ESP32-S3).
  • ESP32-C6 If you need Wi-Fi 6 or ZigBee Support, this is the SoC you want to look for. Sadly, not released yet.

So basically:

  • If you want a very tiny board that runs on battery and doesn’t need much IO, go for an ESP-C3.
  • If you want to have
    • AI support, or
    • camera support, or
    • a lot of IO (which communicates with different protocols), or
    • you don’t know what you are going to do with this board, or
    • you want to develop your own USB peripherals,
    • go for an ESP-S3.

For a more detailed comparison, check out this comparison table.

Board recommendations

All selected boards come with a USB-C connector. I personally don’t buy things anymore that don’t have a USB-C Connector or AAA batteries in them.
This also means that they all have a Serial Adapter. You can plug them directly into your computer and flash them.

ESP32-C3

  • Wemos Lolin C3 Pico. 25.4 x 25.4mm. 12 GPIO. 6 Analog Pins. Built-in Button. Built-in LED. Built-in battery support, charging the battery and measuring the battery’s voltage.
  • Adafruit QT Py ESP32-C3 Wi-Fi Dev Board. 22.0 x 17.8mm. 13 GPIO. 5 Analog Pins. Built-in Button. Built-in LED. Stemma QT Connector (see Sensors Section).

ESP32-S3

  • Wemos Lolin S3 PRO. 65.3 x 25.4mm. 25 GPIO. 17 Analog Pins. Built-in Button. Built-in LED. 8MB PSRAM. Built-in battery support. Built-in MicroSD Slot. Built-in Display Connector (nice to have, but you don’t need that to connect a display).
  • Adafruit ESP32-S3 Feather. 52.3 x 22.7mm. 21 GPIO. 6 Analog Pins. Built-in LED. 2MB PSRAM (you need that for the ESP32-Camera). Built-in battery support. Stemma QT Connector (see Sensors Section).

I personally own the WEMOS Lolin D1 Mini v4 and the WEMOS Lolin C3 Mini Boards. I also bought the Wemos Lolin C3 Pico and S3 Pro Board, but they are currently stuck in shipping.

I personally wouldn’t recommend to buy the D1 Mini or the C3 Mini, because the C3 Pico packs more features in a smaller form factor.

In the HackerNews discussion, some people also mentioned that they had good luck with buying cheap ESP32 boards on Amazon. So this could be an option as well.

Sensors and I2C

An ESP Board alone wouldn’t let you do much.
Luckily you can choose from a variety of different externals. When you’re looking for externals, I would recommend to look for the I2C protocol.
Why? I2C is an easy-to-use protocol on 4 Pins which supports multiple targets. This means you can put multiple sensors on the same 4 contacts and use them without a hassle. The 4 lines are:

  • GND (Ground)
  • 3.3V (in the case of the ESP32)
  • SDA (this is the data line)
  • SCL (clock line).

Each sensor has its own address and listens only for packets with that address.

These 4 pins are also sometimes connected with cables called Stemma QT or Qwiic. These should not be compatible with the solution from Wemos.

If you want a functioning ecosystem of sensors, take a look at the system from Adafruit (Stemma QT). I’ve never tried the Adafruit System, but they have awesome documentation.

Firmware

The ESP has no integrated firmware. You write your code with your development framework of your choice and this code is then compiled into a firmware (more info). This firmware is then flashed to the ESP Chip with the help of a “burned into the chip” ROM bootloader (more info).

So, all you need to do is choose the development framework of your choice. There is a variety of options (most of them I’ve never tried):

  • ESPHome Specifically for a smart home, you configure a yaml file which is then compiled into a firmware.
  • MicroPython You flash the MicroPython Firmware to the ESP32, and then you can deploy the code e.g. via a REPL live on the ESP32.
  • Arduino You modify the Arduino IDE, and then you can flash your compiled firmware + code onto the ESP32.
  • ESP-IDF The official Development Framework. Again, you compile the firmware + code and then flash it to the ESP32.
  • Rust on the ESP32 Same as with the ESP-IDF or Arduino Code. You write your code in Rust, it gets compiled into a firmware, and then you flash it to the ESP32. This seems to be an official project as one of the developers is an employee of Espressif.

My recommendation / My Way

I personally use PlatformIO. It’s not a firmware but instead software helpers to deploy the firmware. You can choose between the ESP-IDF or the Arduino Development Framework.
It brings support for your favourite IDE like VSCode or CLion. Of course real men use CLion (that’s a joke; use whatever you want). If you go the Arduino way, you don’t have to use the Arduino IDE but instead an IDE with real auto-completion.

How to do it:

  • Install Platform IO Core
  • Install Extension of pio (Platform IO) in your favourite IDE.
  • Clone an example project
  • Configure your platformio.ini file to your needs (or more specific: the need of your board[s])
[env:lolin_c3_mini]
platform = espressif32
board = lolin_c3_mini
framework = arduino
build_flags = -DCORE_DEBUG_LEVEL=5
lib_deps =
; MQTT Library
    knolleary/PubSubClient@^2.8

lib_ldf_mode = deep
  • Run pio run -e lolin_c3_mini -t upload for flashing the ESP32
  • Run pio device monitor to see the Serial Output (for Debugging Code).

The platformio.ini example from above is from my project and is configured for a Lolin C3 Mini Board.

My recent project

Lollidisplay Example Image

I built a little project which measures humidity, temperature, light and CO2.

The data is then displayed on the ePaper and sent to a central server for collection. The display also shows me the current weather report.

If you want more information about this project, check the GitHub Repo or shoot me an email, and I will write a detailed post about it.

The code is not perfect (and was never meant to be published, but here we are), but you can look at it to get an idea how to code these ESPs. Enjoy!

Discuss on HackerNews

Wait! Before you go
and do important stuff:

Would you mind give me a little feedback? It would really help me to improve my articles.

What rating would you give this article?

Read More