ADC low battery alarm

CLUELESS1

Senior Member
I'm not near my PC to try, but do I have to establish a fixed reference voltage with a Picaxe being used for a low battery alarm, or can I just use ADC values. Thanks
 

ac21

Member
I'm not trying to hijack this thread but won't using a voltage divider to get a adc reading on say.. A 12 v battery run it down slowly?
 

CLUELESS1

Senior Member
Thanks for the hijack, your right. So maybe I just read the ADC of my positive rail. Be home soon to try, I was just trying to buy time. Have a good weekend
 

Dippy

Moderator
You'll need a fixed ref somewhere.
Whether that is internal or an external reference.

ADC is a ratiometric measurement.
Sometimes, using the 12V battery scenario, you'd just have a 5V reg and sample the 12V battery with a pot-div.
But you can't just have a pot-div without a reference(inc a V.reg supply).
Other people have used a fixed ref and simply done an ADC and determined the ratio as the battery droops.

There are a number of ways to do it.
Read up on ADCConfig and give the old grey cells a thrashing ;)
 

srnet

Senior Member
The newer PICAXE have an internal Fixed Voltage Referance.

Details of what it is and how to use it are under the FVRsetup command in the manual

The online information can be found by putting into Google;

PICAXE Fixed referance voltage
 

CLUELESS1

Senior Member
Thanks Dippy, had a horrible feeling that might be the case, don't have any zeners.

However thanks srnet, excellent, I will try the 2nd example in the link you sent, looks just what I wanted.
 

Pongo

Senior Member
Are you running the picaxe directly from the battery that you want to measure, or are you using a regulated supply for the picaxe?
 

AllyCat

Senior Member
Hi,

You don't even need to bother with directly using the FVR, PICaxe's native CALIBADC or CALIBADC10 commands will directly give you a value.

But note that that the value returned increases as the supply rail falls, so the "alarm" should occur when the value is greater than an appropriate threshold, Also, if you need a specific threshold voltage, then you may need to initially calibrate the value against a known reference (e.g. digital multimeter).

Cheers, Alan.
 

neiltechspec

Senior Member
I always use the following :

calibadc10 w0
w0 = 10486/w0
bintoascii w0,b2,b3,b4
sertxd ("Supply Volts = ",b3,".",b4,"v ",cr,lf)

Then just do stuff according to the value of b3 & b4.

Neil.
 

CLUELESS1

Senior Member
Many thanks everyone for the suggestions and code, answered my problems. I hate using batteries, never know where you are. My next feat is to remove a relay if I can that puts 12 volts onto doorbell circuitry. Trying to find relays to work over voltage ranges and not draw lots of current a real pain.
 

eclectic

Moderator
Many thanks everyone for the suggestions and code, answered my problems. I hate using batteries, never know where you are. My next feat is to remove a relay if I can that puts 12 volts onto doorbell circuitry. Trying to find relays to work over voltage ranges and not draw lots of current a real pain.
Latching relays?

e
 

CLUELESS1

Senior Member
Thanks eclectic, no, momentary. Managed to do (PNP transistor switch)

I hope you are not giving up your "hands on" Picaxe life, very sorry to read your on the move.
 
Last edited:
Top