10 Things to Do After Buying a Raspberry PI
Created on: 16 October 2013
Here are ten things that you may want to do after buying a Raspberry PI board for the first time.
Start by installing an operating system (Raspbian) and then set it up to suit your hardware, location and personal preferences.
In this article the Raspberry PI is set up as a software development environment that will be needed even if you intend to use your PI as an embedded system without keyboard and mouse and perhaps even without a screen.
You will initially need a keyboard, mouse and screen to develop your embedded application.
The Raspberry PI model B board with Ethernet, 2 USB ports and 512MB of RAM is used. The Ethernet connection allows easy software updates and installation via the Internet.
The following hardware is used in this article:
- Raspberry PI model B.
- 5V power supply with micro USB connector and rated at 700mA or more.
- SD card 4GB or bigger with speed grade of 4 or higher (e.g. speed grade 10).
- USB keyboard.
- USB mouse.
- HDMI monitor.
- HDMI cable.
- Ethernet cable and Internet for software updates and installation.
1. Install the Raspbian Operating System
- Raspbian is a Debian Linux operating system that has been configured to run on the Raspberry PI.
- The Raspberry PI can run a number of different operating systems, but we will install Raspbian in this article.
- The Raspberry PI only boots from an SD card, so the operating system is installed to an SD card.
The installation steps and initial setup steps can be seen in this video. The steps are described below.
The easiest way to install Raspbian is to download the New Out of Box Software (NOOBS) from the Raspberry PI download page. NOOBS version 1.3 is used in this article.
Note that NOOBS is larger than 1GB to download if downloading the offline version.
Copying to SD Card
After downloading NOOBS to your hard-drive, extract the contents of the zipped NOOBS file and copy to your SD card.
Plug the HDMI monitor, keyboard, mouse and SD card into the Raspberry PI board. Switch the monitor power on and connect the 5V power supply to the Raspberry PI micro USB connector.
The Raspberry PI will boot from the SD card and allow you to install the operating system of your choice – choose Raspbian and install it now.
NOTE: NOOBS 1.3 should eliminate the problem that previous versions of NOOBS/Raspbian had in that the monitor would not display anything if the PI and monitor were switched on at the same time.
In versions of NOOBS prior to 1.3 it is important to power up the monitor first and then apply power to the Raspberry PI to ensures that the PI detects the monitor. A setting in a file can be changed to allow the PI and monitor to boot at the same time. This setting is now the default in NOOBS 1.3.
2. Setup Language and Keyboard
NOOBS 1.3 allows you to select your language and keyboard after booting from the SD card for the first time and before and during software installation.
Language and keyboard can be selected at the bottom of the screen.
After installation, the Raspberry PI will boot up into the Raspbian operating system and automatically run a configuration program that allows you to change some system settings.
If you did not select the correct language and keyboard settings during installation, you can set them in the configuration program.
NOTE: To start the configuration application at any time, enter the following at the command prompt:
NOTE: If you reboot the Raspberry PI at any time, you will need to enter your user name and password in order to log into the system.
If you did not change your user name and password in the configuration program, the defaults will be:
User name: pi
You will not see any letters appear on the screen when you type the password. Just type the password and press the Enter key afterwards.
If you need to change your language and keyboard settings in the configuration program, you will find them under Internationalization Options.
Change your language under Internationalization Options → Change Locale
Change your keyboard settings under Internationalization Options → Change Keyboard Layout
Your keyboard may be correctly detected (e.g. Generic 105-key), but you still may need to change your keyboard layout. If this is the case, leave the keyboard as-is and go to the next step that will allow you to change your keyboard layout.
The default UK keyboard setting may not print the correct character when pressing the "/" key if you are not in the UK, in which case you will need to change the keyboard layout to US or whatever suits your keyboard layout.
NAVIGATING THE CONFIGURATION PROGRAM
When in the configuration program, press the Tab key to move between fields and buttons. Use the arrow keys to move between items in a list.
Use the Space Bar to select or de-select items in a list.
Use the Space Bar or Enter key to press a button that you have tabbed to.
The arrow keys can be used to select an item on a menu and then the Enter key pressed to select the item without tabbing to the Select button.
The Esc key (escape key) can be pressed to move one level back in the menu, but if you are in the main menu, pressing the Esc key will exit the configuration program.
3. Setup Timezone
In the configuration program, select Internationalization Options and then Change Timezone.
You will now be able to select the geographic area that you are located in and then the city or region in that area that best represents the time zone that you are located in. This will usually be the capital city of your country or one of the time zone regions in your country.
4. Start the Graphical Desktop
The graphical desktop environment can be started from the command prompt after logging into Raspbian. Enter the following at the command prompt to start the graphical desktop:
You can also automatically boot into the graphical desktop by choosing Enable Boot to Desktop/Scratch in the configuration program. Here you can also change back to booting straight to the command prompt.
5. Change Screen Viewing Area
There will usually be a black border around the contents of the screen – this can also be described as the contents of the screen not filling the screen. The border will most easily be seen when running the graphical desktop.
This video shows how to make the image on the screen fill the entire screen and remove the black border.
6. Update the System Software
To update the system software, first connect the Raspberry PI to the Internet through an Ethernet cable. At the command prompt enter the following:
sudo apt-get update
sudo apt-get upgrade
You can enter this command from the main command prompt after logging in or from a terminal window when running the graphical desktop (LXTerminal icon on the desktop).
Each command may take several minutes to complete depending on how many packages must be updated. If the NOOBS software that you downloaded is fairly new, there may be very few or even no updates to download and install.
7. Login Automatically
Update 15 June 2016
The below method no longer works for new versions of Raspbian such as Jessie.
See the article automatically logging in on Raspbian Jessie for a new and easier method of auto logging in to the command prompt.
Because the end use of the Raspberry PI may be to run a dedicated application or be used as an embedded system, you may want the system to start up automatically without the need to log in using a user name and password.
To start up automatically, a setting in a file must be changed. The steps below describe what to do.
Switch on the Raspberry PI, log in to Raspbian and start the graphical desktop.
Start the Run box by pressing:
Alt + F2
Type the following into the Run box and then press Enter:
Start the file manager (on the bar, bottom left, second icon from the left). In the file manager, click the green up arrow twice to go to the root of the file system.
In the file manager, open the /etc folder. Now find the file inittab near the bottom of the file manager and drag and drop it into the leafpad editor that you opened using the Run box.
Scroll to the bottom of the inittab file and change the following line:
1:2345:respawn:/sbin/getty --noclear 38400 tty1
1:2345:respawn:/sbin/getty --autologin pi --noclear 38400 tty1
I.e. add the following to the original line:
Where pi is the default user name. If you changed the user name, then use your new user name instead of pi.
Save the file.
The next time that you boot the PI, you will not need to log in and will go straight to the command prompt.
This video shows the above steps.
8. Play a Video
The Raspberry PI is capable of playing 1080p HD video which we will do from the command prompt.
A video can be played from the command prompt using the application omxplayer and is run by entering the following at the command prompt:
omxplayer <video name>
Where <video name> is the name of the video to play that must be in the current directory (or folder).
The video below shows the process of copying a HD video from flash drive to the home folder and then playing the video. The Keyboard and mouse are plugged into a USB hub which frees up the second USB port on the Raspberry PI. The second port is then used to insert a Flash drive containing the video.
9. Automatically Run an Application
To automatically run a command line application after switching on the Raspberry PI, first configure the PI to login automatically. Modify the .bashrc file in your home directory/folder (default home directory is /home/pi).
The .bashrc file is a hidden file. In the file manager on the graphical desktop, make the hidden files visible by pressing:
Ctrl + H
You will now be able to see the .bashrc file and open and edit it.
Add a line to the bottom of the file that contains the application that you want to run as you would run it from the command line.
The video below shows how to automatically run a video after switching the Raspberry PI on.
10. Clone Your SD Card
After all of your hard work setting up your operating system and / or embedded application in Raspbian, you may want to clone your SD card.
Cloning your SD card provides a backup should the card become corrupted. It also allows you to make multiple copies of your Raspbian setup with embedded application should you want to produce more copies of the same project.
The idea behind cloning an SD card (using Linux or Windows) is to make an image file of the SD card on your computer's hard drive. The image file of the SD card can then be used to make an exact copy of the original SD card onto as many new SD cards as you want.
Cloning an SD Card in Linux
This video shows how to clone an SD card in Linux using the dd command line application.
The command for copying an SD card to an image file on your computer is:
sudo dd if=/dev/mmcblk0 of=~/raspi.img
The command for copying an SD card image to a new SD card is:
sudo dd if=~/raspi.img of=/dev/mmcblk0
~/raspi.img is the location and file name of the image file.
/dev/mmcblk0 is the SD card device on the Linux system.
Cloning and SD card in Windows
This video shows how to clone an SD card in Windows.
The Win32 Disk Imager application is available from: sourceforge.net/projects/win32diskimager/