Tuesday, March 19, 2013

First Steps - the Raspberry Pi


This post is an introduction to the hardware and software components that make up the computational guts of the Devalbo Robot. If you're familiar with the Raspberry Pi, this might not be necessary. If you're not, or you just want a quick tutorial on how to get a Raspberry Pi up and running, read on! If you have any questions or feedback, make comments.

Hardware - Raspberry Pi

The Devalbo Robot uses the Raspberry Pi as the creamy computer nerve center. It is the hub of all robot communications - between robot components and the outside world. Since it was introduced, it has become a hugely popular ingredient for many hacker projects. If you want some more introductory information, this is a decent reference: http://elinux.org/RPi_Beginners

You will need a Raspberry Pi. Get one!

Hardware - SD Card

You need to put a Linux image on an SD card, which gets plugged into the Raspberry Pi (you can think of it as the Raspberry Pi's hard drive). I'm using this one.

Software - Raspbian

The Raspberry Pi is a low-cost computer board, but it doesn't come with an operating system pre-installed. You will need to download a copy of Linux to put onto the SD card from above. The Devalbo Robot uses the Raspbian distribution - you can download the version I've been testing with from here: http://downloads.raspberrypi.org/images/raspbian/2013-02-09-wheezy-raspbian/2013-02-09-wheezy-raspbian.zip

We will be following the installation procedures described here: http://elinux.org/RPi_Easy_SD_Card_Setup. The steps you follow and tools you use will depend on your operating system. Here is the console output from when I followed the installation procedure using OSX.

~ >cd Desktop/
~/Desktop >df -h
Filesystem      Size   Used  Avail Capacity  Mounted on
/dev/disk0s2   112Gi  107Gi  5.2Gi    96%    /
devfs          182Ki  182Ki    0Bi   100%    /dev
map -hosts       0Bi    0Bi    0Bi   100%    /net
map auto_home    0Bi    0Bi    0Bi   100%    /home
~/Desktop >df -h
Filesystem      Size   Used  Avail Capacity  Mounted on
/dev/disk0s2   112Gi  107Gi  5.2Gi    96%    /
devfs          185Ki  185Ki    0Bi   100%    /dev
map -hosts       0Bi    0Bi    0Bi   100%    /net
map auto_home    0Bi    0Bi    0Bi   100%    /home
/dev/disk1s1   3.7Gi  1.6Mi  3.7Gi     1%    /Volumes/NO NAME
~/Desktop >sudo diskutil unmount /dev/disk1s1 
Password:
Volume NO NAME on disk1s1 unmounted
~/Desktop >df -h
Filesystem      Size   Used  Avail Capacity  Mounted on
/dev/disk0s2   112Gi  107Gi  5.2Gi    96%    /
devfs          185Ki  185Ki    0Bi   100%    /dev
map -hosts       0Bi    0Bi    0Bi   100%    /net
map auto_home    0Bi    0Bi    0Bi   100%    /home
~/Desktop >sudo dd bs=1m if=~/Desktop/2013-02-09-wheezy-raspbian.img of=/dev/rdisk1
1850+0 records in
1850+0 records out
1939865600 bytes transferred in 158.045257 secs (12274115 bytes/sec)
~/Desktop >sudo diskutil eject /dev/rdisk1
Password:
Disk /dev/rdisk1 ejected
~/Desktop >

Connect and Configure

At this point, you have a Raspberry Pi, an SD card with Linux, and it's time to start making connections:

  • Plug the Raspberry Pi into a TV or computer monitor
  • Plug the SD card into the Raspberry Pi
  • Plug a USB keyboard into the Raspberry Pi
  • Plug the Raspberry Pi into your local network using its Ethernet port (Type B has an ethernet port)
  • Lastly, connect a USB power supply to the Raspberry Pi's power port

Once the USB power supply has been connected, the Raspberry Pi will boot up. It will eventually give you the chance to set the following options.

  • Desktop on boot (make sure it is set to selected)
  • SSH Server is enabled
  • Finish booting

Now, you can use the "desktop" or an SSH client to login to the Raspberry Pi (default username/password will be pi/raspberry). Your tiny computer is ready for action. 

In the next post, the Ethernet cable will go - we'll go WiFi for about $10 with this little guy.