Not strictly Picaxe

donrecardo

Senior Member
Hi my question isnt about Picaxe but is for use
on a Picaxe based project

I am making a Voltmeter to display on an LCD
My input will be between 21v and 30v so I know I need to
use a voltage divider on the input .
I saw a small circuit for a voltage divider with the normal
2 resistors ( I was planning to use 7.5K and 1.5K to give
a max 5v from 30v input) The circuit I found also shows
a 5.1v zener across the output so if the input was more than
30v it would still give a max of 5.1v and protect the picaxes
input.

What I am hoping is that one of you knowledgeable electronic chaps
can tell me is if there is a way I could connect in an LED to show
when the zener is conducting , ie the input is more than 30v ,
and can you also confirm my choice of resistor values is suitable

I have attached the circuit I found although its values are for 20v not 30v
as I require

Regards
Don
 

Attachments

Janne

Senior Member
The Zener diode is not a good idea, as the leakage current will affect the readings.

It's a better idea to put a schottky diode from the ADC pin towards VCC, so any excess voltage gets dumped to the supply. As for an over voltage led, it's easiest if you activate it from the software when your ADC measurement maxes out.
 
Last edited:

BeanieBots

Moderator
Janne is correct. A zener on an ADC input is a bad idea.
It's been explained here many times how and why it's a bad idea but for some reason people keep wanting to put one there. DON'T.

There's two simple ways of implementing an overvolt LED.
The first is to simply use the PICAXE to light an LED if the maximum value of the ADC (255 or 1023 depending on chosen resolution) has been reached.

The second would be to use a comparitor/op-amp.
I'd suggest the second because to get the best out of the ADC resolution on an input between 21v and 30v would be to subtract an offset. This would require an op-amp and you can get two op-amps in an 8-pin package. The second could be used for your comparitor.
 

hippy

Ex-Staff (retired)
An overload LED being lit when the input hits 255 or 1023 would be easiest, or you can take the same input voltage, divide it down more in a parallel divider, and see when its reading is over some limit.

For example, a 20V input divided by 4 allows a 0V-5V reading (0-255). 20V divided by 8 gives 0V-2V5 (0-127), so any reading above 127 is an overload. That's similar to using a comparator / op-amp BeanieBots mentions.
 

Jaguarjoe

Senior Member
Make sure the values for your voltage divider are a lot higher (~10X) than than resistance of the circuit you are building. I forgot what the max value is for the resistance of the circuit that feeds the ADC is (maybe 10k or something?). This puts you in a box. Too low and it affects the circuit you are measuring, too high and it spoils the ADC readings. An op-amp buffer would fix both of those problems.

Google around for "expanded range voltmeter". This would allow you to scale your input from 20-30v rather than 0-3-voltt giving you a lot more resolution.
 

donrecardo

Senior Member
Thanks everyone

I think the software option will be easiest , If the ADC reading is 255 call it an overload and turn on the LED

Cheers
Don
 
Top