Cheapest way to drive 64 led with pwm control - Page 1
Forum section: electronics / beginners

author: senso
author_rank: Frequent Contributor
timestamp: April 01, 2014, 11:39:46 am
content: Good morning, I have little project and I have been wondering what is the cheapest(and if possible smallest footprint) way to drive 32 red-green leds with at least 64(would be happy with 128) levels, I have used the TI tlc5940 in some boards, but its a bit overkill to use such chips, I dont mind using resistors to limit the current, and the tlc5940 is a bit needy with clock signals and what not, there is also the dumber method of using 595's and bit-banging a soft-pwm, and less than 50 cents each 595 it is possibly the cheapest alternative, but for 64 leds I will need some whopping 8 chips, and that feels a bit wasteful, so well, I'm open for ideas.

author: jmag999
author_rank: Contributor
timestamp: April 01, 2014, 11:56:14 am
content: Do you want each individual led to have it's own level or do all of the same color have the same level?

author: homebrew
author_rank: Frequent Contributor
timestamp: April 01, 2014, 12:14:47 pm
content: Well, from my perspective, the tlc5940 probably already is the cheapest solution. It gives you 16 Channels of 12bit PWM which is quite a lot for the price!Software PWM (especially by "bit-banging") is a bit tricky for 64 parallel channels. You would need at least 100 Hz to get it flicker free and at least 256 steps (intensity-perception is not linear by any means...). That means an update-rate of 25KHz on any of those channels. Then you would also need some latches to get the data out of the uC. Again, you would need some 8 chips or so (74HC573 for example)So either do it in an FPGA (for sure not cheaper), or stick with the available parts.Just an unproven idea:Maybe you could use only one tlc5940 and multiplex 4 LEDs on each channel. Depending on your specific LEDs they might take excessive pulse current.

author: senso
author_rank: Frequent Contributor
timestamp: April 01, 2014, 02:43:27 pm
content: There is also the TLC5947 that has an internal oscillator and needs less intervention of the micro, but its very expensive, 4€ in singles, but its a 24 channel ic.I now remembered about the PCA9685, its i2c instead of spi that the TLC uses, but I think its enough for my needs, and costs just a little bit more than 1.1€.

author: mariush
author_rank: Super Contributor
timestamp: April 01, 2014, 03:00:31 pm
content: There are some PIC18 ICs with 68 IO pins (tqfp 80 pin package, a bit hard to solder) so you could easily turn 64 leds on and off and they cost about 3$ if you buy 10-25 of them. Problem is I don't know how much current a PIC can actually provide, I think it's about 200-400 mA and about 10-25mA per pin.There's also some more plain 40-44 DIP package PIC chips with about 28 IO pins and you can could use port expanders (1$ for 16 IO pins) that connect to the main pic through i2c (so you're left with about 24 IO pins on main mcu). It's cheaper than those TLC chips but you have to do the pwm in software and you have the added cost of resistors to limit current into each led (unless you buy leds with resistor built in)

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: April 01, 2014, 03:06:30 pm
content: If you want a cheap solution, Macroblock MBI3031 is good value - similar basic funtionality to TLC5941 but cleverer interface, better modulation methods and cheaper, but hard to but in small qtys.64 channels soft PWM will get tricky at any decent framerate.If you don't need constant-current drive, NXP's PCA9685 is a cheap PWM driver with internal clock and I2C control.An alternative is to use a 16 channel PWM driver and multiplex it. This can get a little fiddly to get timings spot-on, but very doable with TI and Macroblock drivers - may be trickier with the NXP device as it seems hard to hard-sync to its internal PWM cycle.

author: ivan747
author_rank: Super Contributor
timestamp: April 01, 2014, 04:15:21 pm
content: QuoteThis. Also the TLC59116 from TI is I2C and 8 bit. It also has brightness control for the entire chip. It's designed to be used in this sort of application and has enough bus lines to have 8 of them active at the same time. They have built in resistors, work on 5V and 3.3V, open collector outputs. So use common-anode bicolor LEDs.They have some sort of global address where you can send commands to all of them simultaneously.In my opinion, it is much more elegant than bit banging PWM on a shift register. Less MCU cycles needed.I have used them myself. Right now they are about $3 on 10 of quantities.What Mike suggests, multiplexing the PWM driver, sounds like a good idea.I'd do a compromise. Personally, I'd pick the TLC59116, have 4 of those to handle the 64 LEDs. Now what about the 2 colors? I multiplex them with PNP transistors. That means I'd need common cathode LEDs.That makes things simple for when you want it to be monochrome. When you want it to be bi-color it's still relatively easy because the multiplexing is not hard on you or the MCU. You're only multiplexing the 2 colors, not 8 banks of LEDs.

author: fcb
author_rank: Super Contributor
timestamp: April 01, 2014, 08:21:36 pm
content: If your talking the cheapest solution, and your running the LED's at 20mA or less (no external driver transistor, just a resistor):4x PIC16F57You'd have to write something in assembler, but it wouldn't be difficult. You could use TMR0 as the timebase and even sync up the drivers using the T0CKI pin. It would be fun to work out a protocol, either something like a bit-banged RS232 or you could do a low speed SPI.If you need more current then I would recommend either 2N7002's or those natty little digital transistors (MMUN2211 from memory).