Raspberry Pi – TimeLapse Video


Here are instructions for capturing and compiling a time-lapse video using a Raspberry Pi and the PiCamera module.

Upload and edit the time-lapse video script

1. Connect to your pi via the terminal :

ssh pi@

change the IP address to match your Pi

2. Create a 'scripts' directory in your home folder of your pi:

mkdir scripts

3. Open a new terminal window to work locally on your laptop. Put the time-lapse Python script on your desktop.

4. On your laptop terminal type the following to upload the time lapse python script to your pi:

scp /Users/dwingus/Desktop/TL.py pi@

Change "dwingus" to your laptops username and change the IP address to match your Pi

5. You can edit the TL.py to change the filenames or the speed at which images are captured.

sudo nano TL.py

Make your changes and then save the file.

Stream the video feed from your Pi to your laptop to setup the camera

You will need to install two applications on your laptop to make this step work. You will install HomeBrew and MPlayer

HomeBrew is a package installer for Os X. Installing HomeBrew will allow you to easily install MPlayer. It will also allow you to use additional unix commands that are not included in a standard Os X install.
1. Go here: http://brew.sh
2. Scroll to the very bottom of the page and follow the "Install Homebrew" instructions.
3. The first thing to do after installing HomeBrew is to type into command line:

brew doctor

4. Type the following to install MPlayer

brew install mplayer

You will need to have two terminal windows open on your laptop. One will be for the Pi and the other will be a local terminal. Start MPlayer on the local terminal. It will listen for the video stream from the Pi. MPlayer should always be started first. The video stream on the RPI will be started using raspivid which pipes the video output to NC.

You will need to know your laptops IP address in order to send a video stream to it. To do so go to System Preferences / Network and make note of the IP address. You will need it in the following steps.

on the mac terminal type the following command:

 nc -l 5001 | mplayer -fps 31 -cache 1024 - 

This starts MPlayer and has it wait for an incoming video stream.

on the Pi terminal type the following command:

raspivid -t 0 -o - | nc [ ip address ] [port number] 

My command looked like this:

 raspivid -t 0 -o - | nc 5001 

This starts the Raspivid and pipes its output to your laptop. You should now see the video stream from the Pi Camera in MPlayer on your laptop. This will allow you to adjust the PiCamera remotely in order to setup a nice shot for capturing a time-lapse video.

Running the Python time-lapse script
Once you have setup a nice shot do the following to start capturing images:

Start the time-lapse python script with the following command:

sudo python /home/pi/scripts/TL.py

This will start the image capturing sequence. The script will automatically create a new time-lapse folder with a time stamp in the folder name. It will then start saving JPG files into the folder. There will be many JPG files! You may need a bigger SD card!

To have the script start immediately on boot:

sudo nano /home/pi/.bash_profile

Put the following in the bottom of the .bash_profile file:

python /home/pi/scripts/TL.py

Save the file and reboot

Compiling the JPG files into a time-lapse MP4 movie

Navigate to the time-lapse folder and list the file names into a text file.

sudo ls *.jpg > stills.txt

Run apt-update on the Pi to update all of the library packages

sudo apt-get update

Install a program called mencoder

sudo apt-get install mencoder

Navigate to the time-lapse folder containing your JPG files and run the following command to create a movie file

mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4:aspect=16/9:vbitrate=8000000 -vf scale=1920:1080 -o timelapse.avi -mf type=jpeg:fps=24 mf://@stills.txt

This will take a while depending on how many images there are to process. Once the process is complete you should see a file called timelapse.avi in the folder.

To play the movie:

omxplayer -o hdmi timelapse.avi

Audio-Visual Installation at ICMC


I will be premiering a new audio-visual installation titled PiAV at this years International Computer Music Conference in Athens, Greece from September 14th through September, 20th 2014.

