1
\$\begingroup\$

I am working on a project which is going to have approximately 50 LEDs. These will be status LEDs to show whether an appliance is On/Off. I will also need a brightness control for the LEDs so PWM is a requirement on the pins.

What will be most efficient way (low cost, low PCB area and low component count) to accomplish such a thing?

I had a couple of ideas but then found some issues with all of them:

1) Get a micro-controller with too many GPIO - Controllers with 55 GPIO appeared to give the best GPIO/price ratio. I have selected one with 55 GPIO but even that controller might not be able to handle everything. Putting two micro-controllers complicates things.

2) Use i2c port expanders - These are very costly. I'd rather buy another micro-controller.

3) Use shift out ICs (595) - Lack of PWM. Implementing PWM on code side doesn't seem to be a good idea to me (maybe I am wrong but it feels like I am unnecessarily making things difficult this way).

\$\endgroup\$
6
  • 1
    \$\begingroup\$ 4) Use a dedicated LED driver with PWM capability. I haven't looked too hard, but I know that there are some with 48 channels available. I wouldn't be surprised to find 64 or more somewhere. \$\endgroup\$ Commented Jul 29, 2016 at 12:00
  • \$\begingroup\$ @Ignacio - I found some LED drivers on digikey. They are a bit expensive but I think they will be worth it. Good thing about them is that I don't need any current limiting resistors. \$\endgroup\$ Commented Jul 29, 2016 at 12:24
  • \$\begingroup\$ "Controllers with 55 GPIO appeared to give the best GPIO/price ratio" - just be careful, because not all GPIOs on MCU may provide PWM \$\endgroup\$ Commented Jul 29, 2016 at 13:33
  • \$\begingroup\$ Charlieplexing (en.wikipedia.org/wiki/Charlieplexing) gives a high number of LEDs per IO pin, but would limit the maximum brightness since you can only have one LED lit at any given time (you can strobe them at many kilohertz to give the impression that they are lit simultaneously due to "persistence of vision".) Do you need to control the brightnesses of individual LEDs or have them all at the same brightness? \$\endgroup\$ Commented Jul 29, 2016 at 14:16
  • \$\begingroup\$ @wossname - Most likely I will end up using one brightness level for one group of LEDs and another level for another group. I will take a loot at chalieplexing. If it isn't complicated, I might consider it. Thanks a lot for pointing this out. \$\endgroup\$ Commented Jul 29, 2016 at 14:21

3 Answers 3

1
\$\begingroup\$

Another possibility is to use addressable RGB leds, based on the WS2812 or similar. This is an RGB led with a PWM controller built in. They can be bought in strips, or individually. These are very popular in the Arduino community. (Search on NeoPixel or APA102.) You can string a very large number of them together serially, and then control them with two output pins on a microcontroller. Depending on what you get, you may need an external 12v supply. But you have multi-color capability, which might help for indicators.

A possible downside is that if you microcontroller goes off in the weeds, the LEDs will continue to display their last data, which could be a safety concern.

\$\endgroup\$
1
  • \$\begingroup\$ and if you dont like RGB, use WS2811 and connect your own LEDs \$\endgroup\$ Commented Mar 25, 2017 at 12:48
0
\$\begingroup\$

You could use dedicated led driver chips like 7216 or their modern equivalent.

3) Use shift out ICs (595) - Lack of PWM.

lack of pin-independent PWM. you can apply pwm to the OE pin and control the brightness of all of those leds. not individual leds, however.

\$\endgroup\$
1
  • \$\begingroup\$ No. Without knowing more details, I'm not sure whether this is the best solution, but independent PWM (duty cycle, not frequency) is no problem. \$\endgroup\$ Commented Feb 21, 2017 at 2:09
0
\$\begingroup\$

Your solution 3 (use shift registers with latch) is quite cheap and absolutely feasible for the given number of LEDs.

You can use an SPI interface for generating the bit streams. You will need 7 shift registers and therefore have to send 56 bits followed by a latch pulse (use the SPIs Chip Select signal) x times within T, where x is the desired PWM resolution and T is the period. Both values determine the necessary SPI baudrate.

Of course the micro has to be fast enough to calculate the bit streams and transmit them to the SPI.
Wich micro to choose depends on your PWM performance requirements.
250Hz LED dim frequency at 8bit PWM resolution should not be a big issue for any standard 32 bit device - just to give a number.

You may have a look here for some example implementation.

However solution 1 may be the better choice. For instance, the Renesas RH850 F1L (100 pin housing) can generate up to 48 individual PWM signals, and I'm sure there are some peripherals left to generate the remaining 2.
If your desired controller doesn't have enough dedicated PWM outputs, it should have a DMA unit and be able to write at least 16 bit wide output ports. It depends on your application, but letting the CPU do all that transmission stuff may overload it.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.