lastaid 15 Posted January 24, 2012 Share Posted January 24, 2012 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 Quote Link to post Share on other sites
JWoodrell 285 Posted January 24, 2012 Share Posted January 24, 2012 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. Quote Link to post Share on other sites
TomKraut 17 Posted January 25, 2012 Share Posted January 25, 2012 Considering that you would need some sort of driver anyway (MOSFETs for example...), and that many Value Line MSPs don't even have enough GPIOs to connect 12 channels, I think using a dedicated LED controller with serial interface might be the best approach... Cheers TomKraut Quote Link to post Share on other sites
lastaid 15 Posted January 30, 2012 Author Share Posted January 30, 2012 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 Quote Link to post Share on other sites
lastaid 15 Posted January 30, 2012 Author Share Posted January 30, 2012 disreagard this ... found s.th. Quote Link to post Share on other sites
cde 334 Posted January 30, 2012 Share Posted January 30, 2012 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. Quote Link to post Share on other sites
lastaid 15 Posted January 31, 2012 Author Share Posted January 31, 2012 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 Quote Link to post Share on other sites
oPossum 1,083 Posted January 31, 2012 Share Posted January 31, 2012 If you want many channels of PWM, give this a try. Quote Link to post Share on other sites
kylej1050 27 Posted January 31, 2012 Share Posted January 31, 2012 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. Quote Link to post Share on other sites
TomKraut 17 Posted January 31, 2012 Share Posted January 31, 2012 Have a look at NXPs PCA9622: http://www.nxp.com/documents/data_sheet/PCA9622.pdf It has a standard I2C interface and can be put to sleep. However, there are no DIP versions available. TBH, I would be more interested in the charlieplexing solution. A google search for "rgb charlieplexing" suggests that it is very much possible Cheers TomKraut Quote Link to post Share on other sites
lastaid 15 Posted January 31, 2012 Author Share Posted January 31, 2012 ok, now i use the tlc5940, got it set up but not working properly, or maybe a lot of dead leds ... but in theory, i would set the iref for my leds and then use analog brightness correction to give it the rifght voltage, then manipulate brightness with grayscale? Quote Link to post Share on other sites
lastaid 15 Posted January 31, 2012 Author Share Posted January 31, 2012 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 Quote Link to post Share on other sites
kylej1050 27 Posted January 31, 2012 Share Posted January 31, 2012 i could still need a pointer to determine iref, because i don't know how to calculate Vref That's actually easy. Look at the datasheet for the TLC5940(link below), page 12 has a chart in the top left that shows current vs reference resistor size. http://www.ti.com/lit/ds/symlink/tlc5940-ep.pdf Quote Link to post Share on other sites
lastaid 15 Posted January 31, 2012 Author Share Posted January 31, 2012 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 , seems to be a good project to get started ^^ Quote Link to post Share on other sites
cde 334 Posted February 1, 2012 Share Posted February 1, 2012 As a note, plcc-6 5050 ""smd"" package rgb leds are neither common anode or cathode. Individual c/a leads for each color, in a small package. Those are the same size leds used in most of the 30 leds per meter rgb strips. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.