Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC power supply for LEDs

Status
Not open for further replies.

i2c2k

New Member
hi!

i connected 16 LEDs to the ports B and D of a PIC18F458 and switch them on and off with self-programmed PWM. the problem is that it seems that the two ports don't supply the same current (or voltage) for the LEDs. does anybody know hot that is so or how to solve this problem?
thanks!
 
i2c2k said:
hi!

i connected 16 LEDs to the ports B and D of a PIC18F458 and switch them on and off with self-programmed PWM. the problem is that it seems that the two ports don't supply the same current (or voltage) for the LEDs. does anybody know hot that is so or how to solve this problem?
thanks!

How are the LED's wired?, and what value current limiting resistors are you using?.
 
the leds are wired following:
port-pin ... led-anode ... led-cathode ... resistor-net ... GND
i used 330R resistors. did that help you?
 
i2c2k said:
the leds are wired following:
port-pin ... led-anode ... led-cathode ... resistor-net ... GND
i used 330R resistors. did that help you?

Presumably you used one 330 ohm per LED?. This gives about 10mA current per LED, PIC specs are usually about 30mA maximum per I/O pin, so you could have three off each I/O pin. However, the device also has a maximum current for the entire device, 16 LED's at 10mA is 160mA, which (without checking) I'm pretty sure is well over this maximum limit.
 
You can use transistor or IC like ULN2003 to drive LEDs, it will draws current from the power supply directly, instead of PIC.
 
well, using the ULN2003 would solve my problem but i have limited space for my project.
when i connect only 1 led on a port-d-pin it doesn't illuminate with more bightness. so there might be a problem somewhere else maybe.
 
i2c2k said:
well, using the ULN2003 would solve my problem but i have limited space for my project.
when i connect only 1 led on a port-d-pin it doesn't illuminate with more bightness. so there might be a problem somewhere else maybe.

Perhaps you ought to post a circuit of what you're doing, so we can see exactly what's going on?.

Have you had a scope on the LED's, obviously with a lower PWM they will be less bright, so perhaps they are getting less than you thought?.
 
the pulsewidth is not linked up with the problem because the led on port D doesn't glow properly when it's just switched on.
i think you can easily imagine what connections i've made: power supply, crystal, port b and d connected to LEDs. it's a straightforward thing.
besides, PWM doesn't work this way. the shortest pulse width is too long for proper operation unfortunately so i can forget it all.
does anybody know another mthod to control the brightness (at least in two brightness-steps) of each of 16 LEDs without consuming too much space?
 
i2c2k said:
besides, PWM doesn't work this way. the shortest pulse width is too long for proper operation unfortunately so i can forget it all.
does anybody know another mthod to control the brightness (at least in two brightness-steps) of each of 16 LEDs without consuming too much space?

There's no better way, PWM is simple and cheap to do, and works perfectly.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top