0
\$\begingroup\$

I have a project in which I must drive 4 RGB LEDs using PWM directly from the MSP430. They are separated in two groups of 2 LEDs (1 PWM connection controls one color element of two LEDs) which means I have 6 PWM connections to my uC (two for each color R, G or B). My uC is a MSP430F5438, having a Timer B with 6 CCRs, therefore able to provide 6 PWM hardware signals.

http://i58.tinypic.com/2ch2dtz.png (sorry for the horrible sketch)

They must light all with the same color, possibly blinking with 1 second frequency or so. My question is: how could I save as much power as possible managing/multiplexing the PWM signals and the two groups of LEDs? I thought about simple PWMs for all the 6 signals, or also using only 3 PWMs and multiplexing between the two groups. I'm willing to use software ISR but I only have timer B available for that (to use together with the PWM). Should also be a quick operation due to the rest of the program being relatively heavy. The use of a LED driver is out of question. Thanks.

\$\endgroup\$
  • \$\begingroup\$ Multiplexing can halve the power fed to the LEDs but correspondingly the light output is reduced. You can get the same result with a lower duty cycle PWM. What are the voltage/current characteristics of the LEDs? \$\endgroup\$ – Andy aka Feb 12 '14 at 10:33
  • \$\begingroup\$ They are going to be powered with a 3.6V battery, but resistors and currents affecting brightness are still to be defined, not by me. Minor adjustments could be made later with the PWM. I was thinking software-wise, which would be the best approach? \$\endgroup\$ – XanderW Feb 12 '14 at 10:36
  • \$\begingroup\$ What are the voltage/current characteristics of the LEDs? \$\endgroup\$ – Andy aka Feb 12 '14 at 10:46
  • \$\begingroup\$ these are the LEDs, first table, YTB7 model mouser.com/catalog/specsheets/Avago_OneLED.pdf \$\endgroup\$ – XanderW Feb 12 '14 at 11:06
  • \$\begingroup\$ How will the 3.6V battery change its terminal voltage under load (let's say 6 LEDs x 20mA = 120mA). After a few hours like this the voltage may be down to 3V - what will you want to run down to and still maintain same brightness levels - do you have an ADC that you can make the battery voltage measurement to compensate the PWM to maintain same brightness levels? \$\endgroup\$ – Andy aka Feb 12 '14 at 11:24
0
\$\begingroup\$

What commenters are saying is that your current design without something to boost the voltage will never work. Take a look a this page from the datasheet . If you draw 15mA from a pin there will be a .6V drop from Vcc across that pin. So now you starting at 3V trying to drive a 3.1V LED. enter image description here

As for the software side you do not need very fast PWM. People stop seeing the flicker at a pretty low frequency. So say you want 120hz for your PWM. Have an interrupt fire at what ever number of brightness steps you want times 120hz. If you want 20 brightness levels then interrupt every 20*120hz or (1/2.4kHz) ~= 400us. Each time the interrupt fires increment a counter and compare it to your brightness value(duty cycle) for each of your LED. If its greater then toggle the LED. You can adjust the frequency and brightness steps depending on your timing requirement and number of steps you need. If you need the ISR to be really fast you may need to write it in assembly.

Or you could use something like this http://www.ti.com/product/tlc5971 with a 5V boost converter.

\$\endgroup\$
  • \$\begingroup\$ Thank you. Regarding power, they won't be drived directly from the pin and there will be hardware preventing voltage drops. I'm still quite not getting the part of adjusting/setting the brightness, but I will look further into it. Nevertheless, you recommend using 3 PWM outputs and multiplexing between the two groups of LEDs, or have 6 PWMs in total? \$\endgroup\$ – XanderW Feb 12 '14 at 14:50
  • \$\begingroup\$ I would just use 6PWM unless you need it for something else. if the two sets of leds can be the same color then you could use the same PWM for each. \$\endgroup\$ – DeathBySnuSnu Feb 12 '14 at 21:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.