Raspberry Pi Home Automation with Arduino(Second Edition)
上QQ阅读APP看书,第一时间看更新

Setting up the SD card and installing Raspbian

Installing an operating system is a two-step process. This involves formatting the SD card to the FAT filesystem format, and copying and pasting the image to the card.

File Allocation Table (FAT) is a method used for recording which sectors of a disk files are stored in and which sectors are free to be written to. It has its origins in the 1970s, when Bill Gates and Marc McDonald developed it for use on floppy disks. Due to its robustness and simplicity, it is still found on SD cards today and is the format we will need in order to install Raspbian.

When you purchase an SD card, you might notice that it is already formatted to FAT, as this format is popular with devices such as digital cameras. Many manufacturers ship the card so that it is ready to go out of the box and no further formatting is required. However, we recommend formatting your card if you did not purchase the official SD card.

To format and copy the downloaded Raspbian image to your card, follow the official steps at the Raspberry Pi website, depending on your operating system:

Once the operating system is installed, we can wrap up its configuration by ensuring that the Secure Shell (SSH) for remote connection to the Raspberry Pi is up and running.

Raspberry Pi SSH setup

You have now successfully completed the Raspberry Pi setup and will see the Raspbian Linux desktop. This desktop contains a number of icons that will load the programs installed by default, including Midori, a fast and light web browser, and the Python programming language IDE (integrated development environment), both of which we will be using.

Also of note is the LXTerminal. This icon launches the Linux Terminal window, which allows us to run applications via the command line.

A final task that we can complete before moving on to installing our Arduino software is to check whether SSH is up and running. We will be using SSH to connect to our Raspberry Pi remotely in future projects. Perform the following steps to set up SSH:

  1. Open a Terminal window and type the following command:
    ps aux | grep sshd 
    
  2. You should see the following process running:
    root 2067 0.0 0.2 6208 1060 ? Ss 18:17 0:00 /usr/sbin/sshd
    
  3. If you do not see the SSH process running, enter the following command:
    sudo /etc/init.d/ssh start
    

After this command has run, try running the previous command again and check whether the sshd process is present. We will learn about this in detail in Chapter 4, Temperature Storage – Setting Up a Database to Store Your Results.

Tip

You can use the ps command to show running processes on your Raspberry Pi.

With this task complete, let's move on to installing the software we need to program the Arduino.