# what do I need to build a programmable circuit for some LEDs?

#### CIVEDM

Joined Jan 28, 2014
38
Hey there Here's the deal. Im building a special LED desk for myself. Basically, there will be leds all around the edges of each part of the desk. I want to code some really cool things for these LEDs to do. Eventually i would love to build a circuit where i can connect an audio signal to it and turn my desk into a really cool equalizer. Anyways,... But for now I just want something where i can code whatever i want them to do.

I already ordered 300 white and 300 common anode tri-color leds. I have yet to order the resistors for them. I plan on buying a lot of 40 pin ribbon cable and connectors. I want to power this circuit via my PC. Whatelse do i need? If you can give me an idea of what i need so that i can research each part to learn about how they work. Im not just looking for a list of stuff. I want to learn as well. I thought this would be a good way to start. I actually enrolled for electronics engineering at a local college. I start this fall. Going to get my associates there and then head to another college for my bachelors. Then ill be seeking out higher degrees after that. Anyways.

#### THE_RB

Joined Feb 11, 2008
5,430
The first thing you need to decide is how to control 1200(!) separate LEDs.

The amount of current is not really the problem, it might only be an amp (which you can get from your PC internal +5v or +12v connectors).

The problem will be the control system (what to use to adjust the brightness of 1200 LEDs?), and IF you will use PWM on the LEDs to control their brightness or just run them on/off control.

And your data comms speed from the PC, assuming you will use USB data etc to control them.

What experience do you have with the PC control side? Can you write code for the PC to send data out the USB port?

#### CIVEDM

Joined Jan 28, 2014
38
Yea it's going to be a lot of LED's I don't think I will use all of the 300 RGB's but very close. Plus there will be a white LED for every RGB so you can tack on another 300 as well. I don't know how I will control these. I was hoping that if I gave you enough information as to what I want to do that maybe you could guide me.

I would love to build some kind of programmable circuit where once I have all the coding done, I could flip through different effects using s button. Maybe two buttons, forward and backwards?!?! I'd like a circuit that would allow me to create numerous effects or profiles to flip through.

Not really worried about power consumption because I know LED's don't use all that much power. I would probably just use a 12v line from my PSU.

Would love it if I could connect to the circuit via USB.

I have never written in any language other than Javascript and a tiny bit of VB Script is very similar in syntax. So I would have to learn C or C++. Im not all that worried about the programming side of this as I have some experience programming. I will learn this very quickly. The electronics is what Im weary about because I have ZERO experience doing this. But I have to learn because school is a coming

How would you do this if you were me? There is really no right or wrong way because im learning. This will get me started. I can experiment afterwards try and build on my own with help. It's just that right now I have no clue. Get me started.

When I get home I will post an image of a 3D model of the desk im building. So you can get an idea of what im talking about.

Thanks for you help.

#### shakilabanu

Joined Jul 8, 2014
44
have you ordered 300 separate LEDs or a LED strip that has 300 LEDs? both of these will have their own challenges...

#### CIVEDM

Joined Jan 28, 2014
38
I ordered 300 individual common anode RGB's and 300 individual white LEDs.

Also,.. I want to be able to vary the voltages so that I can fade in and out the LED's. Not just turn them on and off.

#### Brevor

Joined Apr 9, 2011
297
Hello CIVEDM,
I don't like to sound discourageing but I think your project is way too complicated for someone with no knowledge of electronics. You will not be able to complete it before your classes start and then you will be too busy to work on it.

#### Alec_t

Joined Sep 17, 2013
10,355
I want to be able to vary the voltages so that I can fade in and out the LED's. Not just turn them on and off.
You don't 'vary the voltages'; you vary current to control LED brightness, or you use PWM (which turns the LEDs on and off at a high enough pulse rate for the human eye to perceive them as continuously lit and with a varying duty cycle to change the apparent brightness).

#### djsfantasi

Joined Apr 11, 2010
5,579
Alec_t has clarified how to vary the brightness of your LEDs. Would you like them individually controlled? If so, how are you going to "address" them?

You mention programmable circuit. Are you thinking of using a microcontroller? Have you programmed before?

#### CIVEDM

Joined Jan 28, 2014
38
Hello CIVEDM,
I don't like to sound discourageing but I think your project is way too complicated for someone with no knowledge of electronics. You will not be able to complete it before your classes start and then you will be too busy to work on it.
Not trying to finish this desk before school. This desk is for my audio workstation, which has nothing to do with my schooling. It's going to be somewhat of a long term project.

