I've been in search of what would be a "simple" project to cut my teeth on with Arduino, and I think that I found one. I saw a similar project, and read the thread there, but still had some questions.
So, in this case, I want to control a set of LED lights in my truck to illuminate the footwells when the dome light comes on (e.g. when a door is opened). Normally, this wouldn't need any kind of controller (and may still not, after I explain). Where I see the Arduino coming in, is I don't simply want on/off functionality, but rather once the door closes, I'd like the lighting to fade out nicely over a few seconds. I figured that could be done via PWM. You can buy those strip LED's really cheap now that could easily be hidden under the dash and/or seats. Toss it all in a little project box and you're good to go, right?
My questions are:
Is an Arduino Nano overkill for this?
Does the Arduino need constant 12V hot from the truck battery, or does it's startup cycle run fast enough that it'd work off the circuit that controls the dome light?
If it needs constant 12V, is there any danger of it running the battery in the truck dead, or is the amperage it draws low enough that it'd be negligible for the most part?
Am I crazy for thinking about the solution this way?
Any extra advice would be much appreciated, and I'll gladly document the process and share all my code.
EDIT: I should also mention, I'd consider this the start of a bigger lighting system scheme that could extend to also something like lighting strips along the bottoms of the doors, and the bed of the truck too, so I'm seeing this as something that could grow over time, and thought the microcontroller might be the best way to go for it, rather than having everything be a different circuit.
Promini is all you need for this.
If you use a Programmer and File:Upload Using Programmer to load it, there will be no bootloader and the sketch will start immediately.
You'll need a couple of transistors to sink current from 12V thru the LEDs.
Seems like a reasonable project.
Arduino with standard bootloader starts in little less than a second. The delay is noticeable, but I don't think it would be a problem for your application. If it does bother you, you can use the approach CrossRoads stated.
Keep in mind that if you power the Arduino through the dome light, it will lose power as soon as you close the door, so it won't be able to perform the dimming.
You want the light to fade down after you close the door.
When you close the door, the power to the dome light is cut off, isn't it? So you cannot keep using power from the dome light circuit after it switches off. Therefore,you need a more permanent source of power.
Actually, you want to derive the power from the dome light circuit on the "hot" side of the dome light itself - which you should be able to trace at the same time as you identify the wire to the door switch. Door switches always switch to ground with the dome light connected to its own fuse (along with some other accessories).
One complication which clearly you have not come across - recent model cars already have a control to dim out (using incidentally, PWM) the dome light after the door is closed, also to switch it on when you use the remote to unlock the doors - and to fade it out if you leave the door open too long so it does not flatten the battery. If your truck had that you would of course, not be asking this question.
Now since you are going to be powering your Pro Mini continuously, its boot time becomes irrelevant. Its resting current draw is in the order of a few milliamps only so this should not be too much of a problem. You can remove the resistor feeding its pilot LED for one thing.
By the way - one alternative to this all and contrary to what I first said about "you cannot keep using power from the dome light circuit after it switches off": one or more really large capacitors (47 mF or so).
{Note: you would need a current limiting circuit to feed the capacitors}
on the other hand.....
you could have the dome light power up the unit. then once in control. it could turn on a relay to feed itself power.
now, I am not sure of the difference between a door switch and a dome light. if the door switch fades with PWM, then you can monitor that to know if the door is open or fading out. regardless, once you are certain the door switch indicates a closed door, you can start to fade the lights, then turn off the relay and kill the power so your unit does not kill the battery.
you might even add a second power source so that it stays hot when the car has the power on.
I used to have an old GM that when you pressed the volumn knob on the radio, the clock would come on and then fade out. loved that feature.
may I suggest you edit your first post and add '...or the door switch" to eliminate the discussions about using the inside lights ?