Month 5 STEM Project: Programming Light with Arduino – Exploring RGB LEDs and PWM

Project Theme: Embedded Systems, Programming, and Electronic Control
Outcome: Programmed an Arduino Uno to create smooth color transitions using an RGB LED and Pulse Width Modulation (PWM)
For my fifth monthly STEM project, I moved one step closer to the intersection of hardware and software.
Instead of simply assembling a device, I wrote code that controlled electronic components in real time.
The project sounds simple:
Make an RGB LED change colors.
But underneath that colorful light show is an introduction to embedded programming, digital electronics, and one of the most widely used techniques in modern engineering - Pulse Width Modulation (PWM).
Why This Project Interested Me
Every electronic device around us depends on tiny embedded computers.
From traffic lights and washing machines to drones and autonomous vehicles, these systems constantly read inputs and control outputs.
The Arduino Uno is a perfect platform for learning how this works.
With just a few lines of code, I could control hardware and immediately see the results.
That instant feedback made programming feel much more tangible than simply writing software on a computer screen.
Understanding the RGB LED
At first glance, an RGB LED looks like a normal LED.
It isn't.
Inside the package are three separate LEDs:
🔴 Red
🟢 Green
🔵 Blue
Each one can be controlled independently.
By adjusting the brightness of each color, they combine to produce thousands - even millions - of different colors. This follows the same additive color principle used in televisions, computer monitors, and smartphone displays.
For this project, I used a common-cathode RGB LED, where the longest pin connects to ground while each color channel is connected to its own Arduino output through a 220Ω resistor to safely limit current.
The Engineering Challenge
The objective wasn't simply to turn an LED on.
Instead, I wanted to create a smooth color transition:
Red → Green → Blue → Back to Red
Accomplishing that required combining both electronics and programming.
The Arduino continuously calculated brightness levels for each color while updating the LED hundreds of times every second.
The result looked like one light smoothly changing colors - even though it was actually three LEDs working together.
Learning About Pulse Width Modulation (PWM)
The most interesting concept I learned during this project was Pulse Width Modulation, or PWM.
At first, it seems impossible.
How can a digital pin that's only ON or OFF create different brightness levels?
The answer is speed.
Instead of changing the voltage, the Arduino rapidly switches the signal on and off.
If the signal is ON only a small percentage of the time, the LED appears dim.
If it's ON most of the time, it appears much brighter.
Because this switching happens hundreds of times every second, our eyes don't notice the blinking - we only perceive different brightness levels. This is exactly how the Arduino's analogWrite() function creates values from 0 (off) to 255 (maximum brightness).
That simple idea is used everywhere - from LED lighting and motor control to battery management and robotics.
Writing the Program
Once the circuit was complete, I wrote an Arduino sketch to control each color channel.
The program assigned dedicated PWM pins to the red, green, and blue LEDs and continuously adjusted their brightness using the analogWrite() function.
One thing I enjoyed about Arduino programming is how quickly ideas can be tested.
Change one number.
Upload the code.
Watch the hardware respond instantly.
It turns programming into a conversation between you and the circuit.
From Code to Color
Watching the LED smoothly fade through different colors was surprisingly satisfying.
Something as simple as changing three numbers in software produced a completely different physical output.
It reinforced an important engineering lesson:
Software doesn't just live inside a computer - it can control the physical world.
Final Result
Video Coming Soon
The finished project demonstrated:
Arduino Uno programming
RGB color mixing
Pulse Width Modulation (PWM)
Breadboard circuit construction
Hardware controlled through software
Although it's one of the simplest Arduino projects, it introduces ideas that appear throughout embedded systems and robotics.
🔬 STEM Skills Demonstrated
Embedded Programming
Wrote and uploaded Arduino programs
Controlled physical hardware through software
Learned the structure of Arduino sketches using setup() and loop()
Electronics
Built a working breadboard circuit
Used resistors to safely limit current
Connected and tested multiple output channels
Embedded Systems
Learned how microcontrollers interact with electronic components
Controlled multiple outputs simultaneously
Connected software logic with hardware behavior
Signal Processing
Applied Pulse Width Modulation (PWM) to vary LED brightness
Understood how duty cycle affects power delivery
Explored how digital signals can simulate analog behavior
Engineering Problem Solving
Verified circuit wiring before powering the system
Tested code iteratively
Debugged both hardware and software together
Technical Communication
Documented the design, programming process, and engineering principles behind the project
Explained embedded systems concepts using real-world examples
What This Project Taught Me
This project marked an important milestone in my engineering journey.
In previous projects, I focused on building mechanical systems, electronic circuits, and robotic mechanisms.
This was the first project where software became an active part of the design.
Instead of asking, "How do I build this?"
I also had to ask,
"How do I tell it what to do?"
That shift - from assembling hardware to programming behavior is what makes embedded systems so exciting.
Looking Back
Each monthly project has introduced a different branch of engineering:
Project 1: Rubber Band Airplane → Mechanics & Aerodynamics
Project 2: Bluetooth Speaker → Electronics & Audio Systems
Project 3: Wireless RC Car → Mechatronics & Control Systems
Project 4: Hydraulic Robotic Arm → Robotics & Fluid Power
Project 5: Arduino RGB LED → Embedded Programming & Microcontrollers
What I enjoy most is seeing how these disciplines connect.
Programming, electronics, mechanics, and physics aren't isolated subjects—they're different pieces of the same engineering puzzle.
What's Next?
Now that I've started learning Arduino, I'm excited to build projects that combine programming with sensors, motors, and automation.
The ultimate goal isn't just to make an LED change colors.
It's to build machines that can sense, think, and interact with the world.
And this project was the first step in that direction.
.png)



Comments