
Driving an RGB LED — SIK Circuit 3
Instrucciones
Parts & Introduction
Parts & Introduction
An RGB LED contains three tiny LEDs (red, green, blue) in one package. By mixing different brightness levels of each color, you can create any color in the rainbow. This experiment introduces analogWrite() for PWM output.
Parts Needed
- 1x Arduino Uno + USB cable
- 1x Breadboard
- 1x RGB LED (Common Cathode)
- 3x 330Ω Resistors
- 5x Jumper Wires
RGB LED Pin Order (flat edge facing you): Red, Ground (longest pin), Green, Blue.
Materiales para este paso:
SparkFun Inventors Kit - V3.21 kit
Arduino Uno R31 pieza
Breadboard1 pieza
RGB LED (Common Cathode)1 pieza
330 Ohm Resistor3 piezas
Jumper Wires5 piezasHerramientas necesarias:
Hardware Hookup
Hardware Hookup
Wiring Instructions
- Place the RGB LED in the breadboard. Identify pins from the flattened edge: Red, GND (longest), Green, Blue.
- Connect the GND pin (longest, second from left) to the GND rail.
- Connect the Red pin through a 330Ω resistor to Arduino Pin 9.
- Connect the Green pin through a 330Ω resistor to Arduino Pin 10.
- Connect the Blue pin through a 330Ω resistor to Arduino Pin 11.
Pins 9, 10, and 11 are all PWM-capable (marked with ~ on the board).
Materiales para este paso:
RGB LED (Common Cathode)1 pieza
330 Ohm Resistor3 piezas
Breadboard1 pieza
Jumper Wires5 piezasArduino Code
Arduino Code
Open the Arduino IDE and upload the following sketch to your Arduino board.
Materiales para este paso:
Arduino Uno R31 piezaHerramientas necesarias:
Test & Experiment
Test & Experiment
What You Should See
The LED cycles through 8 solid colors (off, red, green, blue, yellow, cyan, purple, white) for 1 second each, then smoothly fades through the entire color spectrum.
Troubleshooting
- Incorrect colors: With four pins close together, it's easy to misplace one. Double-check each connection.
- Red too bright: The red diode is often brighter. Try a higher-value resistor on the red pin, or reduce in code:
analogWrite(RED_PIN, redIntensity/3).
Experiments to Try
- Add a potentiometer to control which color is displayed.
- Create your own color sequences — try a "sunrise" effect (dark red → orange → yellow → white).
Materiales
6- MX$1,826.00
- 1 piezaMarcador de posición
- 1 piezaMarcador de posición
- Marcador de posición
- MX$44.00
- MX$72.00
You can swap these in
Can't get one of the materials? Swap it for an equivalent — these work just as well.
- Instead of Arduino Uno R3, try:
Prototyping Shield for Arduino Uno (3-Pack)
Arduino Uno R3 Board
Arduino Uno - Instead of Resistor 330 Ohm 1/6 Watt PTH - 20 pack, try:
Resistor 10K Ohm 1/6th Watt PTH - 20 pack
AVR ISP Shield - PTH Kit
Resistor 1.0M Ohm 1/6th Watt PTH - 20 pack - Instead of Breadboard, try:
Solder-able Breadboard - Instead of LED - RGB Diffused Common Cathode - 5mm, try:
LED - RGB Clear Common Cathode - 5mm
Recommended for this build
Products makers often use with builds like this one.
5mm LED Assortment Kit (300pcs, 5 Colors)Used together and in similar builds
Resistor 10K Ohm 1/6th Watt PTH - 20 packFrequently used with this build's materials
Diode KitFrequently used with this build's materials
BC547 NPN Transistor (50-Pack)Frequently used with this build's materials
Push Button - 33mmFrequently used with this build's materials
Piezo ElementFrequently used with this build's materials
PotentiometerFrequently used with this build's materials
Servo MotorFrequently used with this build's materialsRelated blueprints
Other builds that share materials, tools, or techniques with this one.






CC0 Dominio público
Este Blueprint se publica bajo CC0. Eres libre de copiar, modificar, distribuir y usar este trabajo para cualquier propósito, sin pedir permiso.
Apoya al Maker comprando productos a través de su Blueprint, donde gana una Comisión del Maker establecida por los vendedores, o crea una nueva iteración de este Blueprint e inclúyela como conexión en tu propio Blueprint para compartir ingresos.