Thursday, June 4, 2015

Book Review: Learning Raspberry Pi

The subtitle of Samarth Shah's Learning Raspberry Pi (Packt Publishing, 2015) is, "Unlock your creative programming potential by creating web technologies, image processing, electronics- and robotics-based projects using the Raspberry Pi." The book features approximately 225 substantive pages divided into 7 chapters.


I like that Packt books' prefaces tend to have sections "What you need for this book" and "Who this book is for." These sections provide a good, brief description of who the author was targeting when writing the book and what the author expected the reader to have in terms of knowledge and tools when reading the book. The author writes that Learning Raspberry Pi is written "for computer literate adults coming from a Linux, PC, or Mac desktop and wishing to learn how to create things with the Raspberry Pi." The author adds that readers are assumed to "have a Raspberry Pi with the required peripherals," are assumed to be "able to install and boot an operating system using NOOBS or RAW images," and are assumed to "have some exposure to Linux and familiarity with general programming concepts." For anyone considering this book, reading the Preface's overview of each chapter may also be useful.

Chapter 1: Getting Started with Raspberry Pi

The initial chapter of Learning Raspberry Pi introduces the Raspberry Pi. It provides a table that compares and contrasts different models of the Raspberry Pi before showing a high definition photograph of a Raspberry Pi marked with numbers associated with descriptions of the labeled parts. Chapter 1 includes a section on operating systems supported on Raspberry Pi, recommends use of Raspbian operating system (Debian-based but optimized for Raspberry Pi), and states that Raspbian is the operating system used throughout the examples in the book. The section includes a table of commands for three of the covered operating systems that are useful in working with software and services.

As part of its coverage of operating systems, Chapter 1 describes the steps for installing operating systems on a Raspberry Pi with NOOBS and BerryBoot. Coverage in this chapter covers using Windows or Linux for images and discusses setting up root accounts and using sudo. This comprehensive and detailed chapter also looks at remote management of the Raspberry Pi with SSH, adding a web server, adding PHP, adding WordPress, and other aspects related to deploying a LAMP stack on a Raspberry Pi.

Chapter 2: Developing Web Applications

The second chapter of Learning Raspberry Pi covers developing web applications on Raspberry Pi. There is a section of this chapter that introduces HTML, CSS, JavaScript, and jQuery. As the author states early in the chapter, this section can be skipped by a reader already familiar with these standards and libraries.

The "An introduction to Python" section of the second chapter states that Python "is the official programming language suggested by Raspberry Pi Foundation." This section describes how to use Python on the Raspberry Pi and provides an introduction to Python that covers syntax and data types. The section also introduces the Python microframework Flask.

Chapter 2 concludes with a demonstration of "creating an Internet radio station." This is a relatively extensive example that integrates all the concepts covered in the second chapter and employs Music Player Daemon.

Chapter 3: Introduction to Electronics

Chapter 3 of Learning Raspberry Pi begins with discussion of the flexibility of Raspberry Pi's general purpose input/output (GPIO) pins in connecting "to different sensors and electronic components." The chapter has a section of basic electronics and covers concepts such as charge, current, voltage, resistance, Ohm's law, Kirchhoff's Current Law (KCL), and Kirchhoff's Voltage Law (KVL).

The third chapter's section on generic electronic components introduces resistors, diodes, switches, integrated circuits, sensors, LCDs, wire, and the breadboard. There is also a section on Raspberry Pi specific electronics components that provides details on using these components and introduces C-based WiringPi and the WiringPi Python wrapper.

This chapter concludes with three detailed step-by-step examples of using Raspberry Pi electronics and Python scripts to develop a digital clock, an analog clock, and an e-mail notifier.

Chapter 4: Getting into Robotics

Learning Raspberry Pi's fourth chapter introduces robotics and describes a robot as "a system that contains sensors, control systems, manipulators, power supplies, and software all working together to perform a task." Additional electronics components are introduced in this chapter including motor, multimeter, robotic base, ultrasonic sensor, and Raspberry Pi's camera, battery, and Wifi module. The detailed examples illustrating these concepts are "developing a remote-controlled robot with live feed and live distance to the nearest wall", "displaying live feed from the Raspberry Pi camera module", and "developing a remote-controlled robot using Raspberry Pi". The chapter concludes with details on merging these three examples.

Chapter 5: Introduction to Image Processing

Chapter 5 of Learning Raspberry Pi introduces the reader to "the basics of image processing" and the OpenCV image processing library for the Raspberry Pi. The chapter's coverage includes outlining two approaches for installing OpenCV on the Raspberry Pi. The chapter then moves onto covering how to perform image processing with OpenCV. Two detailed examples finish off the chapter and illustrate the chapter's points: "creating time-lapse videos with the Raspberry Pi camera" and "developing a Twitter-controlled Raspberry Pi camera."

Chapter 6: Image Processing Algorithms

Learning Raspberry Pi's sixth chapter builds on its fifth chapter and covers "important image processing operations" such as the four types of image filtering supported by OpenCV and four "morphological operators." The chapter then introduces "core algorithms" (edge detection and background subtraction) before looking at "machine learning" with object detection, face detection, and eye detection. This chapter concludes with illustrative projects that provide concreteness to the topics presented in the chapter.

Chapter 7: Troubleshooting, Tips/Tricks, and Resources for Advanced Users

The title of this final chapter describes the three major areas it covers: troubleshooting, tips and tricks, and resources for additional information. The section on troubleshooting outlines some commonly encountered issues when using Raspberry Pi and describes how to address these. The tips and tricks section contains several short topics that provide details on how to accomplish small but commonly useful tasks and Raspberry Pi administration. The final section of this final chapter references and briefly describes three websites, an online magazine, and another book that provide useful additional information for working with a Raspberry Pi.

General Observations

  • Learning Raspberry Pi features useful tables and graphics that illustrate points well visually and the photographs are high definition and easy to see the components being discussed.
  • The text is easy-to-read even though the concepts can probably be a bit daunting for someone new to them.
  • The comprehensive code listings are black text on white background in the PDF version I reviewed with no line numbers and no color syntax.
  • Numerous project examples are provided that contain a high level of detail to illustrate the book's concepts.


I did not have time to work the examples as I read Learning Raspberry Pi, but my initial impression is that they are highly detailed and provide enough information for a person to copy what he or she reads and make the projects successful. Although there is much information regarding Raspberry Pi on the web, Learning Raspberry Pi provides a single source of well-flowing information to introduce one to the world of Raspberry Pi.

No comments: