EEVblog Electronics Community Forum

Electronics => Projects, Designs, and Technical Stuff => Topic started by: Houseman on November 24, 2016, 10:56:23 pm

Title: There should be a smarter way to drive 9 PWM LED with only 1or3 PWMs available..
Post by: Houseman on November 24, 2016, 10:56:23 pm
Dear all.
For my school project I need to simply drive with Arduino 9 PWM strip LED (maximum 500 mA per strip) that goes on and off independently and has a sort of dimming effect on each channel.
Internet is full of PWM driving MOSFET schematics that optocuples the single output and drives the LED strip through an IRF 540; this should not be a problem..
But now the question: my arduino uno has only 3PWM outputs available, and it should, I think, be very pity or better a waste of resources to use an arduino MEGA only because has 14 PWMs.
So I was thinking of using 2 demultiplexer chips (HEF4051B) using only 4 digital pins (yes, 111+001…sigh), making a 4x4 cross matrix and use only 9 of them in order to enable the 9 different outputs.
But now… how to connect the PWM outputs? should all the optocoupler be enabled by the chip? each LED brightness should be controlled individually. How to use the Persistence of Vision in order to allude they are all on?

Any help would be very appreciated. Just give me a hint, one direction, and I will try it by myself.

Best regards
Thank You
Title: Re: There should be a smarter way to drive 9 PWM LED with only 1or3 PWMs available..
Post by: NottheDan on November 24, 2016, 11:41:43 pm
Have never tried it myself but Google immediately spits out some results:

http://www.instructables.com/id/Multiplexing-with-Arduino-and-the-74HC595/ (http://www.instructables.com/id/Multiplexing-with-Arduino-and-the-74HC595/)

http://electronics.stackexchange.com/questions/73087/multiplexing-avr-atmega328-pwm-within-interrupts (http://electronics.stackexchange.com/questions/73087/multiplexing-avr-atmega328-pwm-within-interrupts)
Title: There should be a smarter way to drive 9 PWM LED with only 1or3 PWMs available..
Post by: VoidsWarranties on November 25, 2016, 02:14:45 pm
The tlc5940 has 16 hi res pwm outputs but uses the arduino's to drive it.  I have used it for driving 7 segment led displays since it has built in current limiting.  There is already an arduino library for it.
Note that the tlc5940 does not multiplex the outputs.

Sent from my iPhone using Tapatalk
Title: Re: There should be a smarter way to drive 9 PWM LED with only 1or3 PWMs available..
Post by: Fungus on November 25, 2016, 04:00:42 pm
But now the question: my arduino uno has only 3PWM outputs available, and it should, I think, be very pity or better a waste of resources to use an arduino MEGA only because has 14 PWMs.

An Arduino Uno has six hardware PWM outputs - the pins with a '~' drawn next to them.

If you're handy at programming you can do software PWM on any pin. Just just turn on the pin, count down, turn it off again.

Title: Re: There should be a smarter way to drive 9 PWM LED with only 1or3 PWMs available..
Post by: SL4P on November 25, 2016, 07:34:36 pm
If your code has enough spare cycles, i've built a 72 channel 'SOFTWARE' PWM driver using TPIC595 drivers (4 pins), but depending on how smooth you want the PWM 'glides' to be, you may want drop to a lower number.
This worked great for RGB chaser and pulse/flash/comet-trail effects.
Other shift registers equally relevant.