Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
21608 Discussions

Electronics Newbie question concerning LEDs

Altera_Forum
Honored Contributor II
2,021 Views

Hi all, 

I am an electronics newbie, and I am trying to design an guitar that has a light up fretboard. To do this I need to control about 120 individual, single color LEDs, and I am having trouble finding a good method. I've been researching for a few days now, and can't find a board with that many I/O pins to control. I was wondering if the Cyclone II would be able to control the LEDs? and if so would I need any other equipment? 

Thanks so much in advance!!!! 

-Steve
0 Kudos
15 Replies
Altera_Forum
Honored Contributor II
1,303 Views

I guess you could use a Cyclone part to drive 120 LEDs. The current consumption might be quite high. 120 * say 20mA. 

 

A better way might be to somehow strobe the LEDs so they are not all on at the same time. 

 

For example, if your LED matrix is 6 rows by 20 you could light just 6 LEDS at a time then move on to the next 6 LEDs.  

If you strobe fast enough the LEDs should look like they are all on simultaneously! 

 

You would then only need 20 + 6 Output pins but would probably need to add external buffers to beef up the drive. 

 

Hope this is of some help
0 Kudos
Altera_Forum
Honored Contributor II
1,303 Views

120 LEDs wouldn't be on at a time, right? maybe a max of 5 or 10?

0 Kudos
Altera_Forum
Honored Contributor II
1,303 Views

Thanks for the quick responses guys! I originally was planning to turn on half of them at a time to learn scales but if that isn't feasible I might just do a max of 6 at a time (one for each string). I actually considered the strobing, but it seems to be difficult to program and I'm not sure what external buffers do. Would I need those for the cyclone too?  

Thanks again for the advice!
0 Kudos
Altera_Forum
Honored Contributor II
1,303 Views

Just use 8 or 16 channel serial input LED drivers (or just serial latches). You can do it all with 4 pins and one string of drivers.

0 Kudos
Altera_Forum
Honored Contributor II
1,303 Views

i see i thought it may be limited by the number of fingers you could play with. sounds like a cool project. 

 

you should take a look at PWM (pulse width modulation). this is a method of "strobing". you could also use external drivers as mentioned, or transistor buffers in between all of the LEDs. 

 

with PWM, if you used a 4 bit counter you could have 16 groups of LEDs which would be on 1/16th of the time (or off of course). staggering the phase of each LED group would mean you'd have a maximum of 200/16 LEDs on at a time. the programming is still pretty simple.
0 Kudos
Altera_Forum
Honored Contributor II
1,303 Views

Hi, 

 

As was already said, multiplexing the 160 LEDs into a matrix of say 16 rows of 10 LED's each would be the standard way of doing this. What is not so clear yet is that if you cycle through the columns fast enough, it looks as if all 160 LEDs are on at the same time. You need to go through the matrix about 60 times per second in order for the eye not to see the flickering. You would then drive the 16 LEDS in each column 1/(60*10) = +-1.6ms. You would display col 1 for 1.6ms, then col 2 for 1.6ms, then col 3 for 1.6ms etc until you reach col 10 and then you repeat again from col 1. To the eye it will look as if all the LEDS are on at the same time (at least the one you want to be on). 

 

You do not need an FPGA to do this and a microcontroller with at least 10+16 =26 I/O's can do it (You can use fancier tricks with shift retgisters and latches to further reduce the I/O count). You will need to drive more current through each LED than usual since it is only on for 1/10th of the time. Although it is not purely linear, I would suggest an overcurrent of at least 3 times your normal continuous current. You could probably drive the 16 LEDs directly form the microcontroller (or use 74AC244 or similar buffers to increase current drive). The 10 column you would probably need to drive with transistors. The easiest is to use NPN transistors to ground. 

 

See the attached drawing. 

 

Regards, 

Niki
0 Kudos
Altera_Forum
Honored Contributor II
1,303 Views

that's a nice solution

0 Kudos
Altera_Forum
Honored Contributor II
1,303 Views

The feasability of a multiplexed drive scheme depends on the intended brightness. If you apply 1:10 multiplexing, as suggested, you typically aren't allowed to increase the current higher than a factor of 5, which results in half the intensity achievable in DC operation (not considering current dependant efficiency, which further reduces the effective intensity by a small amount). 

 

But there are considerable differences in pulse current rating between LED product families, so you should always check the datasheet. 

 

It also depends on the current level, if you are able to drive the "rows" by standard logic devices or even a microcontroller IO port. In an application targetting to high brightness, this most líkely won't work.
0 Kudos
Altera_Forum
Honored Contributor II
1,303 Views

when staring at a fretboard i don't imagine you'll want it to be bright at all, in fact the dimmer light would be a welcomed feature.

0 Kudos
Altera_Forum
Honored Contributor II
1,303 Views

Again, thanks for the input everyone! I do like Niki's idea of strobe matrixing, but I'm confused on what parts I would need. Are there any suggestions of microcontrollers and other parts that I would need? I would like to use my laptop to control the lights that go on

0 Kudos
Altera_Forum
Honored Contributor II
1,303 Views

Hi, 

 

Since this is not really on the FPGA topic anymore, I suggest we discuss this off-line. I will send you a private message and we can continue from there. 

 

Regards, 

Niki
0 Kudos
Altera_Forum
Honored Contributor II
1,303 Views

I have a question: 

usually, when ever I sow LEDs driven by FPGA, the IO pin was connected to catoda side (sinking the current) and the current strength was determined by a series resistor, so '0' closed the circuit and '1' opened it. 

 

wouldn't this scheme enable him to drive all 160 LEDs at once?
0 Kudos
Altera_Forum
Honored Contributor II
1,303 Views

Yes, you can, but it is a fairly expensive way to drive 160LEDs - you would need an FPGA with at least 160 user I/Os. You would have to go 240pin PQFP (if it has 160 I/Os) or BGA. Multiplexing LEDs in a matrix is much more economic in terms of resources and cost. In the extreme you could do it with 4 + 2 = 6 I/Os! 4 I/Os indicate the column, and is decoded with a 4-16 binary decoder chip. Two I/Os shift the 16 bits for each row into a 16 bit shift register (clock and data). I have done this a long time ago to create a 160 LED matrix and drive it from my PC's parallel port and it worked well. 

 

Regards, 

Niki
0 Kudos
Altera_Forum
Honored Contributor II
1,303 Views

of course you can connect a line of LEDs (10 in each line) and use only 16 I\Os, but I meant it will solve the current consumption problem, also he will need only resistors on the board, with no active (complicated) components.

0 Kudos
Altera_Forum
Honored Contributor II
1,303 Views

When using many outputs with higher current, also the maximum ratings for output groups should be considered. For Cyclone II and III, 20 mA per pin is generally possible. You should avoid however to switch all pins simultaneously. 

 

I generally agree with the opinion, that there are more economic options to drive a large number of LEDs than using a FPGA. If you want to add a few ten outputs to an existing system, it can be meaningful of course. 

 

External, serial interfaced drivers for slow and medium speed signals, e.g. a LED matrix, have the basic advantage of simplifying signal routing. This can be a sufficient reason to use them, I think.
0 Kudos
Reply