# Single supply op amp to convert 0-5VDC to +/-2VDC (microcontroller to line level)

I am generating a 0-5 volt sine wave using an arduino with a DAC. I would like to level shift this signal (DC bias?) by -2.5 volts and have a gain of .8, so that I end up with a line level sine wave.

Thus I am trying to design a single supply op amp with the following equation:

$$V_{\text{o}} = (V_{\text{i}}-2.5) \times 0.8$$

I found this white paper that is supposed to describe a way to do this but I'm having trouble following as I am new to op-amps.

https://www.eecs.umich.edu/courses/eecs452/Labs/circuit4.pdf

Does anyone know of a way to do this with a single op amp or IC?

The frequency range of 20Hz to 20KHz must be preserved.

• You can't produce a -2 V output from an op-amp with only a positive supply. Jan 29, 2018 at 15:39
• Can you tell us the target peak-to-peak amplitude and DC offset rather than your transformation, which seems ambiguous to me. Jan 29, 2018 at 15:40
• @loudnoises the target peak-to-peak amplitude is 4 volts, and the DC offset is -2.5 volts. Jan 29, 2018 at 15:42
• Not without a negative supply. Jan 29, 2018 at 15:43
• It's conceivable to solve the problem as stated, if your "single-supply op-amp" has only a negative supply. Jan 29, 2018 at 15:46

You have the following situation:

Arduino with DAC generates 0V - +5V sin wave (2.5V +/- 2.5V).

The output should be -2V - +2V sin wave (0V +/- 2V).

POSSIBLE SOLUTIONS:

solution #1:

Arduino with DAC + C1 + R1 + R2 (all elements are in series).

• C1 + R, where R = R1 + R2 is a high pass filter
• R1 and R2 is a voltage divider with the gain of 0.8 V/V
• can be used if DAC is able to source/sink enough current

.

solution #2:

Arduino with DAC + opamp buffer + C1 + R1 + R2 (all elements are in series).

• use in case your DAC is not able to source/sink enough current

.

solution #3: Arduino with DAC + opamp subtractor + C1 + R1 (all elements are in series).

• C1 + R1 is a high pass filter

A single opamp in a configuration of the subtractor takes care of your equation:

Vo = (Vi-2.5) * 0.8

Look here: http://www.mtcmos.com/subtractor/ . You would like to use the configuration at the end of the article, that is, the left from this picture:

You set:

• R2/R1 = 0.8
• V1 = 2.5V
• V2 = Vi

So you get:

Vo = 0.8 * (Vi - 2.5)

You may also refer to this e-book https://payhip.com/b/5Srt. The subtractor circuit explanation is a bit improved there (the core is the same), but you also find other configurations explained.

• This will not work with a single-supply op-amp as requested by OP. Jan 29, 2018 at 16:52
• The author must properly specify the input and the output requirements. It is obvious that single-supply op-amp is not able to generate negative voltages.
– Tako
Jan 29, 2018 at 17:17
• @circuitry Could you specify input and output signal? Is the input signal sine wave 0 - 5 V (2.5V +/- 2.5V) and the output should be -4.5 - 0.5 V (-2V +/- 2V)?
– Tako
Jan 29, 2018 at 17:19
• @Tako the input voltage is 0-5 volts and the output voltage should be +/- 2 volts. Jan 30, 2018 at 14:08
• @circuitry I improved the answer. Look if it solves your problem now.
– Tako
Jan 31, 2018 at 17:51

I think you are trying to make sure that your output signal does not have a DC offset with a peak voltage of 2 V. Simply you can remove a DC offset by inserting a series capacitance:

simulate this circuit – Schematic created using CircuitLab

Which will produce the following conversion:

But will be a high pass so you must choose your capacitance values to ensure that you don't reduce the amplitude of the sine at the spec'd frequency (which you haven't supplied).

Another further improvement would be to place an op-amp buffer after this, however that would require a dual supply (i.e. ±V).

The important equation for your amplitude is from the resistor divider:

$$V_\mathrm{out} = V_\mathrm{in}\frac{R_2}{R_1 + R_2},\quad 4 = 5 \frac{40}{10 + 40}$$

• Awesome, thanks! So this will filter out some frequencies? Ideally I would want to keep all frequencies that humans can hear (20Hz-20KHz). So it sounds like I may need to invert my 5 volts and then set up a dual supply op-amp to do this. Unless it's possible to set the cap values here so that they would not filter out frequencies within the human hearing range. Jan 29, 2018 at 16:20
• The given design shows a high-pass cutoff frequency of much lower than 20 Hz. The main problem with the design is that you would not be able to drive much of a load with it, so unless this is going to be buffered it will struggle. Jan 29, 2018 at 16:23
• do you know what determines that maximum output current this could source? I am using an MCP4725 DAC, is the output current determined by the DAC? If so, it seems like the MCP4725 can source 25 mA which is probably enough for line level audio. Jan 31, 2018 at 21:04
• Yes, your DAC has a built in amplifier which would seem to be fine for most audio gear (which tends to have a high input impedance). It really depends on your load. Further, since your DAC has an amp built in, you'd really be better off spending time designing a negative supply. If you did this you wouldn't need any additional circuitry at the output which would give you better audio performance. Feb 1, 2018 at 7:33

An op-amp can't produce a negative output if it only has a positive supply.

You need to look at how to make a negative supply from your existing positive one. A switched capacitor inverter will likely be sufficient, provided your load currents aren't too high.

You will have at least 2 ICs: the op-amp and the voltage inverter.

• If I had a +/- 5 volt supply, how would I design the gain and DC offset to make my target of +/- 2 volts peak? Jan 29, 2018 at 15:49
• That's a different question. If it hasn't been asked before (it almost surely has) , post it as a new question. Jan 29, 2018 at 15:51