RGB Neon Musical Spectrum Motion Sensing Guitar Stand
by BitstoArt in Circuits > Raspberry Pi
2708 Views, 30 Favorites, 0 Comments
RGB Neon Musical Spectrum Motion Sensing Guitar Stand
A neon wrapped (enclosed individually addressable LED strip) guitar stand that flows though the colors until motion is detected. Then one of fifteen guitar solos is played as the lights dance to the music. It's all wrapped around the Amazon Basics guitar stand. The stand is only $15.77 as of 3/7/2022.
The real colors are much more vibrant than the video and photos show! Check out the LED strip link in supplies to see the vibrant colors it produces.
Supplies
I recommend purchasing parts and installing in sections. Get each section working before moving on to the next section.
Section One
In this section get the computer running and controlling the LED strip, the most critical part of the build.
Computer: Raspberry Pi Zero 2 W, 5V Power Supply and optional 40 pin header
An attached header makes it easier to prototype your creation. You could also solder directly to the Zero.
"Neon" LED Strip: Aclorol 16.4FT LED Neon Rope Lights Addressable LED Strip Neon Sign Flexible Pixels Light RGB Dream Color Rainbow WS2811 DC12V 5M Waterproof for DIY Bedroom Wall Wedding Party Bars Advertising Signs
https://www.amazon.com/dp/B0915WV11L?psc=1&ref=ppx_yo2_dt_b_product_details
I ended up using 110" inches from the original 197".
LED Power Supply: Aclorol 12V 10A 120W Power Supply Adapter Converter Transformer AC 100-240V to DC 12volts 10amps Universal Switching Power 5.5X2.1mm for LED Strip Lights Electric Fans Audio Amplifier
https://www.amazon.com/dp/B08745S8SK?psc=1&ref=ppx_yo2_dt_b_product_details
This is a 12 volt power supply. And yes, 10 amps are required to run the entire 5 meter string at full brightness. For the shorter length we use you might be able to use a smaller supply.
Connector (optional): BTF-LIGHTING 20 Pairs JST SM 3 Pin Connectors for WS2812B WS2811 WS2812 SK6812 LED Strip Female Male 15cm 22awg Wire
https://www.amazon.com/dp/B01DC0KIT2?psc=1&ref=ppx_yo2_dt_b_product_details
Makes it easy to plug into the LED strip. And to connect strips together for future projects.
Voltage Shifter: Songhe 4 Channels IIC I2C Logic Level Converter Bi-Directional Module 3.3V to 5V Shifter for Arduino Green Board 10PCS
.https://www.amazon.com/dp/B07YZTW2SM?psc=1&ref=ppx_yo2_dt_b_product_details
This tiny board shifts the Zero output pin's voltage from 3.3 volts up to 5 volts. This helps the LED strip recognize the signal.
Section Two
In this section concentrate on getting the sound to work.
Speaker: Mini External USB Stereo Speaker
https://www.adafruit.com/product/3369#tutorials
Section Three
In this section get motion sensing to work.
Motion Sensor: XINGYHENG 5Pcs HC-SR505 Micro Body Sensing Module PIR Motion Detector Switch Module High Power High Efficiency Digital Measurement for Electronic Practice DIY
https://www.amazon.com/dp/B07QY7GPWT?psc=1&ref=ppx_yo2_dt_b_product_details
Section Four
In this section create the physical structure.
Stand: Amazon Basics Guitar Folding A-Frame Stand for Acoustic and Electric Guitars
https://www.amazon.com/dp/B018FCZKR2?psc=1&ref=ppx_yo2_dt_b_product_details
All of the 3D printed parts are modeled to fit this stand only.
Filament: Filament for your 3D printer. If you use all of my models it will take about 300 grams.
Dowel: 3 foot long 3/4 inch diameter hardwood dowel painted to match
Thick Cable Ties
Setup the Zero
First install the Raspberry Pi Linux operating system on your Pi Zero. I used this link for a headless install.
After the SD card is loaded remove it from your other computer and insert it into your Zero. Turn the Zero on.
Connect to the Zero using your favorite SSH software. I use Putty. If you have trouble finding your Zero you can check your local router and write down the IP of its wireless connection. Use that IP in Putty.
Sign in to your new system with the default user and password.
User pi
Password raspberry
Change your password.
passwd
If you have, or will have, more than one Raspberry Pi, change the host name from "raspberry" to a new value in two files. Then shutdown.
sudo nano /etc/hostname sudo nano /etc/hosts sudo shutdown -h now
Power back on. Restart your putty session. Sign in as pi with your new password.
Update your system. This may take awhile depending on when the latest Raspian was released.
sudo apt update sudo apt upgrade -y sudo apt autoremove -y sudo shutdown -h now
Component Overview
Above is an overview of all connections required. The project uses a 5V AND a 12V power supply, sharing ground only.
Install LED Software
I am indebted to Raspberry Pi Tutorial, Adafruit and Tony DiCola for directions and programs to use LED strips with the Raspberry Pi.
https://tutorials-raspberrypi.com/connect-control-raspberry-pi-ws2812-rgb-led-strips/
https://learn.adafruit.com/adafruit-neopixel-uberguide
Most of this section comes from these sites. But remember we are running a 12V strip.
Enter the following commands. (For more information please check their websites.)
sudo apt-get install gcc make build-essential python-dev git scons swig sudo nano /etc/modprobe.d/snd-blacklist.conf
Add the following line to this file.
blacklist snd_bcm2835
Save.
sudo nano /boot/config.txt
Comment out the following line.
#dtparam=audio=on
Save and shutdown.
Restart. Sign back in. Install required software and make changes to a file.
sudo pip install rpi_ws281x sudo nano /boot/config.txt
Add the following lines at the end.
hdmi_force_hotplug=1 hdmi_force_edid_audio=1
Save and shutdown.
Restart. Sign back in.
Install LED Strip
Refer to the overview picture and table above to connect the Zero, level converter and LED strip. Double check all connections before powering up. The positive feed from the 12V supply must only go to the LED strip and the positive feeds from the Pi must only go to the converter.
After connecting copy the program below to your /home/pi directory and run it. (I use Filezilla for moving files back and forth.)
sudo python3 strandtest.py
If everything is working you should see some amazing colors!
Notes on this LED Strip
The original length LED strip contains approximately 640 LEDs. The LEDs are grouped into 90 individually addressable pixels. You write to the pixels, not the LEDs.
All of the programs list a pixel total. After cutting the strip, the totals should be updated in the progarms. (The programs will still work with the original number. Just a waste of CPU.) Maximum brightness is 256.
Downloads
Install Sound
I am using a cheap USB speaker. If you want big sound you can use the Zero's native Bluetooth or a USB audio card connected to a powered speaker.
Plug the USB speaker into the Zero's USB only port.
Install audio software required for the programs..
sudo -H pip3 install pyalsaaudio
Test the sound.
speaker-test -c2 speaker-test -c2 --test=wav -w /usr/share/sounds/alsa/Front_Center.wav
You can list your audio devices with this command.
aplay -l
You should see something like this.
**** List of PLAYBACK Hardware Devices **** card 0: vc4hdmi [vc4-hdmi], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0] Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: UACDemoV10 [UACDemoV1.0], device 0: USB Audio [USB Audio] Subdevices: 0/1 Subdevice #0: subdevice #0
The USB speaker is named UACDemoV10 and on card 1. This name is used in the main program. If your device name is different you will need to update the program.
If your USB Audio does not appear, turn the computer completely off and power up with your fingers crossed.
If you are hearing a repetitive accessibility message remove this file.
sudo rm /etc/xdg/autostart/piwiz.desktop
Important Note
The USB speaker is finicky. Sometimes it is not recognized by the computer. I don't know why. The fix is simple. Don't sudo reboot. Instead do a complete shutdown and then restart the power.
sudo shutdown -h now
Install Motion Sensor
Use the overview picture and table above to connect the sensor. The wires should be long enough to reach from the computer case to the sensor holder above the hinge bracket.
Copy the following program to your /home/pi directory and run this test program.
sudo python3 detect.py
Downloads
Guitar Solos
Name your shredding files Shredxx.wav where xx starts at 01. Change the loop count in the program to how many you have loaded.
Copy these files to /home/pi/Music.
Install Programs
Copy the programs below to your /home/pi directory.
shredlight.py is the main program.
shred.py plays Shred01.wav to check your audio setup.
off.py turns off all pixels. (duh)
alternate.py lights up every other pixel. This is useful when you cut the strip.
All of the components should be working now. Try it!
sudo python3 shredlight.py
To change the number of pixels change the following line in the program.
LED_COUNT = 50 # Number of LED pixels.
To control brightness change the following line in the program.
LED_BRIGHTNESS = 64 # Set to 0 for darkest and 255 for brightest
To change the volume change the following line in the program.
os.system("amixer -c UACDemoV10 set PCM 70%")
Note
Most of audio files are ending with a length exception in the spectrum analyzer code. I am catching the exception and ignoring it. If anyone knows how to fix this I would appreciate it!
3D Components
All of the models were designed in Tinkercad and sliced in Ultimaker Cura. According to the Cura software, the total filament required for all models is 300 G. You can cut off 64G by skipping the computer case back.
Because of the weird angles involved, most of the models will require extensive support while printing.
Even with a heated print bed, I had to add crossbars and a brim in Build Plate Adhesion to the Hinge Bracket to prevent the model from breaking free and warping. Remove the brim and crossbars after printing.
07/18/22 The "Right Middle Clip" file was a duplicate of the "Left Middle Clip" file. The correct file has been loaded.
Putting It Together Bit by Bit
Use cable ties to attach the Hinge Bracket to the guitar stand. Slide the dowel in. Use a screw to hold the dowel in position. Add a cable tie at the top of the bracket to help support the dowel.
Use two screws to attach the Top Brackets to the dowel.
Use cable ties to attach the clips to the legs.
Carefully squeeze the LED strip into the clips starting with the wired end at bottom right. You should be able to squeeze the LED casing into the straights and curves and it should stay in place without adhesive.
Use the alternate.py program to identify pixel locations and then cut the LED strip to the desired length.
Use a screw to attach the Computer Case Front to the dowel below the Hinge Bracket. Attach the electronics. Install the Computer Case Back.
Use a screw to attach the Sensor Case to the dowel above the Hinge Bracket. Slide the sensor in.
Test it!
Auto Start
Once you are happy with your program, create the following file so the program will automatically start on power up.
sudo nano /lib/systemd/system/neon.service
Add the following lines.
03/18/2022 From user input changed a couple of lines below.
[Unit] Description=Start Neon [Service] Environment=XAUTHORITY=/home/pi/.Xauthority ExecStart=/bin/bash -c '/usr/bin/python3 /home/pi/shredlight.py > /home/pi/shredlight.log 2>&1' Restart=always RestartSec=10s KillMode=process TimeoutSec=infinity [Install] WantedBy=multi-user.target
Restart systemctl. Shutdown
sudo systemctl daemon-reload sudo systemctl enable neon.service sudo shutdown -h now
Power up. The program should startup merrily on its own. If not check the /home/pi/shredlight.log file for any information.
Breaking In
Sometimes you want to stop the auto-started program to make changes. First find its process number.
ps -U pi
Then in the command below insert the process number (PID) from the systemd entry at the top of the previous list.
sudo kill -9 PID
Now you can start programs manually as above.
Complete
Now shred!