This is a step in my bigger project about creating a spectacular light show with a bunch of bright RGB SMD LEDs. For that project I needed a software PWM library, because I need more PWM pins than there are hardware PWM pins on an Arduino UNO. In this project I test the SoftPWM library by Brett Hagman. Instead of using my bright RGB SMD LEDs, I just hooked the KY-016 into my UNO, because I noticed the pins of the KY-016 go directly as they are into three digital pins and one GND pin of the UNO.
KY-016The KY-016 is an RGB LED on a small PCB including the required resistors for powering the LED with 5 V from the digital pins of the UNO. The KY-016 is included in the 37-in-1 sensor kit, which I believe is available from various manufacturers.
The pinout of the KY-016 is
- R
- G
- B
- GND or -
Pins I use on the UNO are
- ~11
- 12
- 13
- GND
The great thing is that these three pins are consecutive pins on the UNO. Just locate them! And stick your KY-016 into them!
~11 is a hardware PWM pin on the UNO (that's what the tilde (~) means), while pins 12 and 13 only perform digital out. So by writing analogWrite(11, 128); I could without further fuss get the led attached to pin 11 shine half dimmed. But pins 12 and 13 work properly only with digitalWrite(), either full bright or off.
Here's where the software PWM comes in handy. In short, it takes care of creating a PWM signal on any digital pin you want.
Create your own colour showsMy sample program "slides the R, G and B slides" through all combinations of full saturated colours in an RGB colour space. Create your own shows by altering the pattern of how the slides are moved. F.i. omit the blue colours, make the colours as warm as possible, restricting the colours to the spectral sector from red through yellow to green.
Figure out how to black out the two red LEDs on the UNO. In the following video you can see the bright red from the on board LEDs.
Comments
Please log in or sign up to comment.