Introduction: DIY Musical Xmas Lights for Beginners With Raspberry Pi

Today, I'll go through the steps to use a raspberry pi to get your Christmas lights flashing with music. With just a few bucks of extra material, I walk you through converting your regular Christmas lights into a whole-house light show. The goal here is to go from scratch. Although this guide is intended for people who don't know how to use linux at all and those who do alike, the focus is for people for whom linux and the raspberry pi are a complete mystery. There is much more that can be done with the lightshowpi software and more sophisticated hardware, but this is about just getting started.

Step 1: Material

Picture of Material

First the must have:

Temporary needs: this is temporary so I would recommend just using whatever you already have for the few hours it will be needed

  • A USB mouse and keyboard
  • Access to an HDMI monitor or TV
  • A USB hub if switching between mouse and keyboard are too annoying and your other USB ports are occupied

Optional

Step 2: Setting Up the Pi 1: Installing Raspbian

Picture of Setting Up the Pi 1: Installing Raspbian

The first step is to get raspbian on your device. I will cover all of these in a single block, and cover the hardware separately.

I recommend downloading noobs from the pi foundation https://www.raspberrypi.org/downloads/noobs/

Just unzip, and copy over to your freshly formatted micro SD card. That's it. Once you turn on your pi, it will guide you through the installation.

Step 3: Setting Up the Pi 2: Setup SSH and VNC

Picture of Setting Up the Pi 2: Setup SSH and VNC

Having SSH and VNC setup means you won't need to keep the pi plugged in to a huge mess of wires. Everything will be doable from 2 windows on your laptop or even from your phone. We will often precede our commands with "sudo", this essentially gives our command the administrator privileges.

  1. First change your password. Open a terminal window and type the following and you will be prompted to enter the default password (raspberry) and then put in your own password.
    • sudo passwd
  2. now copy your IP address with the following command
    • ifconfig

Now go to the settings menu, and turn on the SSH and VNC. You can now reboot the pi and unplug it from the monitor, keyboard, and mouse.

Step 4: Setting Up the Pi 3: Use Bitvise SSH to Access Your Pi

Picture of Setting Up the Pi 3: Use Bitvise SSH to Access Your Pi

I recommend bitvise because it has an integrated SFTP tool, as well as a good interface. Enter your IP address you copied over earlier, use the username pi, and your new password. Keep the default port (22). The terminal should open when you select login.

Step 5: Setting Up the Pi 4: Update Your Pi

Before you do anything else, run the updates

  1. First, you update the library of what packages are available with
    • sudo apt-get update
  2. Once its done running, you actually install the updates with
    • sudo apt-get upgrade

  3. For good measure, make sure your pi firmware is up to date (this should already be done through upgrade)
    • sudo rpi-update

Step 6: Setting Up the Pi 5: Installing Lightshowpi

Picture of Setting Up the Pi 5: Installing Lightshowpi

This part of the steps is available directly on the lightshowpi website. I will include them for convenience. I will add a few explanations in there.

  • sudo apt-get install git-core
    • apt-get is what gets the packages, and here we will install git-core, dependencies (programs git-core needs to run) will automatically be added
  • cd ~
    • cd is to change directories, while ~ means /home/*username*/, in this case it would be /home/pi/; using that or ~ should work just the same
  • git clone https://togiles@bitbucket.org/togiles/lightshowpi.git
    • That just copied over the folder structure we need
  • cd lightshowpi
    • now we move over to the folder we just downloaded
  • git fetch && git checkout stable
    • now we get the needed files
  • cd /home/pi/lightshowpi
    • we move over to the correct folder; in linux, unless we create system links, we always have to move over to the correct folder before launching scripts
  • sudo ./install.sh
    • this does the actual installation; this took about 3 hours on my pi zero w
  • sudo reboot
    • now we reboot!

Step 7: Wiring Your Stuff

Picture of Wiring Your Stuff

