Jump to content
londonlad

Total Noob Q'n, Need Help Controlling a Transistor

Recommended Posts

I've just started playing around with my msp430 ez-2013 that my uncle gave me a while back (I've been too busy with school and whatnot until now  :smile: ) and am trying to use the ez-2013 to control a transistor that will flash an externally powered LED. So far I've had no luck with it. I'm using a 2n222 transistor with a 10k ohm resistor from P1.0 on the ez-2013 to the base  and a 10k ohm resistor on the emitter, with the anode of the LED attatched to the collector and the cathode attached to +6V. The resistor on the emitter is attached to ground. The led is powered seperately from the microcontroller (the MC is powered by USB) and the led/transistor is powered by 4 AA batteries. The transistor does work (the LED lights up when i connect the base to +6V) but does not turn on when attatched to the MC. I am just using the "Flashing the LED" program to eliminate the possibility of coding error. Is there something that I've done wrong, something I'm missing/have overlooked? Does the MC have to be powered by the same source as the LED or something in order for it to work? Would appreciate some help with my noob problem! Thanks in advance! 

Londonlad

 

PS I attatched a photo of the setup, might provide some help in figuring out what I've done (wrong)

post-35419-0-00083700-1388042577_thumb.jpg

Share this post


Link to post
Share on other sites

You need to connect GND too. For current to flow you need 2 wires. And you may try with 1k ohm resistors instead of 10k.

 

What do I need to GND? Do I need to connect GND from the MC to GND from LED (ie common ground)? LED is connected to GND

Share this post


Link to post
Share on other sites

You're nearly there, your main problem is the 10k resistor in the emitter line. This reduces the current that can flow through the led to a minuscule amount. The correct configuration is to put the current limiting resistor in the collector line. Hopefully the following sketch will show how.

agypyqe7.jpg

 

The value of the collector resistor will vary depending on the forward voltage of the led (typically around 3v) and the current of the led (typically around 20mA). The value is determined by (Vs -Vf)/If, where Vs is the supply voltage, Vf is the led forward voltage and If is the led forward current. Using typical values we get (6-3)/.02 = 150ohm.

 

 

 

Sent from my iPad using Tapatalk

Share this post


Link to post
Share on other sites

Awesome! That did the trick :biggrin: ! Thanks for your help guys, made my day, been struggling with it for a couple days on and off! It was a combination of both tips. I had to decrease the resistor value and have a common GND link. Next step: Knight Rider display!

 

Londonlad

Share this post


Link to post
Share on other sites

At least you are smart enough to use transistors from the start ... i once blew a pin on the launchpad trying to drive some leds in tri-state mode ... :D

I could just drive the leds without transistors (I've done it) but I thought that I should challenge myself to do it with transistors so that way I know that I'm able to do it and it'll make it easier troubleshooting larger projects that I'm controlling with transistors as I know (more) what I'm doing :smile:  

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×