Animated Christmas Lights
LED String with 100 WS2812 RGB LEDs driven by Arduino ATmega 2560
Project Features:
- 100 RGB LED
- Infrared Remote Controller for switching on-off, change effect, increase/decrease brightness
- PIR Sensor for Auto Off after 3 hours of human inactivity around. When human movement is detected around, the speed of effect is increased for 15 seconds
- RGB LED for displaying the status: RED - switched off, BLUE - switched on
BOM:
- Arduino ATmega 2560 (New SainSmart Mega2560 R3 ATmega2560-16AU + ATMEGA16U2 + USB Cable For Arduino)
- Arduino Pro Mini (Pro Mini atmega328 Board 5V 16M Arduino Compatible Nano)
- PIR Sensor module (HC-SR501 IR Pyroelectric Infrared IR PIR Motion Sensor Detector Module M17)
- IR Receiver Module 38Khz (DFRobot IR Receiver module)
- RGB LED Common Anode (diffused 10mm)
- 4 pieces of 220 Ohm resistors
- 1000 μF Electrolitic Capacitor (optional)
- Phillips Universal Remote SRP2008B/86
- 5V ~2A DC Power Supply for LED Strip (AC 100V-240V Converter Adapter DC 5V 10A 50W Power Supply Charger DC 5.5mm New)
- 7-12V 1A DC Power Supply (Arduinos)
- 2.1 x5.5mm DC Power Female Plug Socket Connector 2.1mm CCTV (DC plug for the LED Strip)
- 3-Pin Female Male Connectors plug WS2812B WS2811 WS2812 LED Pixels Strip 15CM (for connecting the LED Strip parts and ATmega/power supply to LED Strips
- 2x50 12mm WS2811 LED Module Full Color RGB Pixel Exposed Light Waterproof
- Box (Wood/Plastic)
The Arduino Mini is used to receive the IR remote commands and converts them to ASCII String containing a integer and send to the ATmega using serial port. This is needed since the FastLed library disables interrupts while sending the data to the LED strip, thus refreshing the LED colors intereferes the IR reception and makes it unreliable. For other types of LED strips this is not necessary.
The PIR sensor is used to detect movement around the "box" and switch off the LED strip after 3 hours of inactivity. The semi-transparent plastic domes also used as a window for the IR receiver module and shows the state of the device by letting the light of the common anode RGB LED (blue-on, red-off).
The IRReceiverModule.zip contains the code for the Arduino Pro Mini (or any other arduino). The programming could be performed by using an other Arduino Uno (http://www.instructables.com/id/Uploading-sketch-to-Arduino-Pro-Mini-using-Arduino/)
The ChristmasLights.zip contains the code for the ATmega 2560. It uses the libraries FastLed and IRremote.
Use Arduino IDE 1.5.6, download latest FastLed (https://github.com/FastLED/FastLED) and IRremote (https://github.com/shirriff/Arduino-IRremote).
When using a Power supply for the LED String, which has an output voltage greater than 5V (e.g. 5.5V as in the case of the Power supply mentioned in the BOM), use a 220 Ohm resistor for the DATA pin of the LED String to avoid flickering, also an optional 1000 μF Electrolitic Capacitor can be used to remove voltage spikes from the power lines of the LED String.
The code has 5 effects :(http://youtu.be/RwZ6XnqKiA4):
- "Shimmering Candles"
- "Fire"
- "Spectrum"
- "Random Colors"
- "Random Color Transitions"
Improvement Ideas:
- Use a 4 wire, 12V LED String (is it any?). This makes the secondary Arduino PRO Mini unnecessary, also the Arduino can be powered from the 12V and does not require an other power supply.
- BLE/WiFi module could be used to control the LED String from iOS/Android. This removes the need of the IR remote controller.
- LDR could be used to switch on/off the String in the evening, or adjust the brightness in lighter/darker conditions.
- RTC module could be used to switch on/off the String at a given time of day.