Building on-top of the basic RGB tutorial, let us take the RGB LED control to the next level by diving into color mixing using the Adafruit NeoPixel library and Mercury Board. Instead of showing static red, green, and blue lights, we’ll blend these base colors in different proportions to create a wide range of custom colors.
By adjusting the intensity of red, green, and blue components, you can create beautiful hues like purple, cyan, yellow — and even white. This concept is not only fun to play with but also fundamental to how screens, smart lights, and digital displays work.
✨ Let’s turn your Mercury Board into a digital color palette! 🔴🟡🟢
By the end of this tutorial, you’ll learn:✅ How to control and do color mixing of WS2812 - onboard RGBLED on Mercury using Adafruit NeoPixel Library.
Quick Video TutorialLet's Get Started- Setting up the environment - if you haven't added the Mercury Board on your Arduino®, this is a good time to do so. Refer to this tutorial for setup: https://www.hackster.io/ral/getting-started-with-mercury-arduino-setup-705f4d
- Plug the USB Cable to Mercury Board and connect it you your laptop.
- To initiate upload process, press and hold FLASH button when "Connecting..." is visible on Arduino Terminal.
- Basic RGB Tutorial: https://www.hackster.io/ral/rgb-led-magic-with-mercury-board-adafruit-neopixel-77075f
Crash Course: Color mixing of RGB Light
Color mixing with RGB LEDs is based on the principle of additive color mixing, where different intensities of Red, Green, and Blue light are combined to produce a wide spectrum of colors. Each of these colors can be adjusted independently from 0 (off) to 255 (fully on), giving you over 16 million possible color combinations!
🔴🟢🔵 The RGB Color ModelHere’s how the primary colors mix:
- Red (255, 0, 0)
- Green (0, 255, 0)
- Blue (0, 0, 255)
When you combine them:
- Red + Green = Yellow (255, 255, 0)
- Red + Blue = Magenta (255, 0, 255)
- Green + Blue = Cyan (0, 255, 255)
- Red + Green + Blue = White (255, 255, 255)
And of course:
All Off = Black (0, 0, 0)
Lets consider Yellow for a moment, on mixing 100% intensity or Red Light 🔴 with 100% intensity of Green Light 🟢, you should in theory get Yellow Light 🟡. But, every hardware has some variability in what light it can produce. Thus in our case, we use the following percentages of Red and Green light to produce Yellow/Amber Light:
pixels.setPixelColor(0, pixels.Color(255, 90, 0, 0));A deeper dive into the code...To simulate a traffic signal 🚦, we’ll recreate the familiar sequence:
- Green Light 🟢 stays ON for 2 seconds — indicating that vehicles can move.
- Yellow Light 🟡 lights up for 1 second — warning that the signal is about to change.
- Red Light 🔴 stays ON for 2 seconds — signaling traffic to stop and wait for the next green.
This simple timing-based pattern mimics real-world traffic behavior and is a great way to practice controlling RGB LEDs with delays and logic!
void loop() {
pixels.setPixelColor(0, pixels.Color(0, 255, 0, 0)); // Green
pixels.show();
delay(2000);
pixels.setPixelColor(0, pixels.Color(255, 90, 0, 0)); // Yellow/Amber
pixels.show();
delay(1000);
pixels.setPixelColor(0, pixels.Color(255, 0, 0, 0)); // Red
pixels.show();
delay(2000);
}Why This MattersUnderstanding RGB mixing is key for:
- Designing custom LED animations
- Creating visual notifications
- Building interactive art or ambient light systems
- Programming smart lighting for wearables or IoT projects
It’s the foundation of digital displays and lighting — and now, you’re learning to master it at the hardware level.
_____
Stay tuned for more tutorial coming up in future!!!





Comments