#### CIVEDM

Joined Jan 28, 2014
38
Alec_t has clarified how to vary the brightness of your LEDs. Would you like them individually controlled? If so, how are you going to "address" them?

You mention programmable circuit. Are you thinking of using a microcontroller? Have you programmed before?
What do you mean how am I going to address them? I am going to wiring them inside my desk so that can I control all of them individually. I don't know how I am going to address them let alone do not know what that means.

yes I want a programmable circuit. I want to be able to write code. I have never written code like this but always wanted to learn. I will not have a problem learning how to code for them. I worry about that when the time comes. Just need to figure out all the hardware needed to get me to that point. Microcontroller, sure. I'm assuming there are many ways to build a programmable circuit. Do you think a microcontroller is the best way to go?

I want to be able to hook up to it via usb to program it.

#### CIVEDM

Joined Jan 28, 2014
38
You don't 'vary the voltages'; you vary current to control LED brightness, or you use PWM (which turns the LEDs on and off at a high enough pulse rate for the human eye to perceive them as continuously lit and with a varying duty cycle to change the apparent brightness).
Gotcha. I kind of knew that about the voltage and current,... but im such a noob. I know voltage drives current to move and current is what makes things do what they do. So for LED's,.. more and less current makes them brighter and dimmer.

Which do you think is a better way to vary the brightness? Will PWM shorten the life of the LED's from being turned on and off so much? I know that when you turn some on and off there's an initial tiny surge of current and then it levels out. This surge is usually what kills light bulbs. I know LED's aren't light bulbs but,... had to ask.

#### Alec_t

Joined Sep 17, 2013
10,355
Will PWM shorten the life of the LED's from being turned on and off so much?
No. They're not like filament lamps.

#### CIVEDM

Joined Jan 28, 2014
38
I don't really want to hear about how hard this is for me to do. That is no reason for me not to try and learn as I do. All Im asking is for a little bit of help. That's all. If you guys could just comprise a list of components for me so I know where to start. Please.

#### djsfantasi

Joined Apr 11, 2010
5,579
"Address" as in figure out which of the apparent 1200 wires you want to turn on and by how much. How do you expect to control each of the 1200 LEDs?

It's impossible to create a list of components until you know what and how you're going to do this. I'm not convinced you know.

I am convinced people here are trying to help.

#### CIVEDM

Joined Jan 28, 2014
38
I don't know. That's why I am here. Could you tell me of one possibility? I see these people creating these 8x8x8 and 16x16x16 cubes of LED's on youtube where they control all of them individually. The desk im making isn't all that much different. What is a good way to control all of them individually?

I attached an image of a 3D model of the desk im working on. I have all off the wood surfaces ready for shaping. I am working on figuring out how many LED's per panel, their positions, and wiring. Although it's not shown within this image I will have grooves cut into the wood to conceal all the wiring. There will be a 2" wide groove down the center that will branch off with tiny grooves to each hole. These tiny grooves will be for the negative wires. I will figure out the total power consumed by each panel and run a positive wire capable of withstanding the total power used from one hole to another. Connecting all the common anodes. I will probably solder the resistors in with the LED's so they fit snug in their respected holes. Once I have all these LED's wired up I will place a white translucent acrylic on top of the wood and then a sheet of aluminum on top of that. Only the edges of each panel will be lit up and seen. I changed the plans so that the LEDs are closer together and a bit close to the edge of each panel which means there are more LED's than I previously planned for. I will have to order more.

#### Attachments

• 282.3 KB Views: 19

#### takao21203

Joined Apr 28, 2012
3,682
I made a 768 LEDs matrix, and I use 4 small PCBs with 2 16F59 controllers each.

So each chip can control 16*6 LEDs, and generate 16 brightness levels in software.

As well I use digital MOSFETs for the cathode rails.

These 8 chips get serial data from a PIC32 master controller.

For RBG, each RGB LED really is 3 individual LEDs.

16 levels each = 4*4 bit = 4096 colors.

#### Austin Clark

Joined Dec 28, 2011
412
I don't know. That's why I am here. Could you tell me of one possibility? I see these people creating these 8x8x8 and 16x16x16 cubes of LED's on youtube where they control all of them individually. The desk im making isn't all that much different. What is a good way to control all of them individually?

