The following are the steps I took to get my raspberry pi set up for development. I like to keep wires to a minimum, so by the end of this you should be able to plug your rPi into an outlet somewhere and connect to it remotely via ssh.
1- Ordering parts
Lets start from the beginning. The following is a minimal list of parts you’ll need.
A Raspberry Pi Model B – $35 – here
Shipping times can vary wildly due to high demand. Mine took 4 months(!) to ship (although I think its down to a couple of weeks now). You can pay more to get it sooner from re-sellers on Amazon/eBay but this goes against the principles of the raspberry pi foundation.
A micro-usb cable – $4 – here
Used to power the device. It’s very important to make sure you use a High powered = 1.5A+ micro USB adapter with this board. It will spontaneously disconnect the Mouse, Keyboard, randomly freeze if you don’t.
A compatible flash card >2GB - $5 – here
Stores the operating system
Edimax EW-7811Un wireless adapter - $10 – here
Internet & local wan connection.
A low amperage keyboard – $12 – here
Only needed for setup
HDMI cable – $5 – here
Only needed for setup
You probably have some of these parts lying around the house. Its important to check that parts are compatible beforehand; if they draw too much power, they will simply not work with the rPi. For a list of verified peripherals, see this wiki from elinux.org.
2- OS installation
So you received all the parts, now its time to put things together. This section outlines the process for geting an rPi image installed onto an sd card. I’m assuming you’re running on a mac (OSX). If you’re running linux or unix, steps should be pretty much similar. If you’re a windows user, check out this guide.
- Stick the flash card into your computer
- Download the Raspbian “wheezy” image here and Unzip the image. This will produce a .img file:
- (From terminal)> unzip ~/Downloads/2012-10-28-wheezy-raspbian.zip
- Get the name of your sdcard by running dh command (Ex: /dev/disk3):
- > df -h
- Unmount the sd card so that you will be allowed to overwrite the disk:
- > sudo diskutil unmount /dev/disk3
- Install dcfldd
- Flash the image using dcfldd. This will take ~30 minutes.
- > sudo dcfldd if=~/Downloads/2012-10-28-wheezy-raspbian.img of=/dev/disk3 bs=1m
- if = Path to .img file
- of = Path to sdcard disk
- Setting ‘of’ ot the wrong path will do verry bad things to your computer. Be careful.
If you run into any problems, follow this more detailed guide which I abridged here.
3- Device configuration
Once the flashing process is complete, its time to boot the rPi for the first time and configure things. In this section, we’ll enlarge the sdcard partition to make use of all available space and modify boot behavior.
1- Take the sdcard out of your computer and plug it into the rPi. In the two USB slots, place the wireless adapter and the keyboard. Hook the hdmi cable up to a monitor/tv.When you plug the micro-usb cable into the device (from your computer), it will start to boot for the first time. You should see lights start to flash red and green.
2- Once the initial boot sequence is complete, you’ll be able to enter raspi-config. This is a configuration utility that allows you to change the settings on the rPi. If prompted for a password, use user: pi, password: raspberry (defaults for wheezy image).
See here for a full details about each of these options
3- Select “expand-rootfs” and follow the instructions here to enlarge your main partition to take up the entire sdcard. If you don’t do this, you’ll only have ~200MB of free space to play arround with (regardless of how big your sdcard is). This change will take effect on the next device boot.
4- Select “ssh” and enable the ssh server on the device. We’ll need this active so we can later connect to the device remotely.
5- (optional) Select “boot_behaviour” and then select “command line”. This will ensure that we always boot into the command line. You can skip this if you want to use the desktop.
6- Once back in the main menu, press the right arrow twice (to select “Finish”) and hit eneter. When you get back to the command line, restart your device using “sudo halt” or unplug/re-plug your device.
4- Wi-fi setup
Ok, we’re almost done. Its time to get the wifi working on the EW-7811Un wireless adapter. The OS image we installed already comes with the drivers for this device, so this saves us some headache. Follow these steps (borrowed from savagehomeautomation.com) to complete setup.
1- Check that the wireless adapter is hooked up properly and recognized by the operating system. Execute the following command:
2- Next check that the driver is properly installed & loaded. Execute the following command
3- Edit the network interface configuration file for the operating system. You can edit the file with the following command:
> sudo nano /etc/network/interfaces
Modify the file to look like this:
iface lo inet loopback
iface eth0 inet dhcp
iface wlan0 inet manual
iface default inet dhcp
4- Next, lets add the login information for your wireless network. Run the following:
> sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
Edit the file to look like this (replace ‘__SSID__’ with your wireless network ssid and ‘__PASSWORD__’ with your password):
5- Restart your network interface:
> sudo ifup wlan0
6- Restart your device. Once you log back in, you should be able to see the wireless adapter connected to your network:
> ifconfig wlan0
7- You can test things out by running:
> curl “www.google.com”
5- Connect & start developing!
Now that you have a network connection, you shouldn’t need the keyboard or hdmi. You can connect to the rPi through ssh and work remotely.
You can also send files to/from you rPi using scp.
Related Posts: On this day...
- HOWTO: Keep your data safe at the US border - 2011
- Tron Earns $3.5 Million in Midnight Showings - 2010
- Richard Stallman: The actions against MasterCard and Amazon are not "hacking." People are just finding a way to protest in a digital space, the internet equivalent of a mass demonstration - 2010
- CMU professor: New privacy issues are emerging - 2009
- Bed gun rack - 2009
- Who feels bad for being a pirate now? - 2008
- HOWTO: Read flowcharts - 2008