I'm a beginner with EE and trying to find the peak amplitude of an electric guitar signal (0-300mV) using an Arduino's 0-5v ADC. I'm going to use the data to pulse lights in accordance with each strum of the guitar.

I've figured out so far that I need to use op-amps to:

  1. Rectify the 0-300mv AC signal (full or half wave)
  2. Amplify the signal to 0-5v
  3. Use a voltage peak finder to locate the peak
  4. Use a buffer to protect against impedance (not sure if I need this?)

I've found circuits that use op-amps to do all of these, and they work fine, however they are all independent of each other.

My Question: is how do I combine all of these together into one circuit and how many op-amps should I really need. My approach initially was just to daisy chain everything, but I'm not sure that's the correct approach. Also, most of these use a buffer op-amp as the last step, do I really need one if I'm sending the signal into an ADC?

  • \$\begingroup\$ If you always amplify the signal to 0-5 V, then find the peak, won't the peak amplitude always be 5 V? \$\endgroup\$ – The Photon Apr 24 '12 at 19:26
  • \$\begingroup\$ It will vary based on how hard you strum the guitar. After rectification some quiet guitar picking could be 0-50mv, but if you strum hard the peaks can get up to 300mv. So I'm saying the possible max would change from 300mv to 5v after amplification. \$\endgroup\$ – uberdanzik Apr 24 '12 at 19:55
  • 2
    \$\begingroup\$ one... tu-whooo... (crunch) three... the world may never know. \$\endgroup\$ – Jason S Apr 24 '12 at 20:35
  • \$\begingroup\$ Daisy chain means to drop something off and then having the same thing continue on it's way to the next drop off point (not just in electronics either). If you're connecting things end-to-end so something through multiple stages that's called cascading. \$\endgroup\$ – DKNguyen Aug 12 at 0:42

I think you can do all of this with just two op-amps (although someone will probably correct me).

Opamps for guitar

The first stage is the peak detector and decay. The op-amp is wired to emulate a perfect diode. We take the feedback signal from after the diode so that the op-amp drives hard enough to overcome the voltage drop of the diode. Being a peak detector, it doesn't really eed a rectified signal. The capacitor holds the peak value, while the resistor decays it. You can make the decay slower by choosing a larger capacitor and resistor. And vice versa.

The second stage is simply 15x gain. It has low output impedance.

  • \$\begingroup\$ That scheme is wrong if I'm right, because when the signal is inverted the first opamp will saturate...do you agree? \$\endgroup\$ – clabacchio Apr 24 '12 at 20:23
  • 1
    \$\begingroup\$ This is wrong. You are not amplifying the peak detected signal. \$\endgroup\$ – Olin Lathrop Apr 24 '12 at 21:29
  • 1
    \$\begingroup\$ @Rocket: Better now. Downvote removed. \$\endgroup\$ – Olin Lathrop Apr 24 '12 at 21:42
  • 1
    \$\begingroup\$ @Telaclavo: You're right, I apologize for that. I've changed the title now to reflect I was looking for the peak. \$\endgroup\$ – uberdanzik Apr 24 '12 at 23:19
  • 1
    \$\begingroup\$ the nitpicker adds: this circuit finds the peak positive amplitude of the signal; signals with 2nd harmonics will have their negative halves ignored. \$\endgroup\$ – Jason S Apr 25 '12 at 16:05

Take a look at this: it's a rectifier, that you can use both to find the envelop of the curve, and to amplify it.

enter image description here

You have to set the resistors such as the gain is the desired one (you can use a pot to set it), and the capacitor to minimize the ripple. Note that the RC constant will determine the responsivity of the circuit, so you'll have to find the optimal value for you.

  • \$\begingroup\$ Damn, you did it in one. Shoulda been obvious. \$\endgroup\$ – Rocketmagnet Apr 24 '12 at 20:23
  • \$\begingroup\$ @Rocketmagnet I didn't :) I shamelessly took the schematic from another question :) \$\endgroup\$ – clabacchio Apr 24 '12 at 20:24
  • \$\begingroup\$ Your output RC constant will largely depend on something external to the circuit (as is the input resistance of the ADC input). Also, the maximum gain for that is 11, and the OP needs 16.8. \$\endgroup\$ – Telaclavo Apr 24 '12 at 21:08
  • \$\begingroup\$ @Telaclavo but I've specified that he can change the components to fit his needs, this schematic is taken from another question. And the RC constant will be quite fine if he feeds the signal to the ADC \$\endgroup\$ – clabacchio Apr 24 '12 at 21:51
  • \$\begingroup\$ Everything there that the OP asked for, except a buffer. And if his ADC needs little enough input current that the error caused by its draining the capacitor is okay, then he doesn't really need the buffer. \$\endgroup\$ – The Photon Apr 25 '12 at 5:09

