Beginning Robotics with Raspberry Pi and Arduino -  Jeff Cicolani

Beginning Robotics with Raspberry Pi and Arduino (eBook)

Using Python and OpenCV
eBook Download: PDF
2018 | 1st ed.
XVII, 363 Seiten
Apress (Verlag)
978-1-4842-3462-4 (ISBN)
Systemvoraussetzungen
36,99 inkl. MwSt
  • Download sofort lieferbar
  • Zahlungsarten anzeigen

Learn how to use a Raspberry Pi in conjunction with an Arduino to build a basic robot with advanced capabilities. Getting started in robotics does not have to be difficult. This book is an insightful and rewarding introduction to robotics and a catalyst for further directed study. 

You'll be led step by step through the process of building a robot that uses the power of a Linux based computer paired with the simplicity of Arduino. You'll learn why the Raspberry Pi is a great choice for a robotics platform; its strengths as well as its shortcomings; how to overcome these limitations by implementing an Arduino; and the basics of the Python programming language as well as some of the more powerful features.

With the Raspberry Pi you can give your project the power of a Linux computer, while Arduino makes interacting with sensors and motors very easy. These two boards are complimentary in their functions; where one falters the other performs admirably.

The book also includes references to other great works to help further your growth in the exciting, and now accessible, field of smart robotics. As a bonus, the final chapter of the book demonstrates the real power of the Raspberry Pi by implementing a basic vision system. Using OpenCV and a standard USB web cam, you will build a robot that can chase a ball.

What You'll Learn

  • Install Raspbian, the operating system that drives the Raspberry Pi
  • Drive motors through an I2C motor controller
  • Read data through sensors attached to an Arduino
Who This Book Is For

Hobbyists and students looking for a rapid start in robotics. It assumes no technical background. Readers are guided to pursue the areas that interest them in more detail as they learn.



Jeff Cicolani is the President of The Robot Group, an Austin, Texas based robotics group consisting of robotics enthusiasts and professionals from throughout the Austin area. He has had a successful technical career as a systems analyst, developer, and project manager for multiple Fortune 500 companies. In 2017, Jeff leveraged his Maker skills, general technical acumen, and passion for robotics into a new career when he accepted a position at SparkLabs, the prototype and research division of SparkCognition, an AI company based in Austin.

Jeff currently lives in Pflugerville, a suburb of Austin, with his lovely wife, two dogs, and countless robots. When he's not building robots at work, he builds robots for fun. He is also the developer of Nomad: Autonomous Robot, which has been featured in several magazine articles and exhibitions.


Learn how to use a Raspberry Pi in conjunction with an Arduino to build a basic robot with advanced capabilities. Getting started in robotics does not have to be difficult. This book is an insightful and rewarding introduction to robotics and a catalyst for further directed study.  You'll be led step by step through the process of building a robot that uses the power of a Linux based computer paired with the simplicity of Arduino. You'll learn why the Raspberry Pi is a great choice for a robotics platform; its strengths as well as its shortcomings; how to overcome these limitations by implementing an Arduino; and the basics of the Python programming language as well as some of the more powerful features.With the Raspberry Pi you can give your project the power of a Linux computer, while Arduino makes interacting with sensors and motors very easy. These two boards are complimentary in their functions; where one falters the other performs admirably.The book also includes references to other great works to help further your growth in the exciting, and now accessible, field of smart robotics. As a bonus, the final chapter of the book demonstrates the real power of the Raspberry Pi by implementing a basic vision system. Using OpenCV and a standard USB web cam, you will build a robot that can chase a ball.What You'll LearnInstall Raspbian, the operating system that drives the Raspberry PiDrive motors through an I2C motor controllerRead data through sensors attached to an ArduinoWho This Book Is For Hobbyists and students looking for a rapid start in robotics. It assumes no technical background. Readers are guided to pursue the areas that interest them in more detail as they learn.

Jeff Cicolani is the President of The Robot Group, an Austin, Texas based robotics group consisting of robotics enthusiasts and professionals from throughout the Austin area. He has had a successful technical career as a systems analyst, developer, and project manager for multiple Fortune 500 companies. In 2017, Jeff leveraged his Maker skills, general technical acumen, and passion for robotics into a new career when he accepted a position at SparkLabs, the prototype and research division of SparkCognition, an AI company based in Austin.Jeff currently lives in Pflugerville, a suburb of Austin, with his lovely wife, two dogs, and countless robots. When he’s not building robots at work, he builds robots for fun. He is also the developer of Nomad: Autonomous Robot, which has been featured in several magazine articles and exhibitions.

