Function generator to peak detector circuit wiring and supply

Thread Starter


Joined Nov 19, 2017

I have a peak detector circuit (based on sparkfun SEN-12642). This is supplied by a standard DC supply at 4.5V.

I've altered the circuit so i am inputting an AC signal (between 50 and 200mV) directly to the peak detector part and observing the 'Envelope' output on a scope.

The AC input is being generated by a function generator (Tektronix AFG1062).

I've noticed that the output is changing with Vin so the peak detector appears to be working but i'm concerned as the voltage measured at envelope is always higher than the AC peaks. i.e. about 50mV higher than input.

I've struggled with how to ground this setup and assume that maybe the problem.

Could anyone give direction about how to correctly link the power supply to the function generator so the input is not just 'floating'?



Joined Nov 23, 2012
Your half wave rectifier stage schematic says "gain of approximately 2"

Your diodes may not be perfectly matched.

If you want a precision device, you should eliminate capacitively coupled stages. The capacitor is forming a filter and reducing the amplitude your circuit is seeing.

Also, it is an envelope filter, not a peak detector. You'll always be lagging the input.

Lots of opportunity for error.


Joined Aug 1, 2013
The circuit is a bit more complex than a simple rectifier. The peak detector has an inverting gain of 2.2, so the negative half-cycles of the input are amplified (as long as the peak is less than -0.6 V) while the positive half-cycles are not.



Joined Aug 21, 2008
If you connected The + output of the power supply to the VCC input of the sound detector and the - output of hte power supply to the GND input of the sound detector it should be fine.

The LM324's (opamp's) output cannot go all the way to ground without some help. A popular method to get the output to go all the way to ground is to put a 1k (value not critical) resistor from the output to ground. In the case of this circuit it needs a 1k resistor from pin 14 to ground.Also check to see whether in 12 goes close to ground when there is no input signal and if it doesn't go very close to ground that might mean that pin 7 needs a 1k to ground too.


Even with that, you will probably have several millivolts of offset because the LM324 has an internal offset voltage. The offset might be below ground, in which case a small negative part of the envelope will be clipped.


Joined Apr 7, 2016
D1 in the peak detector must be connected directly to the OP amp output, pin 7, to get a classic "ideal single rectifier" circuit.

But without a few volts of negative supply, the circuit will always give a little too high output voltage.