Hi there and welcome to Electronics Point
So you want to drive an LED from the headphone output of your phone. You want to play square wave signals through the headphone output, and you want the LED to reproduce the signal. So when the square wave is positive, the LED lights up, and when it's negative, the LED goes out. Is that right?
That circuit might work but it is not the best option. It's more complicated than you need, and its thresholds are poorly defined because it's actually just an amplifier with capacitor-coupled input. The potentiometer that you've added would not affect the threshold of the circuit; it would just have to be set near the bottom of its range, otherwise the LED would be illuminated constantly.
Here's my suggestion. This circuit uses two NPN transistors and operates from a supply voltage from 4.5V to 12V. I haven't tested it, and it may not be ideal. Some experimentation may be needed, and some component values may need to be tweaked.
Input comes in on the tip of the stereo socket. This should be connected to the phone's headphone socket using a stereo cable with a stereo 3.5 mm jack plug at each end, wired pin-to-pin.
R1 provides a DC load on the phone's headphone output; this may be needed so the phone can detect that something has been plugged into the socket.
C1 passes the signal to Q1 which is an emitter follower. Its purpose is to boost the current available from the signal so it can drive Q2 cleanly.
Q1's base bias voltage is set by D1 and D2, which provide a constant voltage of around 1.3V which is relatively stable over a range of supply voltages. R3 and R4 drop this voltage to around 1.0V at Q1's base.
Q1 drops about 0.7V between its base and emitter, so the idle voltage on R5 will be about 0.3V. This is not enough to turn Q2 ON, so the LED will remain OFF while there is no signal.
When signal is present, it is buffered by Q1. Positive excursions on the signal will cause the R5 voltage to increase and current will flow through R6, turning Q2 ON and illuminating the LED.
C2 is important; it decouples the supply rail and provides current during changes in current drain.
The LED current is determined by the value of RLED in conjunction with the power supply voltage and the LED forward voltage. A small voltage is also dropped across Q2.
Here's an example calculation assuming the following:
Supply voltage (V
S) = 4.5V
LED forward voltage (V
LED) = 2.0V at desired operating current
LED desired operating current (I
LED) = 30 mA
First calculate the voltage across RLED as (V
S - V
LED - 0.2V) (the 0.2V is the approximate collector-emitter voltage of Q2)
= 4.5 - 2.0 - 0.2
= 2.3V
Now use a rearrangement of Ohm's Law to calculate the value for RLED:
R = V / I
= 2.3 / 0.03 (remember, "I" in formulas is current in amps; 30 mA is 0.03 amps)
= 76.7 ohms.
You can get 75 ohm resistors, but a more common value is 82 ohms. This would theoretically give you slightly less current than you wanted, but the error will be swamped by variations in all of the other parameters - the battery voltage, the LED forward voltage, the Q2 collector-emitter voltage, and the tolerance of the resistor. So there's no need to be too fussy.
You can drive several LEDs in series (don't connect them in parallel) if you increase the power supply voltage. Use the formula above, but add the LED forward voltages together.
You should create your audio files at near maximum amplitude. -0.1 dB is a good choice. You should also turn up the headphone volume until the LED brightness stops increasing, then several steps more, to ensure it is turning ON cleanly and fully.
If the LED brightness has not reached a stable maximum by the time the headphone volume setting has reached about 75% of maximum, circuit changes may be needed. Let me know in that case.