Pic driven LED's

Using a PIC, in my case a Pic18F4620

What do I need to drive the RA0-RA7 outputs to ignite 7 x 2.2v LED's on each output?

Aurbo

Reply to
aurbo
Loading thread data ...

Ignite? As in, "set them on fire"? ;-) How much current do you want in each? How much current is an output pin capable of? Is there a limit on the total current in those outputs? Assuming you want the same current in each of the seven LEDs on a given output, and assuming the desired current per LED is more than the max pin current divided by seven, the easiest way is probably to put the LEDs in series and use a transistor to switch the current on and off. You then need a power source somewhat over 7*2.2 volts to run the LED strings. You can use a current-limiting resistor, or arrange the transistor to act as a current source, to get the current you want in the LEDs. You can get power mosfets in tiny packages that will drive LEDs easily, and are easily driven from logic outputs. Simple bipolar transistors can be used as drivers, too. But we'd need to know more about the constraints (available power, etc.) before being able to say something was close to optimum for your situation.

Cheers, Tom

Reply to
Tom Bruhns

On a sunny day (Sat, 19 Jan 2008 08:44:11 -0800 (PST)) it happened snipped-for-privacy@eastlink.ca wrote in :

I dunno if that pic has pullup on that port. But if it has, config the port as input, and switch the pullups on and off. LED between output and ground.

That gives about 200uA nominal, enough for high efficiency LEDs.

Else use resistors and go for .5 mA or so.

Reply to
Jan Panteltje

I'm looking at making each "segment" of an led digit out of 5 to 7 individual led's so the output for segment a-g of a typical 7 segment layout would need 2.2v@20mA x 5 or 7 = 100mA or 140mA

I've been looking at the UDN2981 as a possible driver from the RA0-RA7 to UDN2981 to a-g but I'm still unsure if this is the right way to go.

Cheers Steve

Reply to
aurbo

On a sunny day (Sat, 19 Jan 2008 11:02:10 -0800 (PST)) it happened snipped-for-privacy@eastlink.ca wrote in :

Perhaps it is better to put the LEDs in series. And on modern LEDs 20 mA is blinding bright, .5 ma is nicer.

Reply to
Jan Panteltje

Dear god, are you trying to be visible from Sirius? Are you designing with 20 year old parts? What is going on here?

Reply to
a7yvm109gf5d1

You can't put the LEDs in series, because they have to be run from 5v and they each have a voltage drop of 2.2v. Also, the brightness @ 20mA depends on the type of LED. Big 20W LEDs need about 1A to reach full brightness.

As for that driver chip, it looks like it would do the job. It might be cheaper (but not easier) to drive the LEDs from bipolar transistors or MOSFETS - either discrete ones or ones in a transistor bank IC.

Reply to
John Jarman

On a sunny day (Sat, 19 Jan 2008 19:49:29 GMT) it happened John Jarman wrote in :

A little switchmode to step up, and those LEDs in a segmentwill all have the same brightness. Possibly even more efficient then separate resistors for each group.

If that driver can handle the higher voltage, sure. But 20mA is likely way too high for a normal display with modern LEDs.

Reply to
Jan Panteltje

Ok, 20mA is possibly too much, but, especially if this is an outdoor display, you might want at least the capability of higher brightness. It is pretty trivial to use PWM to dim the LEDs if necessary without having to modify the circuit, but adding in power drivers later would require a whole new board design. My guess is that this display needs to be somewhat bright, as it is going to be 5-7 LEDs per segment.

Reply to
John Jarman

LOL, not 20 year old parts.. just a 60 year old brain...

I used the 20mA rating as its the rating I have on some super bright LEd's here..

No I dont need 20mA.. I can use something else..

I have a few hundred red led's that are quite dim compared to the super brights.. I've not measured them to see what they draw.

You mentioned bipolar transistors or Mosfets.. might you have a sample circuit for that?

My overall goal is to take a home built version of this:

formatting link

multiply that by 7 digits to give me DDD:HH:MM with 4 led's drive the ":"'s as seconds, Driven from a single PIC as a 365 day clock

Using as few parts as possible.

All the input and responses so far have been tremendous! Thanks all.. your dragging my old dusty mind down the school corridors once again trying to figure this out.

Reply to
aurbo

