Speedtest: Arduinos - Esp32 / 8266S - Stm32: Instructables
Speedtest: Arduinos - Esp32 / 8266S - Stm32: Instructables
Speedtest: Arduinos - Esp32 / 8266S - Stm32: Instructables
by Fernando Koyanagi
Which microcontroller is faster: Arduinos, ESPs, or commands it to light a pinmode, runs a digitalwrite,
the STM32? This video examines this question, among other simple actions that we have done a
where I perform a speed test, the SpeedTest, with million times.
several devices running the same series of
commands. This test, therefore, has no scientific character, and I
don’t wish to berate the performance of any
Follow and see the result! microcontroller, but simply show the magnitude of
processing that each model has.
Our main goal will be to show how much time each of
the chosen microcontrollers spends to execute a We performed and compared with a million iterations,
series of commands of a simple program. We will and my result resembled what Chester found in some
perform this test with a program that will execute one respects. For example, the ESP32, per core, was 60
million iterations and, from the iteration of 100,000; times faster than the Arduino Uno. In Chester's case,
we will execute commands so that the internal led he did a Divide Float, that is, a floating-point
flashes. operation, and recorded 83,462 milliseconds for the
Arduino Uno against 1,398ms for the ESP. After
I found other speed tests with microcontrollers on the performing the calculations, this shows that the ESP
Internet, including one from Chester Lowrey, which is 59.7 times faster than the Arduino Uno. Contrarily,
produced this table below. I placed it here for you to there are some characteristics that show many
observe. similarities. For example, other parameters range
from 10 to 170 times the speed in the comparison
So I decided to perform my own test which is based between these two microcontrollers.
on a common program: it goes into loop repetition,
does a lot of loop comparisons, calls the function and
https://youtu.be/kRsEDeHI8cI
Arduino Uno
Arduino Due
STM32F103C8T6
ESP12 ESP8266
ESP32 NodeS
Step 2: Results
Here, we have the diagrams of ATMega328, ARM M3 STM32F103, and ESP32. These are all different
microcontrollers. So, we have nothing scientific here because the architecture of the chips is different. But, we
wrote a source code that compiles in all microcontrollers and runs in the same compiler: the GCC.
We ran several tests and came up with a program that was as simple as possible and could be represented on any
microcontroller. So, in this source code I made A for 1 million. I also lit a LED. So, when you give 100,000, it goes
into the alternator.
long int i;
//iterações
for ( i = 0; i < contador; i++) {
//verifica se o LED ja deve começar a piscar
if (i+1 > FLASH)
{
LEDcounter++;
if (alternador) {
digitalWrite(LED_BUILTIN, HIGH);
alternador = false;
} else {
digitalWrite(LED_BUILTIN, LOW);
alternador = true;
}
}
}
tempoTotal = millis() - inicio; //calcula o tempo gasto na execução do algortimo (resultado em ms)
So how did we do the test? We ran the Loop a million Arduino One.
times and analyzed how many milliseconds each
microcontroller took for such actions. Our table above Another surprise I had was in relation to the
shows that the Arduino Uno took 4.920 milliseconds, performance of the STM32. The STM32F103C8T6
while the ESP32 needed only 164ms. and the STM32 Maple Mini had scores well above
Arduino Due. In terms of monetary values, the
The Problem of Making a Table using Milliseconds performance was even better. While the Arduino Due
costs on average R $130,00, the STM32 F103C8T6
A millisecond is inversely proportional to is in the range of $14.00, and has more IOs than the
performance. So, I normalized everything, that is, I Arduino Nano.
created an index: I got 10,000 and divided by T (time
and millisecond). The red bars of the table indicate In the case of the Arduino Mega, I was astonished:
this index. This means that the higher the bar, the the index was 1.38, the lowest on the list. I was also
higher the performance. surprised, in a bad way, about the ESP8266. I
thought it was much faster because of Clock, which
During the test, we had some surprises. I believe that goes from 80 to 160 MHz. Thus, I was disappointed
the Arduino Due was the most powerful of with its rate of 6.83, as I expected more. The best
microcontrollers due to its quantity of IOs. It’s Mega! performance was from ESP32, which has two Colors.
An ARM Cortex-M3! But, its index was actually below
my expectation, with little difference in relation to the
The champion in our evaluation, therefore, is the ESP32. It has the best performance with regard to the speed for
running the program we created specifically for this test. And that's not to say that it's because it's dual core,
because we use only one core in the evaluation. I’ll talk more about programming this microcontroller in an
upcoming video.