Thu, Feb 02, 2023
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.
Have I sparked your interest? Good. That’s why I’m excited about these chips.
If you go on AliExpress, you will find a variety of ESP32 microcontroller boards. Which one should you buy?
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.
These processors all belong to the ESP32 family. They differ in their features set and in their area of application.
So basically:
For a more detailed comparison, check out this comparison table.
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.
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.
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:
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.
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):
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:
[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
pio run -e lolin_c3_mini -t upload
for flashing the ESP32pio 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.
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