I'd like to use my Arduino as a timer for my chains of LED. THis means it will be in sleep mode most of the time and only has to wake up 2 times a day
Question: How much power does the Arduino consume when in delay() function?
Is there maybe a better approach for my use case?
(1) delay 20 hours
(2) put some power to a transistor which turns on the LED
(3) delay 4 hours
(4) turn power to transistor off again
(5) goto (1)
Putting the arduino to sleep will help you. Check out Nick Gammon's page on the subject: power saving
Depending on how many LEDs you are driving their current consumption may vastly outweigh that of the Arduino.
The Arduino uses the same energy while in a delay() as doing anything else - it is still working at 16MHz.
Thanks for pointing me to sleep modes.
What I found is this here:
SLEEP_MODE_IDLE: 15 mA
SLEEP_MODE_ADC: 6.5 mA
SLEEP_MODE_PWR_SAVE: 1.62 mA
SLEEP_MODE_EXT_STANDBY: 1.62 mA
SLEEP_MODE_STANDBY : 0.84 mA
SLEEP_MODE_PWR_DOWN : 0.36 mA
Next question: While in sleep mode, do the I/O-Pins of the Arduino still keep it's values?
E.g. when I set one Pin to OUT and put HIGH on it - will it still keep the 5V even when in sleep mode?
I've never tried it, but the "Configuring pins as inputs/outputs" section on Nick's page strongly suggests that the digital outputs will retain their state in sleep mode. Which makes sense - sleep mode would be pretty useless otherwise.
You can go and look at the source of delay(), the Arduino code is open source
so its there on your computer waiting for you to inspect if you so desire - its
worth realizing that.