# Circuit design for converting sensor input to desired output range

As part of my project, I am tasked with designing a circuit that can accurately convert a voltage signal in the range of -300 mV to 300 mV, obtained from a sensor to a voltage signal in the range of 0 to 600 mV that can be used as input for an ADC (analog-to-digital converter).

I designed the circuit below. I used the op-amp equation Vout = Vin + 0.3 as a basis for my design. However, when I simulated the circuit in LTspice, the output was only around 900 mV. I thought Vout would be 0.6 V for a 300 mV input.

I am seeking advice on where I may have made a mistake in my design. Can someone help me troubleshoot this issue?

• What did you try and why did it fail then? Commented Mar 26, 2023 at 23:52
• Is this a paper design or a physical circuit? What is the impedance of the signal source? What type of sensor is it? If it is a high impedance source you may need a buffer ahead of the signal processing section. Can you show the circuit that you have already tried? The answers below are good on paper but if you have some unique issues you may need a little more.
– Nedd
Commented Mar 27, 2023 at 0:14
• my previous attempts have not resulted in ... is not useful ... please update your post with my previous attempts resulted in ... ... also, please add your circuit Commented Mar 27, 2023 at 0:43
• How accurate is "accurately", what is the bandwidth of the signals, what is the type of ADC used (exact part number, or MCU p/n if it's integrated there), do you care about unadjusted error or can deal with system calibration during production test, and so on. Lots of details are missing here. Is this "project" something practical, or just theoretical homework in circuit theory/basic circuit design class? Commented Mar 30, 2023 at 3:03

You just need a basic difference amplifier to offset the signal, no gain required.

simulate this circuit – Schematic created using CircuitLab

Note that the input reference voltage can be created by using a voltage divider from one of the supply rails. Make sure that the Thevenin source resistance of this divider is equal to the value of R1, and then replace V1 and R1 with your divider.

• Can you please show me how to create the negative input reference voltage using voltage divider? I know this is a silly question but I've tried to think a half of day but still don't know how (I just have a very basic knowledge about electronic components). Commented Jan 17 at 7:20
• @Chicky: Remember, the opamp has both positive and negative supply rails. If you need a negative reference, you divide down from the negative power supply. Commented Jan 17 at 12:57
• I think in a circuit we usually have a single power supply with Vgnd is the "lowest" 0V voltage. How do we get a negative power supply, is it from another independent source? Commented Jan 17 at 14:20
• No, we "usually" have dual supplies for opamps. Single-supply operation is a special case. Commented Jan 17 at 22:05
• Thank you for your information and patient Commented Jan 18 at 1:46

In your circuit the op-amp output is connected to the same node where you are trying to produce a fixed reference potential. So this is a fight between the op-amp and the R1/R2 potential divider to apply some potential there.

The op-amp wins. Sure, it has to supply a lot of current to overcome the influence of R1 and R2, but it does win, and it gets to decide $$\V_{REF}\$$, irrespective of what R1 and R2 have to say about it.

With that in mind, you can see that removing R1 and R2 from the picture altogether will not change the op-amp's behaviour in any way, so you have this:

simulate this circuit – Schematic created using CircuitLab

That is just a voltage follower, so:

$$V_{OUT} = V_{IN}$$

If it's still not clear why we can ignore R1 and R2, let me redraw your circuit in a way that will may make you face-palm. This circuit is exactly the same as yours:

simulate this circuit

As you said, you just want to "lift" the input potential by 0.3V. You want -300mV in to correspond to 0V out, and +300mV in to result in +600mV out.

One thing is clear; when the input goes up, so does the output, and this immediately places a constraint on the design. The input must drive the non-inverting input of the op-amp, because we do not want inverting behaviour.

Another thing is obvious, that gain is 1. A swing of 1V at the input results in a swing of 1V at the output. In other words, all we want is an offset, with no amplification or attenuation.

So, with those design constraints in mind, there a couple of designs I can think of. The first requires a negative voltage source, which you may not have. Still, it's worth exploring. This is a classic differential amplifier:

simulate this circuit

All resistances are equal, so gain is 1. While I won't derive the relationship here, between inputs OFS, IN and output OUT, it is:

$$V_{OUT} = 1 \times (V_{IN} - V_{OFS})$$

That's clearly what you want.

There are caveats to this design. As I said this needs a low impedance source of −300mV, which might not be readily available, but crucially it also requires the op-amp to have a negative supply rail, since inputs can actually go negative.

If you have only supplies of 0V and +5V, for instance, that's a big problem. My next approach tries to solve this issue. I want to use a standard non-inverting amplifier configuration, but I will take care to arrange things such that neither of the op-amp's inputs ever have negative potential.

The first step is to use a potential divider to shift the signal upwards so that it never goes negative. Actually, I have to shift it so that it never dips below 30mV or so, because op-amps that claim they operate down to the negative rail (0V in our case) are lying, and can actually only produce outputs almost down to the negative supply. So I aim to shift up the potential of the signal to have a minimum slightly above ground.

You may notice that a potential divider will always attenuate the signal amplitude, but nothing says that we can't then re-amplify it, to the full 600mV swing.

Here's the divider, followed by a non-inverting amplifier to bump up the amplitude again:

simulate this circuit

First thing to notice is my choice of op-amp. The LM358 works down to its negative supply, 0V, almost.

Secondly, notice that one end of the divider is connected to the positive supply of +5V, instead of ground. This is what causes the positive offset. The formula for the potential at A is (where $$\V_{CC}=+5V\$$):

$$V_A = V_{IN} + (V_{CC} - V_{IN})\frac{R_1}{R_1+R_2}$$

I won't do it here, but I found $$\R_2\$$ by solving this equation with $$\R_1=10k\Omega\$$, $$\V_{CC}=+5V\$$, $$\V_A=30mV\$$ and $$\V_{IN}=-300mV\$$.

Like any potential divider, this one attenuates amplitude by a factor $$\G_1\$$:

$$G_1 = \frac{R_2}{R_1+R_2} = 0.938$$

I want to reverse this attenuation, so the gain of my amplifier $$\G_2\$$ should be:

$$G_2 = \frac{1}{G_1} = \frac{R_1+R_2}{R_2} = \frac{160}{150} = 1.07$$

Now I choose R3 and R4 that satisfy the classic non-inverting amplifier gain equation:

$$G_2 = 1+\frac{R_3}{R_4} = 1.07$$

The circuit has a response like this, input on the X axis, output on Y:

One more thing: since your divider is between +5V and IN, any noise on that +5V supply will be injected straight into your amplifier, and become part of its output. If the +5V supply is noisy (and it's likely to be), then you may have produce a more quiet and stable positive voltage source, that you can connect your divider to. There are a couple of easy ways to go about this:

simulate this circuit

Both will produce a clean and steady +3.6V, free of most of the noise present on the +5V supply.

The zener diode solution, left, won't be exactly 3.6V, but it will be stable. You will need to measure the exact value, to use in the equations from before.

The TL431 is a cheap, amazing device, and will regulate much better. It will be as precise as the resistances R3 and R4 that you use. Seriously, get yourself a few TL431s, they are so useful and versatile.

Obviously, since your divider will be connected to this new +3.6V source, instead of +5V, you'll need to calculate appropriate resistor values for the divider and op-amp feedback accordingly.

You could have a look at an adder circuit.

The topology is: Input -> Impedance inversion (if required) -> filter (if required) -> add offset -> filter (if required) -> impedance inversion ( if required ) -> ADC

simulate this circuit – Schematic created using CircuitLab

But this is "overkill"; you can get much simpler circuits.

You can use tools like LTspice to simulate circuits like this prior to ordering PCBs.