0
\$\begingroup\$

My PCs headphone jack (green) outputs a 4Vpp (2V amplitude) sinusoidal signal at 100% output level set in the sound preferences. What kind of circuit would I need to drive a red LED (2.2V forward voltage, 20mA forward current) based on the voltage level present at the headphone jack?

The LEDs luminous intensity behaves linearly in the range from 0 to 30mA. My idea would be to balance the LED current like follows:

Soundcard output:

+2V: driving the LED with 30mA

0V: driving the LED with 15mA

-2V: driving the LED with 0mA

I experimented with a circuit that puts the signal in parallel to a 9V battery that provided DC bias voltage. And I also tried to use a BC547C npn transistor in combination with the 9V battery. Unfortunately unsuccessful. The outcome was always a offset of the LED current: e.g. +2V: 28mA, 0V: 22mA, -2V: 16mA

I was not able to balance the current through the LED as described above. I guess to achieve this, a much more elaborate circuit is needed.

I would really appreciate any advice. Thank you very much!

Best regards,

Zelyev

Edit:

I would like to modulate the LED with the frequency of the audio signal.

A receiver catches the signal using a phototransistor.

I achieved the transmission using a simple Common-Emitter-Amplifier, the outcome was OK. But I want to make use of the whole LED intensity spectrum (0-30mA).

\$\endgroup\$
  • \$\begingroup\$ Your idea won't work. If you use an AC signal of 4 volts p-p the average is 0 volts and that means your average LED current is 15 mA. If your signal were 1 volts p-p then the average LED current would still be 15 mA and you would notice no difference in the LED brightness. You need to tell us what you want to happen and not specify how you think this is achieved. \$\endgroup\$ – Andy aka May 29 '17 at 14:50
  • \$\begingroup\$ Did you really connect in parallel or did you connect in series. If you connected in series, the results would make sense. \$\endgroup\$ – Oskar Skog May 29 '17 at 14:57
  • \$\begingroup\$ Do you wish to modulate the led brightness at audio frequency? \$\endgroup\$ – kva May 29 '17 at 15:01
  • 1
    \$\begingroup\$ @Andyaka I want a phototransistor to pick up the audio waveform. \$\endgroup\$ – zelyev May 29 '17 at 15:06
  • 1
    \$\begingroup\$ Seemingly you plan a wireless link to transfer the audio signal. No theoretical problems. The idea is very old. It was used massively in early movie soundtracks. The brightness understandably were exposed to the film to cover the distance between Hollywood and local cinemas. In practice you get enormous interference from surrounding lights and shadows. The distance affects radically to the sound amplitude. All and all you would do much better if you used some other mpdulation than AM. By having say 100 kHz pulses and FM you can get much better immunity against noise and non-linearity. \$\endgroup\$ – user287001 May 29 '17 at 17:05
4
\$\begingroup\$

Here is something that seems to meet your specs:

C1 AC-couples the signal so that it can have any DC offset inside the circuit we like. D1 and D2 rectify the input signal to its peak voltage, minus the drop of the two Schottky diodes. C2 holds the value between peaks. Q1 is a voltage-controlled current sink. The LED D3 is then driven by that current.

Your maximum input signal is 4 Vpp. After the two diode drops, that will result in about 3.3 V on C2. That puts the emitter of Q1 at about 2.6 V, which results in 29 mA current thru R1. The vast majority of that current (98% if the transistor has a gain of 50, for example) goes thru the LED. The LED will therefore be driven with about your desired 30 mA when a full amplitude audio signal is applied at IN. Adjust R1 to change the audio voltage to LED brightness ratio. Higher resistances cause less LED current at the same audio level.

The power supply range is limited by the minimum voltage requirement at the low and and the maximum dissipation of the transistor at the high end. At full volume, there will be about 2.6 V across R1. Figure the LED needs about 2.1 V, so that leaves 300 mV for the transistor. A little more would be better for tighter current regulation, but that should still work.

At the high end, I used about 150 mW dissipation for the transistor. That means it can drop 5 V at 30 mA. That plus 2.6 V for R1 and 2.1 V for the LED comes to 9.7 V, so I rounded to 10 V. It's not hard to find a small signal transistor that can dissipate well more than 150 mW.

Added

The above answer is for lighting a LED roughly proportional to the audio voltage level. What is now asked for is to light a LED according to the instantaneous waveform. Here is a circuit that does that:

The transistor is biased so that there is about 2 V at its emitter, and therefore 2 V across R1. That causes 15 mA LED current when there is no input.

The input perturbs the bias point ±2 V. C1 AC couples this input so that it can't disturb the DC bias point, only the instantaneous operating point. When the input swings high by 2 V, the LED current goes to about 30 mA. When it swings low by 2 V, the LED current goes about to 0.

This should work well enough as shown, but it would be a good idea to observe actual operation with a scope, and possibly tweak R2 a bit so that the +2 V and -2 V peaks result in close to the desired LED current without clipping.

