How to get my little cpu to measure voltage

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View


I'm working on a project and I can get most of it done except I need my
microprocessor to measure voltage in a car. It doesn't have to be super
accurate. The chip I'm using is an atmel 89c2051.

Thanks,
Michael

PS, I've googled already but couldn't get the right combination of words.



Re: How to get my little cpu to measure voltage


The words you are after are "analogue to digital converter".

The chip you are using has a built in comparator, so if you only need to
know when the voltage exceeds or falls below a certain level you could
just use that.


Re: How to get my little cpu to measure voltage



Quoted text here. Click to load it

Since the 89C2051 doesn't have an analog to digital converter on board
you will have to either use an external ADC, or use the internal comparator.

The '2051 doesn't have many pins, and since you don't indicate how many
are already allocated, it may be wise to assume that most are already used.
This restricts the selection of an ADC to perhaps one with a serial interface.
Since you're only measuring battery voltage, which doesn't change rapidly
with time, a cheap slow single channel ADC should do the trick. A Texas
Instruments TLC0831, or a National ADC08831 are 8 bit 3 wire serial ADCs
and are available from RS Components at their trade counter for less than
$10 each. There may be others that take your fancy, or may be available
near you.

If the voltage measurement doesn't need to be accurate (how accurate ?)
you could use the on-board comparator to monitor the voltage. Set the -ve
input to a reference voltage, and connect the +ve comparator input to
a voltage divider from the battery voltage to ground. The output of the
comparator will be available on P3.6. Don't forget to filter the +ve input
of the comparator with a capacitor to reduce the incidence of noise.
It may also be a good idea to clamp the comparator input so that it doesn't
rise above its maximum input voltage. Likewise for the ADC.

When measuring the voltage, whatever method you end up using, make
sure that you take several readings, say 16, sum the readings and then
average them, to reduce the noise.


Re: How to get my little cpu to measure voltage


Quoted text here. Click to load it

Only 2 outputs are used at the moment.

Quoted text here. Click to load it

Probably a good idea anyway.

Quoted text here. Click to load it

I'll have a look at them tonight as I've got the rs catalogue at home.

Quoted text here. Click to load it

That all makes sense to me except what do you mean by clamp the input?

Quoted text here. Click to load it

Sounds like a good idea. Thanks for your reply!

Michael
Quoted text here. Click to load it



Re: How to get my little cpu to measure voltage




<snip>

Quoted text here. Click to load it

In this case it means to restrict the voltage swing of the measured signal to a
certain range, usually the limits of the device that the signal is being fed
into.
It can also mean to change the bias of a signal to a different reference voltage.
The clamp can take the form of a diode, zener diode, transient voltage
suppressor, gas discharge tube, etc depending on the situation. It's basically
a protection device.

Quoted text here. Click to load it

You're welcome.


Re: How to get my little cpu to measure voltage


On Mon, 30 May 2005 21:47:05 +1000, dmm

Quoted text here. Click to load it

Or even better, since it does not need to be too acurate, use an RC
circuit and measure the charge time of the cap. Works a treat.

Re: How to get my little cpu to measure voltage


"The Real Andy" <will_get_back_to_you_on_This> wrote in message
Quoted text here. Click to load it

I remember seeing this years ago when working on a dishwasher. I was working
on the mechanical side of things but I remember the electronics guy
mentioning they used something like this to measure temp. Can you give me
some more details of how it works?

Michael



Re: How to get my little cpu to measure voltage



Quoted text here. Click to load it

the simple explanation:

voltage in --/\/\/\---+----port pin (i/o)
                      |
                     cap
                      |
                      |
                     Ov

drive the port pin low, make it an input and measure the time taken to
charge the cap.

Depending on the cap value , max measurement voltage and aquisition
time required, you may need  a resistor between the cap and the port
pin.

There should be a plethora of info on the net using this method, mind
you I have not looked! :)




Re: How to get my little cpu to measure voltage


"The Real Andy" <will_get_back_to_you_on_This> wrote in message
Quoted text here. Click to load it

Shit heh, couldn't get much simpler than that, I'll give it a go hopefully
over the weekend.

Thanks,
Michael



Site Timeline