An RGB LED is a single output component that contains three separate light-emitting diodes—Red, Green, and Blue—housed within a single 4-pin enclosure. By using Pulse Width Modulation (PWM) to vary the duty cycle (intensity) of each color channel, you can mix colors to display millions of custom light shades.
1. Schematic Symbol
Three diodes (Red, Green, Blue) sharing a single common cathode bus — matching how the OMS component itself is wired internally (see the real limitation noted in Section 7):
2. Common Cathode (CC) vs. Common Anode (CA) Wiring
RGB LEDs are manufactured in two internal electrical wiring layouts, which determine how you control them in code:
- Common Cathode (CC):
- The negative terminals of all three internal LEDs are tied together to a single Common Ground Pin.
- Wiring: Connect the Common pin to the microcontroller's GND rail. Connect the R, G, and B pins to digital PWM pins through individual series resistors.
- Control Logic: Active-High. Writing a
255(100% duty cycle) turns a channel fully ON; writing0turns it OFF.
- Common Anode (CA):
- The positive terminals of all three internal LEDs are tied together to a single Common VCC Pin.
- Wiring: Connect the Common pin to the microcontroller's 5V or 3.3V power rail. Connect the R, G, and B pins to digital PWM pins through individual series resistors.
- Control Logic: Active-Low (Current Sinking). To turn an LED ON, you must pull its pin LOW. Writing
0turns a channel fully ON; writing255turns it OFF. The OMS block library automatically handles this inversion once you configure the LED type.
3. Layout & Pin Map
A standard physical through-hole RGB LED contains 4 pins of varying lengths:
- Pin 1 (Red): Controls the Red LED channel.
- Pin 2 (Common): The longest physical lead. Connected to VCC (Common Anode) or GND (Common Cathode).
- Pin 3 (Green): Controls the Green LED channel.
- Pin 4 (Blue): Controls the Blue LED channel.
Breadboard Placement Guide:
- Orient the RGB LED so the flat side of the dome faces you.
- Insert the LED into the breadboard with all 4 leads spanning 4 separate rows.
- The longest lead (Pin 2, Common) should go into row
+. This is the easiest way to identify it. - Counting from the longest lead: the lead to the left is Red (Pin 1), the first lead to the right is Green (Pin 3), and the second lead to the right is Blue (Pin 4).
- Connect each colour pin (Red, Green, Blue) to a separate PWM-capable GPIO pin on your microcontroller, each through its own series current-limiting resistor.
- Connect the Common pin to GND (for CC) or to the 3.3V / 5V power rail (for CA).
4. Core Calculations & Critical Warnings
[!IMPORTANT] Use Three Separate Resistors: You must place a current-limiting resistor on each of the Red, Green, and Blue control lines individually. Do not place a single resistor on the Common pin.
- Why? If you share a single resistor on the Common pin, turning on multiple channels (e.g. Red + Green to make Yellow) splits the current between the two LEDs. Because Red has a lower forward voltage (~2.2V) than Green (~3.2V), current will flow disproportionately through the Red channel, skewing the mixed color toward red instead of a clean Yellow.
Real per-channel voltages (OMS's RGB LED component is modeled on a real Kitronik 5mm common-cathode RGB LED — Red is an AlGaInP die at ~1.9–2.5V, Green/Blue are InGaN dies at ~2.9–3.5V. Green and Blue genuinely overlap here — that's the real datasheet, not a typo):
-
Calculating Resistors:
(typically to )
-
(typically to )
-
(typically to )
-
5. Component Properties (Property Inspector)
When you select an RGB LED on the canvas, you can modify the following parameters in the Property Inspector panel:
- Type (
type): Switches the simulated diode direction to match how you've wired the Common pin (K) — this is what actually makes Common Anode wiring behave correctly in the circuit simulation (see Section 7).- Default:
CC(Common Cathode) - Options:
CC(Common Cathode −),CA(Common Anode +)
- Default:
- Max Forward Current (
If_max): Sets the maximum safe forward current (in amperes) allowed for any single internal LED channel before burnout.- Default:
0.02A (20 mA) - Range:
0.005A to0.05A (5 mA to 50 mA) (step size0.005A)
- Default:

