How to Build a Remote Controlled LED Light Strip With Arduino for Under $15
Introduction
Building your own LED light strip that can be controlled remotely using an Arduino is a fun electronics project that can be completed on a budget. With just a few common components, you can make an LED strip that can change color, pattern, and brightness all from a homemade infrared remote.
Here's what you'll need to build your own remote controlled LED strip with Arduino:
Components
- Arduino Uno - The microcontroller that will control the LED strip. $5-$10.
- Infrared receiver - To receive signals from the remote. Around $1.
- LED strip - I recommend a WS2812 individually addressable RGB strip. Around $10 for 5 meters.
- Transistor - To amplify the Arduino's output for the LEDs. Under $1.
- Power supply - 5V 10A supply to power the LEDs. $5-$15.
- Wires and breadboard - For connecting the components. Around $5.
- IR remote - A simple remote with buttons. Can reuse an existing TV remote. Under $3 if buying new.
Total cost: Under $15
In the rest of this guide I'll walk through step-by-step how to assemble the circuit, program the Arduino code, and control your new LED strip remotely.
Assembling the Circuit
We'll first breadboard the circuit so it can be tested and programmed before soldering a more permanent version.
1. Connect the IR receiver
- Plug the IR receiver into the breadboard.
- Connect VCC to 5V pin on Arduino.
- Connect GND to GND on Arduino.
- Connect the output pin to Arduino pin 11.
2. Connect the transistor
- Insert NPN transistor on breadboard.
- Connect collector to the +5V supply.
- Connect emitter to the data pin on the LED strip.
- Connect base through a 470 ohm resistor to Arduino pin 3.
3. Connect LED strip
- Connect +5V wire to the power supply.
- Connect GND wire to Arduino GND.
- Connect data input to the transistor emitter.
4. Power supply
- Connect 5V power supply to Arduino 5V pin.
- Connect power supply ground to Arduino GND.
The circuit should look something like this:
Installing the Arduino Libraries
We'll need to install the IR remote and LED strip libraries to interface with those components.
IR Remote Library
The IRremote library allows Arduino to decode IR signals from a remote.
To install it:
- Open the Arduino IDE.
- Go to Sketch > Include Library > Manage Libraries.
- Search for "IRremote" and install the latest version.
FastLED Library
FastLED provides easy control of addressable LED strips like the WS2812.
To install:
- Go to Sketch > Include Library > Manage Libraries.
- Search for "FastLED" and install.
Arduino Code
Here is the full Arduino code to control the LED strip with the IR remote. I'll go through it section by section:
```c++
// Libraries
include
include
// Pin definitions
define LED_PIN 3
define IR_RECEIVER 11
// LED strip
define NUM_LEDS 60
CRGB leds[NUM_LEDS];
// IR codes
define CODE_RED 0xFF30CF // Buttons on remote
define CODE_GREEN 0xFF18E7
define CODE_BLUE 0xFF7A85
define CODE_WHITE 0xFF10EF
define CODE_FLASH 0xFF38C7
define CODE_FADE 0xFF5AA5
define CODE_SMOOTH 0xFF42BD
// Config
define BRIGHTNESS 96
define FRAMES_PER_SECOND 60
// Global variables
uint8_t lastButtonState = HIGH;
int brightness = 0;
// Initialize
IRrecv irrecv(IR_RECEIVER);
decode_results results;
void setup() {
// Initialize serial
Serial.begin(9600);
// Initialize IR receiver
irrecv.enableIRIn();
// Initialize LEDs
FastLED.addLeds
FastLED.setBrightness(BRIGHTNESS);
// Set all LEDs to green
fill_solid(leds, NUM_LEDS, CRGB::Green);
FastLED.show();
}
// Main loop
void loop() {
// Check if IR code received
if (irrecv.decode(&results)) {
// Print code
Serial.println(results.value, HEX);
switch(results.value) {
case CODE_RED:
fill_solid(leds, NUM_LEDS, CRGB::Red);
break;
case CODE_GREEN:
fill_solid(leds, NUM_LEDS, CRGB::Green);
break;
case CODE_BLUE:
fill_solid(leds, NUM_LEDS, CRGB::Blue);
break;
case CODE_WHITE:
fill_solid(leds, NUM_LEDS, CRGB::White);
break;
case CODE_FLASH:
// Flash red
if(brightness == 0) {
fill_solid(leds, NUM_LEDS, CRGB::Black);
brightness = 255;
} else {
fill_solid(leds, NUM_LEDS, CRGB::Red);
brightness = 0;
}
break;
case CODE_FADE:
// Fade through rainbow
static uint8_t hue = 0;
fill_rainbow(leds, NUM_LEDS, hue, 1);
hue++;
if(hue >= 255) hue = 0;
break;
case CODE_SMOOTH:
// Smooth pulse
uint8_t maxBright = peak8(brightness);
nscale8(brightness, maxBright, 255);
FastLED.setBrightness(brightness);
fill_solid(leds, NUM_LEDS, CHSV(160, 255, brightness));
FastLED.show();
break;
}
// Send updates
FastLED.show();
irrecv.resume();
}
// Rainbow fade effect
EVERY_N_MILLISECONDS(10) {
fadeToBlackBy(leds, NUM_LEDS, 1);
}
}
```
Libraries and Pins
We first include the IR and LED libraries and define pins:
```c++
include
include
define LED_PIN 3
define IR_RECEIVER 11
```
LED Strip Setup
Next we set up the LED strip with number of LEDs, pin, and brightness:
```c++
define NUM_LEDS 60
CRGB leds[NUM_LEDS];
define BRIGHTNESS 96
```
The FastLED functions like fill_solid()
are used to set colors.
IR Codes
Here we define IR codes for each button on the remote:
```c++
define CODE_RED 0xFF30CF
define CODE_GREEN 0xFF18E7
define CODE_BLUE 0xFF7A85
// etc
```
Use a IR receiver tool like IRrecvDump to get the codes.
Setup Function
In setup()
we initialize the serial monitor, IR receiver, and LEDs:
```c++
void setup() {
Serial.begin(9600);
irrecv.enableIRIn();
FastLED.addLeds
FastLED.setBrightness(BRIGHTNESS);
fill_solid(leds, NUM_LEDS, CRGB::Green);
FastLED.show();
}
```
Main Loop
The main loop checks for new IR codes and sets the LED colors and effects based on the button pressed:
```c++
if (irrecv.decode(&results)) {
switch(results.value) {
case CODE_RED:
// Set color red
break;
case CODE_FLASH:
// Flash LEDs
break;
}
FastLED.show();
}
```
Additional rainbow and pulse effects are also added.
Assembling the Final Version
Once the code is tested and working on the breadboard, solder up a permanent circuit:
- Solder header pins to the Arduino and wire up the components.
- Mount the IR receiver near the edge to pick up remote signals.
- Install the LED strip along its final mounting surface.
Make sure to connect the grounds of the LED power supply and Arduino.
Some tips for the final assembly:
- Use wire with silicone insulation that can withstand LED strip heat.
- Connect power injection wires every meter on long strips to distribute voltage evenly.
- Mount the LED strip using clips or channel housing.
- Enclose in a painted wooden channel for a clean look.
Applications and Improvements
With an Arduino controlled LED strip, here are some cool applications:
- Accent and cabinet lighting - Great for behind TVs or under cabinets.
- Bedroom mood lighting - Relaxing colors and smooth fades.
- Party lights - Quickly change color and flash speed.
Some ways to improve this project:
- Add WiFi control using an ESP8266 module.
- Create preset light shows and color loops.
- Add sound sensitivity to sync to music.
- Use diffuser covers for softer, more even lighting.
So with just a few common components, you can DIY an awesome remote controlled LED strip for under $15!