User Tools

Site Tools


raspberry_pi

Raspberry Pi

Raspberry Pi is a single-board Linux computer. The Food Computer 2.0 uses the Raspberry Pi 3.

Raspberry Pi 3

(Photo: Raspberry Pi 3 by Decio "desmodex" on Flickr)

Setting up

The Raspberry Pi runs its operating system off of a Micro SD card. Before working with the Pi, you'll need to install an operating system on to a Micro SD. See Installing the OS for details.

Working with the Pi

The Raspberry Pi is a Linux computer, so if you know Linux, the same stuff holds. For people new to the Rasbperry Pi and command line, here are some useful things to know:

openag_brain and openag_python

Some useful resources for working with openag_brain on the Raspberry Pi's command line:

Finding the IP address of your Pi

Once your Raspberry Pi is connected to the network, how do you find it's IP address?

If you've got terminal access to the Pi (e.g. a keyboard and monitor hooked up to it), you can type this command into the terminal:

ifconfig

This will list all the network connections. Look for the one that says wlan0 and the line that says inet connection. This is your IP.

To find the Raspberry Pi's IP from your laptop, try AdaFruit's Pi Finder app.

ssh into Raspberry Pi

By default, the ssh credentials for the Raspberry Pi are:

  • username: pi
  • password: raspberry

You can ssh into the Pi with:

ssh pi@<IP ADDRESS>

When prompted, type the password raspberry.

Restart

sudo reboot

Shutdown

sudo shutdown now

Hardware shutdown

If Raspbian Jesse (full version with desktop) is installed, then you can use GPIO pins 3 and 5 to send the shutdown signal. Short 3 and 5 with a GPIO pin connector, or with some wire. See http://www.makeuseof.com/tag/add-reset-switch-raspberry-pi/.

Finding a file

find -name myfile.txt

Editing a file

nano path/to/file.txt

This will open up the Nano editor in the terminal.

If the computer complains that you don't have privileges to edit the file:

sudo nano path/to/file.txt

Connecting to Wifi on Raspbian Lite

Rasbpian Lite doesn't have a desktop. We recommend using the full version of Raspbian with desktop, but if you're using Lite, here's how to connect to a network.

Tutorials:

In a nut:

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf 

In the case of the example network, we would enter:

network={
    ssid="testing"
    psk="testingPassword"
}

Note these have to be double-quotes. If your keyboard is outputting @ instead of double-quotes, you might have to reconfigure your locale and keyboard with sudo raspi-config. (Usually you should choose the 101 key keyboard.)

At this point, wpa-supplicant will normally notice a change has occurred within a few seconds, and it will try and connect to the network. If it does not, either manually restart the interface with sudo ifdown wlan0 and sudo ifup wlan0, or reboot your Raspberry Pi with sudo reboot.

You can verify if it has successfully connected using ifconfig wlan0. If the inet addr field has an address beside it, the Pi has connected to the network. If not, check your password and ESSID are correct.

Creating backup images

See http://raspberrypi.stackexchange.com/questions/311/how-do-i-backup-my-raspberry-pi.

In a nut:

diskutil list
dd if=/dev/rdiskN of=/path/to/my_image.img bs=1m

Tip: if you zip the image, it will be much smaller.

See Also

raspberry_pi.txt · Last modified: 2017/05/01 16:38 by gordonb