Book Image

Learning Raspberry Pi

By : Samarth Shah
Book Image

Learning Raspberry Pi

By: Samarth Shah

Overview of this book

Table of Contents (14 chapters)
Learning Raspberry Pi
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Getting to know your Raspberry Pi


Before you start reading further, you should know what exactly Raspberry Pi is and how you can connect different peripherals such as a keyboard and mouse to Raspberry Pi. There are several models of Raspberry Pi. The following table shows an important comparison between all the Raspberry Pi boards released as of February, 2015:

 

Model A

Model A+

Model B

Model B+

Generation 2

Price

25 USD

20 USD

35 USD

35 USD

35 USD

System on Chip

Broadcom 2835

Broadcom 2835

Broadcom 2835

Broadcom 2835

Broadcom 2836

Memory

256 MB

256 MB

512 MB

512 MB

1 GB

USB 2.0 Ports

1

1

2

4

4

Onboard Network

None

None

10/100 Mbits/s Ethernet

10/100 Mbits/s Ethernet

10/100 Mbits/s Ethernet

Power Ratings

300 mA(1.5 W)

200 mA(1W)

700 mA(3.5 W)

600 mA(3.0 W)

900 mA(4.5 W)

Note

As mentioned in the preceding table, there are variants of the model that you choose. For example in this book, Model B is used. All the code that is developed is compatible with Model B+ and Generation 2 boards. So, you can buy any of the Model B , Model B+, or even generation 2 to get the best out of this book.

  1. The microUSB power port

  2. HDMI out

  3. The Ethernet port

  4. Dual USB 2.0 ports

  5. Audio out

  6. RCA video out

  7. The SD card slot (back side)

Raspberry Pi supports almost all keyboards and mice; however, you can check out verified peripherals by the Raspberry Pi community at http://elinux.org/RPi_VerifiedPeripherals.

You need to load the operating system to the SD card before you start your exploration of Raspberry Pi. The following two sections have useful information about different operating systems that are supported on Raspberry Pi and on how to install particular operating systems.

Different types of operating systems

On a personal note, if you would like to dive in as quickly as possible, I would recommend visiting the official quick start guide at http://www.raspberrypi.org/quick-start-guide in order to install Raspbian. Then, continue from the Remotely accessing Raspberry Pi section of this chapter. Although you will be using Raspbian throughout this book, it helps to know what else is available and how the various operating systems differ. I encourage you to try all of the available operating systems and find what suits your needs.

The Raspbian OS

Raspbian is a Linux distribution based on Debian, with all packages compiled specifically for the Raspberry Pi. Although it is a separate project, Raspberry Pi Foundation creates images of Raspbian and maintains a repository containing additional software. Because Raspbian should be familiar to Ubuntu and Linux Mint users, as it aims to be user friendly and has the largest user base; this is often the recommended distribution.

The Arch Linux ARM OS

The Arch Linux ARM OS, which is a port of Arch Linux, is also optimized for the Raspberry Pi. However, this has a different design philosophy to Raspbian. Rather than aiming to be user-friendly, Arch Linux ARM gives the user a complete control over the system. This means that instead of a distribution that just works, you have a starting point from which to build up the distribution tailored to your needs. While this may be intimidating to some newcomers, the ArchWiki (http://wiki.archlinux.org) contains perhaps the most comprehensive documentation of any distribution, making it easy to get started. The other major difference is that Arch uses the latest software. While stability may be a concern, the advantage of bleeding edge software is that you rarely have to compile from the source to get the latest features and bug fixes. Arch is the ideal distribution for users who know how they want their system to work, who are willing to spend some time getting things up and running and don't mind the occasional hiccup.

Pidora is the Raspberry Pi-optimized remix of Fedora. This is the first distribution created specifically for the Raspberry Pi and was the officially recommended distribution prior to Raspbian. Since this is an RPM-based distribution, it should be most familiar to OpenSUSE and CentOS users. Fedora attempts to avoid non-free software where possible, so things such as MP3 support and Oracle's Java are not included. Its target audience is computer literate tinkerers who are likely to contribute to the project. Although Fedora has a significant user base, Pidora itself is a minor distribution on the Raspberry Pi and is not as actively maintained as Raspbian or Arch. Therefore, getting support may be difficult in some cases.

The RISC OS

RISC OS is not related to Linux and does not share the Unix lineage. It dates back to 1987 and has not followed development in the same direction as modern operating systems. As a result, it takes a while to get used to this system, since the user interface is quite different from what most people are familiar with. It lacks the level of hardware support that Linux has, so USB devices such as Wi-Fi sticks are not supported. On the other hand, it is extremely fast and excellent for low-level programming. While Linux competes for resources with your applications, RISC OS can get out of your way and let your code have complete control over the hardware. This is a great advantage for time-sensitive tasks and applications where you want to be close to the hardware. The RISC OS website (which you can access at http://www.riscosopen.org) has the resources necessary to get started.

OpenELEC and Raspbmc

These two distributions are centered on XBMC, which is a media player that can turn your Raspberry Pi into a home theater PC (HTPC). The major difference between the two is that OpenELEC is built from scratch and is designed only to be a HTPC distribution. Raspbmc, on the other hand, is built from Raspbian and can also be used as a general purpose distribution. Each has its own advantages and disadvantages and the final choice between the two comes down to preference. If you plan to use Raspberry Pi for specific purpose (home theater), then choose OpenELEC over Raspbmc. However, if you plan to do some general purpose stuff as well, then choose Raspbmc.

Other operating systems

Apart from the operating systems covered previously, there are many more to explore (you can access them via http://elinux.org/RPi_Distributions). These include BSD, the customized versions of Raspbian, Slackware, Gentoo, DexOS, Plan 9, and many others.

Note

In the remaining chapters of this book, projects are developed using Raspbian OS distribution, which is officially recommended by the Raspberry Pi Foundation.

Command summary

Although Linux distributions are quite different in their design philosophies, they are quite similar once the difference between the Init and package management systems is grasped. The important differences are summarized in the following table:

 

Raspbian

Arch

Pidora

Search for software

apt-cache search <keyword>

pacman -Ss <keyword>

yum search <keyword>

Install software

apt-get install <package>

pacman -S <package>

yum install <package>

Update package index

apt-get update

pacman -Sy

yum check-update

Update packages

apt-get dist-upgrade

pacman -Syu

yum distro-sync

Remove software

apt-get remove <package>

pacman -Rc <package>

yum remove <package>

Start service

service <name> start

systemctl start <name>

systemctl start <name>

Enable service

update-rc.d <name> enable

systemctl enable <name>

systemctl enable <name>

Init system

SysVInit

systemd

systemd

Package management

APT

pacman

RPM