I've run into a bunch of topics where people are looking for an UPS solution for the Arduino. So far I haven't found a ready to use solution, but after thinking about it I came up with something, there's only one small problem. This is the idea:(Replace LED with Arduino, the LED is just there to act as a load. Switch is to simulate power-loss.)

I think it's obvious what I'm trying to do here. When the main power source, a 9v DC adapter, is working the SPDT relays will connect that power source to the Arduino. When the main power source fails, the relays switch and the battery pack (8 AAA Eneloops) will be hooked up to the Arduino's DC input. And when the power returns, the relays switch again and the main power source will be hooked up to the Arduino.

The problem: During the time the relays are switching, there will be no power going to the Arduino. Can this be solved by placing a capacitor or am I thinking to simple here?

But if you want to do it yourself using other battery types, then you're best off using MOSFETs, not relays. Or just simple diodes. Diode between battery and Arduino. Diode between power supply and Arduino. Highest voltage wins. Then a circuit from power supply to battery for charging - maybe with an isolating MOSFET to disconnect the battery from the Arduino when it's charging.

Those LiPo batteries don't have much of a charge, but that could be me. Plus I want something that can work with every Arduino, since not every shield fits/works with every Arduino (or clone).

Read about a diode solution, those don't prevent a (be it low) discharge from the batteries.

Charging circuit is not required, got a whole bunch of batteries lying around so can switch them at any time.

No idea what to think of MOSFET's, thought of relays because I have those lying around.But will my idea work? If I can find something to compensate for the short power-loss when the relays are switching.

LiPoly and LiIon batteries can have very big charges - it all depends on which batteries you have. After all, they fly planes on them. Real planes. Like the Dreamliner

Why do you have 2 relays? You can do it just as well (better in fact) with one (if you really *must* use relays). Just a single SPDT relay will switch between the two + connections, and you have a common ground. With the power running the relay is energised, so pulls the contacts to connect the incoming power to the arduino, with it off they spring back to connect the battery to the arduino. A massive capacitor should cover the time the relay is not connected to either source.

With diodes, if the main power is higher than the battery power the diode will be reverse biased. You will get a small amount of leakage current flowing backwards into the batteries from the main power - we're talking micro amps here, so nothing to even consider worrying about. I don't see where the discharge of the batteries would happen - other than the self discharge that happens over time anyway.

For MOSFETs, you might like to take a look at the arduino's schematics - it uses a small op-amp and a MOSFET to seamlessly switch between the main power and the USB power.

Those eneloop batteries (NiMH) are "on sale" today [only] at woot.com8 AAs and a charger (it goes to a "trickle mode" after re-charging), $18They hooked me for 2x.

> > >I'm not stumping. I saw this subject with "Eneloops" in it and thought I'd mention it, as I did in fact just buy a couple of packages featuring "same" (coincidental). I got two of 'em, there's just one shipping charge, $5 (in toto - including anything else from any of the other sections), and I paid some sales tax, too, and very convenient.Anybody can pick (or cherry-pick) anything apart, but I think it's nice as a package.

I think they're part of amazon, but I'm not certain.

"You gotta fight - for your right - to party!"Don't react - Read."Who is like unto the beast? who is able to make war with him?"It's "bipolar transistor" or "junction transistor" - "BJT" is just stupid.When all else fails, check your wiring!

The significant disadvantage of NiMH batteries is the high rate of self-discharge; NiMH batteries lose up to 20% of their charge on the first day and up to 4% per day of storage after that. In 2005, a low self-discharge (LSD) variant was developed. LSD NiMH batteries significantly lower self-discharge, but at the cost of lowering capacity by about 20%.

Any slight discharge from the circuitry is going to be dwarfed by the self discharge of the batteries themselves.

Those eneloop batteries (NiMH) are "on sale" today [only] at woot.com8 AAs and a charger (it goes to a "trickle mode" after re-charging), $18They hooked me for 2x.

Hopefully, you have a better charger and are buying it just for the batteries. Enloops are good batteries. The Sunpak SP-charger-01 charger looks like a charger that charges the batteries in pairs rather than each battery individually. These types of chargers generally don't leave all batteries fully topped off. For the batteries alone, $18-20 is about what you pay for Enloops at places like Thomas Distribution.

