48
\$\begingroup\$

I am working with a PIC micro-controller with inbuilt 10bit ADC and want to measure a voltage in the range of -1 to -3Volts.
I thought of using an op-amp in the inverting mode to make voltage positive and then feed it to the adc of the microcontroller however here I would have to power the opamp with a negative power supply, right?. I don't want to use a negative power supply at the moment and was wondering whether it was possible to achieve this configuration? Can you'll help out?

\$\endgroup\$
  • 1
    \$\begingroup\$ the -1 to -3V that I'm measuring is the output of a LM337 that I want to monitor. \$\endgroup\$ – Kevin Boyd Jun 21 '10 at 6:23
  • \$\begingroup\$ related: Measure -20V to +20V voltage with pic \$\endgroup\$ – davidcary Jun 25 '11 at 22:29
  • \$\begingroup\$ I don't have enough details to flesh out a complete answer, but if your PIC has a VREF- (negative reference voltage) pin then you can probably do this directly, without an additional inverter, through creative use of the reference voltages. \$\endgroup\$ – Sparr Aug 16 '13 at 2:04
42
\$\begingroup\$

An inverting amplifier does not need a negative rail to invert the voltage.

gschem

Try to think of your power rails as what supply your output. If you look at the circuit, all op-amp pins are tied to a voltage of 0V or higher. When your range of -1 to -3 comes in, it will show up as the exact opposite of 1 to 3 on the output. This also gives you some advantages as a buffer, as the input impedance of your pin will not affect this circuit very much (so long as Rin||Rf is large).

I agree that a simple resistor divider does the job -- just letting you know that this also works.

\$\endgroup\$
  • 2
    \$\begingroup\$ +1 -- this is the proper way to do it if you don't have an ADC taking in negative inputs. \$\endgroup\$ – Jason S Jun 20 '10 at 19:41
  • 3
    \$\begingroup\$ No, the rails of the op-amp are the bounds for your output. Where a rail to rail op-amp will go very close to the bounds. You could, and many have, spent their life designing op-amps. There is no such thing as a perfect op-amp, but there is normally a perfect op-amp for a specific case. \$\endgroup\$ – Kortuk Jun 21 '10 at 14:03
  • 4
    \$\begingroup\$ On that note, in this configuration, if you surpass around -Vcc as your input your output will hit the Vcc rail. Some op-amps will not go within a volt or more of the rail, some op amps will go within 50mV. If you get a larger input signal, divide it by a larger amount, if you have a -1 to -10 V signal, divide by 2, problem solved. \$\endgroup\$ – Kortuk Jun 21 '10 at 14:04
  • 2
    \$\begingroup\$ @Kortuk - There is is never a perfect op-amp for any case. However, there is the best op-amp out of the available selection, when price is taken into consideration, for every project. \$\endgroup\$ – Connor Wolf Oct 19 '10 at 4:27
  • 3
    \$\begingroup\$ @Fake Name, I think this is a case of a communication error. If it meets the specs you need and is affordable then you have the perfect op-amp. That would be my wording, I understand what you mean though. I accept the limitation and use perfect because I am positive. <3 \$\endgroup\$ – Kortuk Oct 19 '10 at 14:36
16
\$\begingroup\$

You could use a voltage divider, with one end hanging off the positive supply rail. Say you have one with equal resistors and a 5V power supply, this will result in a voltage between +2V and +1V for your -1 to -3V range.

+5V +
    |
    R
    |
    +-- OUT
    |
    R
    |
IN -+
\$\endgroup\$
  • 4
    \$\begingroup\$ This will require the IN terminal to sink a current of (5-Vin)/(2R), so you'll have to choose R large enough to not overwhelm the input with unwanted current. then, your ADC input will need to have at least an order of magnitude more input impedance than the R value, in order not to unduly load down the divider network. Which all may (or may not) be possible. To the data sheets! \$\endgroup\$ – JustJeff Jun 20 '10 at 13:35
  • 3
    \$\begingroup\$ -1: you'd better use precision resistors and a precision reference for 5V. \$\endgroup\$ – Jason S Jun 20 '10 at 19:39
  • 1
    \$\begingroup\$ +1 for being the cheapest simplest way. But as Jason S says, precision will take effort, if that matters. \$\endgroup\$ – DarenW Oct 15 '10 at 20:34
  • 3
    \$\begingroup\$ Any noise on your positive rail will show up in your ADC. \$\endgroup\$ – endolith Oct 15 '10 at 21:37
7
\$\begingroup\$

The voltage divider idea is nice, cheap, but gives you the problem of a change of the voltage to be measured will be seen as 1/2 the change at the ADC input. If accurate measurements are of interest, the solution is a zener diode as the bottom half of the divider. If the thing being measured can tolerate losing a teeny bit of current, this will work great. Zeners aren't absolutely flat in their reverse breakdown voltage, especially for very small currents, so don't make R1 too big.

Now to see if this stackexchange site allows me to add images...

alt text

alt text

\$\endgroup\$
  • 2
    \$\begingroup\$ Simulated in QUCS \$\endgroup\$ – DarenW Oct 19 '10 at 3:51
