0
0
Arduinoprogramming~20 mins

Reducing power consumption tips in Arduino - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Power Saver Pro
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What 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
}
AGoing to sleep...\nAwake!
BGoing to sleep...
CAwake!
DNo output, program hangs
Attempts:
2 left
💡 Hint
Is there any wake-up source (like an interrupt) configured to exit power-down sleep mode?
🧠 Conceptual
intermediate
1:30remaining
Which 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?
AUse delay() to pause the program
BKeep all peripherals running at all times
CIncrease the clock speed
DPut the MCU into deep sleep mode when idle
Attempts:
2 left
💡 Hint
Think about what consumes power when the MCU is idle.
🔧 Debug
advanced
2:00remaining
Why 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
}
AADC is disabled correctly; problem is elsewhere
BADCSRA register is write-protected and cannot be changed
CADEN bit must be cleared with ADCSRA = ADCSRA & ~(1 << ADEN); not &= operator
DADC must be disabled after sleep mode is set
Attempts:
2 left
💡 Hint
Check if disabling ADC alone is enough to reduce power.
📝 Syntax
advanced
1:30remaining
Which 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.
Asleep_disable_bod(); sleep_cpu();
Bdisable_bod_sleep(); sleep_cpu();
Csleep_bod_disable(); sleep_cpu();
Dbod_sleep_disable(); sleep_cpu();
Attempts:
2 left
💡 Hint
Look for the exact function name in the Arduino sleep library.
🚀 Application
expert
2:30remaining
How 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
  }
}
A5
B4
C6
D0
Attempts:
2 left
💡 Hint
Count how many times the interrupt increments wakeCount before stopping.