Raspberry Pi

Raspberry Pi
The Raspberry Pi is an ultra-low-cost (approximately £20) credit-card sized, Linux computer designed for teaching computer programming to children. The objective of this project is to do exactly that and to teach our 12 and 13-yr old children the basics of computer programming.

Along the way, we are hoping to teach them how it can be used for robotics and home automation. To encourage them in this activity, I'm allowing them to add what ever home automation elements they want to they bedrooms.

This project aims to simply to understand how the Raspberry Pi works and what it is capable of. Driving this research are a number of specific projects that we have in mind though:

It is also worth mentioning a few projects that we have ruled out:

Cycle computer
It is much simpler and easier just to use a Smartphone with GPS capability and there are loads of useful apps available already. These also have the advantage of working in other situations (skiing, boating, etc.). Powering a Smartphone using a dynamo is also much easier than trying to keep a Raspberry Pi powered.

The device supports HDMI video out with sound. There is a standard 3.5mm jack for audio out but, no microphone input. You can add any supported USB microphone for audio in.

The Ethernet is driven via USB 2.0, so the upstream bandwidth would not support Gigabit.

The Purchase

29th Feb 2012

The Raspberry Pi was officially launched at 6am and their servers and those of their resellers (Farnell and RS Components) also crashed under the volume of traffic. The first 10,000 pretty much sold out in the first hour. We managed to order one around 8am but, we are not sure when it will be shipped.

The emails from Farnell have been numerous and keep changing the delivery date. As far as we can tell, ours is due around 26th March.

5th May 2012

