# Using transistor to switch leds on/off

1. Aug 16, 2008

### nyxynyx

I'm currently using this circuit, but without the rectifying portion,a audio source from mp3 player instead of a mic, and a 4V LED instead of a bulb. My power source is 12v. However, the voltage across the LED is only around 1-1.5V. How can i increase the voltage across the LED?

Here is what i want to do. I'm trying to have the LED light up only when the input voltage from audio source is above a certain voltage. When the input is above a certain voltage, the LED lights up fully, and when the input drops below that certain voltage, the LED switches off completely. The LED is either at its maximum brightness, or not emitting any light at all. Hopefully, I can replace the LED with another load and have the voltage across the load to be either 12V or 0V, or either 4V or 0V. How can i achieve this?

#### Attached Files:

• ###### 03081.png
File size:
3.9 KB
Views:
255
Last edited: Aug 16, 2008
2. Aug 16, 2008

### MATLABdude

Howdy nyxynyx,

The (idealized) circuit you posted assumes a few things:
1) Microphone transduction (i.e. current generated) is high enough to saturate the BJT
2) (Given 1) The BJT saturation current is sufficient to turn on the lamp (often in the range of a few hundred mA)
3) The BJT responds fast enough to the signal (probably few hundred Hz to few kHz) that the lamp actually turns on.

With that in mind, to get a higher voltage across the LED, you should analyze your circuit to ensure that the BJT is, in fact, saturating. Since a LED has only a very low on resistance (few ohms), you probably need to introduce a current-limiting resistor to accomplish this (as well as to ensure that your LED doesn't go ZAP). I also think your circuit (incidentally, this is what's called a Common Emitter Amplifier) needs some biasing on the base to function properly and give you decent swing.

As to the second portion of your question, how to vary the LED intensity with the input voltage, well, if you're talking DC voltage, that's pretty easy. If you're talking audio (again, stuff between 20 Hz and 22.1 kHz--unless you're a fan of pure tones) I think you'd be dealing with the RMS voltage. Again, you just need to use an appropriate resistor value to limit the current, and design your amplifier gain such that you don't have a lot of saturation (i.e. it doesn't "go to the max" at a low volume).

The above is written assuming a pretty good electronics background, so, if you don't have a few years of EE (or, better yet, EE tech) education behind you, it might be easier to build something called a non-inverting amplifier based off of a op-amp. Or you could build the non-inverting type and use it to sink LED current. Your life is made much simpler because you don't need the negative rail. This would make a terrible audio amplifier, but a great LED indicator. If you cheap out (and you probably can) and just use a "plain-jane" op-amp (e.g. a LM741) with the negative rail connected to ground, you can probably get something to work:

http://hyperphysics.phy-astr.gsu.edu/Hbase/Electronic/opampvar.html

WARNING: If you use the inverting amplifier, make sure to use a large value of R1 (> 1k) Your fancy MP3 player might not survive having lots of current drawn out of it! IIRC, the non-inverting amplifier presents the Op-Amp resistance to your input (which is usually in the range of a few megaohm). Also, whatever configuration you use, don't forget to use a current-limiting resistor for your LED (otherwise, it'll just turn on-off until such time that it burns out). On that note, I take no responsibility for burnt-out audio equipment if you try this without testing!

3. Aug 16, 2008

### nyxynyx

Can i use the non-inverting opamp design with only 0v and +12v? I did try using 500K pot as R_f and 1K resistor as R_i but the output seem to be quite steady at 0.7V across the LED. Did i do something wrong?

I cant find a LM741 so i used a HA11741. Will this make a difference? What does it mean by frequency compensated?

4. Aug 16, 2008

### MATLABdude

As I say, you might be able to make it work with some experimentation ;-)

Best bet, use a smaller gain ratio (right now, it's 501 try 5 or 10 or 50 or something). If it does work, you'd be causing it to saturate pretty quickly (so on-off operation). The second thing is: do you have a current limiting resistor (e.g. 470 ohm) in series with the LED? If so, you might want to check to see if your LED is blown (see if it'll turn on with the 12V supply and the current limiting resistor). If this is still okay, your op-amp might not be able to source enough current to turn on the LED (you need 10 mA or so)--this you can check by hooking up the '+' terminal to 12V, the '-' terminal to GND, hooking up a 1 kohm resistor to the output (and GND) and seeing if you get 12V at the output (meaning that 12 mA are flowing through the 1k resistor)

By 'frequency compensated', it means that there should be no unpleasant surprises in operation within the spec'd frequency range. It acts predictably with no spurious poles or zeros (which would cause the aforementioned 'unpleasant surprise'):
http://www.st-andrews.ac.uk/~www_pa/Scots_Guide/datasheets/Opamps/741.html

I can't find a datasheet for a HA11741, but if it's a general purpose op-amp, it should suffice.