Light Effects For the Festival Season Using Raspberry Pi !

festival decoration

festival decoration

The festival season is here and what makes our celebrations even more fun is the music and the beautiful lighting. So how about giving your decorations some sparkle with light effects using Raspberry Pi.

Do you know that you can use your browser to invoke commands on the Pi. Based on the song selection, Pi responds by playing the song and controlling the LED light display. This year Kaushik Barat, Aditya Toney and Tiju Thomas decided to use Raspberry PI for light effects and the results were quite stunning. The 3 are sharing their project details with us !

Related Read: 5 Reasons Why You Have To Switch To LED !

By following the steps given below you can now control LED strip through Raspberry Pi, run a web-server on Pi allowing access over wireless, control music through USB powered speakers connected to Pi.

Here is a small demo of the use of Raspberry Pi

Hardware

A set of components used in the project *

Raspberry Pi 2/3

Either version of Pi works, V 3.0 has the advantage of onboard Wi-Fi.

If using Pi 2, a separate Wi-Fi dongle will also be needed.

LED strip

3 LED strips, each with 150 LEDs, are connected serially

Each LED in the strip is individually addressable

USB powered speakers

Breadboard

Connectors

raspberry pi

Software

The code is written completely in Python. The following references have been very useful

Raspberry Pi Spectrum Analyzer with RGB LED Strip and Python – This was our primary source of inspiration and instructions. We used equivalent components,

Neopixels – Library and example to control the LED strip, and individually address LEDs

Pygame library – Used to control audio

Cherry Py – Simple python web framework

NumPy  – A python library for scientific calculations. One of our goals was to control LED based on music frequency distributions

Layout

raspbery-pi

Basic Design

* Pi is running a Web server

* The python script exposes Web APIs, which are used to trigger the actions

* The LED light patterns are stored in advance per song

* The python script is responsible for

o Running the web server and responding to commands over HTTP

o Controlling the audio device

o Controlling each LED device

raspberry pi

Usage

Users can use their browser to invoke commands on the Pi. Based on the song selection, Pi responds with playing the song and controlling the LED light display

Things To Note

Python works pretty well on the Pi, and it is an easy programming language. The breadth of available Python libraries helps users program for the various pieces of the puzzle.

There are numerous ways to control the LED strip. It can be a challenge finding the right method that will work for your strip.

Sustaining the web server uptime can be a challenge. Frequent restarts can be required to the Pi, to bring up the server.

Send this to friend