PiAV is an immersive multi-sensory environment created using twelve Raspberry Pi computers. I have created a portable 8-channel sound environment using custom made speaker boxes, networked Raspberry Pi computers, OSC and Pure Data. In addition I have created a 2-channel video-feedback and motion tracking system using four Raspberry Pi computers, Raspberry Pi camera modules, OSC and a custom Python script. Since the Rasperry Pi computers are so small the whole system is completely portable and only requires a gallery space, a wifi connection (I can bring an ethernet hub if necessary), two video projectors and power.

PiAV is an installation that can be observed and is also participatory but in a subtle way. In its more static form PiAV makes use of quiet sin waves that are tuned in a unique just-intonation scale and activate the space through subtle beatings. Meanwhile two channels of abstracted video images are generated using very simple digital processing inspired by traditional analog video feedback techniques. The system is cross-polinated whereby the ever-changing combinations of pitches (clusters) influence the video feedback system and the colors and the amount of motion within the video influence the audio parameters creating a meta feedback system. Two additional Raspberry Pis are used for simple motion tracking of the gallery space. When viewers/listeners enter the environment their movements are tracked providing another subtle input to the audio-visual system which cues interaction and participation.

Raspberry Pi Workshop at Machine Project

Raspberry Pi workshop

I will be teaching a three day Raspberry Pi workshop at Machine Project on Tuesday, July 29th, Thursday, July 31st, and Tuesday, August 5th, 2014. The workshop will focus on using the Raspberry Pi camera module with an emphasis on basic video and audio applications.

In this workshop we will cover getting started with Raspberry Pi computers with an emphasis on working with HD video playback, using the camera module and getting started with sound output using Pure Data. Technically inclined audio-visual artists are encouraged to attend but anyone with a general curiosity about the Raspberry Pi and Linux is welcome. The first class session will focus on getting the Raspberry Pi up and running which will include: installing the system, configuring a WIFI module, and running basic commands

The second class meeting will cover playing back HD video files with a Raspberry Pi and using the camera module to capture HD videos to disk, creating a Python script to make a time-lapse camera capture device, and if time permits we will explore a RaspberryPi “Video Synth” that is remotely controlled from your laptop.

The third class will meeting will delve into using the Raspberry Pi’s built-in audio functions which will include: basic audio playback, installing Pure Data, and running Pure Data patches on a Raspberry pi.

Dog Star Orchestra Concert Series

Dog Star Orchestra

I will be co-curating a concert and premiering a new piece for the 10th annual Dog Star Orchestra concert series. The concert will take place on Tuesday, June 10th 2014 at The Wulf in Los Angeles. The Dog Star Orchestra concert series was founded by composer Michael Pisaro over ten years ago and highlights experimental sound practices and performances by LA based composers and performers.

The first half of the concert on June 10th will feature a performance of Robert Lax’s Black and White Oratorio organized and directed by Sara Roberts. The second half of the concert will feature three new computer music works for the Raspberry Pi based speakers that I recently developed and built. Billed as Three Pieces for Networked Speakers the second half of the concert will feature Type A Nightmare No.2 by Clay Chaplin, Synopsis by Sepand Shahab, and A Glimpse by David Paha. Performers will include Jenica Anderson, Clay Chaplin, Heather Lockie, David Paha, Sepand Shahab, and Stephanie Smith.

Recording session with Mark Trayle


I recently finished a recording session with composer Mark Trayle. We recorded his piece Nearfield Edges in the Wild Beast concert hall at CalArts. Mark’s piece uses a piezo-based feedback mechanism to activate the space with very high frequencies (in the 13K range) that bounce around the room and create mind altering sonic experiences. I used the mid-side stereo technique with a Schoeps CM5 as the mid and an AKG 414 as the side for the main pair. I used an array of Neumann km-184s in the back of the hall to capture room resonances. Look for a release of the piece in the late summer of 2014.

Raspberry Pi – Installing the System


Installing the system on your SD Card