4
\$\begingroup\$

This is the standard circuit for that sort of conversion. I simulated it to prove to someone that it worked, hence the SPICE schematic. You need to choose appropriate resistor values, it works as long as they are 2R, 2R and R.

\$\endgroup\$
4
\$\begingroup\$

I'm at (non-electronics) work right now, w/o handy electronics sw or books, so this will be just a rough idea. Maybe someone else can fill in the details...

Try a current mirror using a pair of PNP transistors hanging on the Vcc rail. Feed the negative voltage signal to the input side of the mirror through an appropriate resistor. The same current should then flow through the output transistor of the mirror. With a well-chosen resistor you create a voltage range within 0V to Vcc.

EDIT - NEW: Here is the current mirror schematic. Whatever current passes through transistor T1, T2 will try to make the same current flow. The negative voltage to be measured, relative to the power supply which I randomly chose to be 15v, creates some trickle of current through R1 (measured in simulation as "inputcurrent"). If R2 were the same as R1, you'd find the same voltage across it, if it were allowed to. But it's connect to 0V (gnd) - our circuit is based purely on a positive supply. It won't work unless we make R2 smaller, say 1/2 of R1 then the voltage across it will be 1/2 of whatever's across R1. Measure it, do math (whoo, multiply by 2, hard!) and there you are. The schematic has different values, a different ratioalt text, but I think we all can handle the math for this.

The advantage of this over a simple voltage divider is that 1) it looks more complicated, 2) it's a common trick in analog IC design. Since I wrote another answer using a Zener diode, I'm not sure now why this is better, but it is an alternative to a voltage divider and may allow getting at different ranges of voltages or something. Now I let others comment on the wisdom or foolishness of this idea... alt text alt text

\$\endgroup\$
  • \$\begingroup\$ I couldn't understand what you meant here, a link to a schematic would help. \$\endgroup\$ – Kevin Boyd Oct 18 '10 at 12:22
  • \$\begingroup\$ Okay, i've got time now...and as I think about it, I'm not sure why it's better than some simpler circuits except as the detailed design might work out better numerically, perhaps. Schematic will be attached soon. \$\endgroup\$ – DarenW Oct 19 '10 at 3:23
  • \$\begingroup\$ Old question I realize, but... This circuit relies on the base-emitter voltage vs collector current curve of the two transistors being the same, so that the same current flows in each of the two transistors collectors. That would be a good assumption in an IC where transistors can be made to match well, (and are at the same temperature), but not for two discrete transistors. The circuit can be made less sensitive to this problem by putting matching resistors in series with the emitters. \$\endgroup\$ – gwideman Mar 6 '13 at 4:44
0
\$\begingroup\$

You might not even need an op-amp. Some ADC's (like the MCP3304, see datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/21697e.pdf have a built in differential mode, where the ADC returns the difference of two channels, which can be a negative number. If you tie one channel to ground (called pseudo-differential mode), the ADC can accept a negative input voltage on the other, and translate it into a negative number, all without needing a negative voltage.

Of course, this only applies if your ADC supports this sort of thing. Many don't have differential mode at all.

\$\endgroup\$
  • 1
    \$\begingroup\$ Have you checked the datasheet on this part? From the sheet in the absolute maximum ratings section: "All inputs and outputs w.r.t. VSS ............... -0.3V to VDD +0.3V" That means you can't have a negative voltage on the inputs or any other pin for that matter. Why? because the input protection diodes will turn on and prevent the part from being burned up. This does not answer the question, the question was how can I measure a negative voltage? You can't measure a negative voltage with this part. \$\endgroup\$ – Voltage Spike Apr 7 '16 at 22:51
-2
\$\begingroup\$

I think there are already very good answers, but I like to post another approach, that I am using myself to do basically the same thing.

You could use an instrumenting op-amp (like an LT1167)? You would however need the negative rail, but wouldn't this give more accuracy? and also better ways of amplifying the voltage if wanted by simply adding one resistor.

adding the negative rail is as easy as adding something like a minmax MCW03-05D05.

The problem I have with using resistors is that it is very hard to find identical resistors, which would give you an error you'd have to correct.

\$\endgroup\$
  • \$\begingroup\$ That's a pretty expensive way to do something simple. \$\endgroup\$ – Matt Young Aug 16 '13 at 2:50
  • \$\begingroup\$ yes but I guess it depends on how good accuracy one would want \$\endgroup\$ – Nisse Aug 16 '13 at 3:26
  • 1
    \$\begingroup\$ You said yourself that the resistors are the primary source of the error. Using a more expensive part, along with needing to add some kind of negative rail, does not fix that. Using resistors with higher precision makes more sense. \$\endgroup\$ – Matt Young Aug 16 '13 at 3:37
  • \$\begingroup\$ well, if there is no need for amplification there is no need of any resistor.. Also it's just another way of doing it, I'm not saying it's the right way to do it for any application, but in some cases it might be better to give up on not using a negative rail. \$\endgroup\$ – Nisse Aug 16 '13 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.