Radio Controls LED Strip Lights
by gameofleds in Circuits > LEDs
2221 Views, 16 Favorites, 0 Comments
Radio Controls LED Strip Lights
We hobbyists love switches, controlling stuff and LED lights, this project is a combination of these elements,
I'm thinking on more ways to use the RC to interact with the LED Strip, let me know in the comments if you have any creative ideas.
The Remote control lights up the LED Strip using two channels, I wondered if it will fell responsive and it turned out to be very on point, even more than I expected.
The Radio Receiver outputs PWM signals that we connect to the Arduino. I used the ELE (channel 2) and the AUX POT (channel 5) to control the LED Strip. To read the PWM signal pulseIn library is used and for the LED control FastLED library. The LED Strip is WS2812B Addressable LEDs (30leds/m) - 5 meter in total.
* This project is part of the GAME OF LEDs DIY Console *
Parts Required
Main Parts
- Arduino Board - (Arduino Nano V3 in my case)
- WS2812B LED Strip
-
Any Radio controller with a receiver that outputs PWM signal
LED Strip Parts
- 470uf - 1000uf 16V Capacitor (prevent voltage spikes)
- 470R Ohm resistor (protect arduino signal)
- 3 Wires servo cable
- 2.3mm wide black heatshrink
- 5V 6A power adapter
LED Strip DC Adapter
The LED Strip should be powered by an external 5V power adapter, the arduino won't be able to provide enough amps to sustain it.
I made a DC to LED Connector adapter and included a servo cable wire to connect to the arduino that includes 5V - LED Signal - GND.
I soldered a 470R Resistor to the LED Signal wire and a capacitor to the DC jack.
Note: If you power the Arduino from the USB you should disconnect the 5V wire from the power adapter,
it's better not to have 2 separated power sources connected simultaneously.
Make sure the GND is connected between the DC adapter and the Arduino
Connect Radio Receiver - CH 2 & CH 5
Connect the PWM Receiver channels as follows:
Arduino D2 -> RX Channel 2
* This will control the LED index position
Arduino D3 -> RX Aux Channel 5
* This will control the LED hue color.
Power the Radio receiver +5V GND from the Arduino
Copy Arduino Code
Copy the following Arduino code to a new sketch, save it and upload it.
The pulseIn function reads the PWM signal and convert it to a value we can use.
#include "FastLED.h" #define NUM_LEDS 150 #define DATA_PIN 5 CRGB leds[NUM_LEDS]; byte PWM_PIN_2 = 2; // RX - ELE - Channel 2 byte PWM_PIN_3 = 3; // RX - AUX - Channel 5 int pwm_value_2; int pwm_value_3; //int led_index_value; int hue_color = 50; //int smoothedVal_index = 0; int smoothedVal_hue = 0; int samples = 1; void setup() { Serial.begin(115200); pinMode(PWM_PIN_2, INPUT); pinMode(PWM_PIN_3, INPUT); LEDS.addLeds(leds, NUM_LEDS); } void loop() { pwm_value_2 = pulseIn(PWM_PIN_2, HIGH); pwm_value_3 = pulseIn(PWM_PIN_3, HIGH); led_index_value = map(pwm_value_2,977,2000,2,NUM_LEDS-2); hue_color = map(pwm_value_3,977,2000,0,255); smoothedVal_index = smoothedVal_index + ((led_index_value - smoothedVal_index)/samples); smoothedVal_hue = smoothedVal_hue + ((hue_color - smoothedVal_hue)/samples); for (int i = 0; i < smoothedVal_index; i++) { leds[i].setHSV(smoothedVal_hue, 255, 255); } for (int i = smoothedVal_index; i < NUM_LEDS; i++) { leds[i].setHSV(0, 0, 0); } FastLED.show(); }
HAVE FUN !
Connect the Power to the DC adapter we made, and play with the LED lights using your Radio Controller.
More GAME OF LEDs mini projects coming soon.
Let us know if you think of any other creative variation for this project.
Cheers,
Nitzan