Tuesday, June 9, 2015

Book Review: Raspberry Pi Essentials

Jack Creasey's Raspberry Pi Essentials (Packt Publishing, April 2015) features 8 chapters spanning approximately 180 substantive pages. The book's subtitle advertises, "Get up and running with the Raspberry Pi to develop captivating projects."

Preface

Packt Publishing books' Prefaces are typically good locations to get an idea of who a particular book is designed for and what the reader should bring to the reading of the book and working a book's examples. The Preface of Raspberry Pi Essentials states that this book "is intended for hobbyists and academic project designers and developers who have minimal experience with programming languages and hardware designs." The Preface also states that NOOBS Version 1.4.0 and Raspbian (Debian Wheezy) Version 7.8 (Linux Kernel 3.18) were used when developing the book's content and references the Raspberry Pi Downloads site.

Chapter 1: Getting Started with Raspberry Pi

The initial chapter of Raspberry Pi Essentials begins by explaining that Raspbian is the "primary operating system" for Raspberry Pi provided by the Raspberry Pi Foundation. The chapter quickly describes the Raspberry Pi as a "complete computer system on a small motherboard."

Raspberry Pi Essentials's first chapter explains why anyone of the several Raspberry Pi models works for the examples in the book and outlines the various ports available on the Raspberry Pi models. The author specifically states, "Although the Pi A+, B+, and Model 2-B are used for all of our projects, nothing covered in this book precludes the use of the older A and B models." The chapter discusses the advantage of starting with a Raspberry Pi starter kit and then moves to coverage on configuring Raspberry Pi's power source. I like that this chapter includes multiple photographs that include showing the Raspberry Pi board itself and showing it in the context of a complete development environment.

Sections in Chapter 1 discuss selecting a screen, preparing the SD card, booting the Raspberry Pi for the first time, and dealing with potential issues preventing a display from showing. Chapter 1's section "A quick tour of the desktop" references several useful keyboard shortcuts and demonstrates using the Raspberry Pi web browser to download the source code associated with Raspberry Pi Essentials.

Chapter 2: Configuring the Raspberry Pi Desktop and Software

Raspberry Pi Essentials's second chapter endeavors to "maximize the utility of the desktop graphical tools and develop code for your projects." The chapter covers installing a wireless adapter (including use of Linux lsusb command), using open source network manager wicd, and reserving a static IP address.

Chapter 2's section "Configuring the Raspberry Pi desktop and software" discusses Lightweight X11 Desktop Environment (LXDE) and Openbox. Other sections introduce commands for keeping the environment up-to-date, for installing a screensaver package, and creating a desktop shortcut that allows for easy locking of the screen. Sections of this chapter cover installing the PCManFM file manager and configuring root privileges.

The second chapter's section "Programming on the Raspberry Pi" summarizes programming languages directly available with Raspbian: Bash, C, Python 2, and Python 3. The project that demonstrates Bash is a talking clock that uses cron, mpg123, Leafpad Text Editor, and gnome-schedule. The project demonstrating Python 3 introduces IDLE3 ("GUI development environment for Python 3).

Chapter 3: Raspberry Pi and Cameras

Chapter 3 of Raspberry Pi Essentials begins with an overview on "connecting cameras to the Raspberry Pi" and highlights the differences between MIPI Camera Serial Interface (CSI) and USB camera connections in text and in a performance characteristics table. The chapter introduces the cameras PiCam and PiNoIR. The chapter employs "a project that builds a motion-sensitive security system using multiple cameras" to demonstrate connecting cameras to a Raspberry Pi. The package lucview is used to test the cameras. Turbo mode is also introduced as part of this project and is covered in more detail in Chapter 4. This project-heavy chapter also features projects for "combining the webcam movement detector and the PiCam camera" (using LeafPad) and "creating a simple Python GUI for the security application" (using TkInter). These projects don't include full code listings, but instead reference where the code can be downloaded from and then explains what to modify in the downloaded code.

Chapter 4: Raspberry Pi Audio Input and Output

Raspberry Pi Essentials's Chapter 4 introduces Raspbian Wheezy and Advanced Linux Sound Architecture (ALSA). The chapter discusses selection of proper headphones for the Raspberry Pi and briefly summarizes and demonstrates three key command-line ALSA utilities (alsamixer, aplay, and arecord). There are sections in this chapter on configuring the default ALSA device and configuring high-quality sound via overclocking.

The projects used in Chapter 4 to illustrate concepts are "installing an advanced audio playback application" (introduces VLC media player), "running VLC in the background for the Internet radio" (uses SHOUTcast as example internet radio channel provider), "designing a playlist file for the Internet radio", "parsing the playlist file for the Internet radio," "implementing a Python text interface to VLC," and "implementing a TKinter GUI for the Internet radio." As with other projects covered in the book, there are step-by-step instructions. Code listings are not provided, but rather there are several references to where the necessary code can be downloaded.

Chapter 5: Port Input and Output on the Raspberry Pi

The fifth chapter of Raspberry Pi Essentials starts with an explanation of Raspberry Pi's digital input and output ports. The chapter discusses "driving LEDs as output indicators" and introduces the concept of Charlieplexing with Raspberry Pi and the Python module raspberry-gpio-python.

