Easy transistor

Status
Not open for further replies.

demestav

Member
Hello there. I am trying to drive an LED out of the PWM pins of a microntroller. When the LED is not connected on the mc the signal is fine, i can see pulses on the osciloscope from 0~5V. However when i connect the LED these pulses drop to 0~1V. I assume the mc cannot provide enough current out of the pins. Is this correct?

Now that means i have to use transistor to drive the LED. And because I am not good at all with analog I wanted to ask you how to do that.

Would the following be ok?

Thanks and sorry if this is too silly.
 

Attachments

  • mc.jpg
    76.6 KB · Views: 500
Your skem for the LED driver will work, but you should add a 10K resistor in series with the base to limit base-emitter current.

When you first connected the LED directly to the controller pin, did you have a current limiting resistor in series with it? If not, the LED may have been drawing more current than the line could handle. Also, most devices can sink more current than they can source. In that case, connecting the anode of the LED to the positive supply through a current limiting resistor and the cathode to the controller output might work. But then the LED will light with a LOW from the controller. It all depends upon what you need.

Dean
 
Thank Dean for the reply.

When i connected it in the first place with the mc i had a resistor connecting the pin and the anode of the diode. the cathode was connected to the ground.

I will try the transistor thing today as you suggested it.

Also, most devices can sink more current than they can source. In that case, connecting the anode of the LED to the positive supply through a current limiting resistor and the cathode to the controller output might work.

Hmm why that happens? If that was the case why it did not work in the first place?

Thanks a lot for your time, and it would be great for me to learn something from this thread. :idea:
 
Have a look at the Hardware Extras section of my PIC tutorials, it shows how to drive LED's and transistors from PIC's.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…