What do you want? A microcontrollers performance comparison
Guest post created with ♥ by Josses 🙂|
Whoever has started to peek into the wonderful world of small electronics will undoubtedly have read about Raspberry Pi or Arduino boards. This is where I personally started to ask myself, what is the right board for which project?
Introduction
I only started collecting my first experiences with this hobby in 2018. I decided to enter my retirement and suddenly had a wealth of time. My first action was a 400 pages book on the Raspberry Pi 2. I remembered the equation V= i*R from school; in Germany, this is known as U = R * I, strangely enough.
In order to understand this formula, you will need to step into the matter and do it. But, my personal goal is the KISS principle, Keep It Simple (and) Stupid. In the meantime, I have finished more complicated projects, such as a digital clock similar to the Düsseldorf Rheinturm (https://de.wikipedia.org/wiki/Lichtzeitpegel), the largest decimal clock in the world (according to the Düsseldorf city guide. I learned a lot reading the documentation from HJBerndt (Homepage von H.-J. Berndt (hjberndt.de) in german language). My final version is a desktop unit, which switches automatically between summer and winter time.
Based on an ESP8266, which does not have a reliable RTC, I pick up the actual time from the NTP time signal via WiFi. This webpage also was a great help in defining summer and winter time:
In the meantime, I have built several units for friends and family, and they can select how often the WiFi budget is charged. Typically every 5 or 10 minutes. The update is indicated by walking red lights followed by decent blue lights. And every full hour, there is a colorful waterfall of all colors, indicating one hour has passed. The base is printed with my Ender 3D pro printer, which has added perfectly to my new office environment.
How to select a board
Well, let’s go back to the start: which board is the right board? There is no simple answer to this question. Too many options will influence your decision:
- Budget, what is the price for a board?
- Connections, how many I/O ports are needed or available?
- Supported by the Arduino IDE or PlatformIO?
- Does the board have a dedicated function, such as the ESP32-CAM?
- Does the project need internet access and Wifi functionality?
- and many more …
Even within the range of products, you will find variants that will answer some or all of your requirements. Surprisingly the ESP-01 can do a great job in supporting an old Raspberry Pi, which lacked the Wifi function.
Also, it is a great “gate-keeper” to forward messages via ESP-NOW. I once built a system reading temperature and light density in front of the garage. The distance did not allow me to receive the data directly at my desk, so I built a chain of boards to solve this problem:
- One ESP8266 is built with a solar-powered light above the garage door. It picks up the light and temperature information and sends an ESP-NOW message to the ESP-01 in my bedroom.
- The ESP-01 then sent the information, again ESP-NOW, to a combined ESP32/ePaper board
- then my solar lamp broke, so I have no pictures. But I picked up the satisfaction that I can do even less common things by combining what I have found in many hours of reading.
- Knowledge is what remains after you have forgotten what you have learned.
Yes, I have ordered quite a number of different boards, both locally and from China. Sometimes you will need fast and reliable delivery (like for my 3D printer), but if time is not the problem, you can quite safely order from Banggood or the others. I have hardly ever lost a shipment, but I never lost my money. If you order rubbish, you will get rubbish. If you think you ordered 10 USB cables, but you received only one, you should blame yourself for not reading precisely what you ordered before you paid the price.
Back to the start of this article. The question is: what do you want to achieve if you start your project. Sometimes it is good to know that you can up or downgrade as well.
Sometimes you can even reach remarkable results without ESPxxxx or Raspberry Pi power, as you can see from a nice little blinking gadget I have built based on a NE555.
Start the performance comparison
For my own reference, I have started a comparison chart, which I will gladly share with you. Of course, it can be improved by adding more topics, such as price, Mhz numbers, etc.
esp8266 boards WeMos D1 mini - NodeMCU V2 V2.1 V3 - esp01 - esp01 programmer
esp32 boards ESP32 Dev Kit v1 - TTGO T-Display 1.14 ESP32 - NodeMCU V3 V2 ESP8266 Lolin32 - NodeMCU ESP-32S - WeMos Lolin32 - WeMos Lolin32 mini - ESP32-CAM programmer - ESP32-CAM bundle - ESP32-WROOM-32 - ESP32-S
Arduino's boards AliExpress
Pico boards Official Pi Pico - Official Pi Pico W - Waveshare rp2040-zero - WeAct Studio rp2040
stm32 boards STM32F103C8T6 STM32F401 STM32F411 ST-Link v2 ST-Link v2 official
But, as I said earlier, KISS. This chart shows not only the difference between the various variants of ESP, Raspberry Pi Pico, or even my latest add-on, the STM34F401 Black Pill. Also, it indicates the reliability of the CPU and the surprising difference between the compiler driver settings.
To reach comparable results, the test program needed to be short, with only one function: display the number of iterations after 10 seconds:
#include "Arduino.h"
unsigned long timeNow, it = 0;
unsigned long timeLast = 0;
boolean running = true;
void setup() {
Serial.begin(115200);
timeNow = millis() / 1000;
timeLast = timeNow;
}
void loop() {
if (!running)
return;
// Time Range of exact 10 seconds
if (timeLast + 10 > timeNow) {
it = it + 1;
} else {
Serial.print("Duration: ");
Serial.print(timeNow);
Serial.print(" seconds, iterations: ");
Serial.println(it);
running = false;
}
timeNow = millis() / 1000;
}
Here is the comparison table
Variant | Driver | 1st | 2nd | 3rd | 4th | 5th | |
---|---|---|---|---|---|---|---|
ESP8266 | ESP-01 | 1 LED | 764.978 | 778.337 | 778.324 | 778.335 | 778.407 |
2 LED | 778.310 | 778.321 | 778.388 | 778.320 | 778.351 | ||
ESP-12E | Generic ESP8266 Module | 779.078 | 779.067 | 779.185 | 778.984 | 779.149 | |
NodeMCU 1.0 (ESP-12E Module) | 778.877 | 778.816 | 778.687 | 778.857 | 778.835 | ||
ESP8266 D1 Mini | Lolin D1 Mini | 777.557 | 777.515 | 777.511 | 777.594 | 777.405 | |
Generic ESP8266 Module | 778.226 | 778.222 | 778.208 | 778.205 | 778.215 | ||
D1 Minin (Clone) | 777.323 | 777.450 | 777.475 | 777.461 | 777.248 | ||
ESP32 | WROOM-32 | ESP32 Dev Module | 7.253.346 | 7.253.308 | 7.253.367 | 7.253.367 | 7.253.372 |
DOIT ESP32 DEVKIT V1 | 7.252.216 | 7.252.218 | 7.252.215 | 7.252.214 | 7.252.220 | ||
D1 R32 Board | WEMOS D1 Mini ESP | 7.252.325 | 7.252.322 | 7.252.323 | 7.252.324 | 7.252.325 | |
ESP32 Dev Module | 7.253.416 | 7.253.417 | 7.253.416 | 7.253.416 | 7.253.416 | ||
ESP32-S | ESP-CAM | AI Thinker ESP32 CAM | 6.401.079 | 6.401.083 | 6.401.083 | 6.401.083 | 6.401.083 |
ESP32 Dev Module | 7.253.612 | 7.253.612 | 7.253.614 | 7.253.639 | 7.253.609 | ||
Arduino Nano | Arduino Nano | old Bootloader | 243.392 | 243.392 | 243.392 | 243.392 | 243.392 |
Arduino Uno | GEEKCREIT clone | Arduino Uno | 243.392 | 243.392 | 243.392 | 243.392 | 243.392 |
Arduino Mega 2560 | no-name clone | Arduino Mega 2560 | 233.021 | 233.021 | 233.021 | 233.021 | 233.021 |
Raspberry Pi RP2040 | original | Raspberry Pi Pico | 6.484.763 | 6.484.770 | 6.484.773 | 6.484.765 | 6.484.779 |
STM32 | Black Pill STM32F4 | BlackPill F401CC | 10.468.847 | 10.468.847 | 10.468.843 | 10.468.819 | 10.468.842 |
As you can see from the chart, the original Arduino products (Nano, Uno, and Mega2560) all presented identical results after 5 test runs, be it at the slowest rate of all tested boards.
esp8266 troubleshooting
Ah yes, indeed, you should also consider reliability as well. Sometimes the ESP8266 board refuses to do its job. During my excursions to the world wide web, I found somewhere this message:
Finally, If I replace:
while(!displayAnimate());
with
while(!displayAnimate()) yield();
it works, and it looks better now.
Yielding
This is one of the most critical differences between the ESP8266 and a more classical Arduino microcontroller. The ESP8266 runs a lot of utility functions in the background – keeping WiFi connected, managing the TCP/IP stack, and performing other duties. Blocking these functions from running can cause the ESP8266 to crash and reset itself. To avoid these mysterious resets, avoid long, blocking loops in your sketch.
The amazing creators of the ESP8266 Arduino libraries also implemented a yield() function, which calls on the background functions to allow them to do their things.
Finally
Now it is up to the reader to decide which board will do the planned job. Success!
Hello. I think that I have a problem with my ESP32’s.
This is my tests helped by your schetch.
ESP32
Duration: 10 seconds, iterations: 1217435
Duration: 10 seconds, iterations: 1217440
Duration: 10 seconds, iterations: 1217438
ESP32 U
Duration: 10 seconds, iterations: 1213727
Duration: 10 seconds, iterations: 1213462
RP2040
Duration: 10 seconds, iterations: 6484855
ESP8266MOD
Duration: 10 seconds, iterations: 1720587
Duration: 10 seconds, iterations: 1720565
I had made many tests. The ESP32 score is to small. I dont know why.
Boards are not microcontrollers. Microcontrolles are single chips that contain all the important parts, including CPU, I/O, Flash and RAM. This disqualifies most of the Pi stuff and also anything that includes a PCB. Atmel AT Mega is a Microcontroller, Arduino is a PCB with an AT Mega and some development stuff, Rasperry Pi is a computer with a SoC chip, some DRAM chips and some I/O chips, Flash not included. The Raspberry Pi Rp2040 chip has no built in flash, requiring everyone to buy an extra chip and protect the connection between the chips from noise, accidents and sabotage.
To me Microcontrollers include products like the 8051 and its clones, the ATR and PIC chips, Padauk PSM, GigaDevice GD32 series, certain NXP chips, the STM and ESP chips etc.
Hi JB,
Thanks for your clarification.
Hi JB,
thank you for jumping into this post. I hope you have enjoyed the comparison, still. Any additional comments will help our readers to make the correct decision for themselves, which was my initial intent.