Intermittently-powered Arduino circuits

'Afternoon, all. I've been chewing on another Arduino-based idea or two (for which the Arduino is probably complete overkill, but you gotta go with what you know, right?). I'd like to work up a brake light flasher for my car. It'll get triggered when the brake light turns on, and will rapidly blink the brake light, so as to try to get the attention of the makeup-applying, coffee-drinking, newspaper-reading, cell phone-talking "driver" in the 6,000 lb SUV riding my bumper. (I've already been rear-ended once in Boston.) This will essentially be a larger version of the LED-blinking "hello, world" we all know and love.

I'm probably over-thinking this (as I tend to do), but the power to the brake light where I want to mount th circuit is only a single 12v power source: I do not believe there is another constant source of power in that region. I think that the startup time of the standard Arduino is too long for it to respond quickly if it's not constantly powered on. Given that the circuit will be tucked away in a recess of the body, I'd rather not use a battery with an indefinite lifespan. I think the simplest solution (short of running another always-on 12v line from somewhere nearby) would be to use a large capacitor which would power the Arduino in sleep mode. If I wake the Arduino from sleep when the power comes on for the brake light via an interrupt, the power consumption should be quite low. Even if I had to power the Arduino with it awake and just polling the input from the brake pedal, I think the current draw would be fairly low (although I don't know how low). Unfortunately, I'm not well-enough (or indeed at all) versed in capacitor theory to figure out how large of a cap I'll need. I think this goes into the area of "super capacitors", but I'm not really sure. Even if the capacitor ran down completely once a day, that would be fine: once the circuit was powered by the brake pedal once more, the capacitor would recharge, and the Arduino would boot.

So, is this a feasible proposition? Assuming that I already have the 12v to 5v conversion taken care of, what would I have to do to wire in said uber-capacitor such that it provides power to my circuit in the absence of a live 12v source?

Thanks,
Brian

A car battery would probably power a Arduino for several years. :wink:

I'd power it constantly but make it sleep. That uses virtually no power.
Then when the brake light goes on, use a interrupt (via transistor) to wake it up again.

From a circuit-design standpoint, I absolutely agree that running another wire would be the best solution. Unfortunately, that's also the approach I would like to avoid, at the moment... :slight_smile:

Think about to use a simple flip flop circuit, using car battery 12v. as power source. You don't need to use an Arduino to do this simple job. Easier, cheaper, less power consumption (not full-time powered), no programming, faster response,...
[edit]In fact, you don't need a power source wire: you can use the same wire that light the original brake light. And flip flops uses only 2 transistors, or think about the 555 that kg4wsv is suggesting below.[/edit]

I think the newer Arduinos have a faster startup time.

