Difference: RGBLEDs (4 vs. 5)

Revision 52018-03-06 - UliRaich

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

RGB LEDs

Introduction

Line: 21 to 21
 
  • red -> gpio 18
  • green -> gpio 17
  • blue -> gpio 22
Changed:
<
<
This cabling is of course only true for the KY-009 and the "standard rgd LED". In contrast to these devices which have a common cathode the LilyPad has a common anode and must be connect to Vcc instead of Gnd. The WS2812 is complete different and is programmed with a serial protocol. To check the device we can temporarily connect these pins to Vcc (or ground in case of the LilyPad, make sure the current limiting resistor is there, either on the breakout board or externally added by you) in which case we should see the corresponding color come up on the LED. Once connected to the gpio pins we can start programming.
>
>
This cabling is of course only true for the KY-009 and the "standard rgd LED". In contrast to these devices which have a common cathode the LilyPad has a common anode and must be connect to Vcc instead of Gnd. The WS2812 is complete different and is programmed with a serial protocol. To check the device we can temporarily connect these pins to Vcc (or ground in case of the Lily Pad, make sure the current limiting resistor is there, either on the breakout board or externally added by you) in which case we should see the corresponding color come up on the LED. Once connected to the gpio pins we can start programming.
  Making a LED light up is one of the most simple programming exercises possible and therefore ideally suited to get us going with Python programming.

The following programs work for common cathode LEDs (KY-009 and Standard 3 color LED) only for which the GND pin is common. For Common Anode LEDs, which have a common Vcc like the the Lily Pad one you must pull the individual red, green, blue pins low to make the LED light up.

Added:
>
>

 Three programs will be developed with increasing difficulty:
  • rgbLED.py uses 3 bit binary numbers, where each bit corresponds to one of the three LEDs. A total number of 7 (+ all LEDs dark) can be displayed this way. First the pigpio library is included and then the connections to the gpio pins defined and each of these pins set to OUTPUT. Then we switch the LEDs on, where the binary number 001 means that only green is on, 010 only red is on 100 only blue is on. A combination of bits like 011 or 110 mean a combination of green and red or red and blue respectivly.
  • fullColors.py is a program that changes the light intensity from total dark to full color intensity for each of the 3 LEDs using Pulse Width Modulation (PWM).
Line: 47 to 50
 
META FILEATTACHMENT attachment="rgbColorIntensities.py.txt" attr="" comment="" date="1517340249" name="rgbColorIntensities.py.txt" path="rgbColorIntensities.py.txt" size="1016" user="UliRaich" version="1"
META FILEATTACHMENT attachment="rgbLED.py.txt" attr="" comment="" date="1517340249" name="rgbLED.py.txt" path="rgbLED.py.txt" size="625" user="UliRaich" version="1"
META FILEATTACHMENT attachment="rgbLED.tar.gz" attr="" comment="" date="1517340390" name="rgbLED.tar.gz" path="rgbLED.tar.gz" size="765" user="UliRaich" version="1"
Added:
>
>
META FILEATTACHMENT attachment="commonAnode.png" attr="" comment="" date="1520343022" name="commonAnode.png" path="commonAnode.png" size="24317" user="UliRaich" version="1"
META FILEATTACHMENT attachment="commonCathode.png" attr="" comment="" date="1520343022" name="commonCathode.png" path="commonCathode.png" size="24312" user="UliRaich" version="1"
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback