Project Overview: Ambient Lighting for Modern Spaces
Interior lighting has evolved from simple functional bulbs to dynamic, color-controllable systems. This project, RGB Strip LED controlled with Bluetooth, provides a low-cost entry into smart home automation. By combining an Arduino Nano with an HC-05 Bluetooth module, you can control the color and intensity of an RGB LED strip directly from your smartphone.
Whether you want a calm blue for reading, a vibrant yellow for energy, or a shifting rainbow fade for a gaming setup, this project provides the firmware and hardware blueprint to make it happen.
Hardware & Power Management
Lighting strips, especially NeoPixels or standard analog RGB strips, can consume a significant amount of power.
- Arduino Nano R3: A compact microcontroller that fits easily into small lighting enclosures.
- HC-05 Bluetooth Module: Acts as the bridge between the smartphone app and the Arduino logic.
- Power MOSFETs (Optional/N-Channel): If using a standard high-power analog strip (rather than a low-power NeoPixel), MOSFETs are used to switch the high current for each color channel (Red, Green, Blue) based on PWM signals from the Arduino.
- DC-DC Buck Converter: Since LED strips often require 12V while the Arduino runs on 5V, a buck converter ensures each component receives its appropriate voltage efficiently.
Understanding the Control Protocol
The system uses a simple character-based protocol over Serial. When you press a button on the custom smartphone app (built with MIT App Inventor), it sends a single character to the Arduino:
- 'r' / 'g' / 'b': Sets the strip to pure Red, Green, or Blue.
- 'w': Sets all channels to max (White).
- 'a' / 'y' / 'v': Creates composite colors like Orange, Yellow, and Violet by mixing the base color intensities.
- 's': Initiates a "Show" or Rainbow Fade mode where the colors cycle smoothly.
- 'z': Turns all colors off.
Code Logic & Technical Excellence
The firmware utilizes SoftwareSerial on pins 8 and 9. This is a smart choice as it keeps the hardware Serial (USB) free for debugging and uploading code.
PWM Intensity Control:
The project uses analogWrite() on pins 3, 5, and 6. These are PWM (Pulse Width Modulation) pins on the Arduino Nano. By varying the duty cycle from 0 to 255, the Arduino can simulate millions of color combinations.
The Rainbow Fade Function:
The code includes a nested for loop structure in the rgb() helper function. It cycles through the 8-bit color space (0-255) for each channel, creating a smooth transition known as "HUE shifting."
void rgb(int rosso, int verde, int blu){
analogWrite(rossoPin, rosso);
analogWrite(verdePin, verde);
analogWrite(bluPin, blu);
}
Next Steps for Expansion
While the current project uses basic color presets, the logic can be expanded. You could add a color picker in the mobile app to send specific RGB values (e.g., "R255G120B000") for precise control. Additionally, adding a sound sensor could allow the lights to "dance" to music in real-time.