Raspberry Pi top
After a rather long sequence of delays, our Raspberry Pi finally arrived on 5th May 2012. The first thing we noticed is there are no mounting holes in the board, for things like hex spacers :-(

The pins in the top left hand corner of this photo are the GPIO pins.

Raspberry Pi bottom
The device is really small, which is good as it means it will work in many more of our intended applications.

Preparation

The first thing you need to do is to register with the Raspberry Pi forums.

Operating Systems

Raspbian 'Wheezy'

In July 2012 a new version of the operating system was released based on the Raspbian optimised version of Debian and with hardware floating point support, to make the RPi much quicker. This OS version also features a nice graphical configuration tool.

The 'startx' command takes you into a nice GUI. The default browser is Midori.

Debian 'Squeeze'

An updated Debian 'squeeze' image release was made on 16th April 2012 and we've used this one initially. To use an image file, you will need to unzip it and write it to a suitable SD card using the UNIX tool dd or Win32DiskImager under Windows. This was a quick and painless process.

Debian Squeeze is the development codename for Debian 6.0.

Early OS Versions

Raspberry Pi recommend the Fedora Remix operating system but initial reviews suggest it is very slow. Quite a few have been tested and reviewed now. Debian looks like the best one to use.

Power Supply

Power is 5V dc and can be taken from a USB port or a USB charging device, so long as it supplies a regulated 5V and also provides the required current. The Model A is rated at 500mA (2.5W) and the Model B at 700mA (3.5W). Most USB ports only supply 500mA. The Raspberry Pi seems very sensitive to the power supply used is particularly sensitive to low voltages.

12V dc to 5V dc converter
We are also testing a dc-dc convertor, which was bought on eBay and is rated at 15W. The plan is to use this in a car (12V to 5V) or from our 12V DC [PR]. This device is marked CPT C155 and accepts an input voltage from 5.5V to about 16V dc. With no load, it draws 14mA with a 12V input.

6-inch USB lead
These StarTech micro-USB leads have proved very handy for use with the Raspberry Pi. They are 6"e or 15cm long.

Display

HDMI to DVI lead
You can use a phono cable to display composite video output on a TV/monitor but its not a very good picture. We have a Dell monitor but it only has DVI input. We picked up this HDMI to DVI cable on Amazon for £2.25 delivered.

Installation & Configuration

SD Card

We have an old 8Gb Dane-Elec SD-card (class 4) sitting around that we plan to use for this project. There have been a lot of issues with SD-cards and it is worth reading the forums to see which ones will work.

2Gb partition
Using the df command (stands for 'disk free'), we could see that only 2Gb of our 8Gb SD-card was available. The process to recover the reminder will be captured here soon. This is because the image is designed for 2GB cards and we need to resize the partition to take up the full size of the card.

You can't use Windows partition editor as it doesn't understand the Linux filesystem used (ext4) and thus can't resize it. We used a program called GParted to resize the partition, which has a nice GUI (rather than being just a command-line tool).

Installation is simply a matter of plugging in a mouse (we are using a Microsoft Comfort Optical Mouse 3000), keyboard (we are using a Microsoft Wired Keyboard 600, ~£9 on Amazon), video cable, network cable and then finally, the power. The Pi boots up quite quickly and presents a login prompt. With this O/S build, the default username is 'pi' and the password is 'raspberry'.

Cases

Raspberry Pi case from ModMyPi
We bought a case from ModMyPi. There were a few delays in production but, this is a quality product and protects the Pi well. Most cases don't provide access to the GPIO header. This case has slots above it that coould be opened out to enable this.

In Use

Packages

If you are new to Linux, then you might want to start by reading this mini 'apt vs aptitude' tutorial.

Apache Web Server

One of the things we want to install is the Apache web server and installation of the Debian version is an easy task.

GUI

The Raspberry Pi Debian build comes with a GUI package and this is started by entering 'startx'.

Scratch

Scratch is also installed on the Debian build.

Web Browser

The GUI also includes a basic Midori web browser. This also has pretty good HTML5 support.

DLNA & NAS

This is an area we will be looking at in more detail:

Interfaces

From our perspective, the Raspberry Pi is only really useful if we can interface it to some other hardware, to enable monitoring/sensing and control. The great thing about the BBC Micro was that it had I/O ports.

GPIO Pins

Raspberry Pi GPIO header
The Raspberry Pi has a GPIO connector and this exposes a number of signals and buses. There are 8 general purpose digital I/O pins, which can be programmed as digital outputs or inputs. One of these pins can also be designated as PWM output. There is also a 2-wire I2C interface and a 4-wire SPI interface (with a 2nd select line, making it 5 pins in total) and the serial UART with a further 2 pins. The GPIO pins on the Pi are 3.3V and not 5v. This means they are not suited to longer distances and there is no buffering or protection present.

There is a good description of the pins and their functions on the Embedded Linux Wiki. There has been some discussion about the choice of connector used but, our view is that its there, so just get on with it!

DIL 2x13 header sockets
To connect to the header pins, an 13x2 IDC connector is required.

In practice the GPIO pins can sink 30 mA absolute max (and the official maximum rating is only 16 mA). Also, they are 3.3V logic level and not 5V tolerant. Do not plan to put more than 3.3V on or 16 mA current through any GPIO pin, if you count on the Pi to be still working. This means that when used for input or output, it is much safer to use opto-isolators.

Velleman K8055 USB I/O Board

Velleman K8055 USB I/O board
We are only really looking at the Velleman K8055 USB I/O board is because we have one sitting around on a shelf unused and happened to come across this project to provide a Linux K8055 library.

Dallas 1-Wire

Interface to our should be very simple, as it is simply re-using our DS9490R USB 1-wire adapter. We will be testing this out very soon. There are also some active projects underway by other people to interface directly via the GPIO pins.

Bluetooth

Zoomtel Bluetooth dongle
This is now a new project and is looking at device tracking and privacy issues. We have managed to get the Raspberry Pi to track family members reliably and accurately going to and from our home, using their Smartphones.

GPS

We would like to generically support GPS on the Raspberry Pi for a number of projects we are looking at.

Hardware

Bluenext BN903S GPS dongle
For the GPS hardware we are using a Bluenext BN903S. This is a cheap (~£18), high performance USB dongle. So far, we have failed to get this device working under Linux (on variousm devices and various distributions).

We tested the device on a Windows 7 PC using PuTTY and we could see a stream of data coming back from the device at 9600. It uses AGPS and acquisition time is very quick.

Getting this working under Linux is simply a matter of plugging it in, or so we thought. When it was plugged in it was identified correctly as a serial USB device and mapped to ttyUBS0. This also created a symbolic link to /dev/gps0. The command dmesg | grep tty showed it as a CP210x converter attached and available at ttyUSB0. The command lsusb also listed the device correctly and showed the VEndor ID to be 10c4 and the Device ID to be ea60.

Typing sudo setserial -a /dev/ttyUSB0 does not work (claims ttyUSB0 is an invalid argument) and I wasn't convinced it was set to the right baud rate. Attempting the command, sudo setserial /dev/ttyUSB0 baud_base 9600 also didn't work. sudo stty -F /dev/ttyUSB0 9600 and sudo stty -F /dev/ttyUSB0 speed 9600 both worked though.

We tried both PuTTY and screen but, neither of these would see any output from the serial device. We also noticed some permissions errors but, did a sudo chmod 666 /dev/ttyUSB0 but, this allowed the terminal clients to connect, still no data.

We now currently stuck! :-(

GPS Software

Most USB GPS modules have a simple USB-Serial interface which is supported by the Raspberry Pi. You then just need to install GPS software. We plan to focus our efforts initially on GPSd. GPSd is a service daemon that monitors one or more GPS or AIS receivers attached to a host computer through serial or USB ports and makes all the data on the location, course, velocity, etc. of the sensors available to be queried on TCP port 2947 of the host computer. It basically handles the parsing of the NMEA 0183 protocol messages.

Satnav Software

We then just had to ask the question: What Linux satnav applications are there out there? This page provided a decent answer. The NAViT program looks like a good starting point.

Webcam

This is now a project in its own right.

Summary

It's been 20 years since we did any UNIX system management and we have little familiarity with Linux. So far, it's been quite a steep learning curve to get the Raspberry Pi configured as we want it. It's fair to say we have hit some issues.

Despite being a widely operating system, Linux is along way from being a good OS from a end user perspective. The reason for its wide adoption is simply because it is cheap. It's quite a complex operating system to get to grips with and this is made much worse by the fragmentation issues. We are using several Linux distributions and they are both very different.

Java

To install the default JRE (Java Runtime Environment) on your system, run: apt-get install default-jre

We have a key requirement to install the Java JDK on our Raspberry Pi though and Oracle announced availability of JDK 7 Update 6, which includes a new JDK port to Linux ARM.

Hardware Issues

HDMI

On the face of it, the HDMI output looks like a good choice but, we found connectivity to existing computing equipment much harder because of this choice. We can see this being a real issue in schools and colleges.

Power Supplies

It seems that a lot of the power supplies out there simply aren't good enough and don't provide a stable voltage under load. The Raspberry Pi is particularly susceptible to low voltages. We have used Apple iPhone chargers and Android Smartphone chargers without issues.

Keyboards

We have experienced issues with keyboards and it appears this is a common thing. Our investigations using both Debian and Arch Linux suggest that the Arch Linux distribution is a big factor and we get regular key press repeats with it.

News & Updates

There are loads of news stories on the Raspberry Pi. Those of particular interest to this project are listed below:

September 2012

The Raspberry Pi is to be made in the UK in the future.

July 2012

A new version of the operating system was released. This is the release based on the Raspbian distribution and replaces the Debian squeeze image as the recommended install. It is the first official image to take full advantage of the Raspberry Pi's floating point hardware and should make many things faster.

Jan 2012

One of the Raspberry Pi developers shows it running Apple AirPlay:

December 2011

Guardian article: At Kesgrave High School in Ipswich (our children's school), a state school, computing teacher Clive Beale is eagerly awaiting the machines.
"There's not been anything like it for 25 years" he says. "We'll boot it up and it will just blink at us  we'll have to tell it what to do. It's going to give pupils a chance to be creative."

Related Reading

There are some interesting projects underway around the Raspberry Pi:

  • @space_pi is a Twitter account for a project to put one into space.
Share ...
We are on ...
Facebook Twitter
YouTube Flickr Follow us on Pinterest