Lucid Projects

Blog - Day to day mumblings...
Who's Hungry

Who's Hungry

24 Apr 2021 - Jake Sherwood

micro controller comparisons micro controller comparisons

Who’s Hungry

Part of my final project for Energy was trying to make the circuit as efficient as possible. Part of which was finding a micro-controller that drew the least amount of power.

Initially, I just set out to compare my Arduino Nano 33 IoT and an Arduino Pro Mini, but it quickly turned into more exploration.

Over the last two years at ITP and before, I’ve collected several MCs. After testing the first two, I was like, well, I really should try them all. And thus, the Who’s Hungry Micro-controller project was born.

Using a USB Voltage Meter and a few different deep sleep libraries I set out to see who was the hungriest who was the least greedy.

I used several sleep libraries. Luckily, all the Arduinos and the Beetle Board worked with the Adafruit Sleepydog library. The usage is pretty straight forward but Serial support on wake-up varied. The logic continues to work on the board, but it just can’t reconnect to the Serial monitor after deep sleep. Depending on the board and included peripherals, you can find even more power savings by shutting down individual peripherals. Using an external RTC clock to have it wake up at specific times could provide further gains, but I didn’t have one to test. Sleepdog does advertise partial support for the Teensy but I ended up using the Snooze library specifically for Teensy. This one worked better and was able to regain Serial monitor connection on wake up. The ESP has a number of sleep modes built-in. The built-in functions also allow you to fine-tune which peripherals you keep on or turn off. There is a great write-up on lastminuteengineers.com, that goes into depth on different ways to handle sleep with ESP32 boards.

Boards Tested:
Arduino Pro Mini, Arduino Nano IOT, Arduino MK 1010 WiFi, Arduino UNO, custom UNO, Arduino MEGA, Teensy LC, ESP32 - NodeMCU_32s, Beetle Board

Below are more details on the boards tested chipsets, relevant advertised specs, and the results of my tests. I had my guesses about which would be the least hungry, but there were some surprises.

Arduino Pro Mini Arduino Pro Mini

Arduino Pro Mini
Chipset: ATmega328
Current: DC Current per I/O Pin 40 mA
Power: 3.3V
Clockspeed: 8 MHz
Observed Draw: 16mA
Sleep Draw: 11mA
Sleep Lib: Adafruit Sleepydog

Arduino Nano Iot 33 Arduino Nano Iot 33

Arduino Nano IOT
Chipset: SAMD21 Cortex®-M0+
Current: DC Current per I/O Pin 7 mA
Power: 3.3V
Clockspeed: 48 MHz
Observed Draw: 29mA
Sleep Draw: 20mA
Sleep Lib: Adafruit Sleepydog

Arduino Mkr 1010 WiFi Arduino Mkr 1010 WiFi

Arduino MK 1010 WiFi
Chipset: SAMD21 Cortex®-M0+
Current: DC Current per I/O Pin 7 mA
Power: 5V
Clockspeed: 4 MHz
Observed Draw: 24mA
Sleep Draw: 11mA
Sleep Lib: Adafruit Sleepydog

Arduino Uno Arduino Uno

Arduino UNO
Chipset: ATmega328P
Current: DC Current per I/O Pin 20 mA
Power: 5V/3.3V
Clockspeed: 16 MHz
Observed Draw: 57mA
Sleep Draw: 34mA
Sleep Lib: Adafruit Sleepydog

Arduino Custom Uno Arduino Custom Uno

Arduino Custom UNO
Chipset: ATmega328P
Current:
Power: 5V/3.3V
Clockspeed: 16 MHz
Observed Draw: 79mA
Sleep Draw: 12mA
Sleep Lib: Adafruit Sleepydog

Arduino Mega Arduino Mega

Arduino MEGA
Chipset: ATmega2560
Current: DC Current per I/O Pin 2 mA
Power: 5V/3.3V
Clockspeed: 16 MHz
Observed Draw: 80mA
Sleep Draw: 29mA
Sleep Lib: Adafruit Sleepydog

Teensy LC Teensy LC

