Can picaxe monitor DS1307 battery?

andrewgodfrey

New Member
I am about to begin designing a timer using a 18X and DS1307. Has anyone used a PICAXE to monitor the 3v battery connected to the DS1307 and turn on a low battery light when the battery gets flat.

I am wondering if it is as easy as connecting the battery to a ADC input on the PICAXE and using the READADC command.
Or, is it bad to connect 3v to a PICAXE when the power supply to the chip is off.

I know the battery life could be 10 years.

Thanks,
Russell.
 

hippy

Ex-Staff (retired)
It should be possible but there are two issues, one identified - With the PICAXE off the voltage to the pin from the battery will be out of spec, and it is also likely that this may act as a 'phantom power supply' keeping the PICAXE and other circuitry powered, running down the battery.

If you can isolate the battery voltage signal from the PICAXE when powered off that should work. Such isolation could affect any analogue reading but that can probably be adjusted out or not be important if looking for specific 'low voltage' points rather than an accurate voltage reading.

I dont know what the ideal hardware for that would look like, probably something involving a FET. A brute force approach would be to use a relay controlled by the PICAXE or from the PICAXE power-supply. It only needs to energise when taking a reading.
 

Dippy

Moderator
Would a micropower op-amp act as a safe mega high impedance buffer?
It could save having clunky old relays :)
 

fernando_g

Senior Member
A P-channel Mosfet between the PICAXE and the battery would isolate it.
And the Mosfet would be driven with the aid of a NPN transistor.

This may not be very clear......However, I drew a small schematic in gif format, but the upload manager keeps telling me it is not a valid image format, for some reason.
 

andrewgodfrey

New Member
Thanks for the replies.
Maybe the picaxe could turn off +5v to the DS1307 via a transistor once a day, and at the same time connect the backup battery to a ADC input via a Mosfet as suggested.
The ADC input could have a 22k resistor connected to ground to stop it floating.


If the battery is too flat for the DS1307 to work correctly, is the time likely to be slow when the main +5v supply returns or does the time/date reset to any certain value.
e.g. Midnight 1/1/1980.


Another way to test for a flat battery may be to turn off +5v to the DS1307 for 1 minute. The time can be read from the DS1307 at the start and end of this period.
If the difference between these two readings is more than 1 minute, this would indicate the backup battery is low.
 

Dippy

Moderator
Why don't you try it? It won't blow up.

As to how the DS1307 behaves when the battery is too flat (or going flat) I really don't know.

Is it really worth the hassle? If you are worried then change the backup battery on each birthday. Battery failure (physical) is highly unlikely and a small lithium coin cell will last for years.
(The data sheet says a >=48mAhr 3V lithium will last over 10 years, so the battery will probably rot before it fails :) ).

After all, unless you get your sampling circuitry at a very high impedance then your circuit will have a significant load on the battery and cut it's life down.
What circuit will you use with the FET to ensure you get consistent volts to ADC?

I would also be tempted to look into the DS1302 which has a programmable trickle charger for the backup battery/capacitor. Harder to drive, but more options and lower backup current. http://www.farnell.com/datasheets/46353.pdf
 

andrewgodfrey

New Member
I don't have a DS1307 chip yet. Just trying to get a few ideas before I start designing.
There is some chance I may make a number of these timers to sell, and it is unlikely others would think to change the battery each year or even in 10 years.

I would like the display to show "LOW BAT" to encourage them to change the battery.

The exact time of day is not really important in the project, I just need to keep an accurate record of elapsed time, even if there is a power failure during the timing period.

I don't have a FET circuit in mind at the moment, just looking for some ideas from others.
If you are not sure a FET would provide enough isolation, I could use a DPDT relay which could disconnect +5v from the DS1307 and connect the backup battery to the ADC input during testing.

The chip you suggest is worth thinking about.

Russell.
 
Top