Monthly Archives: March 2015

Raspberry Pi for Theater

Raspberry Pi: Live @ The Brick Box

I was helping with a Theater production at the Brick Box here in Rutland, Vermont. I was in charge of running the lights and sound, but the only sound they needed for the show was a telephone ring. I could have looked online for a phone ring device designed to be used in theater, but instead I decided to use a Raspberry Pi to get the job done. Here is how I did it.

First off, I was going to be in the back of the audience, and the phone ring needed to come from behind the stage. So I needed a way to have my Raspberry Pi Setup back stage, but be able to control it from the back of the theater. I decided to set it up as it’s own wireless access point, with DHCP server. To accomplish this, I configured the wireless adapter on the Pi with a static IP address of 192.168.42.1, and installed a program called hostapd. The hostapd program allows you to broadcast an SSID (name of network for other devices to see and connect). Then I edited the config files to use the name I wanted for the network, as well as set a password, so only I would be able to connect to the network. I also needed to install  isc-dhcp-server which allows the Pi to act as a DHCP server, and assign IP addresses to any device that connects to the Pi’s wireless access point. After all of these were install and set up properly, my Pi was ready to run headless (without a monitor connected to it).

To set up the wireless access point, I followed instructions found here: https://learn.adafruit.com/setting-up-a-raspberry-pi-as-a-wifi-access-point?view=all

Now that my Pi was set up properly, all I needed to have plugged into it was power, and a speaker for the ring noise. I used a rechargeable speaker called a Music Bullet I got for Christmas a few years ago, but never really used til now. I also used a Lenovo Battery pack for recharging devices like cellphones and tablets on the go. I tested it, and the battery pack can keep the Pi powered and running for the better part of a day on a single charge. The only thing left to do was copy the sound file to it.

Pi Project finished

Bottom: Lenovo Battery, Middle: Raspberry Pi in a case, Top: Music Bullet rechargeable speaker.

IMAG0008

All that needed to be plugged in was Power on the left, and speaker audio cable on right. The wireless adapter is inside the side door of the case, and protected from being removed.

Screenshot from 2015-03-22 11:10:02

I connected my Laptop to the wireless access point of the Pi, in my case it was called TheCocktailHour as that was the name of the show.

Continue reading

Programming Languages and Raspberry Pi

There are two programming languages that are popular for use with the Raspberry Pi computer.  The first is Scratch which is a visual programming language.  The second is Python which has a more traditional approach, with text-based language statements, and use of a text editor interface for program development.

Last year, the Rutland Tech Club hosted two Scratch programming events.  Scratch is a visual programming tool developed by MIT.  The programming language constructs resemble “Lego” blocks which can be snapped together on the computer screen to build programs.

On the Raspberry Pi computer, the Raspian Linux operating system it comes with it’s own custom version of Scratch.  This version of Scratch allows access to GPIO connections on the Raspberry Pi, which are the general purpose I/O or input/output connections.  That means you can access external input sensors and output devices which can be connected to the Raspberry Pi, via the GPIO connectors.  For example, you can instruct Scratch to read in a sensor input (i.e. motion sensor, temperature sensor, etc.) or send output command to output device (i.e. camera, LED lights, etc).

Python uses the more traditional form of programming, using text commands and statements, where the programmer must input the proper program language syntax in order to instruct the Raspberry Pi what to do.  Python is a popular computer language, which has some interesting syntax features.  Unlike other computer languages, the “if” statement (conditional, if – then – else), does not use curly braces “{” and “}” to delineate the statements within an if code block or else code block.  Instead, Python uses consistent code “indenting”.  This can make for a more readable program.  In other words, program whitespace or indenting is critical in Python, whereas in other languages, proper use of whitespace is not critical (although highly recommended for readability).

Just as in Scratch programming, you can use Python to access GPIO connections to input sensors and output devices.  The Python approach is text-based programming instead of Scratch’s visual programming method, but the same types of things can be done in both languages.

The Codecademy.com website is a good place to begin to learn Python.  The tutorials are grouped into units and also include some problem solving exercises to allow you apply what you just learned.

Whatever types of projects you want to do on your Raspberry Pi, having some knowledge of Scratch or Python programming is very helpful.

 

Videos From Raspberry Pi Event

Thanks to everyone who attended the Raspberry Pi Event we hosted at the Rutland Library on March 14th 2015 (Ultimate Pi Day).

Here are the videos that were shown at the presentation. The first few are from the Raspberry Pi Foundation, on their website.  The rest are from YouTube.  There are many more videos on the Raspberry Pi on YouTube, which you can easily find by searching for them.

What is Raspberry Pi?

http://www.raspberrypi.org/help/what-is-a-raspberry-pi/

San Diego (CA) school kids and Raspberry Pi

http://www.raspberrypi.org/san-diego-schoolkids-and-raspberry-pi/

Raspberry Pi Stories (links to more videos and articles)

http://www.raspberrypi.org/stories/

Raspberry Pi as seen on YouTube (more videos)

Continue reading