# Full wave rectification by opamp

I am trying to read a current waveform from a shunt resistor series with the power line.

Using a full bridge rectifier, I got the following waveform:

The waveform was sampled every 2 millisecond using an Arduino. Upon fourier analysis, I found that it contained a 100 Hz signal.

Since the supply frequency is 50hz in my region and being rectified the waveform is 100 Hz.

But I want to use opamps as a precision rectifier to get smaller voltages than the diode drop. I am using the below configuration. I tested the configuration by setting the input as positive and negative DV voltage from a battery and the negative DC was given as positive DC by the opamp.

simulate this circuit – Schematic created using CircuitLab

This is the current waveform obtained I got from the opamp:

The zero point of the waveform keeps changing periodically.

Is this a problem with the opamp configuration, or is there a better way to do full wave rectification using a single supply opamp?

EDIT: I meant to use 10 kiloohm resistors, not 10 ohm. 240-24 volt step down transformer signal divided between 10kiloohms and 1 ohms resistor UPDATE: The opamp configuration was working perfectly fine. The original signal contained the zero point oscillation.The full bridge rectifier's output was not showing this output because it was not strong enough to overcome the diode voltage drop. After increasing the voltage i was able to see the same signal from the full bridge rectifier as well. Phew!!!! Finding out ground truth is very important.

• Considering how the recorded waveform looks like (low sampling rate) this might be an artifact caused by aliasing. How do you make sure that the signal is sampled with exactly 2ms? If the sampling period exceeds 2.5ms you will get into trouble with the nyquist theorem. May 25, 2019 at 12:47
• I wouldn't bet on the sampling time of the Arduino being all that steady, especially if you are transmitting the values live to the PC.
– JRE
May 25, 2019 at 12:59
• If you have access to a real oscilloscope, I'd check the output of your rectifier circuit. Failing that, Circuit Lab has a simulator. Run it and see what comes out.
– JRE
May 25, 2019 at 13:01
• I hope your actual resistors are more like 10,000 than 10 ohms... May 25, 2019 at 13:27
• Your sample rate seems much too low. Try sampling faster? Or at least use a smarter interpolation scheme. May 25, 2019 at 13:42

Your circuit (with proper resistor values) should work just fine. Try the below simulation.

simulate this circuit – Schematic created using CircuitLab

The way it works, for those who are questioning it, is that the lower amplifier OA2 maintains the non-inverting input of OA1 at 0V when the input goes negative, which means that you're getting Vout = -Vin (it's an inverting amplifier and R1/R2 are in play).

When the input is positive the positive input is at the input potential and the output drives then inverting input to the same potential, so the gain is +1.

Here's a simulation of the output with a 300mV peak input at 50Hz. It won't work very well at higher frequencies because the amplifier OA2 is driven into saturation and will have sluggish recovery, but for mains frequency it's more than okay (and it operates from a single supply with a dirt-cheap op-amp).

As an extra bonus, since it's powered from a single supply there is no need to protect the ADC input from possible negative transients.

• sorry i meant to put 10 kilohms. the original waveform is obtained from 10 kiloohms resistors. could the distortion be due to higher frequencies present in the signal. May 25, 2019 at 13:49
• Can you get access to an oscilloscope? This is one of those occasions where it will pay off big-time. May 25, 2019 at 13:51
• i really wish i could get one. could the distortion be due higher frequencies in the signal driving the opamp into saturation. if so should i low pass filter the signal befor sending it into the opamp. also why shouldnt i use 10 ohms resistor out of curiousity May 25, 2019 at 13:52
• Cool circuit. When the input is positive, OA2 does nothing and the output follows. When the input is negative, OA2 won't let OA1+ go negative and the you get an inverter. May 25, 2019 at 14:00
• You can try that, you can try to tease a bit more information out by looking at the average voltage from the output and try feeding it a very clean signal from a voltage divider. You should not use 10 ohms because the LM358 is only happy driving a few mA and you'd be demanding more. At a few K to maybe 30 or 50K you minimize that without adding much error due to bias and offset currents. May 25, 2019 at 14:02

I don't know what your circuit is doing. It doesn't look like a full wave precision rectifier, though.

Texas Instruments has a document describing precision full wave rectifiers.

An example from TI:

The idea is that D1 and D2 switch the signal paths so the the signal either goes through the inverting or non-inverting path through U1b.

The TI document goes into some detail about designing the thing. It isn't as simple as it looks.

At 50 (or 60) Hz, it ought to be pretty straight forward. TI shows examples, though, of what happens at somewhat higher (1 kHz) frequencies.

I missed the requirement for a single power supply. This circuit requires dual rails.

It isn't the right answer for the question, but I'll leave it here in case someone else finds it useful.

• The OP wants to do it with a single supply. Probably possible, but much easier to just add a negative supply and use this design. May 25, 2019 at 13:33
• is this schematic applicable for single supply opamps May 25, 2019 at 13:55
• Nope. I missed that requirement.
– JRE
May 25, 2019 at 13:55
• hello i generated negative dc voltage using a centre tapped transformer and i am trying the circuit u have posted. where should i connect the ground terminal May 25, 2019 at 16:08
• Ground on a center tapped transformer is usually the center tap.
– JRE
May 25, 2019 at 16:11

The circuit is fine, however it has a non linear input impedance. For negative inputs, both 10k resistors are effectively at 0v and therefore the impedance is 5k. For +ve inputs the first op amp inputs are both the same and therefore the input impedance is 10k or more. (Op amp inputs are high impedance, - input is a virtual earth due to feedback.) When fed from a low impedance source everything should be fine.