12-07-2018, 11:33 PM
Create a Fully Automated Light and Music Show for the Holidays: Part 1
<div style="margin: 5px 5% 10px 5%;"><img src="http://www.sickgaming.net/blog/wp-content/uploads/2018/12/create-a-fully-automated-light-and-music-show-for-the-holidays-part-1.jpg" width="1600" height="1302" title="" alt="" /></div><div><p><strong><i>This tutorial series from our archives explains how to build a fully automated holiday display with Raspberry Pi. </i></strong></p>
<p><span><span>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.</span></span></p>
<p><span><span>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.</span></span></p>
<p><span><span>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. </span></span></p>
<p><span><span>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. </span></span></p>
<p><strong><span><span>What you need:</span></span></strong></p>
<ol>
<li>
<p><span><span>Raspberry Pi 3</span></span></p>
</li>
<li>
<p><span><span>Micro SD card 8GB</span></span></p>
</li>
<li>
<p><span><span>5v charger (2 units)</span></span></p>
</li>
<li>
<p><span><a href="https://www.amazon.com/gp/product/B015CWP06Y/ref=oh_aui_search_detailpage?ie=UTF8&psc=1"><span>Male to female breadboard jumper wires</span></a></span></p>
</li>
<li>
<p><span><span>1 power cable</span></span></p>
</li>
<li>
<p><span><a href="https://www.amazon.com/gp/product/B006J4G45G/ref=oh_aui_search_detailpage?ie=UTF8&psc=1"><span>8-channel solid state relay</span></a></span></p>
</li>
<li>
<p><span><a href="https://www.amazon.com/gp/product/B00H8NUVO2/ref=od_aui_detailpages00?ie=UTF8&psc=1"><span>Four gang device box</span></a></span></p>
</li>
<li>
<p><span><a href="https://www.amazon.com/gp/product/B0156VGLWI/ref=od_aui_detailpages00?ie=UTF8&psc=1"><span>Duplex receptacle</span></a><span> (4 pack)</span></span></p>
</li>
<li>
<p><span><a href="https://www.amazon.com/gp/product/B000U3G2PE/ref=oh_aui_detailpage_o00_s01?ie=UTF8&psc=1"><span>Receptacle wall plate</span></a></span></p>
</li>
<li>
<p><span><span>Single core wire (red, white & black)</span></span></p>
</li>
<li>
<p><span><span>Wood board</span></span></p>
</li>
<li>
<p><span><span>Push switch</span></span></p>
</li>
<li>
<p><span><span>Soldering rod</span></span></p>
</li>
</ol>
<h3><span><span>Get started with Pi</span></span></h3>
<p><span><span>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.</span></span></p>
<p><span><span>Run the </span><span><em>lsblk</em> </span><span>command to list the block devices so you can get the block devices name of the micro sd card:</span></span></p>
<pre>
<span><span>lsblk</span></span></pre>
<p><span><span>In my case, it was </span><em><span>mmcblk0</span></em><span>. Once you have the block device name, run the parted command as sudo:</span></span></p>
<pre>
<span><span>sudo parted /dev/mmcblk0</span></span>
</pre>
<p><span><span>Once you are inside the parted utility, you will notice parted in the command line. Now create the partition table:</span></span></p>
<pre>
<span><span>mklabel msdos</span></span>
</pre>
<p><span><span>Then, create one partition: </span></span></p>
<pre>
<span><span>mkpart primary fat32 1Mib 100%</span></span>
</pre>
<p><span><span>And exit the parted utility:</span></span></p>
<pre>
<span><span>quit</span></span>
</pre>
<p><span><span>Again run the <em>lsblk</em> command to find the name of the partition that you just created:</span></span></p>
<pre>
<span><span>lsblk</span></span>
</pre>
<p><span><span>In my case, the partition on the ‘mmcblk0’ block devices was ‘mmcblk0p1’. We are going to format this partition with Fat32 file system:</span></span></p>
<pre>
<span><span>sudo mkfs.vfat /dev/mmcblk0p1</span></span>
</pre>
<p><span><span>Our Micro SD card is ready. Let’s download the zip file of the </span><a href="https://www.raspberrypi.org/downloads/noobs/"><span>official image of NOOBS from this page.</span></a><span> Then unzip the content of the downloaded folder into the root of the Micro SD card. First, c</span></span><span><span>hange directory to Micro SD card:</span></span></p>
<pre>
<span><span>cd path_of_microsd_card</span></span> <span><span>unzip path_of_noobs_zip_file.zip</span></span>
</pre>
<p><span><span>Open the Micro SD card in a file manage to make sure that all files are in the root folder of the card. </span></span></p>
<h3><span><span>Prepare your Pi</span></span></h3>
<p><span><span>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:</span></span></p>
<p><span><span><img alt="HvmwmAahNsQx7sIdo04PgxbQXccCZrvOsFhE3c6H" src="http://www.sickgaming.net/blog/wp-content/uploads/2018/12/create-a-fully-automated-light-and-music-show-for-the-holidays-part-1.jpg" /></span></span></p>
<p><span><span>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. </span></span></p>
<p><span><span>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:</span></span></p>
<pre>
<span><span>ifconfig</span></span>
</pre>
<p><span><span>Note down the IP address listed under ‘wlan0’.</span></span></p>
<p><span><span>Once you have the IP address, open the configuration file of Raspbian by running the following command in the Terminal: </span></span></p>
<pre>
<span><span>sudo raspi-config</span></span>
</pre>
<p><span><span>Go to Advanced > SSH and select ‘Yes’ to enable SSH server. </span></span></p>
<p><span><span>(Note: use the arrow and enter keys to navigate and select; the mouse won’t work here)</span></span></p>
<div><span><span><img alt="4Dq4jUwtH3z5GqrAOEb3OOB57tY2kQwC2TNcL_Sh" height="227" src="http://www.sickgaming.net/blog/wp-content/uploads/2018/12/create-a-fully-automated-light-and-music-show-for-the-holidays-part-1.png" width="624" /></span></span></div>
<div><span><span><img alt="35o1s47TeYpWFEYF3tM5c9ha0x-GEQyWdLmeIc7K" src="http://www.sickgaming.net/blog/wp-content/uploads/2018/12/create-a-fully-automated-light-and-music-show-for-the-holidays-part-1-1.png" /></span></span></div>
<p><span><span>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’.</span></span></p>
<p><span><span><img alt="z7hunlE8Ic5S917VZouteuql54j36HRgaKg8sHQJ" src="http://www.sickgaming.net/blog/wp-content/uploads/2018/12/create-a-fully-automated-light-and-music-show-for-the-holidays-part-1-2.png" /></span></span></p>
<p><span><span>Select ‘Finish’ in the main window and then reboot the system. </span></span></p>
<pre>
<span><span>sudo reboot</span></span>
</pre>
<p><span><span>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:</span></span></p>
<pre>
<span> <span>ssh pi@IP_ADDRESS_OF_PI</span></span></pre>
<p><span><span>In my case it was:</span></span></p>
<pre>
<span><span>ssh [email protected]</span></span>
</pre>
<p><span><span>Then enter the password for the Pi: ‘raspberry’.</span></span></p>
<p><span><span>This is the default password for pi, if you want to change it you can do so from the ‘raspi-config’ file.</span></span></p>
<p><span><span>Now it’s time to update your system:</span></span></p>
<pre>
<span><span>sudo apt-get update</span>
<span>sudo apt-get dist-upgrade</span></span>
</pre>
<p><span><span>It’s always a good idea to reboot your system if there are any kernel updates:</span></span></p>
<pre>
<span><span>sudo reboot</span></span>
</pre>
<p><span><span>In the <a href="https://www.linux.com/learn/create-fully-automated-light-and-music-show-holidays-part-2">next article</a>, I’ll show how to set up the light show portion of our project, and in <a href="https://www.linux.com/learn/create-fully-automated-light-and-music-show-holidays-part-3">part 3</a>, we’ll wrap it all up with some sound. </span></span></p>
<p><em>For 5 more fun projects for the Raspberry Pi 3, including a holiday light display and Minecraft Server, <a href="http://go.linuxfoundation.org/l/6342/2016-11-11/3l9nvc" target="_blank">download the free E-book today!</a></em></p>
<p><em>Read about other Raspberry Pi projects:</em></p>
<p><a href="https://www.linux.com/learn/5-fun-raspberry-pi-projects-getting-started">5 Fun Raspberry Pi Projects: Getting Started</a></p>
<p><a href="https://www.linux.com/learn/how-build-minecraft-server-raspberry-pi-3">How to Build a Minecraft Server with Raspberry Pi 3</a></p>
<p><a href="https://www.linux.com/learn/build-your-own-netflix-and-pandora-raspberry-pi-3">Build Your Own Netflix and Pandora With Raspberry Pi 3</a></p>
<p><a href="https://www.linux.com/learn/turn-raspberry-pi-3-powerful-media-player-rasplex">Turn Raspberry Pi 3 Into a Powerful Media Player With RasPlex</a></p>
</div>
<div style="margin: 5px 5% 10px 5%;"><img src="http://www.sickgaming.net/blog/wp-content/uploads/2018/12/create-a-fully-automated-light-and-music-show-for-the-holidays-part-1.jpg" width="1600" height="1302" title="" alt="" /></div><div><p><strong><i>This tutorial series from our archives explains how to build a fully automated holiday display with Raspberry Pi. </i></strong></p>
<p><span><span>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.</span></span></p>
<p><span><span>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.</span></span></p>
<p><span><span>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. </span></span></p>
<p><span><span>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. </span></span></p>
<p><strong><span><span>What you need:</span></span></strong></p>
<ol>
<li>
<p><span><span>Raspberry Pi 3</span></span></p>
</li>
<li>
<p><span><span>Micro SD card 8GB</span></span></p>
</li>
<li>
<p><span><span>5v charger (2 units)</span></span></p>
</li>
<li>
<p><span><a href="https://www.amazon.com/gp/product/B015CWP06Y/ref=oh_aui_search_detailpage?ie=UTF8&psc=1"><span>Male to female breadboard jumper wires</span></a></span></p>
</li>
<li>
<p><span><span>1 power cable</span></span></p>
</li>
<li>
<p><span><a href="https://www.amazon.com/gp/product/B006J4G45G/ref=oh_aui_search_detailpage?ie=UTF8&psc=1"><span>8-channel solid state relay</span></a></span></p>
</li>
<li>
<p><span><a href="https://www.amazon.com/gp/product/B00H8NUVO2/ref=od_aui_detailpages00?ie=UTF8&psc=1"><span>Four gang device box</span></a></span></p>
</li>
<li>
<p><span><a href="https://www.amazon.com/gp/product/B0156VGLWI/ref=od_aui_detailpages00?ie=UTF8&psc=1"><span>Duplex receptacle</span></a><span> (4 pack)</span></span></p>
</li>
<li>
<p><span><a href="https://www.amazon.com/gp/product/B000U3G2PE/ref=oh_aui_detailpage_o00_s01?ie=UTF8&psc=1"><span>Receptacle wall plate</span></a></span></p>
</li>
<li>
<p><span><span>Single core wire (red, white & black)</span></span></p>
</li>
<li>
<p><span><span>Wood board</span></span></p>
</li>
<li>
<p><span><span>Push switch</span></span></p>
</li>
<li>
<p><span><span>Soldering rod</span></span></p>
</li>
</ol>
<h3><span><span>Get started with Pi</span></span></h3>
<p><span><span>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.</span></span></p>
<p><span><span>Run the </span><span><em>lsblk</em> </span><span>command to list the block devices so you can get the block devices name of the micro sd card:</span></span></p>
<pre>
<span><span>lsblk</span></span></pre>
<p><span><span>In my case, it was </span><em><span>mmcblk0</span></em><span>. Once you have the block device name, run the parted command as sudo:</span></span></p>
<pre>
<span><span>sudo parted /dev/mmcblk0</span></span>
</pre>
<p><span><span>Once you are inside the parted utility, you will notice parted in the command line. Now create the partition table:</span></span></p>
<pre>
<span><span>mklabel msdos</span></span>
</pre>
<p><span><span>Then, create one partition: </span></span></p>
<pre>
<span><span>mkpart primary fat32 1Mib 100%</span></span>
</pre>
<p><span><span>And exit the parted utility:</span></span></p>
<pre>
<span><span>quit</span></span>
</pre>
<p><span><span>Again run the <em>lsblk</em> command to find the name of the partition that you just created:</span></span></p>
<pre>
<span><span>lsblk</span></span>
</pre>
<p><span><span>In my case, the partition on the ‘mmcblk0’ block devices was ‘mmcblk0p1’. We are going to format this partition with Fat32 file system:</span></span></p>
<pre>
<span><span>sudo mkfs.vfat /dev/mmcblk0p1</span></span>
</pre>
<p><span><span>Our Micro SD card is ready. Let’s download the zip file of the </span><a href="https://www.raspberrypi.org/downloads/noobs/"><span>official image of NOOBS from this page.</span></a><span> Then unzip the content of the downloaded folder into the root of the Micro SD card. First, c</span></span><span><span>hange directory to Micro SD card:</span></span></p>
<pre>
<span><span>cd path_of_microsd_card</span></span> <span><span>unzip path_of_noobs_zip_file.zip</span></span>
</pre>
<p><span><span>Open the Micro SD card in a file manage to make sure that all files are in the root folder of the card. </span></span></p>
<h3><span><span>Prepare your Pi</span></span></h3>
<p><span><span>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:</span></span></p>
<p><span><span><img alt="HvmwmAahNsQx7sIdo04PgxbQXccCZrvOsFhE3c6H" src="http://www.sickgaming.net/blog/wp-content/uploads/2018/12/create-a-fully-automated-light-and-music-show-for-the-holidays-part-1.jpg" /></span></span></p>
<p><span><span>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. </span></span></p>
<p><span><span>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:</span></span></p>
<pre>
<span><span>ifconfig</span></span>
</pre>
<p><span><span>Note down the IP address listed under ‘wlan0’.</span></span></p>
<p><span><span>Once you have the IP address, open the configuration file of Raspbian by running the following command in the Terminal: </span></span></p>
<pre>
<span><span>sudo raspi-config</span></span>
</pre>
<p><span><span>Go to Advanced > SSH and select ‘Yes’ to enable SSH server. </span></span></p>
<p><span><span>(Note: use the arrow and enter keys to navigate and select; the mouse won’t work here)</span></span></p>
<div><span><span><img alt="4Dq4jUwtH3z5GqrAOEb3OOB57tY2kQwC2TNcL_Sh" height="227" src="http://www.sickgaming.net/blog/wp-content/uploads/2018/12/create-a-fully-automated-light-and-music-show-for-the-holidays-part-1.png" width="624" /></span></span></div>
<div><span><span><img alt="35o1s47TeYpWFEYF3tM5c9ha0x-GEQyWdLmeIc7K" src="http://www.sickgaming.net/blog/wp-content/uploads/2018/12/create-a-fully-automated-light-and-music-show-for-the-holidays-part-1-1.png" /></span></span></div>
<p><span><span>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’.</span></span></p>
<p><span><span><img alt="z7hunlE8Ic5S917VZouteuql54j36HRgaKg8sHQJ" src="http://www.sickgaming.net/blog/wp-content/uploads/2018/12/create-a-fully-automated-light-and-music-show-for-the-holidays-part-1-2.png" /></span></span></p>
<p><span><span>Select ‘Finish’ in the main window and then reboot the system. </span></span></p>
<pre>
<span><span>sudo reboot</span></span>
</pre>
<p><span><span>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:</span></span></p>
<pre>
<span> <span>ssh pi@IP_ADDRESS_OF_PI</span></span></pre>
<p><span><span>In my case it was:</span></span></p>
<pre>
<span><span>ssh [email protected]</span></span>
</pre>
<p><span><span>Then enter the password for the Pi: ‘raspberry’.</span></span></p>
<p><span><span>This is the default password for pi, if you want to change it you can do so from the ‘raspi-config’ file.</span></span></p>
<p><span><span>Now it’s time to update your system:</span></span></p>
<pre>
<span><span>sudo apt-get update</span>
<span>sudo apt-get dist-upgrade</span></span>
</pre>
<p><span><span>It’s always a good idea to reboot your system if there are any kernel updates:</span></span></p>
<pre>
<span><span>sudo reboot</span></span>
</pre>
<p><span><span>In the <a href="https://www.linux.com/learn/create-fully-automated-light-and-music-show-holidays-part-2">next article</a>, I’ll show how to set up the light show portion of our project, and in <a href="https://www.linux.com/learn/create-fully-automated-light-and-music-show-holidays-part-3">part 3</a>, we’ll wrap it all up with some sound. </span></span></p>
<p><em>For 5 more fun projects for the Raspberry Pi 3, including a holiday light display and Minecraft Server, <a href="http://go.linuxfoundation.org/l/6342/2016-11-11/3l9nvc" target="_blank">download the free E-book today!</a></em></p>
<p><em>Read about other Raspberry Pi projects:</em></p>
<p><a href="https://www.linux.com/learn/5-fun-raspberry-pi-projects-getting-started">5 Fun Raspberry Pi Projects: Getting Started</a></p>
<p><a href="https://www.linux.com/learn/how-build-minecraft-server-raspberry-pi-3">How to Build a Minecraft Server with Raspberry Pi 3</a></p>
<p><a href="https://www.linux.com/learn/build-your-own-netflix-and-pandora-raspberry-pi-3">Build Your Own Netflix and Pandora With Raspberry Pi 3</a></p>
<p><a href="https://www.linux.com/learn/turn-raspberry-pi-3-powerful-media-player-rasplex">Turn Raspberry Pi 3 Into a Powerful Media Player With RasPlex</a></p>
</div>