Temporary Battery Backup (Just need about 3 seconds)

Hey everyone, I'm currently designing a catfeeder that will work while my household is away. We have inconsistent schedules and can't keep them on a scheduled feeding routine easily, so hence Arduino dispenser!

I am using an Arduino Nano for this project, which will be plugged in via usb to the wall at all times.

My issue however is designing a circuit to be able to temporarily hold the backup power on just long enough to turn the servo for the cat food open. After that, wait for me to reset it when the power comes on. I'm using two capacitors and a resistor in my code to check for power loss just like this video: Arduino Power Loss Detection with 2 Components - Saving State to EEPROM - YouTube My original plan was this circuit Imgur: The magic of the Internet using two relays. (NO=Normally Open, NC = Normally Closed, C=Coil). Allowing me to use one as a backup relay, and the other as a kill switch relay. The issue becomes that the capacitor I have between the +5v and ground only keeps it powered for about a fifth of a second. Not driving enough current through the Digital Pin to trigger the coil on the relay closest to the battery before the arduino dies.

The idea behind the circuit is upon detecting power loss, it turns on "DPin1" to high on power loss, allowing 9v to flow into the Vin Pin, running it off battery. Then using "Dpin2" to cut off the ground connection, killing itself.

So I'm curious if anyone has other ideas for being able to instigate a backup power, and kill itself method once the jobs done?

My idea currently which will cost me some money is using a rechargable battery charged off a second wallsocket. Turn the servo and just let the battery die.

Thank you in advance for any help!
~Yuri

A typical backup solution would have a backup battery going through a Schottky diode to the 5V pin of the Nano. The battery would be slightly below 5v, such as three alkaline AAs in series, or one rechargeable 18650 lithium battery. If the power ever fails, the diode would become forward biased, and current would automatically flow from the battery to power the Uno. The Uno doesn't have to do anything. But that would leave the Uno running on battery power until the batteries discharge down to the point that the Uno can't run any longer, or until the power comes back on.

If you do need to shut down the power, I think you will find that a mosfet will work better than a mechanical relay.

Will your device be dispensing food more than once a day? Do you know how much current it will draw when it's dispensing, and when it's idle?

I may not have fully understood the issue here.
Is it that you have an automatically controlled cat feeder and you want, in the event of a mains power failure, that the cat feeder is immediately operated for a short period ?
It sounds like some sort of timed latch circuit, in conjunction with the circuit described @ShermanP, may work to maintain power from a secondary source until the latch timer expires.
A Uno is quite power hungry (~50mA). There may be better options including using a sleep mode to ensure the whole application can run autonomously in the event of a mains power loss.

If a servo is involved the current draw may be upto 1A - this makes capacitors impractical, you require
a backup battery capable of 1A for short periods.

Alternatively design the system to be fail-safe - power goes, latch automatically opens via a spring
or something like that.

6v6gt:
I may not have fully understood the issue here.
Is it that you have an automatically controlled cat feeder and you want, in the event of a mains power failure, that the cat feeder is immediately operated for a short period ?
It sounds like some sort of timed latch circuit, in conjunction with the circuit described @ShermanP, may work to maintain power from a secondary source until the latch timer expires.
A Uno is quite power hungry (~50mA). There may be better options including using a sleep mode to ensure the whole application can run autonomously in the event of a mains power loss.

What I'm trying to achieve is not just turning on the backup power, but also allowing the arduino to kill it's own power to prevent me from draining an entire 9v or other battery. -- Sounds like you understand it correctly. As a main supply power loss is detected, the servo opens, dumping massive amounts of catfood down. So I only need a supply for about 3 seconds for the servo to turn. Hence the relay design, but the capacitor is not able to power the arduino long enough to send a signal out the coil. Perhaps could use an external timer as you suggest.

yuripulzeff:
As a main supply power loss is detected, the servo opens, dumping massive amounts of catfood down

Now all you have to do is make sure the cat(s) don't learn to pull the plug :slight_smile:

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.