

The word robotics can mean a lot of things. For some people, it is anything
that moves by itself; kinetic art is robotics. To other people, robotics means
something that is mobile or something that can move itself from place to
place. There is actually a field called mobile robotics; automatic vacuum
cleaners, such as a Roomba or a Neato, fall into this category. To me
robotics falls somewhere in between kinetic art and mobile robotics.
A robot is technology that applies logic to perform a task in an
automated manner. This is a fairly broad definition, but robotics is a fairly
broad field. It can cover everything from a child’s toy to the automatic
parallel parking capabilities in some automobiles. We build a small mobile
robot in this book.
Many of the principals that you are exposed to in this book are easily
transferable to other areas. In fact, we will go through the entire process of
building a robot from beginning to end. A little later in this chapter, I go over
the project that we will build. At that time, I will provide a list of the parts used
in in this book. These parts include sensors, drivers, motors, and so forth. You
are welcome to use whatever you have on hand because, for the most part,
everything we go through in this book can be applied to other projects. RPA (robotics process automation) is now trending and RPA online training courses are on a high these times. Many students and professionals enroll on online courses to learn more about RPA.
Robotics Basics
I like to tell people who are new to robotics, or are just robotics curious, is
that a robot consists of three elements.
• The ability to gather data
• The ability to process, or do something with the
gathered data
• The ability to interact with the environment
In the following chapters, we apply this principal to build a small
mobile robot. We will use ultrasonic rangefinders and infrared sensors to
gather data about the environment. Specifically, we will identify when there
is an object to be avoided, when we are about to drive off the edge of a table,
and the contrast between the table and the line that we will follow. Once we
have this data, we will apply logic to determine the appropriate response.
We will use Python in a Linux environment to process the information
and send commands to our motors. I chose Python as the programming
language because it is easy to learn, and you don’t have to have a complex
development environment to build some pretty complex applications.
Our interaction with the environment will be simply to control the
speed and direction of motors. This will allow our robot to move about
freely on the table or floor. There really isn’t much to driving a motor.
We will look at two ways of doing it: with a motor driver made for the
Raspberry Pi and with a common motor controller.
This book is intended to be challenging. I cover some pretty complex
material and I do it quickly. There is no way that I can provide detailed
coverage on any of these topics, but I hope to get you to a functional robot
by the end of the book. In each chapter, I try to provide you with more
resources to follow up on the topics discussed. You will struggle at times; I
did and I frequently still do.
Not everyone will be interested in all the subjects. The expectation is
that you will expand on the areas that interest you the most outside of this
book. Persistence pays off.
At the end of the book, I add a little more challenge. In Chapter 9, we
begin leveraging the real power of the Raspberry Pi. We look at computer
vision. Specifically, we look at an open source package called OpenCV (CV
stands for computer vision). It is a common and very powerful collection
of utilities that make working with images and video streams very easy.
It’s also a six-hour build on the most recent version of the Raspberry Pi. To
make things a little easier and a lot less time-consuming, I have available
for download a version of the operating system with OpenCV already
installed. I discuss this more in Chapter 2.
Linux and Robotics
Linux is a Unix-based operating system. It is very popular with
programmers and computer scientists because it’s simple and
straightforward. They seem to enjoy the text-based interface of the
terminal. Yet, for many others, including me, Linux can be very
challenging. So, why in the world would I choose this environment for an
introduction-to-robotics book? The answer to that question is threefold.
First, when you work with robotics, you eventually have to confront
Linux. That’s just a fact. You can do a lot without ever typing a single sudo
command, but you will have limited capabilities. The sudo command stands
for super user do in Linux. This tells the operating system that you are about
to perform a protected function that requires more than general user access.
You will learn more about this when we begin working with the Raspberry Pi.
Second, Linux is challenging. As I stated before, this book will challenge
you. If you have worked in Linux before, then this reason doesn’t apply to
you. However, if you are new to Linux, the Raspberry Pi, or working in a
command line, then some of the things that we do will be challenging. And
that’s good. You’re learning something new and it should be a challenge.
Third, and this is by far the most important, the Raspberry Pi uses
Linux. Yes, you can install other operating systems on the Pi, but it was
designed and intended to use Linux. In fact, the Raspberry Pi has its
own flavor of Linux called Raspbian. This is the recommended operating
system, so it is what we’ll use. One of the nice things about using a prebuilt
operating system, besides its ease of use, is many of the tools are already
installed and ready to go.
Since we are using Linux, we will use command-line instructions
extensively. This is where most new users have problems. Command-line
code is entered via a terminal. Raspbian has a Windows-style interface
that we will use, but much of it uses the terminal. A terminal window
is available in the graphical user interface (GUI), so we will use that.
However, when we set up the Pi, we will set it up to boot into terminal
mode by default. Getting to the GUI is only a simple startx command. All
of this is covered in Chapter 2.
Sensors and GPIO
GPIO stands for general-purpose input/output. It represents all the various
connections to devices. The Raspberry Pi has a lot of GPIO options: HDMI,
USB, audio, and so forth. However, when I talk about GPIO in this book, I’m
generally referring to the 40-pin GPIO header. This header provides direct
access to most of the board’s functionality. I discuss this in Chapter 2.
Arduino also has GPIO. In fact, one could argue that Arduino is all
GPIO and nothing else. This isn’t far from the truth given that all the other
connections are there to allow you to communicate with and power the
AVR chip at the heart of the Arduino.
Read more: Beginning Robotics with Raspberry Pi and Arduino Using Python and OpenCV by Jeff Cicolani





