Batttery backup of the RTCC?

Thread Starter

spinnaker

Joined Oct 29, 2009
7,830
This could probably go in the embedded forum but since it is a bit more generic question and this subfourm gets more notice I figured I would post it here.

I am building a project involving an RTCC. The project will be powered via a wall wart. The project will run on 3V via an on board regulator. But I want a battery backup for the clock in the event of a power failure. I think I can figure out how to monitor for main power failure and put the pic to sleep. That is not the problem.

Where I need help is how to design the battery backup. Can I simply put the battery in parallel with my 3VDC supply? Or do I need to switch it in somehow during the power failure? If so, how do I do that?
 

bug13

Joined Feb 13, 2012
2,002
Sorry something like this, if your 3VDC doesn't draw power (back into your plug pack), you can remove the diode between 3VDC and MCU
O8lTi.png


Or if
 

Thread Starter

spinnaker

Joined Oct 29, 2009
7,830
Now why didn't I think of that??? ;) So simple. I am doing just this with my solar panel project. I will need two diodes so the pic can monitor power failure and then go to sleep. I need to make sure it is only monitoring the wall wart supply.
 

GopherT

Joined Nov 23, 2012
8,009
Now why didn't I think of that??? ;) So simple. I am doing just this with my solar panel project. I will need two diodes so the pic can monitor power failure and then go to sleep. I need to make sure it is only monitoring the wall wart supply.
Put a pair of resistors in series to ground (before the diode on the Wall wart ). Then monitor the voltage at the midpoint of the two resistors.
 

MrChips

Joined Oct 2, 2009
34,807
The diode solution is pretty much the standard solution.
Don't forget to use a Schottky diode such as 1N5817 for low diode forward voltage.
 

Thread Starter

spinnaker

Joined Oct 29, 2009
7,830
The diode solution is pretty much the standard solution.
Don't forget to use a Schottky diode such as 1N5817 for low diode forward voltage.

Weird. I have been organizing my parts tonight. Had a envelope sitting here that had some previously ordered . I thought I had removed all components and put them away but before I tossed it decieded to check the contents once more. I noticed something inside. It was a bunch of 1n5819s! ;)
 

GopherT

Joined Nov 23, 2012
8,009
I was sort of thinking something like that except through a current limiting diode. I guess I can go without D2 then? I just need D1 so the supply doesn't try to power my battery.
I would keep D2, I wouldn’t want the little battery to lose any current through the power supply if there is any path to ground.

EDIT ...and Go Steelers.
 
Last edited:

Picbuster

Joined Dec 2, 2013
1,058
This could probably go in the embedded forum but since it is a bit more generic question and this subfourm gets more notice I figured I would post it here.

I am building a project involving an RTCC. The project will be powered via a wall wart. The project will run on 3V via an on board regulator. But I want a battery backup for the clock in the event of a power failure. I think I can figure out how to monitor for main power failure and put the pic to sleep. That is not the problem.

Where I need help is how to design the battery backup. Can I simply put the battery in parallel with my 3VDC supply? Or do I need to switch it in somehow during the power failure? If so, how do I do that?
Hi Spinnaker, are you using a rtc chip or do you use the main mpu?
If you use a chip like MCP795XX series then a battery switchover is embedded.
( this chip is great I no problems easy to program)
Even an interrupt at a given time could be generated.

Picbuster
 

Thread Starter

spinnaker

Joined Oct 29, 2009
7,830
Better to do it with a diode drop (same as power supply, then you can simply check for a digital high or low on any 8nput pin.



View attachment 138321
Wait I just realized something. How is this setup going to keep my battery from running the Pic when the power is on? Won't it deplete the battery over the long term? Don't I need to switch in the battery somehow only during power failure?
 

GopherT

Joined Nov 23, 2012
8,009
Wait I just realized something. How is this setup going to keep my battery from running the Pic when the power is on? Won't it deplete the battery over the long term? Don't I need to switch in the battery somehow only during power failure?

No, if the battery is at 3v and your power supply is 3.3 v, then the diode to the battery will be reverse biased and no current will flow from the battery n
 

Thread Starter

spinnaker

Joined Oct 29, 2009
7,830
Cool. I don't even need to use another pin to monitor it.

26.0 HIGH/LOW VOLTAGE DETECT
(HLVD)
The High/Low-Voltage Detect (HLVD) module can be
used to monitor the absolute voltage on VDD or the
HLVDIN pin. This is a programmable circuit that allows
the user to specify both a device voltage trip point and
the direction of change from that point.
If the module detects an excursion past the trip point in
that direction, an interrupt flag is set. If the interrupt is
enabled, the program execution will branch to the interrupt
vector address and the software can then respond
to the interrupt.

When enabled, the HLVD circuitry continues to operate
during Sleep. If the device voltage crosses the trip
point, the HLVDIF bit will be set and the device will
wake-up from Sleep. Device execution will continue
from the interrupt vector address if interrupts have
been globally enabled.
 
Top