3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

PICAXE battery voltage monitor

does anyone have an idea of how one could get a picaxe to monitor its own battery source and light an LED when the voltage drops below a certain value. I am thinking that there might be a way to do it using a ADC input. Perhaps a zener diode could be used and the voltage above its threshold could be measured.

PICAXE_logo4.bmp
4 comments
Jul 21, 2008. 5:07 AMgmoon says:
A voltage divider with the ADC will do it.

          Sample Voltage           |           R1           |ADC---------            |           R2           |           GND

Most micro ADCs have an input range dictated by their supply voltage (0-5V, or instance.) Need to sample a larger value, say 15V for your car? No problem. The voltage divider scales the sampled voltage down to an acceptable range.

Example-- to scale a sample voltage of 15V down to 5V:
R1 = 10K
R2 =5K

(or other proportional values...100K and 50K, for instance. The actual values used depends on the input Z (impedance) of the ADC. Lower resistance values will have greater current loss.)
Jul 22, 2008. 5:54 AMgmoon says:
OK, then using the ADC exclusively (not external components) depends on the PIC--and if the PICAXE firmware is flexible enough to take advantage of the PIC's capabilites. Most micros have the option of using an internal reference voltage, for this very reason. I.E., if the micro Vcc can vary from 2.7 to 5V, then the ADC results will always be proportional to the supply voltage (the current supply voltage will be the max ADC result.) Not what you want... Some micros also have an external ADC reference voltage pin, and you can supply that reference with a regulator or Zener, as you suggested.
Jul 22, 2008. 10:13 AMgmoon says:
Some elaboration:

Your problem is discussed in this thread. As suspected, the ADC reference voltage is the present Vcc, so the results of an ADC read vary with the supply voltage.

They discuss two real options (basically what was outlined above):

1) use a picaxe X1 chip, which has an internal voltage reference.

2) create an external reference; although there's no external reference voltage pin (like AREF on AVRs), you can use a a separate ADC pin and track how the ADC reads the reference voltage--the reference voltage will be unchanged, but you can derive the supply voltages from how much the ADC values deviate.

They propose using the forward voltage drop of a diode as the reference voltage.

In your case, you don't even need to use two ADC channels. You're not reading an external voltage, rather your tracking changes in the ADC readings of a fixed reference voltage. I.E., the reference doesn't change, but the ADC reads change with the supply voltage...

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!