Teensy LC
Chipset: ARM Cortex M0
Current: DC Current per I/O Pin 5 mA
Power: 5V/3.3V
Clockspeed: 48 MHz
Observed Draw: 16mA
Sleep Draw: 3mA
Sleep Lib: Teensy Snooze

ESP32 ESP32

ESP32
Chipset: NodeMCU 32s
Current: DC sleep current is less than 5 μA
Power: 5V
Clockspeed: 240 MHz
Observed Draw: 54mA
Sleep Draw: 11mA
Sleep Lib: ESP native sleep modes logic

Beetle Board Beetle Board

Beetle Board
Chipset: ATmega32u4
Current:
Power: 5V
Clockspeed: 16 MHz
Observed Draw: 38mA
Sleep Draw: 0mA
Sleep Lib: Adafruit Sleepydog

So the winners are:
HUNGRIEST: Arduino Mega
LEANIST: Dfrobot Beetle Board
RUNNERUP: Arduino Pro mini

If I could get the Pro mini to work an external RTC clock and reach the advertised 0mA at sleep, it would win as it had the lowest observed draw.

It was not surprising the Mega was the hungriest, as the name suggests, it’s mega. I was surprised to see difference between my Uno and custom built Uno. The observed draw on the custom Uno was 28% hight than the regular Uno. Part of which I think is due to the CH552 boot-loader chip, but the custom Uno also had much less sleep draw.

I was also surprised to see the Beetle board go to 0mA in sleep mode with out any modifications.

I mostly ran default code in my tests, attempting to find the most straightforward code to energy savings ratio.

Sleepydog is pretty simple, but with the caveat, you need some function to wake it back up, e.g., digitalWrite and delay in the code below.

#include <Adafruit_SleepyDog.h>

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, HIGH);
}

void loop() {
  digitalWrite(LED_BUILTIN, LOW); // Show we're sleeping
  
  // Sleep
  Watchdog.sleep();

  digitalWrite(LED_BUILTIN, HIGH); // Show we're awake again
  delay(5000);
}

UPDATE
After further testing and applying some of this to my actual circuit, the caveat mentioned above became more evident. I got my Beetle board locked in deep sleep with no reset button 🤦‍♂.

The forever sleep was primarily due to another critical point I learned, most of these libraries only work for short deep-sleep times. I was initially hoping to have it check once every thirty minutes. Setting the various delay times that high caused the program to crash and lock up the MCs. I ended up with 25s sleep intervals; anything higher would crash.

I also had issues with the Teensy Snooze library and another library, which wins for best name, narcoleptic delay being able to wake up and communicate with the servo.

They would wake up, and I could control the bulletin LED, but servo would never work.

The only one that seemed to wake up reliably was our friend, the SleepyDog.

I finally resuscitated my Beetle with a shorting tip I found here.

It did prove difficult since you access the reset from the bottom, and I had already soldered to my proto-board!

I also found this great way of handling the locking in sleep mode; I just set it to delay the first few milliseconds to upload a new sketch. It does still require unplugging and replugging the device.

void LowPowerDelay( int ms)
{
// if we’re in the first ten seconds, use regular delay
// so we’re not locked out of USB re-programming
if( millis() < 10000) {
delay(ms);
}else {
// otherwise, use super-low-power delay
Narcoleptic.delay(ms);
}

I also learned that the above-observed draw metrics aren’t entirely accurate. The circuit will still draw more even with the MC in the sleep mode when more components are in the circuit. Resistors, led, motors, etc., still have a slight draw, with the MC off, and were not represented in my original metrics.

END UPDATE

The Arduino-Nano-33-IoT-Ultimate-Guide claimed to get the Nano down to 6mA but I never saw it go lower than 20mA.

After the first few tests I was planning to use the Teensy LC in my solar project. However, I think the Beetle is the better choice since I can easily get to 0mA draw in deep sleep mode.

Now I need to add it to my solar circuit and make sure that bears out.

categories: energy

join me on this crazy ride. enter your email:

contact [at] jakesherwood [dot] com

contact me if you'd like to work together