requirement of more than 14 pwm pins..

hello...
i m yash..
i was building a project which needs more than 14 pwm pins..
i m stuck with it, plz help..
currently i m using atmega2560(14 pwm pins).

suggest an alternative to increase the no. of pwm pins...
thank you..

Perhaps you could tell us what you are trying to do.

Is 992 PWM pins enough?

If the reason you need multiple pwm pins is to control rgb lights (3 pins/pixel), it may be better to go with one of the set of lights that have individually addressed pixels with a tiny processor on each pixel or group of pixels. One that I'm familiar with is the Adafruit neopixels: Adafruit NeoPixel Digital RGB LED Strip - Black 30 LED [BLACK] : ID 1460 : $84.75 : Adafruit Industries, Unique & fun DIY electronics and kits

TLC5940
16 Channels
12 bit (4096 Steps) Grayscale PWM Control

Drive Capability (Constant-Current Sink)
0 mA to 60 mA (VCC < 3.6 V)
0 mA to 120 mA (VCC > 3.6 V)

Cost: <1$ on Ebay

thnx fr d replies... :slight_smile:

I have the same problem. I need more PWM Outputs on my Arduino Mega 2560.
I want to control two 6 Channel LED Drivers. For testing I used the PWM Output pins 8 - 13 on the Mega board directly. Now I want to use the TLC5940 for extending the PWM pins. But I have a problem with wiring them to the LED drivers.
Are the outputs of the TLC5940 completely the same as the pwm outputs on the atmega? The atmega gives 0V or 5V for PWM signal. But how does it work with the TLC5940? The examples I have found only explanes it for connecting the LEDs directly to the TLC5940.
Can somebody help me? I only need to have the same Output signal as it comes from the atmega.

best regards

The TLC5940 is a 16-channel, constant-current sink LED driver, if you want the same Output signal as it comes from the atmega,
you need a pull up resistor with value about 200 to 1K ohms, depend on how much current you need.

Ok thanks
Is this right?
How can I find out how many ohms R1 have to be? Arduino PWM has a maximum of 40mA. then maybe the current should be 30mA for example.
Is it simply 5V / 0,03A = ~166 ohms? -> would be 200ohms

pwm.png

MaikB85:
How can I find out how many ohms R1 have to be?

then maybe the current should be 30mA for example.

Be aware that output voltage drops as current increases, so you won't get a whole 5.0V out of it. Typically it's still enough for a single LED, though.

30mA is acceptable, particularly for PWM output (I prefer to limit myself to 20mA for continuous duties).

I could be wrong, but I don't agree with your schematic. Usually the resistor is in series with the I/O pin.

I could be wrong, but I don't agree with your schematic.

Yes you are wrong.
The TLC5940 is a current sink so you need that resistor to convert it into a voltage.

However this signal is not the same as you get from a PWM pin on an Arduino so if you will say what you want to actually do with the signal we can advise on the whole circuit.

Grumpy_Mike:
The TLC5940 is a current sink so you need that resistor to convert it into a voltage.

Oh I missed that we were interfacing with an LED driver instead of an LED directly. In that case, why not use a more generic shift register? Seems like the TLC5940 + 12 pullup resistors is not really appropriate here as the LED driver inputs are presumably high-Z so a generic shift register can drive them directly.

Well I want to build a LED lamp for my aquarium. The lamp has got 84 LED. 7 LEDs on each of the 12 channels. I'm using this LED Driver: http://www.ledsee.com/index.php/new-products/arduino-6-channel-led-shield-035-07-1a-detail

Works very well when it is connected directly to a pwm pin of the atmega. But on the atmega board are only 6 channels left (the others are used by tft screen). So I want to use the TLC5940...

The schematic is right or isn't it? It doesn't have to be 5V. the product description says min 2,5V.
So I think the final question ist which value for R1

best regards

Maik

MaikB85:
I want to use the TLC5940...

I don't think you do. I think you want to use 74HC595, either one 74HC595 and 6 direct Arduino PWM pins, or, two 74HC595s daisy chained. The 74HC595 is cheaper and does not require a pile of pullup resistors.

tylernt:

MaikB85:
I want to use the TLC5940...

I don't think you do. I think you want to use 74HC595, either one 74HC595 and 6 direct Arduino PWM pins, or, two 74HC595s daisy chained. The 74HC595 is cheaper and does not require a pile of pullup resistors.

Sorry I am going to disagree with you again. Using a shift register does not give you individual PWM control over each LED unless you use something like shiftPWM http://www.elcojacobs.com/shiftpwm/ but this requires a lot of CPU cycles. Also that shield is a constant current driver for the LEDs which is what you need if they are high power LEDs. The 74HC595 can only supply a limited amount of current not much over 20mA and 70mA in total for the chip.
The shield linked supplies:-

  1. input voltage 6-30V
  2. output current selectable: 0,35A – 0,7A – 1A

Grumpy_Mike:
Sorry I am going to disagree with you again. Using a shift register does not give you individual PWM control over each LED unless you use something like shiftPWM http://www.elcojacobs.com/shiftpwm/ but this requires a lot of CPU cycles.

True. So, the choice is cheap hardware and high CPU load, or expensive hardware and low CPU load. I guess MaikB85 has to decide what's best.

As for the TLC5940 pullups, I don't imagine they'd need to be very strong to overcome both the TLC5940 and LED driver impedance? Say 4.7K to 10K? Don't want too strong or the TLC5940 won't be able to pull it low enough...

The 74HC595 can only supply a limited amount of current not much over 20mA and 70mA in total for the chip.

If we're feeding LEDs directly, then yeah, a TLC5940 makes way more sense. But 6 TTL driver inputs should pull way less than 20/70mA...

But 6 TTL driver inputs should pull way less than 20/70mA...

Yes but he is wanting to light up his fish tank, you can't do that with 6 LEDs at 20mA.

As for the TLC5940 pullups, I don't imagine they'd need to be very strong to overcome both the TLC5940 and LED driver impedance? Say 4.7K to 10K? Don't want too strong or the TLC5940 won't be able to pull it low enough.

The TLC5940 sinks current, therefore if you have say a 10K pull up resistor then yes you get 5V out when high but you do not get the current drive capability of an Arduino pin. In fact you will only be able to source 0.5mA through the resistor. The current sinking capacity will be determined by the current setting resistor for the TLC5940 minus the 0.5mA supplied by the pull up resistor.

The problem is I already have the hardware. Two LED Drivers and a TLC5940 Breakout Shield. The LEDs are 3 W which need 700mA current. Input voltage of the LED Driver is 24V.
to add 12 pull-up resistors is not the problem. But which value for them? I think i need to test it. in which range should it be?

The problem is I already have the hardware.

Yes but it is the wrong hardware. It is like saying I want to fly to Africa and I already have the bicycle.

1 Like

MaikB85:
to add 12 pull-up resistors is not the problem. But which value for them? I think i need to test it. in which range should it be?

Base on the datasheet of the TLC5940 on page 14,

The maximum output current per channel is programmed by a single resistor, R(IREF), which is placed between
IREF pin and GND pin.
Imax must be set between 5 mA and 120 mA. The output current may be unstable if Imax is set lower than 5 mA.

So the resistor for the IREF pin is 10K ohms and the pullup is 1K ohms.