Translate

Wednesday, October 8, 2014

TeirmiLab - prepare Raspbian

For the TeirmiLab project, one of the platform I choose to prototype it, is the Raspberry Pi B (or B+).

This is a quick step-by-step reminder about how to prepare Raspbian for the Raspberry Pi B and B+ for this project.

There are on-line hundreds of places where is described how to install a Raspbian over a Raspberry Pi.


If this quick step-by-step is not enough for you, try this.
If you think that this is too technical ... are you sure you want to play with microcontrollers ? :)

Lets start.
I used a 8 Gbyte micro SD card with a low profile adapter. In this way is easy to eventually swap to the Raspeberry Pi B+.

It is necessary, at least for the installation, to have :
  • a 5 Volt 1A USB power supply
  • a USB cable (microUSB) for the power supply
  • an internet connection, better if wired
  • a computer (needed to download the image and prepare the SD card)
Optionally if you want to enable the graphic interface or plan to use Noobs, better to have also:
  • a HDMI monitor or a composite monitor (suggested an HDMI one)
  • an USB keyboard
  • an USB mouse

As keyboard and mouse, I used a wireless Logitech keyboard with an included touch-pad with USB dongle, in this way there is still available an USB Port.

SD card preparation  

Once all the HW components are available and connected, is possible to prepare the SD card.
Raspberry Pi does not have flash, it boots from the SD card that is used also as hard drive.
Because of that it needs to be formatted in Fat32.

Using kparted erase all the data on the SD card (new partition) and then simply format all the card in Fat32.
If you DON'T plan to use Noobs, there is no need to format the SD card.

Problems
Use a decent SD card for the job.
It should be fast and good quality/brand.
I had some SD cards not working properly because not fast enough or bad brand.
I found more reliable to use microSD cards with the adapter.

Installing distribution

There are two main choices about installing a distribution/OS on the SD card:

  • installing Noobs
  • installing a specific distribution

Noobs
If you choose to use Noobs, here some notes.
It is easier, shows you the latest available distributions and install automatically everything needed.
You must connect an HDMI monitor and a keyboard/mouse to the Raspberry Pi.

To install Noobs, simply download it and extract it on the SD card.
That's it. No strange formatting of the SD card, no partitions, secret code, ecc.
Just a plain copy.

Once copied, insert the card on the Raspberry Pi and turn it on.
After few seconds will appear on the HDMI screen the list of available OS to install.
If you have enough space on the SD card, it is possible to install more than one.

With 8Gbyte SD card, generally there is space for 1 or 2 OS.

The suggested distro to install is the Raspbian , accessible via the Noobs menu.

It is a Debian based distro and is probably the most used.
Once installed, a configuration menu' will allows to set up some parameters, like starting the distro in graphic mode rather than command line.
The default is command line ! So it is normal to boot in command line if no configuration modifications are made.

Raspbian
It is possible to install directly Raspbian. The main advantage is to have much more space on the SD card.
Here how to do it.
Go on the Raspberry Pi website download page , locate the Raspbian image and download it on your computer (look for Operating Systems Images - Raspbian).
Detailed explanations about how to do that are available on the Raspberry website, shortly here a quick reminder. I'm using Linux and I'm assuming you KNOW how to work on Linux.
  • download the image on your PC
  • extract the image from the zip file
  • open a terminal
  • df -h
    to see what memory devices are present
  • insert the new SD card
  • df -h
    identify the latest device inserted - ignore the partitions, we need to overwrite the entire card with the image
    If nothing appears, try with gparted or kparted to identify the new card
  • umount /dev/sdxx
    umount the device added if for any reason it was mounted.
    In case the card has more than one partition, umount all of them.
    Eventually better reformat the card with gparted so to have a single partition but is not necessary.
  • copy the entire image downloaded on the sd card with the command:

    dd bs=4M if=name_image_downloaded.img of=/dev/sdx

    where name_image_downloaded is the path/name of the downloaded Raspbian image and sdx is the name of the unmounted device (DEVICE !  NON PARTITION !)

    CAUTION!  Take your time and triple check ! If you use the wrong /dev you can lose your data !
At this point you have the SD card ready to be inserted in the Raspberry Pi.
Do it, be sure to have connected the board to the network, no need to have HDMI and keyboard/mouse, you can operate via ssh.

The image installed allows for the default user named 'pi' and password 'raspberry'.
Hook up  a terminal to the board, for example in ssh, is possible to login with:

- ssh pi@192.168.xxx.xxx   (address of the board - see your DHCP assignment)
- password : raspberry

Once gained access, is better to do an update with :  sudo apt-get update

After the reboot is better to configure Raspbian running the command sudo raspi-config.
At least run the option
- Expand Filesystem and the
- Advanced Options/A6 I2C in order to enable the I2C support.

No need to run other options.

The Raspberry Pi B (or B+) board is ready for the next step.

No comments:

Post a Comment