Table of Contents 5
About the Author 10
About the Technical Reviewer 11
Introduction 12
Chapter 1: Introduction to Robotics 15
Robotics Basics 16
Linux and Robotics 17
Sensors and GPIO 18
Motion and Control 19
Raspberry Pi and Arduino 19
Project Overview 22
The Robot 22
Bill of Materials (BOM) 23
Summary 29
Chapter 2: An Introduction to Raspberry Pi 30
Downloading and Installing Raspbian 30
Raspbian with OpenCV 32
The “Hard” Way 32
The “Easy” Way 35
Connecting Raspberry Pi 37
Configuring Your Pi 39
Using raspi-config 40
Users 47
Securing Root 48
Change the Default Username 48
Connecting to a Wireless Network 50
Going Headless 50
Remote Access 51
Remote Desktop with xrdp 51
SSH with PuTTY 53
Finding Your Device on a Network 55
Summary 58
Chapter 3: A Crash Course in Python 59
Python Overview 61
Downloading and Installing Python 61
Python Tools 62
The Python Shell 63
The Python Editor 64
The Zen of Python 67
Writing and Running a Python Program 68
Hello World 69
Basic Structure 70
Program Parts 70
Indentation 70
Comments 71
Running a Program 73
Programming in Python 73
Variables 74
Data Types 74
Strings 75
String Manipulation 77
Numbers 79
Lists 81
Tuples 83
Dictionaries 84
None Type 86
A Final Note on Variables 86
Control Structures 87
if Statements 88
Loops 89
for Loop 90
while Loop 91
Functions 93
Defining a Function 94
Passing Arguments 95
Default Values 96
Return Values 96
Adding Functionality through Modules 97
Importing and Using Modules 97
Built-in Modules 98
Extended Modules 100
Custom Modules 101
Classes 103
Creating a Class 105
Planning 105
Initial Sample Robot Class 105
Initial Sample Robot Class 106
Styling 111
Blank Lines 112
Commenting 112
Naming Conventions 112
Summary 113
Chapter 4: Raspberry Pi GPIO 114
Raspberry Pi GPIO 114
Pin Numbering 116
Connecting to the Raspberry Pi 117
Limitations of Raspberry Pi’s GPIO 118
Accessing GPIO with Python 119
Simple Output: LED Example 121
Hooking Up the Circuit 121
Writing the Code 122
Pulse Width Modulation (PWM) 125
Hooking Up the Circuit 125
Writing the Code 125
Simple Input 128
Push-button Example 128
Hooking up the Circuit 129
Writing the Code 131
Sonic Rangefinder Example 132
Hooking Up the Circuit 132
Writing the Code 135
Summary 138
Chapter 5: Raspberry Pi and Arduino 140
Raspberry Pi’s GPIO in Review 141
Real-Time or Near Real-Time Processing 141
Analog Input 142
Analog Output 142
Arduino to the Rescue 143
Using Arduino 145
Installing the Arduino IDE 146
Connecting an Arduino 146
Programming Arduino 147
The Arduino IDE 148
Icons and the Menu 149
Creating a New Sketch 150
Saving a Sketch 150
Opening Exiting Sketches 150
Board and Port Selection 151
Cheating with Examples 152
Using Tabs and Multiple Files 153
Sketches 156
Hello Arduino 157
Anatomy of a Sketch 158
A Brief Introduction to the Arduino Language 160
Including Other Files 161
Variables and Data Types 161
Characters and Strings 162
The String Object 163
Numbers 164
Arrays 165
Control Structures 166
if and else 166
while Loops 168
for Loops 169
Functions 170
Working with Pins 173
Digital Operations 174
Analog Input 175
Analog Output (PWM) 175
Pulsing LED 176
The Circuit 176
The Code 177
Objects and Classes 178
Serial 178
Connecting to Serial 179
Sending Serial Data 180
Receiving Serial Data 180
Arduino to Pi and Back Again 182
Installing PySerial 183
Sending Data to the Raspberry Pi 184
Sending Data to the Arduino 189
Pinguino 192
Setting up the Circuit 193
The Code 194
Arduino 194
Raspberry Pi 195
Summary 196
Chapter 6: Driving Motors 197
Motors & Drivers
Types of Motors 198
DC Motors 198
Brushless Motors 199
Stepper Motors 200
Servos 201
Motor Properties 202
Voltage 203
Amperage 203
Motors and Amps 204
Motor Drivers 205
Working with Motor Controllers 205
Adafruit DC & Stepper Motor HAT
Some Assembly Required 207
Hooking up the Motor Controller 214
Using the Motor HAT 220
Installing the Library 220
The Code 220
Turning a Single Motor 221
Turning Two Motors 224
L298N Generic Motor Driver 227
H-bridge Motor Controller 227
Using the L298N 228
Arduino Code 229
Hooking up the L298N 231
Turning One Motor 232
Turning Two Motors 235
Summary 238
Chapter 7: Assembling the Robot 239
Assembling the Chassis 240
Choosing a Material 240
The Whippersnapper 241
Mounting the Electronics 249
Wiring 256
Mounting Sensors 259
The Finished Robot 262
Making the Robot Mobile 263
The Plan 263
Sensors 264
Motors 264
Behavior 265
The Code 265
Arduino Code 266
Raspberry Pi Code 268
Summary 276
Chapter 8: Working with Infrared Sensors 277
Infrared Sensors 277
Types of IR Sensors 278
Reflectance Sensors 278
Line and Edge Detection 279
Rangefinders 280
Interrupt Sensors 281
PIR Motion Detectors 281
Working with IR Sensors 282
Connecting an IR Sensor 283
Mounting the IR Sensors 286
The Code 288
Arduino Code 289
Python Code 290
Understanding PID Control 299
Control Loops 299
Proportional, Integral, and Derivative Control 299
Proportional Control 300
Integral Control 300
Derivative Control 300
Bringing Them Together 301
Implementing the PID Controller 302
The Code 302
Raspberry Pi Code 303
Summary 306
Chapter 9: An Introduction to OpenCV 307
Computer Vision 307
OpenCV 309
Installing OpenCV 309
Selecting a Camera 312
Installing the Camera 314
OpenCV Basics 315
Working with Images 316
Displaying an Image 316
Capturing Images 318
Opening an Image File 319
Capturing Video 321
Viewing the Camera 322
Recording Video 323
Reading Video from a File 325
Image Transformations 326
Flipping 326
Resizing 328
Working with Color 329
Color Spaces 329
Color Filters 331
Blobs and Blob Detection 335
Finding a Blob 336
The Parameters 338
The Filters 339
filterByColor 339
filterByArea 339
filterByCircularity 340
filterByInertia 340
filterByConvexity 340
Blob Tracking 340
Ball-Chasing Bot 343
Summary 350
Chapter 10: Conclusion 352
Types of Robotics 353
Tools 353
Software 354
Choosing an IDE 354
Design Software 356
2D Drawing 356
Circuit Board Design 358
3D Design 359
Hardware 360
Basic Tools 360
Specialty Tools 362
Makerspaces 362
Summary 363
Index 364

