未加星标

Build a Spooky Halloween Music-Light Show with Raspberry Pi and Linux

字体大小 | |
[系统(linux) 所属分类 系统(linux) | 发布者 店小二03 | 时间 2016 | 作者 红领巾 ] 0人收藏点击收藏

My son just turned 4, and he is super-excited about Halloween and zombies. So I planned to create a haunted house-like experience for him. The biggest challenge was to get audio-visual effects. I wanted spooky music synchronized with well-placed lighting.

Instead of buying some expensive Halloween decorations, I wanted to build them myself. I also wanted to be able to control the lights over the network. I looked around and didn’t find the perfect solution, so I did what DIY people do best: I picked and chose different pieces to create what I needed.

In this tutorial, I am going to share how you can build a board with Raspberry Pi and open source software that synchronizes music with lights for less than $20. You can place this board inside a plastic pumpkin decoration, for example, or attach LEDs to props and create spooky displays for Halloween. Be creative!

Here is what you need:

A Raspberry Pi 3 (v3 comes with WiFi and Bluetooth)

32 GB Micro SD card (minimum 16GB)

A PC monitor with HDMI port for initial setup

Keyboard and mouse (I recommend Logitech Wireless Touch Keyboard K400 with built-in Multi-Touch Touchpad)

5v 2A power supply (If you want full mobility then get a 5V battery bank for smartphones)

LEDs (minimum of eight, or more as desired)

220 Ohm resistors (one per LED, minimum of eight)

Speakers (get portable Logitech speakers)

Assembled Pi Cobbler Plus - Breakout Cable for Raspberry Pi A+ / B+ (I recommend this one from Adafruit as it has clear pin numbers)

Breadboard and wires (and a basic knowledge of how to use it)

Solderable breadboard (optional)

Software

We will be using linux-based Raspbian as the base operating system for this project. The easiest way to install Raspbian on your Pi is by using NOOBs. Plug in your Micro SD card to your PC and format it as FAT32 using Gnome Disk Utility (Figure 1).

halloween-f1.png
Build a Spooky Halloween Music-Light Show with Raspberry Pi and Linux

Figure 1: Format Micro SD.

Creative Commons Attribution

Then, change directory to the Micro SD card:

cd /path_of_USB

And unzip the NOOBS file into the Micro SD card:

unzip PATH_OF_NOOBS

In my case it was:

unzip /home/swapnil/Downloads/NOOBS_v1_9_2.zip

Ensure that all the content of the NOOBS folder is in the root directory of the Micro SD card.

ls /path_of_micro_SD_card/

You should see all these files there (Figure 2):

halloween-f2.png
Build a Spooky Halloween Music-Light Show with Raspberry Pi and Linux

Figure 2: Files in root directory.

Creative Commons Attribution

Prepare your Pi

Connect the Pi to the monitor using an HDMI cable and then connect the keyboard. Connect one end of the GPIO 40 Pin cable to the Pi and the other end to the breadboard using Adafruit Assembled Pi T-Cobbler Plus - GPIO Breakout board. Now plug in the Micro SD card and connect the power supply.

When NOOBS boots, you will see the option to connect to the wireless network. Because we will be using the Rasp Pi outside as a Halloween decoration, we need it to be wireless. Click on the wireless option and select the desired wireless network from the list (Figure 3).

halloween-f3.png
Build a Spooky Halloween Music-Light Show with Raspberry Pi and Linux

Figure 3: Select wireless network.

Creative Commons Attribution

NOOBS will offer several operating systems to choose from, select Raspbian and let the installation finish. Once the installation is finished, reboot the system. Once you boot into Raspbian, update your system:

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

In order to use the sound output from the 3.5mm jack of Raspberry Pi, run the following command to open the configuration file of Raspbian:

sudo raspi-config

Then, go to Advanced>Audio and set audio out from 3.5mm jack (Figures 4 and 5).

halloween-f4.png
Build a Spooky Halloween Music-Light Show with Raspberry Pi and Linux

Figure 4: Set audio out.

Creative Commons Attribution

halloween-f5.png
Build a Spooky Halloween Music-Light Show with Raspberry Pi and Linux

Figure 5: Select auto.

Creative Commons Attribution

Install lightshow software

We are using the open source Lightshowpi project to control music and lights. Clone the project on your local machine:

git clone https:[email protected]/togiles/lightshowpi.git

Change directory to the newly created ‘/home/pi/lightshowpi’ folder:

cd lightshowpi

Grab the stable branch:

git fetch && git checkout stable

Install lightshowpi:

sudo ./install.sh Reboot the system: sudo reboot Install LEDs on the Breadboard

We need to set up the LED lights on the breadboard for initial testing. Now we need to find the right PIN of GPIO board for LED connections. I strongly recommend Adafruit’s Assembled Pi Cobbler Plus - Breakout Cable for Raspberry Pi. This cable comes with clearly marked PIN numbers, which will make it easier to connect to each corresponding PIN. Because we are using 8 LEDs for our setup, let’s find out which PINs are we going to use. Figure 6 shows a picture of the Adafruit’s breakout cable.

halloween-f6.png
Build a Spooky Halloween Music-Light Show with Raspberry Pi and Linux

Figure 6: Adafruit’s breakout cable.

本文系统(linux)相关术语:linux系统 鸟哥的linux私房菜 linux命令大全 linux操作系统

主题: Raspberry PiLinuxWiFi
分页:12
转载请注明
本文标题:Build a Spooky Halloween Music-Light Show with Raspberry Pi and Linux
本站链接:http://www.codesec.net/view/482499.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 系统(linux) | 评论(0) | 阅读(22)