However you end up powering your devices depends on what you are using. There are many options here, but at the end of the day, you will need 5v for your pi, either through a USB, or using the header pins and a custom power solution like I did. All the power you are interrupting should be DC. AC line voltage will work just fine, but it brings along extra risk. Low voltage is far safer.

Step 8: Wiring Your Stuff 2: Soldering the Pins

Picture of Wiring Your Stuff 2: Soldering the Pins

If you are using a pi zero, you will either have to solder header pins, or solder the wires directly at the pin holes themselves.

Step 9: Wiring Your Stuff 3: Connecting the Pi to the Relay Board

Picture of Wiring Your Stuff 3: Connecting the Pi to the Relay Board

We are using the wiringpi pin numbering. There is an alternative naming convention out there, just use the chart I provided, or go to wiringpi.com

From the relay board, with the pins towards your, from left to right, you will connect to the following on the pi

  1. pin 20: ground
  2. pin 11: GPIO 0
  3. pin 12: GPIO 1
  4. pin 13: GPIO 2
  5. pin 15: GPIO 3
  6. pin 16: GPIO 4
  7. pin 18: GPIO 5
  8. pin 22: GPIO 6
  9. pin 7: GPIO 7
  10. pin 4: 5v power

If you are powering your pi from the header pins, then the +5v will go to pin 2, and the - (ground) will go to pin 6.

Step 10: Wiring Your Stuff 4: Wiring Your Relays

Picture of Wiring Your Stuff 4: Wiring Your Relays

The relays work like a switch. However you would wire your lights directly to your power, do that, but then cut the live wire and put each end of that cut wire on one of the relays. Each relays have 3 terminals. 2 of them are together, and powering the relay separates them, the other one becomes connected to the center terminal when the relay is powered. The little diagram of a corner shape shows you which one is separate (in red). The opposing ends (first and last) of each relay will never be connected. If you want, you can do always-on and use the 2 in the green, it just means the lightshowpi commands will be in reverse. It might be useful if you want the lights to default to on after the music ends.

Step 11: Test It

Picture of Test It

I used these little LEDs to test my board, but really you can just look at the red light that is on the relay board. Each relay already has its own LED.

  • Don't forget to navigate to the lightshowpi folder first
    • cd /home/pi/lightshowpi/
  • Then use one of these test commands
    • sudo python py/hardware_controller.py --state=flash
    • sudo python py/hardware_controller.py --state=fade
  • To end the test, use CTRL+C

Step 12: Enjoy!

Picture of Enjoy!

Now it's time to setup your actual christmas lights, and enjoy the show. Don't forget to check out my full video!

To run your first song, use the demo file provided by the lightshowpi devs

sudo python py/synchronized_lights.py --file=/home/pi/lightshowpi/music/sample/ovenrake_deck-the-halls.mp3

To play any other son, just change the name of the mp3 at the end of that command. This is where the sftp feature of bitvise comes in; you can simply click and drag your files.

Comments

D6equj5 (author)2017-11-29

Nice post and useful, thanks for posting.
Uh its "Christmas" by the way.

MakinThings (author)D6equj52017-11-30

Too long, makes the most title less clear in previews :p

crkrjak2001 (author)2017-11-30

Well done Instructable! Very impressive!

I look forward to doing this next year to my house. :-D

TheWoodfather (author)2017-11-22

really looking forward to doing this, i might be too late for this year but next year I'm in :-)

I was really rushing to get it done on time for this season. It ended up taking way longer than planned as I pieced it all together :p

Swansong (author)2017-11-21

I thought that was video game music for a second! Your display is a lot of fun, great job :)

About This Instructable

1,628views

38favorites

License:

Bio: www.patreon.com/making https://www.youtube.com/making www.thingiverse.com/MakinThings/designs
More by MakinThings:DIY Musical Xmas Lights for Beginners with raspberry pi3D Printer PCB EtchingTurn your 3D printer into a plotter
Add instructable to: