December 9, 2016

Create a Fully Automated Light and Music Show for the Holidays: Part 1

holiday-lights-1.jpg

holiday lights
In this three-part tutorial, we show how to set up a fully automated holiday music and light show with a Raspberry Pi.

You better watch out
You better not cry
Better not pout
I'm telling you why
Christmas lights are coming to town

Christmas has been one of my favorite festivals, and this year it’s special because I’m planning a massive project to decorate my house using open source projects. There will be WiFi-controlled lights and a music show, there will be a talking moose singing Christmas carols (powered by Raspberry Pi, Arduino, and some servo motors), there will be a magical musical Christmas tree, and much more.

I built a music-light show for Halloween, but I improved it and added more features as I worked on the Christmas project. In this series, I'll provide comprehensive instructions to build a fully automated Christmas music/light show that turns on automatically at a given time or that you can plug and play.

Caveat: This project involves working with 110v A/C, so take on this project only if you have experience with high voltage and understand the necessary safety precautions.

I spent weeks finding just the right parts below to create my setup. You can use your own creativity when selecting that parts that you need.

What you need:

  1. Raspberry Pi 3

  2. Micro SD card 8GB

  3. 5v charger (2 units)

  4. Male to female breadboard jumper wires

  5. 1 power cable

  6. 8-channel solid state relay

  7. Four gang device box

  8. Duplex receptacle (4 pack)

  9. Receptacle wall plate

  10. Single core wire (red, white & black)

  11. Wood board

  12. Push switch

  13. Soldering rod

Get started with Pi

We need to install an operating system on our Pi, and we will be using Raspbian. First, let’s prepare the Micro SD card for Raspbian. Plug in the card into your PC and open the Terminal; we are going to format the Micro SD card as FAT32.

Run the lsblk command to list the block devices so you can get the block devices name of the micro sd card:

lsblk

In my case, it was mmcblk0. Once you have the block device name, run the parted command as sudo:

sudo parted /dev/mmcblk0

Once you are inside the parted utility, you will notice parted in the command line. Now create the partition table:

mklabel msdos

Then, create one partition:

mkpart primary fat32 1Mib 100%

And exit the parted utility:

quit

Again run the lsblk command to find the name of the partition that you just created:

lsblk

In my case, the partition on the ‘mmcblk0’ block devices was ‘mmcblk0p1’. We are going to format this partition with Fat32 file system:

sudo mkfs.vfat /dev/mmcblk0p1

Our Micro SD card is ready. Let’s download the zip file of the official image of NOOBS from this page. Then unzip the content of the downloaded folder into the root of the Micro SD card. First, change directory to Micro SD card:

cd path_of_microsd_card

unzip path_of_noobs_zip_file.zip

Open the Micro SD card in a file manage to make sure that all files are in the root folder of the card.

Prepare your Pi

Connect an HDMI monitor, keyboard and mouse to the Pi. Plug in the Micro SD card and then connect the 5V power supply. NOOBS will boot up and you will see this screen:

HvmwmAahNsQx7sIdo04PgxbQXccCZrvOsFhE3c6H

Select Raspbian from the list and click on the install button. The system will reboot after successful installation. Once you boot into Raspbian, open the wireless settings from the top bar and connect to your wireless.

We will be using our Raspberry Pi in headless mode so that we can manage the Christmas music show remotely from a PC, laptop, or mobile device. Before enabling SSH, however, we need to know the IP address of our Pi so that we can log into it remotely. Open the Terminal app and run the following command:

ifconfig

Note down the IP address listed under ‘wlan0’.

Once you have the IP address, open the configuration file of Raspbian by running the following command in the Terminal:

sudo raspi-config

Go to Advanced > SSH and select ‘Yes’ to enable SSH server.

(Note: use the arrow and enter keys to navigate and select; the mouse won’t work here)

4Dq4jUwtH3z5GqrAOEb3OOB57tY2kQwC2TNcL_Sh
35o1s47TeYpWFEYF3tM5c9ha0x-GEQyWdLmeIc7K

We will also change audio settings to get the audio output through the 3.5mm audio jack instead of HDMI. In Advanced Options, go to Audio and select the second option ‘Force 3.5mm (‘headphone’) jack’, then select ‘Ok’.

z7hunlE8Ic5S917VZouteuql54j36HRgaKg8sHQJ

Select ‘Finish’ in the main window and then reboot the system.

sudo reboot

You can now unplug the HDMI monitor as we will do the rest of the installation and configuration over ssh. Open terminal app on your PC or laptop and then ssh into the Pi:

 ssh pi@IP_ADDRESS_OF_PI

In my case it was:

ssh pi@10.0.0.33

Then enter the password for the Pi: ‘raspberry’.

This is the default password for pi, if you want to change it you can do so from the ‘raspi-config’ file.

Now it’s time to update your system:

sudo apt-get update
sudo apt-get dist-upgrade

It’s always a good idea to reboot your system if there are any kernel updates:

sudo reboot

In the next article, I’ll show how to set up the light show portion of our project, and in part 3, we’ll wrap it all up with some sound.

For 5 more fun projects for the Raspberry Pi 3, including a holiday light display and Minecraft Server, download the free E-book today!

Read about other Raspberry Pi projects:

5 Fun Raspberry Pi Projects: Getting Started

How to Build a Minecraft Server with Raspberry Pi 3

Build Your Own Netflix and Pandora With Raspberry Pi 3

Turn Raspberry Pi 3 Into a Powerful Media Player With RasPlex

Click Here!