Erscheint lt. Verlag 23.4.2018
Zusatzinfo XVII, 363 p. 103 illus.
Verlagsort Berkeley
Sprache englisch
Themenwelt Informatik Weitere Themen Hardware
Schlagworte Arduino • GPIO • IC2 • Maker • Python • Raspberry Pi • robot • Robotics • Webcam
ISBN-10 1-4842-3462-6 / 1484234626
ISBN-13 978-1-4842-3462-4 / 9781484234624
Haben Sie eine Frage zum Produkt?
PDFPDF (Wasserzeichen)
Größe: 8,2 MB

DRM: Digitales Wasserzeichen
Dieses eBook enthält ein digitales Wasser­zeichen und ist damit für Sie persona­lisiert. Bei einer missbräuch­lichen Weiter­gabe des eBooks an Dritte ist eine Rück­ver­folgung an die Quelle möglich.

Dateiformat: PDF (Portable Document Format)
Mit einem festen Seiten­layout eignet sich die PDF besonders für Fach­bücher mit Spalten, Tabellen und Abbild­ungen. Eine PDF kann auf fast allen Geräten ange­zeigt werden, ist aber für kleine Displays (Smart­phone, eReader) nur einge­schränkt geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.

Zusätzliches Feature: Online Lesen
Dieses eBook können Sie zusätzlich zum Download auch online im Webbrowser lesen.

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

Mehr entdecken
aus dem Bereich