This is a basic question about passing AC (audio) signals through a diode. I'm trying to use an audio signal to power an LED (which in turn heat-shrinked to an LDR) in order to control the behaviour of a simple audio oscillator. At the moment I'm simply passing the audio input signal through a 1k resistor that's in series with the LED - this is working, but it has the annoying feature that the amplitude of the audio signal (and hence the brightness of the LED) decreases over time, over a period of several seconds.

The same thing happens when the signal passes through an ordinary diode, such as a 1N4002 - the signal starts loud, then decreases over several seconds. Here's a screenshot of the output seen when a sine wave (around 70 Hz) is passed through a 1N4002 - as expected, the output is rectified, but has a decaying envelope.

70 Hz sine wave through 1N4002

Why's this happening, and is there a way to power an LED (such that its brightness follows the amplitude of an audio signal) where this effect won't happen?

EDIT: here's an incredibly crude diagram of what I'm up to - I'm sending a sine wave from an output of my computer's soundcard to a breadboard, putting a diode in series with the signal, and recording the output from the diode back into the computer.audio through diode diagram

EDIT: Here's an image of the output waveform when a 100 ohm resistor is put between the output of the diode and ground, as per Kaz's answer below. When the output is goes directly into a pair of headphones instead of the computer, the effect is much less pronounced but still audible, suggesting that the problem lies partly with the computer's audio interface. enter image description here

EDIT: There's no obvious frequency dependence - here are the recorded waveforms of:

  1. A 1k sine wave without the diode in place (i.e. just recording the output back into the computer) enter image description here

  2. A 1k sine wave with the diode, as in the diagram above. The signal is attenuated and has the same decay envelope. The same general shape is seen for frequencies going from 50 Hz up to 8k. enter image description here

  • \$\begingroup\$ Can you provide schematic(s) of the current diode circuits? \$\endgroup\$ Commented Jun 28, 2016 at 20:21
  • \$\begingroup\$ Even a crude but readable hand sketch would be OK. We need something to work with. \$\endgroup\$
    – user105652
    Commented Jun 28, 2016 at 20:35
  • \$\begingroup\$ I've added a diagram, apologies for the crudeness - hope this is clear \$\endgroup\$
    – JakaQuan
    Commented Jun 28, 2016 at 20:50
  • \$\begingroup\$ Can you change the frequency, leaving the input amplitude at the same level, to see the dependance of the steady state output amplitude? That transient looks like second order to me. How long are the connections? Perhaps the circuit is expecting headphones' coils? \$\endgroup\$ Commented Jun 29, 2016 at 0:03
  • \$\begingroup\$ @Sredni Vashtar There doesn't seem to be a frequency dependence. I've added two pictures showing a 1k sine wave recorded without the diode, and again with it - the signal is attenuated with the diode, and the same decay envelope is there. I tried other frequencies from 50 Hz up to 8k and the same general shape remained. \$\endgroup\$
    – JakaQuan
    Commented Jun 29, 2016 at 7:23

2 Answers 2



simulate this circuit – Schematic created using CircuitLab

Figure 1. (a) Reverse conducting diode. (b) Symmetrical LED.

The problems seem to be caused by the asymmetrical current path caused by the in-line diode. Since you are using and LED to LDR opto-isolator you can use the LED as the rectifier. Figure 1a shows the circuit with D2 providing protection for reverse voltage (since the audio signal is AC).

Figure 1b shows a pair of LEDs in back to back arrangement. This has the advantage of symmetrical loading of the AC. If you can find a package with both LEDs mounted back to back (internally) it means your LDR will be illuminated on both positive and negative audio signals. Failing that you could try to mount both LEDs on the one LDR or use circuit of Figure 2a.


simulate this circuit

Figure 2. (a) Pair of opto-isolators with parallel LDRs. (b) Bridge rectifier feeding LED.

For completeness, Figure 2b shows one LED fed by a bridge rectifier. This has the disadvantage of higher voltage drop due to two series diodes at all times.

  • \$\begingroup\$ Solved! I'm still unsure as to what exactly was causing the envelope shape, but putting a 'reversed' diode in parallel with the LED - as per figure 1(a) has fixed the problem - a constant signal is now powering the LED at constant brightness. \$\endgroup\$
    – JakaQuan
    Commented Jun 29, 2016 at 20:58
  • \$\begingroup\$ Good. What exactly did you end up with? My Figure 1a with a diode instead of R1 or in series with it? \$\endgroup\$
    – Transistor
    Commented Jun 29, 2016 at 21:01
  • \$\begingroup\$ Exactly as in figure 1a, with a diode parallel to the LED. Kaz's suggestion below of putting resistors between signal and ground (both before and after the diode) also gave a signal that didn't decay, albeit with an initial shape to the waveform similar to those in my OP, so I assume that the original issue arises from some capacitance at the output and input stages of the audio interface. \$\endgroup\$
    – JakaQuan
    Commented Jun 30, 2016 at 12:06

it has the annoying feature that the amplitude of the audio signal decreases over time, over a period of several seconds.

Nothing that a diode can do by itself has a gradual effect of several seconds. You have a capacitance somewhere which is slowly charging through a resistance, creating a gradually changing DC offset which somehow affects the amplitude.

Maybe some DC return resistors before and after the diode would fix the problem.

A more full schematic is probably something like this:


simulate this circuit – Schematic created using CircuitLab

Note that if C1 gets charged through the diode (current flowing left to right) and builds up a voltage, it cannot discharge back through the diode. So the R2 resistor is prevented from doing its job. A resistor R3 placed between the external-facing terminal of the capacitor and ground will provide a discharge path. That resistor has to be appropriately chosen because it sets the upper bound on the input impedance of the input device. If you, say, make it only 100 ohms, then the output device is effectively driving a 100 ohm device, which may be too low.

  • \$\begingroup\$ Kaz you are on the right track .Capacitive coulping in the computer is probably the culprit. \$\endgroup\$
    – Autistic
    Commented Jun 28, 2016 at 20:58
  • \$\begingroup\$ Putting DC offset on the input cap of line-in could cause the capacitance to decrease. \$\endgroup\$
    – Daniel
    Commented Jun 28, 2016 at 20:59
  • \$\begingroup\$ That's interesting Kaz, I assumed that this was just a property of AC through a diode, perhaps because the signal was too high. I'll try the circuit in your answer and put the results here. I'll also try out some other audio input sources besides the computer and see what happens. \$\endgroup\$
    – JakaQuan
    Commented Jun 28, 2016 at 21:21
  • \$\begingroup\$ I've tried various resistor values for R3, from 100 ohm to 2.2k, but the effect remains. I've added a picture of the output waveform for 100 ohms to the question - there's still an initial peak and a decaying envelope. When the output is sent into a pair of headphones (with the 100 ohm R3 still in place), so that any capacitances arising at the computer input can be ruled out, the signal still audibly gets quieter over a few seconds, but the effect is less pronounced. The actual output from the computer (i.e. what's going into the diode) sounds fine. Very odd \$\endgroup\$
    – JakaQuan
    Commented Jun 28, 2016 at 22:02
  • \$\begingroup\$ Also try it on the other side of the diode, in case the output stage is capacitively coupled. In my diagram, the output stage is shown DC coupled, which might not be the case. \$\endgroup\$
    – Kaz
    Commented Jun 28, 2016 at 22:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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