Challenge - 5 Problems
Power Saver Pro
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediateWhat is the output of this Arduino sleep mode code?
Consider this Arduino sketch that puts the microcontroller into a low power sleep mode. What will be printed on the serial monitor?
Arduino
void setup() {
Serial.begin(9600);
delay(1000);
Serial.println("Going to sleep...");
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
sleep_enable();
sleep_cpu();
Serial.println("Awake!");
}
void loop() {
// Empty loop
}Attempts:
2 left
💡 Hint
Is there any wake-up source (like an interrupt) configured to exit power-down sleep mode?
✗ Incorrect
The code prints "Going to sleep...", then enters power-down sleep mode. Without a wake-up source, the MCU never wakes up and "Awake!" is never printed.
🧠 Conceptual
intermediateWhich method reduces power consumption the most in Arduino?
Among these options, which is the most effective way to reduce power consumption in an Arduino project?
Attempts:
2 left
💡 Hint
Think about what consumes power when the MCU is idle.
✗ Incorrect
Deep sleep mode turns off most parts of the MCU, saving the most power.
🔧 Debug
advancedWhy does this Arduino code not reduce power consumption as expected?
This code tries to reduce power by turning off the ADC, but power consumption remains high. What is the problem?
Arduino
void setup() {
ADCSRA &= ~(1 << ADEN); // Disable ADC
}
void loop() {
// Do nothing
}Attempts:
2 left
💡 Hint
Check if disabling ADC alone is enough to reduce power.
✗ Incorrect
Disabling ADC is done correctly, but other peripherals or settings may keep power high.
📝 Syntax
advancedWhich option correctly disables the Brown-out Detector (BOD) during sleep to save power?
Select the correct Arduino code snippet that disables the BOD during sleep to reduce power consumption.
Attempts:
2 left
💡 Hint
Look for the exact function name in the Arduino sleep library.
✗ Incorrect
The function sleep_bod_disable() disables BOD during sleep correctly.
🚀 Application
expertHow many times will the wake-up function be called after this power-saving timer setup?
This Arduino code sets up a timer to wake the MCU every second for 5 seconds. How many times will the wake-up function be called?
Arduino
volatile int wakeCount = 0; ISR(TIMER1_COMPA_vect) { wakeCount++; } void setup() { noInterrupts(); TCCR1A = 0; TCCR1B = 0; TCNT1 = 0; OCR1A = 15624; // 1 second at 16MHz with prescaler 1024 TCCR1B |= (1 << WGM12); TCCR1B |= (1 << CS12) | (1 << CS10); TIMSK1 |= (1 << OCIE1A); interrupts(); } void loop() { if (wakeCount >= 5) { // Stop timer TIMSK1 &= ~(1 << OCIE1A); while(1); // Stop here } }
Attempts:
2 left
💡 Hint
Count how many times the interrupt increments wakeCount before stopping.
✗ Incorrect
The interrupt triggers every second and increments wakeCount until it reaches 5, then stops.
