I'm working on a simple setup using an Arduino Nano to automate the switching of my car headlights when it gets dark. I am happy with how to program the Arduino & LDR use and coding, it will be powered using a DC-DC buck converter to convert the 12.9V(ish) to around 7V. I intend to power the Arduino from the switched live circuit in the car, so that it will not draw power when the car is not in use, and as it will control a normally open relay, there is no risk of the Arduino accidentally turning on the lights when it's parked up. (relay will be on the low current switch side of the OEM factory wiring, before the main headlight relays, there will also be a switch to isolate the Arduino and operate the lights as normal)

However I would like to have it so the lights stay on for 5 minutes or so after the car is switched off, would this be possible using a capacitor or similar that charges when the Arduino is powered, and continues to power it after the power is cut? I assume I would need some circuitry to ensure the cap provides stable current/voltage during discharge, although the Arduino is helpful in being able to run on anything from 5-12V. This would give me automatic lights when the car is on(or the key is turned in the ignition at least), but ensure there is no way for the lights to come on accidentally.

Any help is much appreciated. I asked this question on an Arduino forum but most answers just advised to power the Arduino constantly and do the delay with code, which is something I really want avoid as the car is not used everyday, and I don't want to have to jump it because the Nano has drained the battery.

  • \$\begingroup\$ To be honest, the power consumption of an arduino (especially if you put it on sleep) is tiny compared to what a car can handle. (I found some references pointing to it drawing a couple of milliamp, which would mean your battery still lasts hundreds of days). I would be much more worried about spikes on the voltage rails which are common in cars. \$\endgroup\$
    – Joren Vaes
    Apr 13, 2018 at 12:41
  • 4
    \$\begingroup\$ Depends how big the capacitor is. Charging calculator. \$\endgroup\$ Apr 13, 2018 at 12:41
  • \$\begingroup\$ @JorenVaes even if the ATMega is asleep, an Arduino board draws at least a 30mA quiescent current for the regulator and USB controller. \$\endgroup\$ Apr 13, 2018 at 12:42
  • 1
    \$\begingroup\$ Assuming a 12V input, and a minimum Arduino input voltage of 7V (allowing for regulator drop-out), and a current draw of 60mA, you would need at least a 5F (five farad) capacitor, rated for sufficient voltage (bear in mind the 12V rail will be higher than 12V most of the time) to come close to lasting 5 minutes. \$\endgroup\$ Apr 13, 2018 at 12:44
  • 2
    \$\begingroup\$ Why not power the board from the lights? No need for a hold up capacitor then, when the lights go off, the board goes off. Or do you need the board to do something else after the lights go off? \$\endgroup\$
    – Neil_UK
    Apr 13, 2018 at 12:49

2 Answers 2


Run the microcontroller off the same power that is available to the headlights. The extra current to run the micro is miniscule compared to that of the headlights.

Just make sure the micro goes into proper low power sleep mode when done with the headlights. I don't know whether the arduino hardware is designed to allow for low sleep current or not, but plenty of micros are. With competent hardware around them, this is trivial. It is easy to get well below the self-discharge current of the car battery.


Another idea: You can use a timer relay such as this one or even this one to have a constant power running thru the new relay, but use the car's ignition "ON" position as a positive (+) trigger passing through another relay, with the ground (-) of the relay triggered by your Arduino (if it's dark outside). Set the timer to 5 minutes, and each time you turn off the ignition, if it's dark outside, the headlights can stay on for 5 minutes.

  • \$\begingroup\$ Note that links go dead or the content changes. Consider adding some text or an image to explain the basic concept of the links. \$\endgroup\$
    – Bort
    May 7, 2018 at 13:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.