2N2222 LED Controller Question

A place to discuss all things involving power and lighting. Generator tips, alternative energy, lighting your camp/bike/art/self and more.

2N2222 LED Controller Question

Postby 5280MeV » Sun Sep 09, 2012 6:28 am

So I am using a 2N2222 Transistor to control a bunch of LEDs. Here is the circuit with an Arduino as the controller:

Screen shot 2012-09-09 at 8.07.38 AM.png


This works just fine. I set pin 13 to high and the LEDs turn on. I set pin 13 to low and they turn off. Groovy.

Now I want to use a trick. I want to get a flicker/flame effect, so instead of hooking up an expensive Arduino I use a cheap flicker LED as a controller:

Screen shot 2012-09-09 at 8.09.32 AM.png


This does not work. The main LEDs are always on, even as the flicker LED flickers.

I found that by adding another resistor R I can get it to work:

Screen shot 2012-09-09 at 8.10.46 AM.png


If R is too big (10k Ohm), then the main LEDs just stay on all the time. If R is too small (100 Ohm), then the LEDs all turn off. If R is 1000 Ohms, then the whole setup works, the three LEDs flicker and I can easily make electric candles/lanterns of any color/size/shape that I want. Cool.

The only thing that bugs me is that I cannot figure out exactly why I need R? Any thoughts?
You do not have the required permissions to view the files attached to this post.
Image
User avatar
5280MeV
 
Posts: 488
Joined: Sun Nov 20, 2011 8:32 pm
Location: Nashville, TN

Re: 2N2222 LED Controller Question

Postby Zhust » Sun Sep 09, 2012 7:21 am

First note: the 250 ohm resistor is unnecessary if you use a 50K base resistor. Transistors are current amplifiers so 50K at 5 volts is 0.1mA at the base; typical DC current gain is 200, so collector current would be 200 * 0.1mA = 20mA. The collector-emitter voltage will automatically change to ensure exactly 20mA passes through the collector. Neat, huh? I typically connect the LED chain anode directly to the unregulated source to reduce the load on the regulator.

I'm sure the flicker LED has an internal microcontroller so it needs a little juice to run. The 1K resistor you're adding pulls the transistor's base close enough to ground (emitter potential) to shut off (that is, VBE is below about 0.6V), but when the LED is on, the current draw in the flickering LED is high enough to pull that voltage up and current flows from base-to-emitter and turns the transistor on.

In other words, when the flickering LED is off, the flicker LED current might be about 1mA, but with it on, it's about 20mA.
May your deeds return to you tenfold,
---Zhust, Curiosityist
User avatar
Zhust
 
Posts: 710
Joined: Tue Feb 15, 2005 1:46 pm
Location: Rochester, NY
Burning Since: 2004
Camp Name: Camp CampCampCamp

Re: 2N2222 LED Controller Question

Postby 5280MeV » Sun Sep 09, 2012 9:50 am

Zhust wrote:First note: the 250 ohm resistor is unnecessary if you use a 50K base resistor. Transistors are current amplifiers so 50K at 5 volts is 0.1mA at the base; typical DC current gain is 200, so collector current would be 200 * 0.1mA = 20mA. The collector-emitter voltage will automatically change to ensure exactly 20mA passes through the collector. Neat, huh?


Very cool.

Zhust wrote:I'm sure the flicker LED has an internal microcontroller so it needs a little juice to run. The 1K resistor you're adding pulls the transistor's base close enough to ground (emitter potential) to shut off (that is, VBE is below about 0.6V), but when the LED is on, the current draw in the flickering LED is high enough to pull that voltage up and current flows from base-to-emitter and turns the transistor on.

In other words, when the flickering LED is off, the flicker LED current might be about 1mA, but with it on, it's about 20mA.


Well that explains it! I can sleep now. The site where I learned the flicker LED trick used a PNP transistor and now I think I understand why.

Thanks!
Image
User avatar
5280MeV
 
Posts: 488
Joined: Sun Nov 20, 2011 8:32 pm
Location: Nashville, TN


Return to Power & Illumination

Who is online

Users browsing this forum: MSNbot Media and 1 guest

cron