For flashes for my camera, I used to use Enloops a few years ago, but they started becoming harder to find in retail settings. You can still find them at some places if you look around. I tend to like Low Discharge Maha Imedion AA 2400mAh Rechargeable Batteries these days, because the nominal capacity is greater (2400mAh vs. 2000mAh). Enloop does have a new 2500maH battery, but for $21 for a set of 4, they are a little pricey for my taste.

LiPoly and LiIon batteries can have very big charges - it all depends on which batteries you have. After all, they fly planes on them. Real planes. Like the Dreamliner

Why do you have 2 relays? You can do it just as well (better in fact) with one (if you really *must* use relays). Just a single SPDT relay will switch between the two + connections, and you have a common ground. With the power running the relay is energised, so pulls the contacts to connect the incoming power to the arduino, with it off they spring back to connect the battery to the arduino. A massive capacitor should cover the time the relay is not connected to either source.

With diodes, if the main power is higher than the battery power the diode will be reverse biased. You will get a small amount of leakage current flowing backwards into the batteries from the main power - we're talking micro amps here, so nothing to even consider worrying about. I don't see where the discharge of the batteries would happen - other than the self discharge that happens over time anyway.

For MOSFETs, you might like to take a look at the arduino's schematics - it uses a small op-amp and a MOSFET to seamlessly switch between the main power and the USB power.

Why 2? Seems I didn't realize that the grounds could be hooked up together

Define massive, would 3300µF do the trick? Or a couple of those hooked up parallel. Those are the biggest ones I got lying around I believe.

Those eneloop batteries (NiMH) are "on sale" today [only] at woot.com8 AAs and a charger (it goes to a "trickle mode" after re-charging), $18They hooked me for 2x.

> > >I'm not stumping. I saw this subject with "Eneloops" in it and thought I'd mention it, as I did in fact just buy a couple of packages featuring "same" (coincidental). I got two of 'em, there's just one shipping charge, $5 (in toto - including anything else from any of the other sections), and I paid some sales tax, too, and very convenient.Anybody can pick (or cherry-pick) anything apart, but I think it's nice as a package.

I think they're part of amazon, but I'm not certain.

Thanks for the tip for anyone who does not already have a bunch of those batteries lying around

Most eneloop batteries has lower voltage, I think fully charged one measure around 1.35V and it can go down to 1.2V but still have plenty of power. Most photographers use it for their flash guns. I have 32 of it for my flash guns (but I ain't a photographyer).

Most eneloop batteries has lower voltage, I think fully charged one measure around 1.35V and it can go down to 1.2V but still have plenty of power. Most photographers use it for their flash guns. I have 32 of it for my flash guns (but I ain't a photographyer).

Rechargeable Nimh AA/AAA batteries have a nominal voltage of 1.2 volts per battery. I believe for most of the period of charge, it is at 1.2 volts. You can get them in two forms, normal Nimh which starts discharging rapidly, and low-discharge Nimhs (like enloop) which hold the majority of their charge longer. The downside of low-discharge batteries is the total capacity is lower. When I started with digital photography, normal Nimhs were the only battery, and I needed to setup a weekly schedule to charge and rotate the batteries. Now that I've switched over to low-discharge batteries, I don't have to worry whether batteries I threw in the camera bag a month ago is dead.

Non-rechargeable alkalines have a nominal voltage of 1.5 volts per battery, but the voltage varies depending on the amount of charge left (which makes it easy to implement fuel gauges for non-rechargeable alkaline batteries). For things like digital cameras that take AA batteries, if you use alkalines, some cameras will only get a few shots out before the voltage drops enough that there isn't enough charge for the camera.

Nickle-zinc AA batteries have a nominal voltage of 1.6 volts. A bunch of photographers lept onto Ni-zi batteries for flashes when they came out, but the conventional wisdom is the flashes aren't designed for the higher voltage and will burn out and that the flash manufacturers will reject a flash for warranty repair if it appears you used the higher voltage batteries.

For the record, I have burned out a flash, using normal Nimh batteries, shooting very rapidly.