I want to measure -30Vdc up to 0Vdc using a microcontroller. I'm basically measuring a voltage source with an output current of upto 2A.

I need to bring the voltage up onto a scale of 0V to 5V so that I can use the ADC of my microcontroller. I found two types of solutions to do this.

One with a simple resistive adder as shown below:

^{simulate this circuit – Schematic created using CircuitLab}

and another with a non inverting summing amplifier:

^{simulate this circuit}

What I need help with is that I don't understand the specifications for this offset voltage source? Can I use a resistive divider circuit on my 5V power rail to provide this voltage? How do I calculate the current to be provided from this offset voltage source so as to create the divider?

Please help.

## Best Answer

This circuit

^{simulate this circuit – Schematic created using CircuitLab}is a resistive level shifter and divider with an output voltage range

2.5V(approximately, see below) to0Vfor an input voltage range0Vto-30Vrespectively. You can solve this circuit using the superposition theorem, for instance. Simply put, it divides the potential between R1 and R2 by13.When V

_{in}is -30V, V_{out}is 0V: the voltage difference between R1+R2 is then 32.5V, which if you divide it by thirteen (R1//R2 = 1 over 12+1) yields 2.5V. That voltage is measured over R2 and makes V_{out}equal to zero volt. However if V_{in}is 0V, V_{out}is slightly under 2.5V: 2.5V - (2.5V / 13) ~= 2.5V - 192mV or 2.31V actually.If you need a voltage swing up to 5V you need to replace the 2.5V reference with a 5V reference.

When it comes to analogue-to-digital conversion, note that you don't necessarily need to shift voltage levels, for at least two reasons:

Many ADCs have differential inputs, which convert a differential voltage between two inputs, plus and minus Vref. This of course makes sense when measuring negative

andpositive voltages. It also implies a negative supply voltage to your ADC.Depending on how you power your ADC, you may very well use the negative line of your voltage input as the ground line for your ADC (or micro-controller) and its power supply. It is possible if the power supply of the A-D converter can float, i.e. if the voltage to be measured has no galvanic connection with the power supply of your ADC.

The latter greatly simplifies the circuitry and keeps the number of input components to a minimum. It also avoids level shifting by performing a

relativeconversion: just divide the input signal by 6 to have a 0-5V voltage range for your ADC.You will find relevant responses to a similar question, as pointed to by SunnyBoyNY.