I attached an image of a 3D model of the desk im working on. I have all off the wood surfaces ready for shaping. I am working on figuring out how many LED's per panel, their positions, and wiring. Although it's not shown within this image I will have grooves cut into the wood to conceal all the wiring. There will be a 2" wide groove down the center that will branch off with tiny grooves to each hole. These tiny grooves will be for the negative wires. I will figure out the total power consumed by each panel and run a positive wire capable of withstanding the total power used from one hole to another. Connecting all the common anodes. I will probably solder the resistors in with the LED's so they fit snug in their respected holes. Once I have all these LED's wired up I will place a white translucent acrylic on top of the wood and then a sheet of aluminum on top of that. Only the edges of each panel will be lit up and seen. I changed the plans so that the LEDs are closer together and a bit close to the edge of each panel which means there are more LED's than I previously planned for. I will have to order more.
You're correct about the LED cubes. It occurred to me as well. You could very easily adapt those projects and tutorials for your needs.
I'd definitely prototype some smaller stuff before going straight to the full build. Perhaps make your own cube, or a little display? Once you've nailed the principles, it will be much easier to scale up.
Controlling such a massive number of LEDs isn't easy. You'll need to choose from dozen or so different techniques to make it happen. Basically the trade-offs are complexity of code VS complexity of hardware and Cost.
There are individually addressable RGB LED strips you can buy that will work out of the box, which would be the simplest solution, but very expensive. (especially now that you've already purchased alternative hardware).

Right off the bat I would recommend you throw away the idea of individually controlling brightness. That will help simplify the design significantly.

To get you on the right track, research multiplexing, charlieplexing, and shift registers.

The more LEDs you control the harder it will be to keep them all bright. This is because multiplexing techniques typically require you to control single rows or columns at a time, cycling between them quickly, and using human persistence of vision to make them appear solid. The more rows / columns you have the less time each LED will be one during their cycle, and thus appear less bright.
To give you an idea, if you were to use normal muliplexing (basically connect the LEDs in an "array", which by the way might be difficult if the LEDs are in long strings) you'd need 64 I/O pins. 32 columns and 32 rows = 1024 controllable LEDs. Once you realize this, and the fact that everything needs to be soldering together correctly (literally thousands of junctions) you may want to reduce the number of LEDs you want to use. If you use only 256 LEDs (which I imagine should still be enough) you would need half the I/O pins, 1/4 the number of wires running down the length of the "strip", and twice the maximum brightness.

#### Austin Clark

Joined Dec 28, 2011
412
I made a 768 LEDs matrix, and I use 4 small PCBs with 2 16F59 controllers each.

So each chip can control 16*6 LEDs, and generate 16 brightness levels in software.

As well I use digital MOSFETs for the cathode rails.

These 8 chips get serial data from a PIC32 master controller.

For RBG, each RGB LED really is 3 individual LEDs.

16 levels each = 4*4 bit = 4096 colors.
Very cool. What was the cost, maximum frame rate, and complexity and time to build? Using driver chips could make his project much more viable. It could also make a largish DIY RGB LED display possible for me in the future

#### Austin Clark

Joined Dec 28, 2011
412
(Sorry for the triple post)

I forgot to mention that this is a perfect candidate for an Arduino (a microcontroller development board, great for beginners). Check out tutorials for muliplexing and charlieplexing LEDs with them on youtube. Using a microcontroller is pretty much the only option with this project. You can control the sequence the LEDs perform using buttons with the microcontroller, or by sending commands via a PC to the microcontroller.

Let me/us know if you run into any particular problems from there.

#### takao21203

Joined Apr 28, 2012
3,682
Very cool. What was the cost, maximum frame rate, and complexity and time to build? Using driver chips could make his project much more viable. It could also make a largish DIY RGB LED display possible for me in the future
Frame rate at 16 brightness levels is just enough the human eye does not notice the multiplex. 32 levels arent possible (however these simple PICs can be overclocked). I run them at 18 MHz.

I made a lot of these PCBs, originally for 7segment LCD, but then repurposed.

Not expensive, each chip less than $1, and the PCBs little above$2.

For RGB LEDs, you could only control 16*2 = 32 of them with one chip, 64 with one PCB. They are small carrier PCBs, with very few extra parts.

total framerate? I dont know, the frame is composed of 8 slices, and each of these needs 16*6*4 bits = 16*24 = 16*16 + 16*8 = 256+128 = 378 bits. For that you need approx 2000 cycles minimum, maybe 3000.

18 MHz / 4 = 4.5 MHz. Lets say 4500 cycles, so you can update 1000 times per second.

Indeed, you cant since you also need to refresh the LEDs.

But it's safe to say you can update each chip about 100 times a second with serial data.