Makerlab/Guides/Raspberry

Setting up a Raspberry Pi

On this page, we describe the basic process for setting up a Raspberry Pi with the Raspian OS.

Preliminaries

  1. Get a good, stable power supply for the Raspberry. Not every USB charger suits well. It should be able to supply at least 1.5A. There are some special versions of 5V power supplies available that are actually supplying 5.1 - 5.25 V (e.g. Goobay Model 43651) that are meant to compensate for the voltage drop caused by the self-resetting fuse inside the Raspberry Pi that is the likely cause of unreliable Raspberry installations.
  2. Use a short, high-quality USB cable for connecting the Raspberry to the power supply. Long and/or cheap cables will cause a significant drop in the actual voltage received by the Raspberry, which will cause unreliable operation and SD card corruption, and other errors that are hard to reproduce and can cause a lot of trouble.
  3. You can measure that the Raspberry is getting a good power supply by checking that the voltage between TP1 and TP2 on the Raspberry Pi never drops below 4.75V with all devices attached and when doing complex tasks. (By the way: Measuring the voltage with a standard multimeter is not a really helpful, because the typical switching power supplies have a fair amount of ripple and noise on the DC output, which you can judge only with an oscilloscope).
  4. Use high-quality SD cards, cheap or unsuitable ones can also cause a lot of trouble.

Getting Started

  1. Download the latest version of Raspbian from https://www.raspberrypi.org/downloads/raspbian/

    • Hint: The minimal version (e.g. Jessie Lite) is sufficient for most purposes and a lot smaller.
  2. After downloading the .zip file, unzip it to get the image file (.img) for writing to your SD card.

  3. Put the SD card into your computer (not into the Raspberry Pi!).

  4. Format the SD card using the FAT 32 format. On a Mac, use "Disk Utility".

  5. Write the image file to the SD card. See here for detailed instructions:

    • Mac OSX
    • Windows
    • Linux
    • Hint: You can speed up the copy process by increasing the block size, see here.
    • On a Mac, this is the command-line approach in a nutshell:
      • Find the name of the SD card

    : :$ diskutil list :/dev/disk2 : #: TYPE NAME SIZE IDENTIFIER : 0: FDisk_partition_scheme *7.9 GB disk2 : 1: DOS_FAT_32 RBPI 7.9 GB disk2s1

    : The name is "disk2 in my case. The same disk can be accessed without buffering etc. as rdisk2, see here for background. For large copy operations like writing an image to an SD card or backing one up, rdiskx can be uo to 20 times faster than diskx.

  6. Unmount the volume:

    $ diskutil unmountDisk /dev/disk2 :Unmount of all volumes on disk2 was successful

  7. Copy the image to the drive using the name of your SD card instead of rdisk2.

    : #:$ sudo dd bs=1m if=/Users/hrg/Downloads/2016-05-10-raspbian-jessie-lite.img of=/dev/rdisk2

    This will take ca. 2 minutes, press Ctrl-T to get a status update.

    1386217472 bytes transferred in 129.045041 secs (10742121 bytes/sec)

  8. Now eject the volume:

    $ sudo diskutil eject /dev/rdisk2

  9. Now put the SD card into the Raspberry Pi, connect a USB keyboard and an HDMI monitor and power it on.

  10. Log in to the system using the defaults (keep in mind that the keyboard layout is most likely set to US, so y and x are interchanged, and so are some other keys!):

    • User: pi
    • Password: raspberry
  11. Change the password immediately:

$ passwd
  1. Connect the Raspberry to the Internet:
  1. Reallocate all available space on SD card to OS
  2. Secure the Raspberry against basic attacks.
  3. Change the keyboard layout to "German":
    • Open config file in editor: sudo nano /etc/default/keyboard

    • Replace XKBLAYOUT=“gb”

      by

      XKBLAYOUT="de"

      .

  1. Set up SSH
  1. If an error message -bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)

    appears, check http://askubuntu.com/questions/454260/how-to-solve-locale-problem.

Special Topics

References