Since you just want to turn on and off LEDs, and don't need hi-fidelity, this should work for you. The opamp amplifies only the positive range of your input signal, and therefore it does the rectification without needing any diode and, at the same time, it provides a voltage gain. The opamp will go into and out of saturation constantly, with the corresponding penalty in its frequency response but, I repeat, since you don't need hi-fi, this shouldn't be any problem.

R1 = 4.7 kohm (to limit input current when Vin is negative)

R2 = 9310 ohm

R3 = 590 ohm (gain will be the 5/0.3=16.8 that you need)

R4 = 1 kohm

C1 = 47 uF (R4 and C1 will low pass filter at fc=3.4 Hz, good for a vu-meter)

C2 = 1 uF 0805

U1 = AD8615AUJZ (with rail-to-rail input and output)

Notice that this circuit does not perform peak detection. Vout is the average of the positive cycles of Vin. That is proportional to the average amplitude of the input signal, which is what the OP wanted. So, in fact, Vout will be at most 2.5 V for full-scale, 50% duty ratio square wave input, but linearity will be better than with a peak detector, because that is nonlinear. The reduced Vout range can be easily compensated:

a) In software.

b) In hardware, applying 2.5 V to the VREF input of the Arduino.


  • \$\begingroup\$ With that circuit the range goes also to 5 V. And eventually he can use the LED itself as rectifying element \$\endgroup\$ – clabacchio Apr 24 '12 at 20:47
  • \$\begingroup\$ @clabacchio No, Vout goes to an analog input of an Arduino, he said. \$\endgroup\$ – Telaclavo Apr 24 '12 at 20:47
  • \$\begingroup\$ I do need high fidelity. These LEDs will be pulsing/fading to the guitar's dynamic activity like a light show. Hard strum / light strum should equal Bright pulse / Dim pulse. \$\endgroup\$ – uberdanzik Apr 24 '12 at 21:36
  • \$\begingroup\$ @uberdanzik 1) Clearly, you don't know what hi-fidelity means. Hi-fidelity means something like <= 0.01% THD which, I repeat, makes no sense to drive vu-meter LEDs. 2) This circuit is the most linear of the 3 answers that I see here. 3) You wrote "trying to find the average amplitude", but then selected a circuit that gives you the peak amplitude, so you don't know the difference between them, either. 4) You shouldn't write "How many opamps does it take...", if you later select a solution that does not use the minimum possible number of opamps. Anyway, good to know, for the future. \$\endgroup\$ – Telaclavo Apr 24 '12 at 22:56
  • \$\begingroup\$ @Telaclavo you're right about high-fidelity, but I'm quite sure that for "average amplitude" he means the envelope of the curve, which basically can be obtained with a fast peak detector \$\endgroup\$ – clabacchio Apr 25 '12 at 6:08

Here's another precision full wave rectifier. Full wave amp

Single Supply Precision Rectifier (B-B/ TI)

Image from Rod Elliott at Elliott Sound Products

Personally you can do a lot of signal conditioning with HEX CMOS inverters with each buffer having an open loop gain of 1000. A log amp is useful if you want to regulate Light intensity with log of input amplitude similar to hearing response. You can use a State Variable Filter to create bandpass, low pass and high pass for 3 channel or use a chain of gyrator BP filters with quad OA's and make one light per note or one per octave. Again it all depends what you want to do.

  • \$\begingroup\$ +1 -- this circuit detects both positive and negative peaks of waveforms. \$\endgroup\$ – Jason S Apr 25 '12 at 16:08
  • 1
    \$\begingroup\$ TY @pipe for the link update \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Aug 12 at 0:43

In the 60's we used filters , triacs and lights to sound .. Light organ .. million ways depending what you want to do

Wasn't trying to be trite, but the question is fallacious and assumes incorrectly that you need Op Amps to detect the peak amplitude. @uberdanzik For example 2 transistors in emitter follower NPN then PNP with Caps on emitter will detect peak without offset and buffer it. I hope you understand.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.