# Level shifting a +/- 2.5V signal to 0 - 5V

I have a front end module that generates an (ECG) signal that varies from +/-2.5 V. I want to shift this signal to 0 - 5V. What is the best way to do this? Would a summing amplifier like the below circuit good enough? With R1 = R2 and V1 = 2.5V, V2 = my signal, V3 = V4 = GND First thing to try is a simple resistor adder, without opamp. But it's clear that this won't work here: a resistor adder always attenuates the signal, and we need a $\times$1 amplification. This is a non-inverting summing amplifier. You would think that we simply have to add 2.5 V, but do you have that? I'm assuming you have 5 V, so let's use that and see where it gets us. If we have -2.5 V on the Vin input the non-inverting input should be zero if you want 0 V out, regardless of the values of R3 and R4. So R1 and R2 form a voltage divider, and R2 should be twice R1 to get the 0 V.

Next we have to find the amplification, which is determined by R3 and R4:

$A_V = \dfrac{R3 + R4}{R3}$

If we have 2.5 V on the Vin input and with R2 = 2 $\times$R1 we get 3.33 V on the non-inverting input of the opamp. To make that 5 V out we have to amplify by 1.5, so R3 must be twice R4.

We could use the following values:

R1 = 10 kΩ
R2 = 20 kΩ
R3 = 20 kΩ
R4 = 10 kΩ

You'll need an RRIO (Rail-to-Rail I/O) opamp if you want to power if from a single 5 V supply.

• Thank you for your circuit, but I find that I need to give 2.5 V at R2 instead of 5V for the shifting to work. Not sure why that is the case.. But the circuit works Aug 7, 2012 at 10:47
• @govindm - Nope, the calculation says 5 V :-). Are you sure you didn't use the same values for R1 and R2? Aug 7, 2012 at 10:55
• Oops sorry Steven, stupid mistake on my part. I'd interchanged r1 and r2. I am happy to confirm once again (in the history of human civilization), that calculations DONT lie. Aug 8, 2012 at 3:45

Here is one way to do it: The resistive divider supplies 1.25V to the non-inverting input. This can be replaced by a dedicated voltage reference if desired. You will need a rail to rail output opamp.

Here is a simulation: Note the input impedance is defined by R3, so you may need to increase this (and R2 by the same) or buffer if the source is high impedance. Also note that the output is inverting.

Here's a non-inverting method for reference also: And the simulation (the "to_adc" is the output voltage): The above non-inverting circuit is a bit like your summing amplifier.
The summing amp you show has a problem though, the inverting gain resistors shown will not correct for the divider. It needs (R1 + R2) for the feedback resistor.
So gain equals ((R1 + R2) / R2) + 1.

Here is an example of how it should look (the a and b suffixes are just to keep SPICE happy): In the simulation you can see the opamp +IN swings from 0V to 1.25V, so it needs a gain of 4 to output 0V to 5V. Since R1c and R1d are in parallel, we get 50k. So (150k / 50k) + 1 = 4. • I'm curious, how did you size C2? Aug 3, 2012 at 6:27
• I didn't actually size it for this particular question, it's a remnant from a previous schematic I adjusted for this answer (I left it in as it's always a good idea to have a small cap across Rf to prevent oscillation, but didn't want to go into more detail in that area) However, as shown the bandwidth would be 1 / (2pi * C2 * (R1+R2)) -> 1 / (6.28 * 100e-12 * 150e3) = ~10.6kHz. For an ECG, the bandwidth could be reduced plenty more. Aug 3, 2012 at 6:35
• Thanks for your detailed answer. I just tried your non-inverting circuit, but I seem to have run into some problem. Even though the input signal swings from -2.5 to 2.5 V, the output of the amplifier swings between 1V and 3.3V only, I don't know what is going on.. I am using LM358AN Aug 3, 2012 at 7:17
• The LM358 is not a rail to rail opamp, specifically the output won't swing all the way to +5V though it should reach ground. The input is not rail to rail either. Also, if your source impedance is high (e.g. > 5k) you will need to buffer the signal before sending to the level shifter. Aug 3, 2012 at 7:35
• I also tried OPA333 - which according to the datasheet is "rail to rail output within 3mV", with the same result. Maybe it's an issue with the input impedence then? I shall try adding a voltage follower.. Aug 3, 2012 at 7:45