Even better, burn your code directly to an ATmega (you weren't going to stick the whole arduino in the trunk, were you?) without a bootloader, and it'll be pretty much instant-on.

I hate to say it, but as an alternative, go look up a basic 555 timer circuit. Save the Arduino for something else.

-j

I started out by looking at a 555, but I want something with a little more intelligence than just flashing the LED array. Something like blinking quickly for 10 flashes, then slowing down for another 20, then solid on. And don't repeat the flashing if the brake pedal's hit again within 30 seconds. The numbers are approximations, but the idea is the same. I probably could do it without the use of a microprocessor, but it'd take me years to learn the hardware design. :frowning:

In this case, I'll make a suggestion:
do the opposite: first slow flashing, then fast flashing, and then full light. This gives the sensation of increasing danger (the other car is getting closer, the light flashes faster).

And to get more interesting, perhaps a ultrasound sensor, that does this timing between three flashing speeds: when the other car is far from your, it blinks slowly, when gets closer, blinks fast. When it stops, light stops blinking.

A simple alternative is to associate this timing to your car speed. With high speed while breaking, low speed blinking. With lower speeds while breaking, fast blinking.

Proximity sensor, mp3 player and a loud speaker.

Play pre-recorded profanity at idiots who cant drive. ;D

I like the ultrasonic sensor idea! I believe some of the high-end manufacturers (like BMW) have a system that modifies the brake light intensity based on how hard you hit the pedal.

The question still remains on how to power this wee beastie, tho. :wink: Running another wire just seems to ... easy!

The question still remains on how to power this wee beastie, tho. :wink: Running another wire just seems to ... easy!

Assuming you mean the up to 8 second delay of a Arduino NG/Deicimila then this is the answer you are looking for:

Even better, burn your code directly to an ATmega (you weren't going to stick the whole arduino in the trunk, were you?) without a bootloader, and it'll be pretty much instant-on.

--Phil.

I'm looking to figure out how to power the circuit for at least 60 seconds from a capacitor. I want to not repeat the flashing sequence if the pedal's released and pressed again within, say, 30 seconds. If I take power only from the brake lights and have an immediately-booting Arduino, I won't be able to do that because the circuit will power off once the pedal's released.

As I said before, Instead of powering the AVR intermittently, its FAR easier to power it constantly and make it sleep.

Power it from what - the OP is trying not to run a power wire to the back of the vehicle, so the only power he has is when the brake lights come on.

Regards,

Mike

Thanks, Mike. That's my point. :wink: The easiest solution is to run another always-on line to the circuit. I don't want to do that.

I've been researching capacitors for the last couple of days and I'm still kind of stuck. I know that a large enough capacitor should be able to power the Arduino (or any circuit) for some finite amount of time. The problem is that I don't have the formula that will take me from a known voltage and known current draw and give me a capacitor size, from which I can determine run-time. I also don't know how to wire it into the system. I think can just run it in parallel with either my 12v source or the regulated 5v to the circuit, but I'm not sure if I need to put some resistance in there to keep from frying things.

Just stick your big cap in there, logically parallel to the power supply filter caps. Physically, stick it in the +5 and GND ports on the Arduino. I'd put it on the 5V side, just so you're not powering the regulator, too.

I've caps, e.g. 1F 5.5V, for just such applications.

-j

So, a thought I had that I'll just throw out there... :slight_smile:

How about using a capacitor to store charge to use for timing? I have no idea on the logistics, but if you had a capacitor that took 30s to discharge, on startup you could sense if there was any charge in it, and if so don't flash the lights. Obviously charging time might be an issue...

A suggestion just in time for International Wild Ideas Day... :smiley:

--Phil.

I've caps, e.g. 1F 5.5V, for just such applications.

Thanks, J. What kind of runtime to you get out of a 1F cap, roughly speaking? This puppy's gonna be pretty minimal: bare-bones Arduino support components (7085 for power regulation, crystal, two transistors or optoisolators).

How about using a capacitor to store charge to use for timing? I have no idea on the logistics, but if you had a capacitor that took 30s to discharge, on startup you could sense if there was any charge in it, and if so don't flash the lights. Obviously charging time might be an issue...

That's a good idea, Phil. I still want to have a little more logic in the flashing pattern, however: start off fast, slow down the longer the pedal's pressed, etc. Someone with more knowledge of R-C circuits, timers, etc. could probably build this circuit more quickly and for far less than the cost of the AVR chip, but it'll be much faster for me to implement this way. I'm a software guy with a very limited knowledge of electronics and it'll be faster for me to change my loop() than it will be to reconfigure various discrete components to do what I want.

What kind of runtime to you get out of a 1F cap, roughly speaking?

Sorry, but I haven't actually used them myself, just seen them advertised.

Just spent a little time (with wikipedia) reminding myself of the units/derivation of capacitance, and it looks like a 1F cap would provide one Amp-second, so a 100mA load would run for 10 seconds.

for longer times, maybe a capacitor could be used as some sort of memory cell: wire it with a resistor across it, then when the arduino starts up check the voltage with an ADC. A bit of math and a bit more testing (temperature variations, especially with an automotive application, could be killer) could give you a crude analog timer out of a very simple RC network.

Of course, you could probably manage to make a single memory cell with some sort of logic, but my brain is starting to hurt with the unfamiliar use, so I'll let you run with it for a while.

-j

Removing the bootloader is a good idea. To save costs get a boarduino and program the device to use the internal oscillator. I'm considering something as trivial but am looking at the ATTINY for it.

You could place the whole thing in the trunk in a waterproof box. I highly recommend using a normally closed relay, having the arduino powered on and then start opening and closing the relay. That way if the arduino fails the brake lights still work because the relay stays closed. Well it's more likely to stay closed.

Be aware that the power in cars sucks. You'll want LOTS of filtering, smoothing, spike suppression etc. Start with a MOV at 30v and a transorb at 15 then a filter network and then preregulate the power 9V with filtering then feed that to the arduino.