You can try running a segment of 5 LEDs wired in parallel with a 5kohm resistor on each LED (sorry, I can't draw LEDs!):

------- PIC |--------|-----|----//---| | LED1 LED2 LED5 | | | |

------- \\ \\ \\ /5k /5k /5k \\ \\ \\ | | | GND------------|-----|---------|---

That will draw ~5mA from the PIC. The safe limit for 1 pin is 25mA, and you can source a maximum of 100mA or sink 150mA from one port (e.g. PORTA).

I mentioned the transistors as a way of driving a higher current load of LEDs, i.e. if they were drawing 20mA each (100mA per segment). That would toast the PIC without drivers ;)

Reply to
John Jarman

Why is everyone telling him to wire LEDs in parallel or serial? He wants 7 individual 7 segments LEDs for a total of 49 segments.

Reply to
linnix

e

A).

d text -

aaaaa f b f b f b f b f b ggggg e c e c e c e c e c ddddd

Each segment leg is made up of 5 to 7 individual led's for a total of

35 to 49 leds per digit. Each output channel has to handle its own a-g string.

Did I do that right?

Reply to
aurbo

text -

Usually they're wired in series for each segment and you would use a sink driver for each. Something like 20-24V would be about right for 7 LEDs in series, and the resistors will probably end up being 1/4 or so.

What is this, a scoreboard or something like that?

Reply to
Spehro Pefhany

t

ple

he

once

m

nd

ORTA).

of

oted text -

Timer at the end of the pool for the swimmer and spectators to see, in the one format it will be HH:MM:SSS for competitions, and under that will be an inversed layout that will be a Julian date clock.. DDD:HH:MM Only one of the two displays will be running at any given time.. it depend on whether its a competition day or training day.

Two completely separate displays, one is a stopwatch, one is a clock.

Steve

Reply to
aurbo

The competition display is seven digits at seven segments per digit for a total of 49 segments which must be controlled. This would make for a total of seven ICs. That's a lot of I/O, so the display drivers will have to be latched. There are power octal addressable latches which require one data bit input, three address inputs, and a latch control line. All the data bit inputs and address bits can be run in parallel, with the latch control line the only input controlled separately for each IC. Assuming you're working with a single 8-bit PIC port, RA was it, then you can assign RA0 to the data bit input common to all the latches, and bits RA1-RA3 to the common bit address lines which are your segment selects within a digit, which leaves RA4-RA6 as a 3-bit latch select address which are your digits, and maybe RA7 for a load enable line. The RA4-RA6 for the latch select can be input to a cheap 74HC138 to produce one-of-eight active low outputs into the individual latch control inputs. Moving onto the actual segement drive, as others as have stated, it is better to drive a series string than a parallel string for display uniformity. That would make 7 LEDs x 2.2V/LED or a total of

15.4V drop across the LEDs. If the LEDs are powered from a supply voltage of V+ and a resistor R is between V+ and the LED segement string, you would need (V+-15.4)/0.02A ohms for R with a power rating of (V+-15.4)x0.02A, and you will need 49 of these resistors, one for each segment. The fluctuation in segment current using a standard tolerance R will be (deltaR)/R, the same as the resistor tolerance IOW. The fluctuation of current with LED VF will be (deltaVF)/(V+-15.4) or p*15.4/(V+-15.4)=p/((V+/15.4)-1) where p is a fractional percent deviation. This shows that the selection of V+ is important in desensitizing the LED bias current variation with respect to LED VF variation resulting from manufacture. Getting on with the actual circuit, it will look something like this, using a one TPIC6259 per digit, widely available, from Digikey especially (the UDN2981 does not appear to be readily available): View in a fixed-width font such as Courier.

