I'm doing a thesis on the power consumption of MicroPython VS Arduino.
As a test I wrote a program that wakes the microcontroller up and puts it back to sleep (with a timer for 1s) and just keeps on doing this.
I used an ESP32_DevKitC_V4 with the WROOM-32 module.
This is the Arduino code:
Code: Select all
void setup() {
esp_sleep_enable_timer_wakeup(1000000);
esp_deep_sleep_start();
}
void loop() {}
Code: Select all
import machine
machine.deepsleep(1000)
Some notes:
- I wrote some letters in yellow on the image to refer to later.
- The deep sleep current is the same for both Arduino and MicroPython: 2.8 mA
- With the Arduino code it's active for 190 ms
- With the MicroPython code it's active for 690 ms
- I know that the code that I wrote only starts being executed µs before it goes back to sleep. (So right before D with Arduino and right before H with MicroPython) I know this because I tested this by adding some delay in the code before going to sleep and I would always see this graph + the delay in the active region.
My questions:
- In the beginning (from A to C) the current is the same. Is this because the microcontroller is in the bootloader? And if so does the bootloader stop at point C or point B (or another point).
- Why has the Arduino code a higher (max) current draw then the MicroPython code? (between C and D)
Most importantly:
- What processes are ran after the bootloader and before the (user) code is executed? And is it possible to determine when these start and stop on the graph?
Thanks in advance!