1. Download the system software here:
http://www.raspberrypi.org/downloads – choose the latest Raspian “Wheezy” installer

Once the file downloads, extract the image by double clicking on the download file and put the image file on your desktop.

2. Insert your SD card into the card reader and see that it mounts on the desktop
3. Open the OS X Disk Utility application from your Utilities folder.
4. Select the SD card partition in the left-hand menu and click on the erase tab.
5. Make sure the format is MS-DOS(FAT) and click on erase to reformat the card.
6. Once the card formats choose ‘verify disk’ and look for the BSD name: must be something like diskn where n is a number (for example, disk4). Note this number.
7. Click Unmount from the menu above.
8. Open the Terminal application from your Utilities folder and run the following:

sudo dd if=path_of_your_image.img of=/dev/diskn bs=1m

Make sure to replace the ‘n’ of ‘diskn’ in the command with the number you noted from the BSD name in the previous step.

here’s what the command looked like on my computer

sudo dd if=/users/dwingus/desktop/2014-01-07-wheezy-raspbian.img of=/dev/disk3 bs=1m

This step copies the Linux system software onto the card. Once you hit return to start the 'dd' command your terminal will look like nothing is happening at all. This is a good thing. Go get some coffee and relax. An eight gigabyte SD card takes around fifteen minutes or so to format properly. Larger SD cards will take longer.

When the card is formatted you will see something like the following on your terminal:
2805+0 records in
2805+0 records out
2962227200 bytes transfered in 1002.34582 secs

You're done!

Drag the icon for your SD card to the trash and remove it from your laptop.

Insert the SD card into the Raspberry Pi and plug it in. Have fun!

Raspberry Pi – Initial Configuration for Video

raspberry pi video configuration

Raspi-Config Menu

When you boot your Raspberry Pi for the first time make sure it is connected to a display. The software configuration window should open. You can run the raspi-config program from the terminal at any time by typing:

sudo raspi-config

In the raspi-config menu navigate to the following options and make changes:

1) Expand the filesystem – will resize the amount of storage space available
2) Change User Password: the default is raspberry. change it to be r
5) Enable camera – yep. gotta turn it on
7) Overclocking — set to High or Turbo
8) Advanced options –
- A2 Hostname – you can change this if you’ll be working with multiple Pis via a command line
- A3 Memory split for gpu – set to 256
- A4 SSH – confirm that the SSH server is on. It should be by default

Click finish and reboot the Pi.

Change the Time Zone

On your Pi’s terminal type:

sudo dpkg-reconfigure tzdata


US, pacific ocean

Software Update
Its a good idea at this point to make sure all of the Pi’s software is up to date. The system version we installed was created in January so some of the libraries and programs have been updated since then. Type the following commands to do a complete software update

sudo apt-get update
sudo apt-get upgrade  

Your Pi is now configured! type the following to reboot

sudo reboot

Raspberry Pi – WIFI Setup


To get a WIFI dongle going I find its easier if you use the Pi’s GUI. To do so make sure the Pi is connected to a video monitor and your WIFI dongle is plugged into a USB port. Start your Pi and login.

- To start the Pi’s GUI type:


- Double click on the WIFI Config icon that is on the desktop. A status window will open.
- Click the Scan button to scan for wireless networks.
- Select the network you’d like to join and double click on its name. Another window will open.
- In the first field labeled SSID make sure that the network name is displayed correctly
- In the PSK field type in the network password
- That is all you need to edit. Click on the Add button on the bottom of the window. Then close the Scan window
- In the main window titled wpa_gui you’ll see the network status. If you successfully joined the network the Status field will say Completed
- Look at the last field titled IP address and make note of the IP address. You’ll need the IP address in order to login to the Pi remotely from your laptop.

Disable WIFI Power Saving

If you find that your wireless connection is spotty and unpredictable try disabling WIFI power saving.Do the following:

- Type

