PyRasp

RGB LED module

The RGB LED module is a common-cathode RGB LED with three 220 Ω resistors — one per colour — already soldered on one board. It costs $4.50 and is for colour: status colours, a mood light, or mixing practice with PWM. Wire red, green and blue to three PWM-capable GPIOs and gnd to ground.

What's inside

PartQtyPrice each
RGB LED1$2
Resistor3$0.25
Total4$2.75
  • The RGB LED is three dies (red, green, blue) sharing one package and one common cathode leg.
  • Three 220 Ω resistors, one per die, because the dies meet only at the common leg and each needs its own current limit.
Exposed pinInside the kit
redrr.1
greenrg.1
bluerb.1
gndled.COM

red, green and blue are the free leads of the three resistors; gnd is the shared common cathode. A high pin — or a PWM duty — lights that die. The kit has no chain ends.

Wiring it in circuit.py

circuit.py
from wiring import *

pi = Pi()
rgb = kits.RGBModule()

pi.GPIO17 >> rgb.red
pi.GPIO27 >> rgb.green
pi.GPIO22 >> rgb.blue
rgb.gnd >> pi.GND

Driving it in main.py

main.py
from gpiozero import RGBLED
from time import sleep

led = RGBLED(red=17, green=27, blue=22)

while True:
    for colour in [(1, 0, 0), (1, 1, 0), (0, 1, 0), (0, 1, 1), (0, 0, 1), (1, 0, 1)]:
        led.color = colour
        sleep(0.4)

led.color takes values from 0 to 1 per channel and gpiozero drives each pin with PWM, so partial values mix smoothly.

Why buy the kit

Loose parts come to $2 + 3 × $0.25 = $2.75, against $4.50 — $1.75 more for four parts and six solder joints saved. The module also removes the two classic RGB mistakes: forgetting a resistor on some colour, and wiring the shared leg to the wrong rail. The common cathode is fixed, so a real part of the common-anode variety needs the loose RGB LED instead.

Simulator vs real hardware

  • The three dies are independent Shockley junctions, so from 3.3 V the red die is visibly brighter than the green and blue ones, which sit near the supply rail at about 1 mA — exactly the reason real RGB LEDs want 5 V or a driver for full brightness.
  • PWM duty sets each die's average current, and the canvas adds the glow layers so overlapping colours mix visually.
  • The RGB model warns on overcurrent (above 30 mA per die) but does not burn out; the LED stays lit.

Further reading

  • gpiozero: RGBLED — color, per-channel properties, active_high for common-anode parts, and PWM mixing.