LightShow Pi ~ Early Tech Behind the Laminar Fountain

Today was awesome. I made huge progress in the tech side of the laminar fountain project.

I found a software called LightShow Pi, which was originally created for Christmas light shows, but many people have used it for smaller projects of their own.

The first step after getting an LED to flash with the Pi was to install the software. First I had to update all the packages ‘n stuff on my system with sudo apt-get update and sudo apt-get upgrade. That took around thirty-minutes to fully install.

Next I cloned the LightShow Pi repository off of GitHub: cd ~
git clone https://togiles@bitbucket.org/togiles/lightshowpi.git

And change to the stable branch of code: cd lightshowpi
git fetch && git checkout stable

Once completed, you install the stuff! Just make sure you’re in the “lightshowpi” directory. Then you can run: sudo ./install.sh.

This part tripped me up, because it took over two hours. Everything installed fine until it started running the line Installing rpi-audio-levels.... My Pi got really hot and stuck, so I rebooted and tried to reinstall, but it kept getting stuck. img_4697

I left it for about 2hrs (with many checks in between) before seeing that it had finished. Then I rebooted as the instructions said.

After that, the next step would be to build the actual LED setup on my breadboard. Initially I tried following this link, but only for a generic idea of how to wire the breadboard. I didn’t have a breakout board, so I went back to basics and made a simple circuit like the one in my last post, but with eight LEDs instead of just one. Next I attached the pins of the Raspberry Pi (3.3V and Ground) to the breadboard:img_4706

Next step was to figure out what GPIO pins the Pi was using for the project, the google doc said GPIOs 0-7. I used this chart to locate them.

img_4708

img_4712

Lovely mess, ain’t it? The pins are attached to their respective LED, and each LED is also connected to ground.

Finally, I could plug it all in and test this thang! To test it and make sure you have all the right channels, you run sudo python py/hardware_controller.py --state=flash

Each LED blinked twice, and I knew I had the right setup.

To play music, there were a few more steps I had to take. First, to make sure I had audio output, I connected my audio jack to a portable speaker I had (that’s the blue thing). Next I had to actually find the music. Using a Lexar USB, I pulled some mp3 files from my music collection and put them on the USB, which I connected to the Pi. Then using the command sudo python py/synchronized_lights.py --file=/home/pi/Desktop/Music/singles/shelter.mp3

With --file=, you continue the command with the file path of where your music is located.

After all that work, I got this wonderful result. https://youtu.be/oHTUvcA52Bo

Next step, to try it with RGB LEDs. Until next time!

 

Projects, Packages, and Progress, Oh My!

Good Morning, all!

It’s not really morning, but I like that greeting.

This past week has been filled with crazy excitement and many new things! I received two awesome packages filled with electronic components such as logic gates, cords, jumper wires, LEDs, RGB LEDs, resistors, and a breadboard. I couldn’t wait to start working with a breadboard for the first time.

My beginner storage is pretty good for now, but I can tell I’m going to fill it pretty quick and will have to upgrade to something else soon.

The first thing I did was find a guide on how to set up an LED on a breadboard and found this great article. To say I was ecstatic when I built my first circuit was an understatement.

I figured you could put multiple LEDs in a row, because that’s just a bunch of resistors in parallel and it would work, so I played around and got a happy rainbow:

I did learn that breadboard wire links are the same as jumper wires, they’re just specially sized for different purposes.
In my package I received an RGB LED (common cathode) as well, which is a Light Emitting Diode that has a Red, Green, and Blue LED in it, and it can make multiple different colors depending on the intensity of each LED. I had no idea how to get it to change colors, so I pulled out my Raspberry Pi for the first time and started experimenting, as I knew there were ways to get an RGB to work with a Pi.

My parents were a bit shocked when they came out and saw I had turned the TV into a monitor, but I assured them it was okay and I wasn’t going to break the TV with my programming.

I didn’t have a usb mouse to connect to my Pi, but I did have a nice mechanical keyboard that I got to highlight the desktop apps, which, fortunately, one of them was a terminal. (I love terminals.) I got the terminal up and running, next I needed to get the RGB LED hooked up to the breadboard and then connect the breadboard to the GPIO pins of the Raspberry Pi.

With this picture, I got the general idea of how to set up the wires in the breadboard and connect them to the Pi:

I must admit, it took me way too long to figure out that I had a Raspberry Pi 1, not a Raspberry Pi 2. Heh. Once I discovered that, I could effectively attach my jumper wires to the appropriate GPIO pins on the Pi, using this diagram:

gpio-pinout

Raspberry Pi I GPIO Chart

The code I used required me to attach my cathode (the longest pin) to pin 6, GROUND. The RED pin I attached to GPIO 12, GREEN I attached to GPIO 16, and BLUE to GPIO 18. Here’s a picture of it all set up (from two different angles).

Once I connected the wires right, I could start finding code to get this LED to work. After searching for code that worked with a Raspi 1, I stumbled upon this website by a guy named Henry Leach. Boy, was I glad to find his post. He showed his calculations about resistors and picking the right values to get the brightest colors, and then nicely shared his code that cycled through a variety of colors with his LED.

I don’t know anything about Python (yet), but I went with it because I wanted to get this thing working. I typed in all the code (which was painstaking, because I use a dvorak keyboard layout, but it was in US on the Pi. That took a while…) into the terminal text editor, nano. To get there, I opened a terminal and executed nano rgb.py

Once I finished typing that all out, I assumed IDLE was a Python Shell, so in a terminal I executed idle . From my experience with a Forth terminal, I knew if you wanted the code to be used in that session you had to use include filename.fth to use your code within the shell. I assumed import did the same thing, and viola, it worked! I had some syntax errors but once I fixed those and ran the program, I got a wonderful result:

I think the lights were a bit shaky at certain colors because I only had 1k Ohm resistors, so once I get my package of 30 different types of resistors today in the mail I’m going to try this project again to see if it makes a difference.

Now my goal is to replicate this in C code, as I’m going to learn it. After that, I’m going to attempt to get the LED to change colors and respond based on the waveforms of music that is playing, and eventually put this tech in the laminar water fountain I’m building with my friend.

I’ll put a post up about the fountain soon, we just bought the first installment of the supplies and materials, and once we start building it I’ll put up a tutorial type post.

Before I wrap up this post, in other news, I received a mandolin from my Nana as an early birthday present and I couldn’t be more excited!

I’ve been teaching myself some scales, and I’m working on the Irish Washerwoman melody picking. I’m thinking of naming it Henry. What do you all think? 🙂

Cheers!