\$\endgroup\$
  • \$\begingroup\$ "@Andyaka I want a phototransistor to pick up the audio waveform." Have you missed that comment or have I misunderstood how this circuit works? \$\endgroup\$ – Oskar Skog May 29 '17 at 15:56
  • 2
    \$\begingroup\$ @Oskar: Comments aren't content, so I usually skip them. You really can't expect someone to read thru the comments to other answers. I see now that the OP added this requirement to the question, which apparently happened while I was writing this answer, so wasn't aware of it at the time. I thought the OP was looking for a way to light the LED roughly indicating volume. What he wants can be done fairly easily too. \$\endgroup\$ – Olin Lathrop May 29 '17 at 16:07
  • \$\begingroup\$ @OlinLathrop I am sorry for the inconvenience caused. \$\endgroup\$ – zelyev May 29 '17 at 16:12
  • \$\begingroup\$ @OlinLathrop Thank you very much! I simulated your design in LTspice, and all my requirements are met. I also already built the circuit on a breadboard (instead of 2k for R3 I used 470+1.5k in series and instead of 130 for R1 I used 100+33 in series). I also want to thank all the other people that offered their help. \$\endgroup\$ – zelyev May 29 '17 at 17:30
1
\$\begingroup\$

You might attempt using a Class-D amplifier to drive the LED, instead of headphones or speaker. The PAM8403 type audio driver accepts analog audio input voltages, and outputs pulse-width-modulated digital pulses at a repetition frequency of about 250 kHz. A +5 V DC supply is used. Many other Class-D headphone drivers are available from other manufacturers (TI, Maxim).
A resistor (R1) in series with your LED should limit the current to the desired 30 mA. Haven't tried this, but its no-bias simplicity is very tempting. Certain LEDs that modify colour with phosphor coatings may not be appropriate, since phosphors add an optical "tail" that could distort pulse width. Full zero-to 30 mA modulation should be easily achievable. A higher-power LED (up to 600 mA) could be driven with a smaller series resistor. This circuit could also drive a red solid-state laser diode as well. Only right channel output is shown. Stereo (using another similar LED on left channel output) is possible, but the optical paths to the left and right detectors would have to be kept isolated.
This should be compatible with a conventional phototransistor receiver circuit, although you may want to add a low-pass filter to remove any 250 kHz modulation.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
  • \$\begingroup\$ Not much use without a receiver that rejects noise from the PWM signal. But the relatively simple receivers deserve its own Q&A. +1 for transmitter of low noise communication (lower than AM, yes I mean AM, the carrier is about 460 THz). \$\endgroup\$ – Oskar Skog May 29 '17 at 20:25
  • \$\begingroup\$ @OskarSkog Yes, I'd guess some phototransistor receiver circuits might not average PWM pulses properly. \$\endgroup\$ – glen_geek May 30 '17 at 0:50
0
\$\begingroup\$

One simple circuit to do what you want is a rectification circuit. The chain of sub-circuits would look like:

  1. Decoupler
  2. Rectifier
  3. buffer + bias op-amp
  4. Filter
  5. LED bias.

    • The decoupler will remove any DC component from the waveform.
    • The rectifier will convert from a ground-centered 4Vpp sine wave to a 2Vpp half-sinewave.
    • The buffer will reduce load on the laptop and should be connected to shift up the signal to be biased such that a max amplitude will present 30mA to the LED, and a min amplitude will present 0 - for this you will need to know the forward voltage drop of the LED.
    • The filter will convert from the half-sinewave to a DC rail.
    • The LED bias will be a simple resistor.
\$\endgroup\$
0
\$\begingroup\$

If you dont mind inverting the signal you can use a simple inverting op-amp amplifier with the 9V battery as power source and a voltage divider to generate the offset voltage on the non-inverting input of the amplifier. The output voltage will be lower than 9V, so connect the LED cathode to the output and a resistor to 9V on the annode. I leave it up to you to work out the gain.

Good luck with your design :)

\$\endgroup\$
  • \$\begingroup\$ Thanks for your suggestion. For clarification: I was already able to transmit the audio signal using a common-emitter-transistor amplifier. The receiver then only blocked the DC part and the outcome was the original audio signal. But I think it would be best to use the whole LED intensity spectrum (0-30mA) for the data transmission. Would the suggested OpAmp Design achieve the balancing I am looking for? \$\endgroup\$ – zelyev May 29 '17 at 15:16
0
\$\begingroup\$

I assume your circuit adds the voltage of the battery with the voltage of the signal and puts that on the LED and resistor.

The issue you have with this is that 9 V > 2.2 V + 2 V, that's why you had too much current flowing through the LED.

Using a 3V (2* 1.5 V AA) battery instead should give better results.
Or you could use a simple class A (current-)amplifier and set the bias point.

R1 - trimpot: sets the bias point. Set this to -(V_negative_peak) + Vgs + Vled.
R2 is for the input impedance. Omit this if R1 is big enough.
C2 - AC coupling. Avoid having both a big C2 and a big R1. Q1 is just about any MOSFET. Eg. from an unused/broken SMPS (power supply).
R3 sets the LED current by dropping the excessive current. This should be 4 V / 30 mA = 130 Ohm. You may want to use a trimpot for R3 too.

The components are extremely available, you can even get them from junk. And the circuit is extremely simple and can be adjusted with the trimpots. Almost no thinking required.

\$\endgroup\$

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.