Lab-Tools.com

Raspberry Pi - How To do the Initial Setup.

Dr. Beau Webber
2013-05-15

lab-tools.com/instrumentation


This discussion considers the initial purchase and set-up of the Raspberry Pi, so that it can be accessed, programmed and controlled from another computer, such as a laptop, and does not always need its own monitor.

Good websites :
www.raspberrypi.org
simonthepiman.com/

Purchasing notes:

Buy a B version Raspberry Pi - it has more memory and 2 USB sockets.

If you buy separate items :
(see: www.raspberrypi.org/quick-start-guide )

A box for the Raspberry Pi is recommended for a longer life.
The power supply should be over 1 Amp.
But a 1 Amp iPhone power supply with USB output may work.
The lead should end in a micro (not mini) USB plug.

For Internet access an ethernet wired connection is best.
A wifi connection may well work for accessing the internet.
However when logging in through it, I find the wifi drops the connection sometimes, so I now use wired ethernet.
Radio Keyboard and Mouse - works, but mine sometimes multiple keys letters.
TV/Monitor :
A digital TV/monitor is recommended to aid with initial set-up, one with digital connection (DVI or HDMI). So you will need a HDMI to (DVI or HDMI) cable.
Once you have done the initial configuration using a monitor, it is oftem more convenient to work using a window on a PC or Mac, via the ethernet, see below.
2x Raspberry Pis Boxed
Two boxed Raspberry Pi Linux credit-card sized computers,
connected to a home network,
set-up for control, programming and file copying from a Windows laptop.

Operating System and File System.

You can buy a pre-loaded 4 GByte card.
In the UK RS or Farnel sell reasonably uptodate ones,
but I think currently they are the software floating point version.

Recommended version :

Raspbian "wheezy"
- has a more secure installation
- uses hardware floating point;

free downloads from :
www.raspberrypi.org/downloads

These OSs will start SSH and SCP at boot time by default,
so you can log in using a window on your PC or Mac, and transfer files.
If you buy a pre-loaded card, first back it up onto your PC.
And if you are downloading the OS, your first thing is to flash the download onto the SD card.
A 4GB SD card should be fine, but I have used up to 16GB and bigger will work.

To use an image file, you will need to unzip it and write it to a suitable SD card using the UNIX tool dd ; en.wikipedia.org/wiki/Dd_(Unix)
or one for windows is available.

Windows users can use Win32DiskImager:
sourceforge.net/projects/win32diskimager/

Do not try to drag and drop or otherwise copy over the image without using dd or Win32DiskImager - it won't work.
Check the download - a checksum should be given (usually for the .zip file) : downloads.raspberrypi.org/verifying_an_image.html
using sha1sum.exe :
downloads.raspberrypi.org/tools/sha1sum.exe

IMPORTANT NOTE : both dd and Win32DiskImager are capable of wiping your PC hard drive - make sure you are fully on the ball, know the partition letter for the SD card when plugged into the PC, and that you are reading and writing the correct partitions/files.

First Boot

Plug the SD card in first and power last.

There should then be lots of scrolling text, after a first-time delay.
login : pi
password : raspberry
You should get a menu on a blue page, with some things to configure. The main one : resize the partitions on image to fill the SD card. Then :
: startx
will start a graphical desktop.
Try a web browser or calculator accessory, or the File Manager : Menu => Accessories => File Manager

If you want to do more text commands, open a command window : Menu => Accessories => LXTerminal

If you want to issue privileged commands (as per root) then use :
sudo COMMAND
I.e.
to shut the machine down, logging off all users tidily :
sudo shutdown -h now

To set up another user account (i.e. user1), and their home directory and initial password :
sudo useradd -m user1
sudo passwd user1

If this user needs to use sudo, this may come by default (check). If not do :
adduser user1 sudo

Update all the software to the latest version :

sudo apt-get update
reboot
This will log you off.

If you allow the Raspberry Pi onto the world-wide web (see later),
first change the password for pi :
sudo passwd pi

It is sometimes useful to have access to the world-wide-web from a textual window - install lynx text web browser :
sudo apt-get install lynx
Raspberry Pi GUI
Raspberry Pi Graphical User Interface (GUI).

Logging in from a PC or Mac

The OS will start SSH and SCP at boot time by default,
so you can then log in using a window on your PC or Mac, and transfer files.
To find your IP address on the local network :
ifconfig
or
ip address show

On a PC, download PuTTY from :
www.chiark.greenend.org.uk/~sgtatham/putty/
and then use SSH, inserting the correct ip address, and port 22. You should then get a text window where you can log in as any user that you have configured.

Configuring to have a graphical Raspberry Pi screen on a PC or Mac

Install tightvncserver :
sudo apt-get install tightvncserver
Configure it :
tightvncserver
If the password is not now set, do it now :
vncpasswd

Run a server : here we are running server 0, with a large screen :
vncserver :0 -geometry 1920x1080 -depth 24
Here is a smaller less demanding screen :
vncserver :0 -geometry 1024x768 -depth 16
Often on my laptop I use a small window 750x500 ...
vncserver :0 -geometry 750x500 -depth 16
To kill the server use :
vncserver -kill :0

On the PC one needs a VNC viewer,
i.e. install one from :
www.tightvnc.com/

This then gives a configuration panel and connection panel.
Enter the Remote Host Ip and window number : i.e. 192.168.1.71:0 and press connect. Hopefully you will get a window that allows you to enter the VNC password you set above, and then the Raspberry Pi desktop should open in a window.
RaspberryPi - 1SSH + VNC windows on PC
RaspberryPi - SSH + VNC windows on PC.

Back-up NOW !!!

You have now done lots of work, and have a version that you may want more copies of.
The simplest is to use the above shutdown command, move the SD card to the PC, and use Win32DiskImager again, this time copying TO a file.
If all the above frightens you, or you are busy, I can do you a 4 GByte SD card with the above all done, fully updated, for £10, plus postage and VAT.
(You will have to set your passwords - if you want - and check your ip address, as above.)

All the best, this has worked for me, I hope it helps, but of course things change, no guarantees.


Please contact me if you would like to commission the design and construction of a new piece of apparatus or software, based on the Raspberry Pi or otherwise.
Dr. Beau Webber
www.Lab-Tools.com
Beau@Lab-Tools.com

2013-05-15