sudo nano /etc/modprobe.d/8192cu.conf

to create a new config file
- Paste the following in to the file:

# Disable power saving
options 8192cu rtw_power_mgnt=0 rtw_enusbss=1 rtw_ips_mode=1

- Save the file
- Type

sudo reboot

to reboot your Pi

The following link provides more information on getting setup on a wired or WIFI network.

Adafruit WIFI Overview

Raspberry Pi – SSH & Remote Login

SSH picture

At some point you probably will want to connect to your Pi remotely using the Terminal program on your laptop. This allows for the Pi to be run “headlessly” – meaning a display is not connected to the Pi.

In order to connect to the Pi from your laptop the Pi will need to be connected to a network and you will need to know the Pi’s IP Address. Type the following command on your Pi:

ip addr

and make note of the IP address. Its the other one, not

Make sure your laptop is connected to the same network as the Pi you’d like to remotely connect to. On your laptop open the Terminal program from the Utilities folder. At the prompt type:

ssh pi@ip-address 

replace ‘ip-address’ with the actual IP address of your Pi

The command looked like this on my laptop:

ssh pi@

Press return, answer ‘yes’ to the authentication question, and enter the Pi’s password

Raspberry Pi – Email IP Address


When running a Pi headlessly it’s helpful to find out the IP address without having to connect the Pi to a display. A Python script can be executed on boot to send you an email that contains the Pi’s IP address. You’ll need to edit the Python script that is linked below and one other file on your Pi to make this happen. You also need to know the Pi’s current IP address.

Download the following python script to your laptop:


Once downloaded, change the name to “startup_mailer.py”
Open the file in a text editor on your laptop and add information to the following variables:
     to – this is your email address
     gmail user – this is your gmail username
     gmail password – this is your gmail password
Save the file to your desktop

It’s probably pretty obvious but you have to use a Gmail account. In the next step you will upload the python script from your laptop to your Pi.

Upload the script to your Pi using a new ‘local’ terminal window on your laptop
In the Terminal program on your laptop type command-t to open another session window. Make sure you are typing commands to your laptop and not the Pi! Check the command line prompt at this point.
In the new / local terminal window type:

 scp /users/username/desktop/startup_mailer.py pi@ip-adress:/home/pi/scripts

make sure to edit the username and ip-address to match your settings. The command, assuming startup_mailer.py is on the desktop, looked like this on my laptop:

scp /users/dwingus/desktop/startup_mailer.py pi@

Back on the Pi’s terminal window (check the prompt) move to your home directory

cd /home/pi

Make the python script executable

sudo chmod +x startup_mailer.py

Make a new directory called scripts

sudo mkdir scripts

Move the startup_mailer.py file to the scripts directory

sudo mv startup_mailer.py scripts

Now the python script is in place and is ready to be executed.

Edit the rc.local file that will call the startup_mailer.py script when the Pi boots

Open the file rc.local in the nano text editor

sudo nano /etc/rc.local  

Add the following right above “fi”:

python /home/pi/scripts/startup_mailer.py

Save the file

rc.local is a file that is called at the end of the Pi’s boot sequence. You’ve placed a command in rc.local that calls Python to execute the startup_mailer script that ultimately emails you the Pis IP address.

If you find that you do not receive an email when the Pi boots try a couple of things:
- confirm that you entered all of your email information correctly in the python script

 sudo nano /home/pi/scripts/startup_mailer.py

- make sure your Pi is connected to the internet

 ip addr

- try running the script directly from Python and then check your email

sudo python /home/pi/scripts/startup_mailer.py

- If you get an email when running the script directly as in the line above try adding a pause to the rc.local file.
Open the file rc.local in the nano text editor

sudo nano /etc/rc.local  

Add the following right after # Print the IP Address

sleep 5 

This will cause the system to wait 5 seconds before executing the python script. Sometimes the Pis need just a hair more time to establish a network connection.