Go Down

Topic: PWM pins - I am very lost!!  (Read 137 times) previous topic - next topic

tea123

Apr 12, 2019, 02:59 pm Last Edit: Apr 12, 2019, 03:06 pm by tea123
Hi there,

Hopefully the attachment has worked. Basically I have 2 sets of 4 RGB LEDs attached that I control from the arduino uno via the 6 available PWM pins. I need to control all 8 LEDs separately instead of as 2 sets of 4. Any ideas how I can increase from 6 PWM pins to 24 PWM pins? Maybe via another breadboard or integrated circuits etc??

Any help would be awesome please!!??

Cheers again. 

PS sorry the attachment is slightly old, and the right four LEDs are attached to PWM pins 6/5/3.

larryd

No technical PMs.
The last thing you did is where you should start looking.

Grumpy_Mike

#2
Apr 12, 2019, 09:15 pm Last Edit: Apr 12, 2019, 10:36 pm by Grumpy_Mike
Use one or more of these boards:-
https://www.adafruit.com/product/815
I know it says for servos but you can get PWM out of these as well.

However these days using a WS2812 strip or individual LEDs is the way to go when you want a lot of LEDs.

PerryBebbington

Use one or more of these boards:-
https://www.adafruit.com/product/815
I know it says for servos but you can get PWM out of these as well.

However these days using a WS2812 strip or individual LEDs is the way to go when you want a lot of LEDs.
Nice find!

++Karma :)

PaulRB

#4
Apr 13, 2019, 08:05 am Last Edit: Apr 13, 2019, 08:16 am by PaulRB
Basically I have 2 sets of 4 RGB LEDs attached that I control from the arduino uno via the 6 available PWM pins... the right four LEDs are attached to PWM pins 6/5/3.
This is a bad circuit and will damage your Arduino. Why? Because with those 220R series resistors, around 15mA can be flowing through each led. With 4 LEDs attached to each pwm pin, the pin will have to supply 60mA. The maximum a pin can provide is 40mA, and for long life, this should be kept below 30mA. The pin will not limit the current itself, you must do that with your external circuit, or the pin will be damaged.

There is another way to individualy control the colour of each led. It is more difficult and complicated than using NeoPixels or an external pwm chip, and your LEDs will not be very bright. But it can be done by simply re-wiring the LEDs, using 4 or maybe 8 digital pins, and changing the code. But you must also increase the series resistors to prevent pin damage. This technique involves multiplexing, so the code changes will be difficult for a beginner. I won't go into more detail unless you are seriously interested. In terms of time, it would be quicker to buy NeoPixels, but you might be interested in the learning opportunity.

Go Up