Just wanted a quick start guide for myself so that I wouldn't have to keep rooting through Google to remember all this stuff. Hopefully it helps other people.
If you had other ideas or suggestions please leave a comment.
The first time I bought a Pi I was enormously frustrated with myself because I didn't own all of this stuff. Kept having to order things off of Amazon and wait to get started... very irritating. This is all good stuff to have laying around anyway:
- An extra keyboard and mouse.
- An adapter for your monitor. I use this one
- HDMI cable
- Ethernet cable
- An enclosure for the Pi, the Pibow is quite popular.
- A USB hub
(unqualified opinion coming up, warning)
Come up with a project and set up your Pi for that. Don't try to make the Pi into another workstation for yourself - it's a nice idea but you'll forget how to set everything up.
I suppose you could make a disk image (see below) if you wanted, but I find it easier to plow ahead with a single Pi dedicated to a specific goal. That way I know when I turn that Pi on it'll always do what I wanted it to... and nothing else.
In other words don't try to use one Pi for everything. If you don't need Processing and openFrameworks then don't install them both!
If you're doing anything besides running startx on the machine I'd go with an 8GB class 10 SDHC drive. Class 10 will run a tinsy bit faster I've read, though I'm betting the performance gain is negligible. Thanks to Stacey for the advice on this... just wish I had asked BEFORE I purchased myself. :)
If you don't feel like learning how to flash the drive yourself you can buy one off of these guys pre-loaded for you.
IMPORTANT :: If you're going to use the Pi for openFrameworks dev you want to make sure you're using the Raspbian "wheezy" distro. Again, either buy your flash drive with it pre-installed or download it here.
Assumes you're on a Mac.
Download the version of the distro you're into from Raspberry Pi's download page. Unzip it that and you should have a .img file.
Pop your SD card into your Mac and then in Terminal do the following:
diskutil list
Remember the identifier of your SD card (should be something like disk1 or disk4 or along those lines).
diskutil unmountDisk /dev/IDENTIFIER
sudo dd bs=16m if=/path/to/your/downloaded/distro.img of=/dev/IDENTIFIER
Type in your password and wait awhile. Insert SD card in your Pi and you're ready to go.
Courtesy the RPI Easy SD Card Setup Guide
Just to make sure all my stuff stays latest/greatest.
sudo apt-get clean
sudo apt-get update
sudo apt-get upgrade
WARNING :: Updating and upgrading can take awhile. It also requires a connection to the Internet. I'd recommend a physical connection for the initial setup of your Pi for your initial install so that you don't encounter issues setting up the wireless stuff later.
Way easier for managing updates to the lower level stuff on the Pi.
sudo wget http://goo.gl/1BOfJ -O /usr/bin/rpi-update && sudo chmod +x /usr/bin/rpi-update
sudo rpi-update
sudo reboot
WARNING :: rpi-update can take a long time to do it's magic.
sudo apt-get install git-core binutils git libnss-mdns netatalk tightvncserver
Briefly:
- git-core :: not sure why I need this but the openFrameworks walkthrough recommended.
- binutils :: same as above
- git :: for version control
- libnss-mdns :: so I can use raspberrypi.local instead of the IP address
- netatalk :: so I can use afp:// to connect on my Mac
- tightvncserver :: VNC Client, so I can remote in from my laptop.
I used an Edimax EW-7811Un. Basically a tiny USB wireless adapter. Plug it in to your Pi, then...
nano /etc/network/interfaces
Add this to the bottom:
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa.conf
Save and quit (Ctrl+X). Now to create that wpa.conf:
nano /etc/wpa.conf
Write into that:
network={
ssid="NETWORK_SSID"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk="NETWORK_PASSWORD"
}
Change NETWORK_SSID and NETWORK_PASSWORD to your wifi's network name and password respectively, save and quit.
Set it to connect to Wifi on boot with:
nano /etc/network/interfaces
My file looks like this:
auto lo
iface lo inet loopback
iface eth0 inet dbhcp
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa.conf
I believe you only need to add the last line but I can't recall and wanted to make sure to post my complete configuration to compare.
Save. Reboot. The edimax should glow blue when it's working.
sudo reboot
Thanks to this tutorial for the assist.
We already installed Tight VNC so we can remote in if you followed the basics. I like to have it automatically start on boot up so I can just use it.
sudo nano /etc/init.d/tightvncserver
Then in the subsequent editor:
export USER='pi'
eval cd ~$USER
case "$1" in
start)
su $USER -c '/usr/bin/vncserver :1 -geometry 1280x800 -depth 16 -pixelformat rgb565'
echo "Starting vncserver for $USER "
;;
stop)
pkill Xtightvnc
echo "vncserver stopped"
;;
*)
echo "Usage: /etc/init.d/vncserver {start|stop}"
exit 1
;;
esac
exit 0
Ctrl+X to exit. Y to save. Enter to keep the same filename.
sudo chmod 755 /etc/init.d/tightvncserver
sudo update-rc.d tightvncserver defaults
Reboot and test. You should be able to share screen off of OSX or type in the IP address in your VNC client and see the Pi. If you need a port number to connect I believe it's 5900 but if that's wrong someone tell me in a comment and I'll update.
Thanks to the tutorial here and for more detailed information check out eLinux.org's post.
ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub
Whatever it prints out is your SSH Key. Feel free to add that to your Github settings so you can pull.
Wanted my openFrameworks stuff set up separate from anything else I might do on the Pi. I put it in [user directory/Programming/openFrameworks.
Here's how I do it:
cd ~
mkdir Programming
cd Programming
git clone https://github.com/openFrameworks-RaspberryPi/openFrameworks/
cd openFrameworks/scripts/linux/debian_armv6l
sudo ./install_codecs.sh
sudo ./install_dependencies.sh
cd ~/Programming/openFrameworks/libs/openFrameworksCompiled/project
make
You can also type make Debug instead of make here. Release vs. Debug configurations. Up to you.
WARNING :: This takes a long time to compile. Brace yourself.
Once all that's done:
cd ~/Programming/openFrameworks/scripts/linux/template/linuxarmv6l
cp Makefile ~/
cd ~/Programming/openFrameworks/apps/devApps/raspberrypi_hello_world
cp ~/Makefile ./
make clean
make
Once compiled it'll tell you how to run the application, most likely by typing "make run". Quit the application with Ctrl+C.
At this point I typically switch over to my Mac and either ssh in or mount the Pi as a remote volume. I copy and paste the raspberrypi_hello_world project for re-use, much like I would the emptyExample on a OSX development.
How'd I learn this? The oF-Pi getting started guide.
sudo apt-get install arduino
startx
You should see Arduino in your Start Menu -> Programming Folder. You'll likely need to switch from COM0 to /dev/ttyACM0
Want to test?
sudo apt-get install python-serial
Then follow this tutorial. You'll already have pySerial installed.
sudo apt-get install librxtx-java openjdk-6-jdk
wget http://processing.googlecode.com/files/processing-1.5.1-linux.tgz -O /home/pi/processing-1.5.1-linux.tgz
tar -xzvf /home/pi/processing-1.5.1-linux.tgz
rm /home/pi/processing-1.5.1-linux.tgz
cd /home/pi/processing-1.5.1
sudo rm -rf java
sudo ln -s /usr/lib/jvm/java-6-openjdk-armhf java
sudo rm modes/java/libraries/serial/library/RXTXcomm.jar
cp /usr/share/java/RXTXcomm.jar modes/java/libraries/serial/library/
Should be able to fire up Processing from there by simply typing:
/home/pi/processing-1.5.1/processing
or cd /home/pi/processing-1.5.1 ./processing
Also helps to use startx and then LXTerminal to run this. Adapted from this tutorial graciously sent to me by Jenn Kaye.
Once I'm happy with something I may actually want to this from one Pi to the next.
To do that, turn the Pi off and remove the SD card. Connect that card to your Mac. From Terminal:
dd if=/dev/sd-card of=/path/to/save/image bs=16m
/dev/sd-card is the path to your SD Card. /path/to/save/image is the path you want to save the image to.
Unplug your SD card, grab a new one and run this:
dd if=/path/to/save/image of=/dev/sd-card bs=16m
Should be pretty obvious what is what in this restore command.
Steps to to that courtesy this StackExchange post.
Nice! Time to put my Pi to use...