Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

measuring negative voltage with microcontroller

Status
Not open for further replies.

neazoi

Advanced Member level 6
Advanced Member level 6
Joined
Jan 5, 2008
Messages
4,155
Helped
13
Reputation
26
Reaction score
15
Trophy points
1,318
Location
Greece
Activity points
37,164
Hi I have a micro with an A/D and I want to use it to monitor a voltage

My application outputs a negative voltage of 0 to -1V and it does not allow to interchange poles, so that I use the GND of the application rail as a positive terminal for the micro.

How should I measure this negative voltage?
 

How should I measure this negative voltage?
Hi Neazoi
You can convert that negative voltage into the positive voltage easily via an inverting amplifier with gain of -1 so you can easily measure it !
Best Wishes
Goldsmith
 
  • Like
Reactions: neazoi

    neazoi

    Points: 2
    Helpful Answer Positive Rating
A pullup resistor will bring a negative value into the positive. You would adjust the potentiometer to produce your desired range.

2659200500_1365820689.png


Your source must be able to sink a milli-amp or thereabouts.

I used a source resistance of 3k. The real figure may not be known, and that is the reason to use a potentiometer adjustment.

You state your range of input as 1V. The above method will reduce that range (as shown by the scope traces). If this is not acceptable then you may need to resort to an op amp inversion as Goldsmith suggests (post #2).
 
  • Like
Reactions: neazoi

    neazoi

    Points: 2
    Helpful Answer Positive Rating
Can you suggest a suitable inverting opamp schematic with a gain of -1?
I suppose the -1 gain is in order to convert a negative voltage to it's exact positive one, for example a -1v to exactly +1v ?
 

A simple way would be to use a potential divider of two equal value resistors between +5V and the -1V you are measuring. Take the junction of the resistors to D/A pin. The measured voltages 0V to -1V will then give 2.5V to 2.0V at the D/A. Then make the correction in software.
 
Mr pebe 's idea is very nice . i personally like it . if you are powerful in programming then i recommend this idea.
but if you want to make simple code then make op amp amplifier following using following simple instruction's.

use rf=
300px-Op-Amp_Inverting_Amplifier.svg.png

in ideal condition make Rf=Rin. that can solve your problem.
but noise and many other conditions make this idea false.
so simply use variable resistor at the place of Rf. and set your gain.
 
You are doing a level shifting with this method. I would prever a direct conversion from negative voltages to the exact positive ones. Is there a suitable practical opamp schematic?

- - - Updated - - -

Mr pebe 's idea is very nice . i personally like it . if you are powerful in programming then i recommend this idea.
but if you want to make simple code then make op amp amplifier following using following simple instruction's.

use rf=
View attachment 89278

in ideal condition make Rf=Rin. that can solve your problem.
but noise and many other conditions make this idea false.
so simply use variable resistor at the place of Rf. and set your gain.

Have you got any suggestion as a starting value of these resistors? I am using a scotkey detector diode to rectify RF and to convert it to a voltage.
Also in which one should I put the potentiometer?

I guess I have to adjust the potentiometer so that I get an exact positive voltage, like the negative one..
 

Hi Neazoi
For resistors of that inverting amplifier if they be exactly the same together then gain will be -1 so you can use a simple op amp like TL072 or anything else . as you probably know the resistor which has been tied into the inverting input of op amp ( one of it's heads ) and another head of that connected into the vin , is your input impedance . so you can select it a bit high . for instance you can use 10 k ohm for both of the resistors .
Best Wishes
Goldsmith
 
  • Like
Reactions: neazoi

    neazoi

    Points: 2
    Helpful Answer Positive Rating
Hi I have a micro with an A/D and I want to use it to monitor a voltage

My application outputs a negative voltage of 0 to -1V and it does not allow to interchange poles, so that I use the GND of the application rail as a positive terminal for the micro.

How should I measure this negative voltage?



There is another method. Put a 3.3V zener diode, bottom to the -1V to 0V signal line. It then goes 3.3V 'up'. Attach a 1K or 10K resistor from the top to the 5V line. The bottom of the diode rides along with your signal, since the diode drops 3.3V, so the top side tracks at 2.3V to 3.3V..

How well it works will vary with how low or high impedance your signal is.
 
  • Like
Reactions: neazoi

    neazoi

    Points: 2
    Helpful Answer Positive Rating
I used the op-amp method, seen here: https://electronics.stackexchange.com/questions/3105/how-do-i-measure-a-negative-voltage-with-a-adc
to display the negative voltage output of my bench power supply. It works well.

If you know the voltage will never exceed -1V, you can pick a gain of -3 and use a common LM324 to get nice resolution for the microcontroller to read. (Note: The LM324 can't get closer than about 1.5V to its positive supply rail, which is why I chose a gain of 3.) You can go with 10K and 30K resistors.
 
  • Like
Reactions: neazoi

    neazoi

    Points: 2
    Helpful Answer Positive Rating
I used the op-amp method, seen here: https://electronics.stackexchange.com/questions/3105/how-do-i-measure-a-negative-voltage-with-a-adc
to display the negative voltage output of my bench power supply. It works well.

If you know the voltage will never exceed -1V, you can pick a gain of -3 and use a common LM324 to get nice resolution for the microcontroller to read. (Note: The LM324 can't get closer than about 1.5V to its positive supply rail, which is why I chose a gain of 3.) You can go with 10K and 30K resistors.

The author states that the zener method is more accurate. Can this be real?
 

A simple way would be to use a potential divider of two equal value resistors between +5V and the -1V you are measuring. Take the junction of the resistors to D/A pin. The measured voltages 0V to -1V will then give 2.5V to 2.0V at the D/A. Then make the correction in software.

I think this may be more accurate than even the opamp, even down to the 10s of mV provided that the +5v supply is dead stable. The positive output voltage variation will precisely folow the negative input voltage variation but at a smaller variable amount.
Low ppm resistors would provide temperature intependent measurements and no need for any re-adjustment in temperature variations.
how should I make the correction in software, any hints?
 
Last edited:

I think this may be more accurate than even the opamp, even down to the 10s of mV provided that the +5v supply is dead stable. The positive output voltage variation will precisely folow the negative input voltage variation but at a smaller variable amount.
Low ppm resistors would provide temperature intependent measurements and no need for any re-adjustment in temperature variations.
how should I make the correction in software, any hints?
OK. Can you tell me:
1. How many bits resolution in the A/D of your micro?
2. Is the reference voltage limited to the 5V of the supply, or can you input a different voltage?
 
  • Like
Reactions: neazoi

    neazoi

    Points: 2
    Helpful Answer Positive Rating
The author states that the zener method is more accurate. Can this be real?

I can tell you that my display is accurate to within 20mV over the entire range. Using 1% resistors, of course.
 
Last edited:
  • Like
Reactions: neazoi

    neazoi

    Points: 2
    Helpful Answer Positive Rating

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top