Reader small image

You're reading from  Building a Home Security System with Raspberry Pi

Product typeBook
Published inDec 2015
Publisher
ISBN-139781782175278
Edition1st Edition
Right arrow
Author (1)
Matthew Poole
Matthew Poole
author image
Matthew Poole

Matthew Poole is a systems engineer based near Southampton on the south coast of England, with over 20 years of industry experience. After graduating in electronics and communications engineering, he went on to train as and become an air traffic engineer for Civil Aviation Authority, UK, working on microprocessor-based control and communications systems. Later, he became a software architect and mobile technology specialist, working for several consultancies and global organizations in both hands-on architecture and product-management roles . He is now a partner at Connecting Objects, a boutique systems consultancy focusing on the design of Bluetooth and other wireless-based IoT systems, taking ideas from concept to prototype. He is also the Director of Technology for Mobile Onboard, a leading UK-based transport technology company specializing in bus connectivity and mobile ticketing systems. He is also the author of Building a Home Security System with Raspberry Pi, Packt Publishing. You can find his blog at http://cubiksoundz.com and LinkedIn profile at https://www.linkedin.com/in/cubik, or you can reach him on Twitter at @cubiksoundz.
Read more about Matthew Poole

Right arrow

Preparing the SD card


The Raspberry Pi only boots from an SD card (or micro SD card for the B+ and v2 models), and cannot boot from an external drive or USB stick (well that's not strictly true, but is beyond the scope of this book).

It's recommended that you use a Class 10 SD card for performance, but a Class 4 or 6 card will be fine for this project. You'll need to have a minimum card size of 4Gb.

Now that we have our Raspberry Pi board and SD card to hand, we need to prepare the SD Card specifically for our home security system. We're going to use the standard Raspbian operating system as there really is no reason to use any other distribution; it's the de facto choice for the Raspberry Pi.

Downloading the Raspbian image

You'll need to grab the latest Raspbian OS image from the Raspberry Pi site at https://www.raspberrypi.org/downloads.

Download the Raspbian OS ZIP file containing the image to your PC.

Note

At the time of writing, the latest version was Raspbian Jessie version 4.1 (2015-09-24-raspbian-jessie.zip).

Once downloaded, unzip the file and you'll have the file, 2015-09-24-raspbian-jessie.img.

The next thing to do is burn this image to your SD card…

Using Microsoft Windows

On a Windows PC, the best way to burn the image to your SD card is to use the Win32 Disk Imager utility. This can be downloaded from http://sourceforge.net/projects/win32diskimager.

Note

The current version, at the time of writing, is 0.9.5.

It doesn't have an installer, and launches directly from the EXE file.

Now, it's time to create your SD card image:

  1. Insert your SD card into the PC and launch the Win32 Disk Imager.

  2. Select the SD card device drive letter (make sure it's right!).

  3. Choose the Raspbian image file you've just downloaded.

  4. Click on the Write button to create the SD card image.

Using Linux

On a Linux PC, you'll need to use the gparted and dd utilities to burn the image on your SD card.

Carry out the following steps to create your SD card image:

  1. Extract 2015-09-24-raspbian-jessie.img to your Home folder.

  2. Insert your SD card into the PC.

  3. If you're not already in a shell terminal window, open one (you can use Ctrl + Alt + T on most graphical-based desktop systems).

  4. Type the following command in the shell terminal:

    $ sudo fdisk -l 
    

    In the list check, your SD card appears as a drive device (for example, /dev/sdb). It's crucial that you ensure you use the right device in the next step. We'll assume that your device is /sdb.

  5. To burn the image to the SD card, type the following command:

    $ sudo dd if=2015-09-24-raspbian-jessie.img of=/dev/sdb
    
  6. Hit Enter and go make a cup of tea or coffee as this will take a while. You'll know that it's finished when the command ($) prompt re-appears.

  7. When the command prompt does re-appear, type the following command:

    $ sudo sync
    
  8. Once that command has finished, you can remove the SD card from the PC.

Booting your Pi

You're now ready to boot up your Raspberry Pi. Pop your shiny new SD card into it and plug in the power.

Assuming that you have a monitor attached to your Pi, you should see your system booting up nicely. Although you could wait for it to boot up and connect to it via a terminal session (we'll look at that later), I recommend that you connect a monitor to it, at least in the first instance, just to make sure everything is working correctly.

In the new Jessie version of Raspbian, you'll boot straight into a desktop GUI, which is a major change from previous versions, where you'd be taken to the raspi-config utility, the first time the system is run, where you'd set up your Pi, and importantly, expand the file system to use the entire space available on your SD card.

Debian Jessie boots into the GUI by default

Expanding the file system

When you first create your Raspbian SD card, you'll only be left with about 200Mb of space in the file system, regardless of the size of your SD card. This is not much use, so we want to expand the file system so that it uses all of the available space on the card.

Fortunately, this is very easy on the Raspberry Pi now, as this function is available in the Raspberry Pi Configuration Tool on the desktop.

To access the new configuration tool, go to Menu and select Preferences | Raspberry Pi Configuration.

The new Raspberry Pi Configuration Tool

Tip

Goodbye GUI

Most of our work is going to be done in the command-line interface (CLI). Therefore, before we reboot the system in a minute, let's change the Boot option by selecting To CLI, as shown in the previous screenshot, so boot into the command line going forward.

Anyway, now we click on the Expand Filesystem button, and in a couple of seconds, you'll see a confirmation message. The filesystem will be expanded when the system next reboots.

Using the raspi-config utility

If you have an older version of Raspbian, or you're not using the desktop GUI, then you'll need to use the raspi-config utility (which is still better than the old days when we had to do this manually in the shell). The first time you boot up, you'll be taken straight to the raspi-config utility.

The first option is the Expand Filesystem option; select this and you'll see various commands scrolling up the screen. Once it's finished, you'll see the following message:

Root partition has been resized.
The filesystem will be enlarged upon the next reboot

Click on OK.

Select Finish on the config screen and reboot your Pi when prompted.

After your Pi reboots with its fuller file system, you'll be taken straight to the shell prompt where you can log in with the default user and password.

Login: pi

Password: raspberry

Previous PageNext Page
You have been reading a chapter from
Building a Home Security System with Raspberry Pi
Published in: Dec 2015Publisher: ISBN-13: 9781782175278
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Matthew Poole

Matthew Poole is a systems engineer based near Southampton on the south coast of England, with over 20 years of industry experience. After graduating in electronics and communications engineering, he went on to train as and become an air traffic engineer for Civil Aviation Authority, UK, working on microprocessor-based control and communications systems. Later, he became a software architect and mobile technology specialist, working for several consultancies and global organizations in both hands-on architecture and product-management roles . He is now a partner at Connecting Objects, a boutique systems consultancy focusing on the design of Bluetooth and other wireless-based IoT systems, taking ideas from concept to prototype. He is also the Director of Technology for Mobile Onboard, a leading UK-based transport technology company specializing in bus connectivity and mobile ticketing systems. He is also the author of Building a Home Security System with Raspberry Pi, Packt Publishing. You can find his blog at http://cubiksoundz.com and LinkedIn profile at https://www.linkedin.com/in/cubik, or you can reach him on Twitter at @cubiksoundz.
Read more about Matthew Poole