Getting started with Raspberry Pi

Know your Pi models

These notes were written for use with Raspberry Pi, specifically the Pi Zero W but it's hopefully general enough for use with either the Zero, or Zero W or the Pi 3 Model B.

There's even a Pi 3 Model B+ now, which has a number of small improvements, changes to the wireless hardware, boosts to performance and built-in PoE.

If you're just getting started you can pretty much forget about the Pi rev 2, the original Pi or Pi model B, etc. They still work, they can still be found for sale, and can be had for a little cheaper, but they are less powerful. We're talking about $35 vs. $10 for a new board, so unless you're dealing with huge scale or backward compatibility you may as well avoid confusion and use the latest hardware.

There are some other very similar boards out there, like the Banana Pi, ODROID, etc. Raspberry Pi tends to have the most community support, and that counts for a lot whether you're just learning / experiment or trying to make something reliable.

Note: once you finish this guide and you've "built" a Pi, you can easily copy that Pi system over to a new Pi by copying the contents of the SD card. But, given just the bare Pi and a keyboard/mouse, this guide is the right place to start from "scratch" and get going.

Where to buy / Favorite vendors
The goods
  • Raspberry Pi (and power cord)
  • A blank micro SD card, at least 8GB
  • A plastic case for the Pi (recommended)
  • A screen/monitor and a USB keyboard*
*Screen / keyboard

Pretty much anything should work. I typically use an old Apple iMac USB keyboard and a 1024x768 LCD VGA monitor. I got both at a thrift store and they work really well. A drawback to this though is that if your monitor is VGA you'll need something like this HDMI converter box.

Getting the SD card ready

Note: some vendors will sell you an SD card that's ready to go out of the box. If you want to use their SD card, go ahead. It will probably work the same. If you want the latest software, or the experience / knowledge, do the following steps.

Here we will use the "network install" version of Raspbian which only has just enough to boot up and relies on a connection to the Internet to continue.

  • Format your micro SD card using the Fat32 filesystem
  • Download the "Noobs" files and unzip them
  • The zip file will contains a lot of files and folders. Put all of these at the root of the SD card.
  • While you're at it, save a new blank file called just "ssh" in the root of the SD card along with the other files (i.e. touch ssh).
  • If the Raspbian system detects this file you've created called just ssh or ssh.txt it will enable incoming connections on ssh which is an optional feature we will use often.
Powering on the first time
  • Insert the SD card, attach monitor / keyboard, mouse if you have one, and lastly plug in the power cord
  • When the Pi boots up it will boot into the Noobs software
Installing software
  • Use the arrow keys and the space bar to select your WiFi network
  • (or use a mouse :)
  • Use arrows and spacebar to select an OS to install and then type "i"
  • For general projects typically Raspbian is best
  • Wait for "OK" message
  • When it's done, hit the spacebar to say "OK"
  • The Pi will restart automatically to a login prompt

Note: The files you put on the SD card are still there, but a lot of other partitions have been created. The Pi uses these partitions to operate, and as a result the original partition (where the first Noobs files are) is made much smaller after setup.

Pro tip: If you attach the Pi to ethernet (i.e. an empty port on the back of your router) you will NOT need to provide WiFi information to continue.

System setup / upgrade software
  • Login as user pi password raspberry and do the following commands:
  • The WiFi credentials you selected during setup will be persisted permanently in /etc/wpa_supplicant/wpa_supplicant.conf
  • passwd
    • Change the password (important)
  • sudo passwd
    • Change root password (also important)
  • sudo apt-get update
    • This updates all software repos
  • sudo apt-get [-y] dist-upgrade
    • This updates all the software
Using the Pi camera
  • When the Pi is OFF, connect the camera circuit board to the main board of the Pi with a flat ribbon cable
  • Boot up the Pi and log in
  • Command: sudo raspi-config
  • Select to "Enable the camera" to enable the software part of the Pi camera
  • Command: raspistill
  • After you do all the commands above (and maybe restart) you can issue this command to capture a picture and create image files with the camera

Note: The command sudo raspi-config lets you change a lot of really cool settings, not just the camera module.

Working with Git

To have and use git, run this command:

sudo apt-get install git
Working with Node.js projects

You will need a version of Node JS installed to work with picam or to write other node software

  • Install nvm: Go to http://nvm.sh to find the latest command to run to install nvm
  • nvm manages Node.js on your Pi. It allows you to upgrade or try different versions easily.
  • The command for installing nvm will look something like: curl -o- https://raw.githubusercontent.com/creationix...
  • Command: nvm install stable
  • This will compile the latest stable version of Node.js and may take a few hours on a Pi Zero W
  • You can avoid this later by simply cloning a Pi you've previously made