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

Choose

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:

startx

– 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

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 127.0.0.1

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@10.0.1.20

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:

startup_mailer

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@10.0.1.20:/home/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.

TroubleShooting
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.

Raspberry Pi – Keyboard Layout

You may find that certain characters do not show up as expected when typing on a keyboard connected to your Pi. This is because the default keyboard layout is set to work in Great Britain and some of the character mappings are different. To fix this you need to change the keyboard layout to work in the US.

To change the keyboard layout you need to edit a file. Type:

sudo nano /etc/default/keyboard

Change the line:

XKBLAYOUT="GB"

To:

XKBLAYOUT="US"

Save the file and reboot the Pi

sudo reboot

Raspberry Pi – Backing up the SD Card

1. Shutdown the Raspberry Pi:

sudo shutdown -h now


Remove the SD card and insert it into your laptop’s card reader.
2. On your laptop’s local terminal program type:

mkdir ~/Desktop/Pi_BU

to make a folder for the backup image
3. Then type:

df -h

and look for your SD card. Make note of the disk number. It should look something like: /dev/disk3s1
4. Unmount the SD card:

diskutil unmount /dev/disk3s1

(change the 3 to your card’s disk number)
5. Start the backup:

sudo dd if=/dev/rdisk3 of=~/Desktop//pi_BU/wheezy-backup.img bs=1m

Wait about 10 minutes for an 8GB card

Raspberry Pi – Image Viewer

Raspberry Pi Image Viewer

INSTALL AN IMAGE VIEWER ON THE PI – Single view and Slideshow

To install the FBI image viewer type the following in a terminal on your Pi:

sudo apt-get install fbi

To view an image type the following:

sudo fbi -d /dev/fb0 -a -T 2 0001.jpg

#  the -d /dev/fb0 flag calls a 'framebuffer'

#  the -T 2 is needed when controlling the pi via SSH - tells it to use the Terminal for input

To "unview" the image you have to kill the FBI process. To find the FBI process type:

ps -aux | grep fbi

# ps -aux lists all processes running which is then "piped" (|) to the grep search function which looks for any fbi processes

To kill the FBI process type:

sudo kill  [process id number]

To start a slideshow of images in a folder via SSH terminal

sudo fbi -d /dev/fb0 -a -T 2 -t 5 *.jpg

#  the - t  (lowercase) sets the time interval in seconds between images

To start a slideshow of images in a folder without the photo information on the bottom of the screen type:

sudo fbi -noverbose -a -t 10 -T 2 -d /dev/fb0 *.jpg

Digital Meditation Loop No.2

Digital Meditation Loop No.1

I’ve been experimenting with sound and video collisions using max/msp/jitter. The result of this particular collision is a one minute video loop using footage of a Dutch herring chef and a processed field recording of the market where the herring stand was located. The sonic and visual processing is driven by a crossed feedback network of parameter data from the digital audio and video files. The sound affects the video and the video affects the sound.