Jump to content
43oh

Controlling 4 RGB Leds with minimal components


Recommended Posts

Hello :)

 

I am looking for a way to controll 4 RGB Leds aqnd I am working with the MSP430 Value Line, where most of them only have 1 PWM Channel. Is there a way to controll 4 RBG Leds [ 12 Leds channels so to speak ] individually without the usage of a controller like the TLC5940? And if not, it should be relativly simple to use a Shift Register to Controll all LEDS and dim all of them with the 1 PWM channel of the MSP430, right?

 

-lastaid

Link to post
Share on other sites

in my mind if you don't mind running the cpu to perform some of the work.

 

I would think you would just run the timer in up mode counting up to whatever frequency you want to pulse at wake the CPU up at regular intervals within that count (the more often, the finer granularity you will have), and have an int for each color of each RGB. Set those color variables as a percentage of the max timer count, and when the int is above the timer "count" T0AR turn a GPIO on driving the color pins on the LED... But that is running the CPU more often than some would like.

 

 

hope this helps. :)

Link to post
Share on other sites

Hey :)

i did some experimenting with a bunch of leds and found charlieplexing quite interesting. it uses less pins, it only lights up 1 led at a time which decreases brightness but improves battery life and it means that i can drive 12 leds [ or 4 RGB ] without any mosfets, just leds and a few resistors. so i started building the charlieplexed ciruit, and it was a pain in the ass, but now its done.

 

my problem is that its not working. i tested it by connecting a 3V coin cell to different leads, and it lights up multiple leds. i checked the ocnnections for shorts, but nothing. i will build the circuit with just 3 * 2 = 6 leds a little later, maybe this will help to pinpoint the error. anyone has any ideas?

 

thanks :)

Link to post
Share on other sites
Hey :)

i did some experimenting with a bunch of leds and found charlieplexing quite interesting. it uses less pins, it only lights up 1 led at a time which decreases brightness but improves battery life and it means that i can drive 12 leds [ or 4 RGB ] without any mosfets, just leds and a few resistors. so i started building the charlieplexed ciruit, and it was a pain in the ass, but now its done.

 

my problem is that its not working. i tested it by connecting a 3V coin cell to different leads, and it lights up multiple leds. i checked the ocnnections for shorts, but nothing. i will build the circuit with just 3 * 2 = 6 leds a little later, maybe this will help to pinpoint the error. anyone has any ideas?

 

thanks :)

 

Did you get it working? If so, let us know how. It's always helpful to others.

Link to post
Share on other sites

I'd love to reply something positive, but as of now its not working. i find a lot of rgb related projects on the web, but most of them either use one rgb led and an arduino to pwm every channel, or they use a rgb led strip solution that is addressable via i2c or spi.

 

i don't think my charlieplexing solution will work, i have to find another way, and i think the TLC5940 might work, although i have no idea how much power it consumes or if it can be disabled to safe power ^^.

 

 

-lastaid

Link to post
Share on other sites

Charlieplexing won't work with most RGB leds. They're common anode or common cathode. Even the 10mm ones(my favorite) are only 4 lead. They make 3W leds that are individually addressable like you would need for charlieplexing but no way you'd run that off an LP directly.

 

A couple of options that I see would be to use individual LEDs so you could charlieplex using the tri-state output mode of the 595 registers or use your one PWM output as a common source or sink(depends on if you're dealing with common anode or cathode) and use two shift registers to select each color of each led individually while changing PWM value for each led depending on the brightness you want.

 

I will be honest though, it would be so much easier, cleaner, and brighter to just use a TLC5940 or similar led controller. It also meets your requirements for minimal components since all you need is the leds, the TLC, a bypass cap, and a single resistor to set maximum current across the array. You can use DOT correction to make sure all of your leds are the same brightness and all you have to do is write each led value once, then you're done until a change is made. Very low CPU usage and should take much less memory to incorporate. Additionally, you'll have 120mA of output power(at 5v led supply, 60 if you run only 3V) which is more than either option above.

 

Charlieplexing is a neat way to run a bunch of LEDs off a few pins but it sounds like you want brightness control which is better left to real PWM.

Link to post
Share on other sites

Ok, i finally have it working. 16 LEDS connected, 16 leds controllable and quite bright ^^. unfortunatly i cannot use my rgb leds because they are common cathode, the tlc5940 needs common anode. i could still need a pointer to determine iref, because i don't know how to calculate Vref

Link to post
Share on other sites

I have it working now with the TLC5940. looks great but i am a little suspicious about the refresh time. It seems to be around 30 refreshes per second @16MHz. As i want a low power solution i might try to set the DCO to 1 MHz, wait for an interrupt and put it up to 16Mhz, then slow it to 1MHz again. The advantage i have now is that 30 updates per second might be enought because i dont have to do the brightness controll in software anymore. I am just afraid that the tlc5940 might eat up too much power.

next step is to figure out how touch interfaces work and implementing yet another rtc and then i have a binary clock once again :D, seems to be a good project to get started ^^

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...