PDA

View Full Version : Led + resistor ?



ruijc
- 9th March 2008, 11:57
Hi all,

i have a home project which is working perfectly in the breadboard.

However i assembled it in a pcb and the result was a bit different.

I have made 2 pcbs and they both react the same way ( 2 out of 6 leds do not light up with the same intensity as the other in the middle of the code...but they all light up good in the initialization ).


The code is the same for the initialization and the rest:
ex: led1=1 or led1=0

The 2 things i made diferent from the breadboard are:

5v generated from 3v (x2 AA bat. ) using a max1724 ( the breadboard version has 5v from 12v using 7805 )

and

removed all 10k resistors from the pic to leds to increase led brightness.

The leds are conected to ports
led2 var PORTA.6
led1 var PORTA.7
green var PORTB.4 ' bicolor led (green)
red var PORTB.5 ' bicolor led (red)
led4 var PORTB.6
led3 var PORTB.7

The ports that have these strange simptoms are PortA.7 and portB.4

The pic is a 16f88

My question:

Can it be current issues in these ports ? Do these ports have some limitation that can react with the leds ?

Thanks

ardhuru
- 9th March 2008, 17:28
Hi,

I'm surprised you had any brightness at all with 10 K reisitors; and connecting your LEDs without resistors is probably the only reason you're seeing these results, besides potentially damaging the LEDs, or the pic, or both; use 1 K (or 470 ohms for a brighter display) resistors instead, and that should make your PCBs behave like the breadboard version did.

Regards,

Anand

Archangel
- 9th March 2008, 18:49
My question:

Can it be current issues in these ports ? Do these ports have some limitation that can react with the leds ?

Thanks
Hi ruijc,
The short answer is YES, PIC pin max 25ma, your diodes even less. ardhuru set you straight already as to how to fix that, I am just answering the question. ;)

ruijc
- 9th March 2008, 19:36
ardhuru, Joe S., thanks for your help

Those were my thoughts also, i just dont understand why only 2 ports ( without resistor ) give a diferent result and the other 4 ( also without resistors ) light up just fine.

Without the resistor the leds light up brighter as expected, but these 2 ports ( also without the resistors ) just barely light up .

Maybe there is something in this pic's hardware to produce this behavior.

skimask
- 9th March 2008, 22:25
Maybe there is something in this pic's hardware to produce this behavior.

Solderless breadboard?
Move everything up/over a few holes and see what happens...

ruijc
- 9th March 2008, 22:41
Hello Skimask,

It's on the solderless breadboard that it's working as it should.

It's on the pcb that i get this strange behavior.

I'm beginning to suspect that the max1724 is not handling it very well.

i'm going to simulate on the breadboard the final circuit ( including the max1724 ) and let's see what happens .

falingtrea
- 10th March 2008, 15:09
You need to check the data sheet for the specific PIC device you are using. Not all pins are direct drive. Some are only open collector and need pull-ups if you need a high output. Also, what level are you using to turn your LEDs on? The I/O pins will drive a higher current for a low(8.5 mA) than a high(-3 mA). So the best bet is to connect the LEDs to you positive rail to the anode and the I/O pin to the cathode.

ruijc
- 10th March 2008, 20:33
Thanks falingtrea, that is a good idea.

In fact i was going to change my code to do that by i remembered that one of the ports i mentioned is one bi-color led ( green and red with comon anode ) and the green one doesn't light up.

This was what i changed :

PortA.7 and portB.4 added a 2K resistor in series.
Remaining ( working ) ports...left as is ( meaning...without resistors )

Result :

Now all led light up normally !!! :)

Still, i have to mention the hardware feature in these 2 ports that produce this behavior.

I searched the 16F88's datasheet and i could not find anything that could link to this :( .

.