# Precision rectifier doesn't give expected output

I'm currently designing a precision rectifier. I have a current sensor that outputs a current (AC) of 0.3mA to 32mA for 0-100A across a resistor of 510 ohms. As the value of the voltage will be around 0.3v for 1A of current, I can't just use a half-wave rectifier and rectifier the output and get the Dc value. I won't be able to sense current till it reached 5A or so. Hence I decided to design a precision rectifier.

The circuit is straight forward, didn't have any issue with simulation but when I actually implemented the circuit on a breadboard, I'm not getting the possible output.

The current sensor is sensing 11A current. It's outputting 2.2mA and I'm getting a voltage drop of 1.2V across a 510-ohm resistor. So far so good. Now I'm giving this voltage to the non inverting pin of LM358P. I'm measuring the same voltage at the output pin of the opamp. But when I measure the voltage after the diode (D1), I'm getting 2V for some reason. I'm getting the same 2V at the non-inverting input of the opamp too. I'm not sure where is it getting that 2V from.

When I connect the load resistor(Rl) and smoothing capacitor(C1), get 10V after the diode (D1). I'm not sure what I'm doing wrong?

I have attached the circuit to this email.

• You say you measure 1.2V across your resistor. Yo also say you measure 2V at the non-inverting input to the opamp. These are supposed to be the same node in the circuit, and therefore cannot have different voltage levels. Check your circuit and/or post a pic of it in your question for someone else to check. You may also be suffering from typical breadboard poor-connection behavior ... Commented Oct 7, 2020 at 19:53
• Not really. When I connect the load resistor I get 12V. When I disconnect it, I get 2V(at inverting pin and after the diode). The load resistor (Rl) is connected to the ground. Not sure how it's getting that voltage. Commented Oct 7, 2020 at 20:08
• Sounds like your opamp is oscillating - possibly due to the non-inverting input not being connected properly... Commented Oct 7, 2020 at 20:20
• I got rid of all the connecting and changed where I connected the opamp on the breadboard and just powered the opamp. It has 12V at V+ and gnd at gnd. Non inverting input is reading DC 0V but the inventing pin is fluctuating between 1.7V to close to 0V DC. I'm using a multimeter to measure the voltage. Why is there any voltage on the inverting pin? Is something wrong with the opamp? Commented Oct 7, 2020 at 20:45

Precision rectifiers need fast opamps. I'm guessing this one isn't.

This is because, when the diode is reverse-biased, the opamp operates open-loop. Thus, when V1 goes -ve, U1 output swings hard -ve and settles at (or close to) V-. The -ve input is uncontrolled after that.

When V1 becomes +ve again, or at least more +ve than In-, there is a considerable lag before the opamp returns to linear operation again.

You can mitigate this with another diode from the opamp output to In-, limiting the open loop operation to 1.2V pk-pk.

simulate this circuit – Schematic created using CircuitLab

Now, when IN goes -ve, D2 controls the opamp IN- and limits the output swing. And R2 provides some isolation between all that and OUT. There is usually a large capacitor on OUT, R2 will drain in ... slowly. If too fast, increase R2.

• I'm using LM358 from TI. Is this not fast? Commented Oct 7, 2020 at 21:26
• It's very not fast. Put a scope on it's output and see. Might be OK at very low frequencies with the modified circuit though.
– user16324
Commented Oct 7, 2020 at 21:31
• Hey, It still doesnt work. When Vin = 1.8Vac Vout = 1.6v DC. this part is good. Vin = 0.9Vac Vout = 2.4V DC. This is is not good. I have no idea how this is ending with a higher voltage than the voltage supplied. I dint connect a capacitor yet. The circuit is exactly similar to the one in your picture. Commented Oct 7, 2020 at 21:43
• And with the capacitor?
– user16324
Commented Oct 8, 2020 at 11:37