. . . . . RA7=0 ;used to enable write without address error . . FOR DIGIT=1 TO 7 . . RA4-RA6= DIGIT-1 . . FOR SEGMENT=1 TO 7 . . RA1-RA3= SEGMENT-1 . . RA0= SEGMENT ON/OFF (1/0) . . OUTPUT RA0-RA7 . . RA7=1 . . OUTPUT RA0-RA7 . . RA7=0 . . OUTPUT RA0-RA7 . . NEXT SEGMENT . . NEXT DIGIT . . . . . . . . a . LED DRIVER --- . --------------- 7 f| g |b . wherever-----|CLR O1a-O1g|----/---- --- DIGIT1 . | | e| d |c . | | --- . RA0-----------------|D | --- . | | 7 | | . s | O2a-O2g|----/---- --- DIGIT2 . e RA1-----------------|A0 | | | . g | | --- . m RA2-----------------|A1 | --- . e | | 7 | | . n RA3-----------------|A2 O3a-O3g|----/---- --- DIGIT3 . t ------ | | | | . | __| |__ | --- . d RA4 -----|S0 O1|---|G1 | --- . i | __| |__ | 7 | | . g RA5------|S1 O2|---|G2 O4a-O4g|----/---- --- DIGIT4 . i | __| |__ | | | . t RA6------|S2 O3|---|G3 | --- . | __| |__ | --- . | O4|---|G4 | 7 | | . RA7------|G __| |__ O5a-O5g|----/---- --- DIGIT5 . | O5|---|G5 | | | . |__ __| |__ | --- . .--|G1 O6|---|G6 | --- . | |__ __| |__ | 7 | | . +--|G2 O7|---|G7 O6a-O6g|----/---- --- DIGIT6 . | ------ | | | | . --- 74HC138 | | --- . gnd digit | | --- . select | | 7 | | . | O7a-O7g| ---/---- --- DIGIT7 . --------------- | | . --- . . . . O1a-O1g O7a-O7g . LED DRIVER | | . .------------------------------------------------------- . | U1 | U7 | | . | TPIC6259 | 7x TPICs TPIC6259 | | . | ------- | ------- | | . D |-> -|D O1a|/| -|D O7a|/| | . | | | | | | | | . | |__ O1b|/| |__ O7b|/| | . | .-----|G1 | | .-----|G7 | | | . | | | O1c|/| | | O7c|/| | . --- | | |___ | | | |___ | | | . CLR |-> | -|CLR O1d|/| | -|CLR O7d|/| | . | | | | | o o o | | | | | . | | | O1e|/| | | O7e|/| | . A0|-> | -|A0 | | | -|A0 | | | . | | | O1f|/| | | O7f|/| | . A1|-> | -|A1 | | | -|A1 | | | . | | | O1g|/ | | O7g|/ | . A2|-> | -|A2 | | -|A2 | | . | | | O18|-NC | | O78|-NC | . | | ------- | ------- | . __| | DIGIT1 DRIVE | DIGIT7 DRIVE | . G1|------' 7-segments | 7-segments | . __| a-g | a-g | . G2|------> | | . __| | | . G3|----------> | A2 A1 A0 seg | . __| | 0 0 0 a | . G4|------------> | 0 0 1 b | . __| | 0 1 0 c | . G5|--------------> | 0 1 1 d | . __| | 1 0 0 e | . G6|-----------------> | 1 0 1 f | . __| | 1 1 0 g | . G7|----------------------------------' | . ------------------------------------------------------- . . . DIGITX X=1-7 . +------------------------------------------+ . | | . | OXa--|

Reply to
Fred Bloggs

Looks like the TPIC6B259 is significantly cheaper than the other candidate addressable latches, making the LED DRIVER schematic: View in a fixed-width font such as Courier.

. . O1a-O1g O7a-O7g . LED DRIVER | | . .------------------------------------------------------- . | U1 | U7 | | . | TPIC6B259 | TPIC6B259 | | . | ------- | 7x TPIC6B259 ------- | | . D |-> -|D O1a|/| -|D O7a|/| | . | | | | o o o | | | | . | |__ O1b|/| |__ O7b|/| | . | .-----|G1 | | .-----|G7 | | | . | | | O1c|/| | | O7c|/| | . --- | | |___ | | | |___ | | | . CLR |-> | -|CLR O1d|/| | -|CLR O7d|/| | . | | | | | | | | | | . | | | O1e|/| | | O7e|/| | . A0|-> | -|A0 | | | -|A0 | | | . | | | O1f|/| | | O7f|/| | . A1|-> | -|A1 | | | -|A1 | | | . | | | O1g|/ | | O7g|/ | . A2|-> | -|A2 | | -|A2 | | . | | | O18|-NC | | O78|-NC | . | | ------- | ------- | . __| | DIGIT1 DRIVE | DIGIT7 DRIVE | . G1|------' 7-segments | 7-segments | . __| a-g | a-g | . G2|------> | | . __| | | . G3|----------> | A2 A1 A0 seg | . __| | 0 0 0 a | . G4|------------> | 0 0 1 b | . __| | 0 1 0 c | . G5|--------------> | 0 1 1 d | . __| | 1 0 0 e | . G6|-----------------> | 1 0 1 f | . __| | 1 1 0 g | . G7|----------------------------------' | . ------------------------------------------------------- .

Reply to
Fred Bloggs

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.