The Raspberry Pi is marketed as a small and affordable computer that you can use to learn programming. At least that was its initial goal. As we will see in this book, it is much more than that.
The following topics will be covered in this chapter:
- A brief history of the Raspberry Pi
- A look at operating systems for the Raspberry Pi
- Installing the Raspbian OS
- A quick overview of the Raspbian OS
First released in 2012, the firstRaspberryPi featured a 700 MHz single core processor and 256 MB of RAM. The Raspberry Pi 2Â was released in February of 2015 with a 900 MHz quad core processor and 1 GB of RAM. Released in February of 2016, the Raspberry Pi 3 increased the processor speed to 1.2 GHz.Â This model was also the first one to include wireless LAN and Bluetooth.
Here is an imageÂ of aÂ Raspberry Pi 3 B (2015):
This version of the Raspberry Pi features the following parts:
- Four USB 2 ports
- A LAN port
- A 3.5 mm composite video and audio jack
- An HDMI port for video and audio
- An OTG USB port (which we will use to connect the power)
- A microSD slot (to hold our operating system)
The Raspberry Pi Zero was released in November of 2015.Â Here is an image of it:
Although not as powerful as the previous Raspberry Pis, the Zero featured a smaller size (65 mm X 30 mm), perfect for projects with limited physical space (namely, wearable projects).Â Plus, the Raspberry Pi zero was priced at $5 USD, making it very affordable.Â The Raspberry Pi zero W was released on February 28, 2017 at double the price ($10 USD) with built-in Wi-Fi and Bluetooth capabilities.
The latest model, as of the time of writing, is the Raspberry Pi 3 B+, which was released on March 14, 2018.Â The processor speed has been upgraded to 1.4 GHz as well as the wireless LAN now supporting both 2.4 GHz and 5 GHz bands.Â Another upgrade is theÂ addition of Bluetooth low energy, a technology built for applications that do not require large amounts of data to be exchanged but are required to have a long battery life.
Creators of the Raspberry Pi initially believed that they would sell at most 1,000 units.Â Little did they know that their invention would explode in popularity.Â As of March 2018, sales of Raspberry Pi computers has passed the 19 million mark.
There are various operating systems (or system images) that may be installed on the Raspberry Pi. These range from application-specific operating systems, such as audio players, to various general purpose operating systems.Â The power behind Raspberry Pi is the way it can be used for various applications and projects.Â
The following is a list of just a few of the operating systems (system images) available for the Raspberry Pi:
- Volumio:Â Do you have a desire to set up a networked audio system where you access your music list using a computer or cell phone?Â Volumio may be what you are looking for.Â Installing it on a Raspberry Pi creates a headless audio player (a system that does not require a keyboard and mouse) that connects to your audio files either over USB or a network.Â A special audioÂ Hardware Added on TopÂ (HAT)Â may be added to your Pi to provide a pristine audio connection to an amplifier and speakers.Â There is even a plugin to add Spotify so that you can set up your Raspberry Pi to access this service and play music over your sound system.
- PiFM radio transmitter: The PiFM radio transmitterÂ turns your Raspberry Pi into an FM transmitter, which you can use to send audio files over the air to a standard FM radio receiver. Using a simple wire connected to one of the GPIO pins (we will learn more about GPIO later), you can create an antenna for the transmitted FM signal, which is surprisingly strong.Â
- Stratux: ADS-B is the new standard in aviation where geo-location and weather information are shared with ground controllers and pilots.Â The Stratux image with additional hardware turns the Raspberry Pi into an ADS-B receiver of this information.
- RetroPie: RetroPie turns your Raspberry Pi into a retro game console by emulating gaming consoles and computers from the past.Â Some of the emulations include Amiga, Apple II, Atari 2600, and the Nintendo Entertainment System of the early 1980s.
- OctoPi: OctoPiÂ turns your Raspberry Pi into a server for your 3D printer.Â Through OctoPi, you may control your 3D printer over the network, including viewing the status of your 3D printer using a webcam.
- NOOBS: This is arguably the easiest way to install an operating system on the Raspberry Pi.Â NOOBS stands for New Out-Of-the Box Software, and we will be using NOOBS to install Raspbian.
In this project, we will install the Raspbian operating system onto our Raspberry Pi. After installation, we will take a quick tour of the operating system to familiarize ourselves with it. We will start by formatting a microSD card to store our installation files. We will then run the installation from the microSD card. After Raspbian has been installed, we will take a quick look at it in order to familiarize ourselves with it.
This project should take about two hours to complete, as we install the Raspbian operating system and take a quick look at it.
The following is required to complete this project:
- A Raspberry Pi Model 3 (2015 model or newer)
- A USB power supply
- A computer monitor
- A USB keyboard
- A USB mouse
- A microSD RAM card
- A Raspberry Pi NOOBS image (https://www.raspberrypi.org/downloads/noobs/)
Raspberry Pi uses a microSD card to store the operating system.Â This allows you to easily switch between different operating systems (system images) for your Raspberry Pi.Â We will be installing the default Raspbian OS for our projects using the NOOBS image.
Start by inserting the microSD card into a USB adapter and plug it into your computer:
You may need to format the microSD card.Â If so, use the utilities appropriate for your computer's operating system to format the card to FAT32.Â It is recommended that you use a card with a capacity of 8 GB or greater.Â For Windows OS and cards with 64 GB of capacity or greater, a third-party tool such as FAT32 format should be used for formatting.
The files should look the same as in the following screenshot:
We will now install Raspbian on our Raspberry Pi. This step should beÂ familiar toÂ those that have previous experience installing operating systems such as Windows or macOS. The Raspbian operating system will be installed and willÂ run off of our microSD card.Â
To install Raspbian onto our microSD card, do the following:
- Start by inserting the microSD card into the appropriate slot on the Raspberry Pi.Â Be sure to install it so that the label side (opposite side of the exposed contacts) is facing up.Â Insert it with the metal contacts facing the board.Â The microSD card should have a slight ridge at the top of the label side, which is good for easy removal using a fingernail.
- Insert a keyboard and mouse into the USB slots on the side, a monitor into the HDMI port, and lastly, a USB power cable into the power port.Â The Raspberry Pi does not have an on/off switch and will power up as soon as the power cable is connected:
- After an initial black screen with rolling white text, you should see the following dialog:
- In the previous screenshot, we clicked on the
Languageoption. For our purposes, we will keep the default of
English (UK). We will also keep the keyboard at the standard
- As the Raspberry Pi 3 has wireless LAN, we can set up our Wi-Fi (for older boards, please plug a Wi-Fi dongle into a USBÂ port or use the wired LAN port and skip the next step):
- Click on the
Wifi networks (w)button.Â Choose the
Authentication methodusing the radio buttons.Â Some routers areÂ equipped with a
WPSbutton that allows you to connect directly to the router.Â To use the
passwordmethod, choose the
Password authenticationradio button and enter the password for your network.After connecting to your network, you will notice that there are now more operating system options to select from:
- We will go with the top option,
Raspbian. Check the box beside
Raspbian [RECOMMENDED]and then click on the
Install (i)button at the top-left corner of the dialog. Raspbian will start installing on your Raspberry Pi. You will see a progress bar with previous graphics, describing various features of the Raspbian operating system:
The Raspbian desktop is similar to the desktops of other operating systems such as Windows and macOS.Â Clicking the top-left button drops down the application menu where you may access the various pre-installed programs. We may also shut down theÂ Raspberry Pi from this menu:
The Chromium browser is a lightweight browser that runs remarkably well on the Raspberry Pi:
home folder is a great place to start when looking for files on your Raspberry Pi.Â In fact, when you take screenshots using either the
scrotcommand or the
Screenbutton, the file is automatically stored in this folder:
It is from the command line where you may update the Raspberry Pi using the
sudo apt-get updateand
sudo apt-get dist-upgrade commands.
apt-getupdates the packages list, and
apt-get dist-upgradeupdates the packages:
It's a good idea to run both of these commands right after installing Raspbian using the
sudocommand. The default user for Raspbian on the Raspberry Pi is
pi, which is part of the Super Users group in Raspbian, and thus must use the
sudocommand (the default password for the
Mastering the command line is a virtue that many a programmer aspires to acquire. Being able to rapidly type command after command looks so cool that even movie makers have picked up on it (when was the last time you saw the computer wiz in a movie clicking around the screen with a mouse?). To assist you in becoming this uber cool computer wiz, here are some basic Raspbian commands for you to master using the Terminal:
ls: Command to see the contents of the current directory
cd: Command to change directories. For example, use
cd to move up a directory from where you currently are
pwd: Command to display the directory you are currently in
sudo: Allows the user to perform a task as the super user
shutdown: Command that allows the user to shut down the computer from the Terminal command line
Mathematica spans all areas of technical computing and uses the Wolfram language as the programming language. The areas in which Mathematica is used include machine learning, image processing, neural networks and data science:
Mathematica, a proprietary software first released in 1988, can be used free for individuals on the Raspberry Pi through a partnership that was announced in late 2013.Â
Now letâs take a look at some of the programs that are accessed from the main drop-down menu.
Sonic Pi is a live coding environment for creating electronic music.Â It is accessed from the
Programmingmenu option.Â Sonic Pi is a creative way to create music as the user programs loops, arpeggios, and soundscapes in real time by cutting and pasting code from one part of the app to another.Â Synthesizers in Sonic Pi may be configured on a deep level, providing aÂ customized experience for the music coder:
Geared toward an EDM style of music, Sonic Pi may also be used to compose classical and jazz styles of music.Â
Scratch and Scratch 2.0 are visual programming environments designed for teaching programming to children.Â Using Scratch, the programmer creates their own animations with looping and conditional statements.
Games may be created within the program. The first version of Scratch was released in 2003 by the Lifelong Kindergarten group at the MIT media lab.Â Scratch 2.0 was released in 2013, and development is currently underway with Scratch 3.0:Â
Scratch and Scratch 2.0 may be accessed under the
Programming menu option.
LibreOffice is a free and open source office suite that forked over from OpenOffice in 2010.Â The LibreOffice suite consists of a word processor, a spreadsheet program, a presentation program, a vector graphics editor, a program for creating andÂ editing mathematical formulae, and a database management program.Â The LibreOffice suite of programs may be accessed through the
We started this chapter with a look at the history of the Raspberry Pi. What started as an initiative to promote programming to a new generation has grown into a global phenomenon. We then downloaded the NOOBS image and installed the Raspbian OS, the default operating system for the Raspberry Pi. This involved formatting and preparing a microSD card for the NOOBS files.
It's easiest to think that a computer as inexpensive and small as the Raspberry Pi is not all that powerful. We demonstrated that the Raspberry Pi is indeed a very capable computer, as we took a look at some of the applications that come pre-installed with the Raspbian OS.
In Chapter 2, Writing Python Programs Using Raspberry Pi, we will begin Python coding using the Raspberry Pi and some of the development tools available in Raspbian.
- What year did the first Raspberry Pi come out?
- What upgrades did the Raspberry Pi 3 Model B+ have over the previous version?
- What does NOOBS stand for?
- What is the name of the pre-installed application that allows for creating music with Python code?
- Where is the operating system stored for the Raspberry Pi?
- What is the name of the visual programming environment designed for children that comes pre-installed with Raspbian?
- What is the name of the language used in Mathematica?
- What is the default username and password for Raspbian?
- What does GPIO stand for?
- What is RetroPie?
- True or false? Clicking on the two-folders icon on the main bar loads the
- True or false? The microSD card slot is located at the bottom of the Raspberry Pi.
- True or false? To shutdown the Raspberry Pi, select
- True or false? You may only install the Raspbian OS with NOOBS.
- True or false? Bluetooth low energy refers to people that eat too many blueberries and have a hard time waking up in the morning.
For more information on the Raspberry Pi, please consult the main Raspberry Pi website at www.raspberrypi.org.