The "TKinter LED demo" contains 7 "blocks," each of which provides a code listing and associated textual explanation. The "TKinter switch demo" has 3 "blocks" and highlights the need to address switch bouncing. The project that concludes this chapter is to "add a switch interface to the Internet radio."

Chapter 6: Driving I2C Peripherals on the Raspberry Pi

Chapter 6 of Raspberry Pi Essentials discusses "an interface bus that uses a simple message communication protocol that communicates from a master device to a slave device" (I2C or SMBus). The chapter briefly compares and contrasts I2C with SMBus and uses both in examples. This highly technical chapter includes demonstrations and a multi-"block" project to illustrate concepts related to I2C and SMBus. One of the interesting side notes in this chapter is that, at time of the book's writing, the out-of-the-box python-smbus module only works with Python 2.

Chapter 7: Going Mobile with Raspberry Pi

The learning objectives of the seventh chapter of Raspberry Pi Essentials are to "create a command-line interface to the Raspberry Pi" and to "develop mobile power solutions for the Raspberry Pi." An early section of the chapter discusses "connecting from a PC to the Pi using PuTTY on Microsoft Windows." This section describes and illustrates downloading and installing PuTTY. The chapter then discusses "built-in SSH terminal utilities" available in Linux and OSX.

Chapter 7's coverage of batteries compares "primary" batteries to "rechargeable" batteries, explains why rechargeable batteries are more appropriate for a remote Pi system, and provides a table comparing the performance characteristics of "the most common rechargeable battery technologies." This section discusses the need to use a regulator to ensure that "the Pi runs on a regulated 5V power supply" and briefly outlines the three common regulator types for hobbyists. The chapter also introduces some specific batteries that work well with the Raspberry Pi and wraps up with a project "Selecting a project battery capacity."

Chapter 8: Creating a Raspberry Pi Line-following Robot

The final chapter of Raspberry Pi Essentials begins by describing line detection. The author recommends that any reader with no robotics experience might read a little about robotics first and references the Doug Kelley article Line Detection Using a Digital Camera.

A high-level overview of the software portion of the robotics project is presented as the software architecture. Included in this section is a brief explanation of the advantage of writing modular software with an overview of each of the Python modules to be written for the project. After significant discussion on the Python implementation and use of the Python 2 IDLE IDE, the chapter moves onto testing wireless connectivity, assembling the robot, starting up the robot, and navigating the robot. The end of this final chapter also presents the end of the book.

General Observations

  • Raspberry Pi Essentials does not contain many code listings. Instead, there are references to an online resource from which the code listings can be downloaded.
    • This is an advantage for those who don't want to be bothered with the code (want to run it as-is) and for those who would rather read concepts first and look at code separately.
    • Downloaded code can be viewed in a favorite IDE or text editor to enjoy color coded syntax, line numbers, and the ability to easily copy and paste and make modifications.
    • The most significant disadvantage of this approach would be realized when the days comes that this code is no longer available online for download.
    • A secondary disadvantage exists for those who like the text, illustrations, and code to be all in one place.
    • Perhaps the easiest way to download the majority of the code and resources is to download the zipped directory that is available rather than downloading individual chapters' resources.
  • There are several screen snapshots demonstrating graphical tools, screen output, and hardware. These photographs and screen snapshots are clear and illustrate the concepts well.
  • Raspberry Pi Essentials covers several essential aspects of the Raspberry Pi. Much of this is done in an introductory fashion, though the ideas get fairly complex by the end of the book. Some hobbyist background with related technologies or even a little experience with the Raspberry Pi would help a reader get the most out of this book.
  • Raspberry Pi Essentials is a project-centric book. I didn't take the time to complete the projects and I believe that completing the described projects would have made the book much more useful to me. I recommend that anyone reading this book ensure they have access to a Raspberry Pi on which to work the projects and has the ability to allocate some time for completion of each project. The book builds upon previous projects and subdivides several of the larger projects into smaller tasks so that individuals pieces could be accomplished in smaller amounts of time.

Conclusion

Raspberry Pi Essentials uses text, code (included in the book in some cases and downloaded separately in others), graphics, screen snapshots, and projects to introduce essential features of the Raspberry Pi and how to apply those. Although the book is designed for readers with no previous experience, the projects will be easier to accomplish and the concepts easier to understand with some basic familiarity with programming (particularly Python and the Linux operating system) and with hardware (particularly the Raspberry Pi). However, readers without previous experience can likely download and use the code as-is without fully understanding it and can follow the step-by-step instructions to get the projects going.

1 comment:

Jack Creasey said...

Thanks for the book review Justin (I'm the author)
One of the reasons we decided to go with downloadable code was because of the impact on page count.
Many of the introductory texts for Raspberry Pi blow out the page count and still never manage to get satisfactorily meaty projects. My view was that anything beyond 200 lines of code becomes difficult to manage in a book. So our focus was to pick out the high impact lines of code, explain those and provide downloadable code/applications that could be researched at leisure.

Our aim was to produce a compact readable book, where you could absorb the basic processes used in the software and project implementation. When you consider that by the final chapter we had a four module robot controller with interprocess communication going, I thought we achieved that.