100% found this document useful (4 votes)
120 views

Full Download Beginning Robotics With Raspberry Pi and Arduino: Using Python and OpenCV Jeff Cicolani PDF

OpenCV

Uploaded by

aabdeakkila
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (4 votes)
120 views

Full Download Beginning Robotics With Raspberry Pi and Arduino: Using Python and OpenCV Jeff Cicolani PDF

OpenCV

Uploaded by

aabdeakkila
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 62

Download the full version of the textbook now at textbookfull.

com

Beginning Robotics with Raspberry Pi and


Arduino: Using Python and OpenCV Jeff
Cicolani

https://textbookfull.com/product/beginning-
robotics-with-raspberry-pi-and-arduino-using-
python-and-opencv-jeff-cicolani/

Explore and download more textbook at https://textbookfull.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Beginning Robotics with Raspberry Pi and Arduino: Using


Python and OpenCV 2nd Edition Jeff Cicolani

https://textbookfull.com/product/beginning-robotics-with-raspberry-pi-
and-arduino-using-python-and-opencv-2nd-edition-jeff-cicolani/

textbookfull.com

Beginning Robotics with Raspberry Pi and Arduino: Using


Python and OpenCV 2nd Edition Jeff Cicolani

https://textbookfull.com/product/beginning-robotics-with-raspberry-pi-
and-arduino-using-python-and-opencv-2nd-edition-jeff-cicolani-2/

textbookfull.com

Beginning Sensor Networks with XBee, Raspberry Pi, and


Arduino: Sensing the World with Python and MicroPython 2nd
Edition Charles Bell
https://textbookfull.com/product/beginning-sensor-networks-with-xbee-
raspberry-pi-and-arduino-sensing-the-world-with-python-and-
micropython-2nd-edition-charles-bell/
textbookfull.com

Out of Eden: The Surprising Consequences of Polygamy 1st


Edition David P. Barash

https://textbookfull.com/product/out-of-eden-the-surprising-
consequences-of-polygamy-1st-edition-david-p-barash/

textbookfull.com
Neurocritical Care Management of the Neurosurgical Patient
Monisha Kumar

https://textbookfull.com/product/neurocritical-care-management-of-the-
neurosurgical-patient-monisha-kumar/

textbookfull.com

How Global Capital is Remaking International Education The


Emergence of Transnational Education Corporations Hyejin
Kim
https://textbookfull.com/product/how-global-capital-is-remaking-
international-education-the-emergence-of-transnational-education-
corporations-hyejin-kim/
textbookfull.com

Today's Technician: Automotive Electricity and


Electronics, Classroom and Shop Manual Pack, Spiral bound
Version 7th Edition Barry Hollembeak
https://textbookfull.com/product/todays-technician-automotive-
electricity-and-electronics-classroom-and-shop-manual-pack-spiral-
bound-version-7th-edition-barry-hollembeak/
textbookfull.com

Architecture and the Novel under the Italian Fascist


Regime Francesca Billiani

https://textbookfull.com/product/architecture-and-the-novel-under-the-
italian-fascist-regime-francesca-billiani/

textbookfull.com

Multiscaled PVA Bionanocomposite Films Characterisation


and Nanoscale Modelling Mohanad Mousa

https://textbookfull.com/product/multiscaled-pva-bionanocomposite-
films-characterisation-and-nanoscale-modelling-mohanad-mousa/

textbookfull.com
Handbook of Radioactivity Analysis: Volume 2:
Radioanalytical Applications 4th Edition Michael F.
L'Annunziata (Editor)
https://textbookfull.com/product/handbook-of-radioactivity-analysis-
volume-2-radioanalytical-applications-4th-edition-michael-f-
lannunziata-editor/
textbookfull.com
TECHNOLOGY IN AC TION™

Beginning
Robotics with
Raspberry Pi
and Arduino
Using Python and OpenCV

Jeff Cicolani
Beginning Robotics
with Raspberry Pi and
Arduino
Using Python and OpenCV

Jeff Cicolani
Beginning Robotics with Raspberry Pi and Arduino:
Using Python and OpenCV
Jeff Cicolani
Pflugerville, Texas, USA

ISBN-13 (pbk): 978-1-4842-3461-7 ISBN-13 (electronic): 978-1-4842-3462-4


https://doi.org/10.1007/978-1-4842-3462-4
Library of Congress Control Number: 2018937971

Copyright © 2018 by Jeff Cicolani


This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or
part of the material is concerned, specifically the rights of translation, reprinting, reuse of
illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way,
and transmission or information storage and retrieval, electronic adaptation, computer software,
or by similar or dissimilar methodology now known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark
symbol with every occurrence of a trademarked name, logo, or image we use the names, logos,
and images only in an editorial fashion and to the benefit of the trademark owner, with no
intention of infringement of the trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if
they are not identified as such, is not to be taken as an expression of opinion as to whether or not
they are subject to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of
publication, neither the authors nor the editors nor the publisher can accept any legal
responsibility for any errors or omissions that may be made. The publisher makes no warranty,
express or implied, with respect to the material contained herein.
Managing Director, Apress Media LLC: Welmoed Spahr
Acquisitions Editor: Aaron Black
Development Editor: James Markham
Coordinating Editor: Jessica Vakili
Cover designed by eStudioCalamar
Cover image designed by Freepik (www.freepik.com)
Distributed to the book trade worldwide by Springer Science+Business Media New York,
233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505,
e-mail [email protected], or visit www.springeronline.com. Apress Media, LLC is a
California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc
(SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.
For information on translations, please e-mail [email protected], or visit http://www.apress.
com/rights-permissions.
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook
versions and licenses are also available for most titles. For more information, reference our Print
and eBook Bulk Sales web page at http://www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this book is available
to readers on GitHub via the book's product page, located at www.apress.com/978-1-4842-3461-7.
For more detailed information, please visit http://www.apress.com/source-code.
Printed on acid-free paper
For Martha, my beautiful and patient wife, for putting up
with random robot parts strewn about the house, pretty
much constantly
Table of Contents
About the Author���������������������������������������������������������������������������������xi

About the Technical Reviewer�����������������������������������������������������������xiii


Introduction����������������������������������������������������������������������������������������xv

Chapter 1: Introduction to Robotics�����������������������������������������������������1


Robotics Basics�����������������������������������������������������������������������������������������������������2
Linux and Robotics������������������������������������������������������������������������������������������3
Sensors and GPIO��������������������������������������������������������������������������������������������4
Motion and Control������������������������������������������������������������������������������������������5
Raspberry Pi and Arduino�������������������������������������������������������������������������������������5
Project Overview���������������������������������������������������������������������������������������������������8
The Robot��������������������������������������������������������������������������������������������������������8
Bill of Materials (BOM) ������������������������������������������������������������������������������������9
Summary������������������������������������������������������������������������������������������������������������15

Chapter 2: An Introduction to Raspberry Pi����������������������������������������17


Downloading and Installing Raspbian�����������������������������������������������������������������17
Raspbian with OpenCV����������������������������������������������������������������������������������19
The “Hard” Way���������������������������������������������������������������������������������������������19
The “Easy” Way���������������������������������������������������������������������������������������������22
Connecting Raspberry Pi�������������������������������������������������������������������������������������24
Configuring Your Pi����������������������������������������������������������������������������������������������26

v
Table of Contents

Using raspi-config�����������������������������������������������������������������������������������������27
Users�������������������������������������������������������������������������������������������������������������34
Connecting to a Wireless Network����������������������������������������������������������������37
Going Headless���������������������������������������������������������������������������������������������������37
Remote Access����������������������������������������������������������������������������������������������38
Summary������������������������������������������������������������������������������������������������������������45

Chapter 3: A Crash Course in Python��������������������������������������������������47


Python Overview�������������������������������������������������������������������������������������������������49
Downloading and Installing Python���������������������������������������������������������������������49
Python Tools��������������������������������������������������������������������������������������������������������50
The Python Shell��������������������������������������������������������������������������������������������51
The Python Editor������������������������������������������������������������������������������������������52
The Zen of Python������������������������������������������������������������������������������������������55
Writing and Running a Python Program��������������������������������������������������������������56
Hello World����������������������������������������������������������������������������������������������������57
Basic Structure����������������������������������������������������������������������������������������������58
Running a Program����������������������������������������������������������������������������������������61
Programming in Python��������������������������������������������������������������������������������������61
Variables��������������������������������������������������������������������������������������������������������62
Data Types�����������������������������������������������������������������������������������������������������62
A Final Note on Variables�������������������������������������������������������������������������������74
Control Structures�����������������������������������������������������������������������������������������75
Functions�������������������������������������������������������������������������������������������������������81
Adding Functionality through Modules����������������������������������������������������������85
Classes����������������������������������������������������������������������������������������������������������91
Styling�����������������������������������������������������������������������������������������������������������99
Summary����������������������������������������������������������������������������������������������������������101

vi
Table of Contents

Chapter 4: Raspberry Pi GPIO�����������������������������������������������������������103


Raspberry Pi GPIO���������������������������������������������������������������������������������������������103
Pin Numbering���������������������������������������������������������������������������������������������105
Connecting to the Raspberry Pi�������������������������������������������������������������������106
Limitations of Raspberry Pi’s GPIO��������������������������������������������������������������107
Accessing GPIO with Python������������������������������������������������������������������������108
Simple Output: LED Example�����������������������������������������������������������������������110
Simple Input������������������������������������������������������������������������������������������������117
Summary����������������������������������������������������������������������������������������������������������127

Chapter 5: Raspberry Pi and Arduino�����������������������������������������������129


Raspberry Pi’s GPIO in Review��������������������������������������������������������������������������130
Real-Time or Near Real-Time Processing���������������������������������������������������130
Analog Input������������������������������������������������������������������������������������������������131
Analog Output����������������������������������������������������������������������������������������������131
Arduino to the Rescue���������������������������������������������������������������������������������������132
Using Arduino����������������������������������������������������������������������������������������������������134
Installing the Arduino IDE����������������������������������������������������������������������������135
Connecting an Arduino��������������������������������������������������������������������������������135
Programming Arduino����������������������������������������������������������������������������������136
Sketches������������������������������������������������������������������������������������������������������145
A Brief Introduction to the Arduino Language���������������������������������������������������149
Including Other Files������������������������������������������������������������������������������������150
Variables and Data Types�����������������������������������������������������������������������������150
Control Structures���������������������������������������������������������������������������������������155
Working with Pins����������������������������������������������������������������������������������������162
Objects and Classes������������������������������������������������������������������������������������167
Serial�����������������������������������������������������������������������������������������������������������167
Arduino to Pi and Back Again����������������������������������������������������������������������171

vii
Table of Contents

Pinguino������������������������������������������������������������������������������������������������������������181
Setting up the Circuit�����������������������������������������������������������������������������������182
Summary����������������������������������������������������������������������������������������������������������185

Chapter 6: Driving Motors����������������������������������������������������������������187


Motors & Drivers�����������������������������������������������������������������������������������������������188
Types of Motors�������������������������������������������������������������������������������������������188
Motor Properties������������������������������������������������������������������������������������������192
Motor Drivers�����������������������������������������������������������������������������������������������195
Working with Motor Controllers������������������������������������������������������������������������195
Adafruit DC & Stepper Motor HAT����������������������������������������������������������������196
L298N Generic Motor Driver������������������������������������������������������������������������217
Summary����������������������������������������������������������������������������������������������������������228

Chapter 7: Assembling the Robot�����������������������������������������������������229


Assembling the Chassis������������������������������������������������������������������������������������230
Choosing a Material�������������������������������������������������������������������������������������230
The Whippersnapper�����������������������������������������������������������������������������������231
Mounting the Electronics����������������������������������������������������������������������������������239
Wiring����������������������������������������������������������������������������������������������������������������246
Mounting Sensors���������������������������������������������������������������������������������������������249
The Finished Robot�������������������������������������������������������������������������������������������252
Making the Robot Mobile�����������������������������������������������������������������������������253
Summary����������������������������������������������������������������������������������������������������������266

Chapter 8: Working with Infrared Sensors���������������������������������������267


Infrared Sensors�����������������������������������������������������������������������������������������������267
Types of IR Sensors�������������������������������������������������������������������������������������268
Working with IR Sensors�����������������������������������������������������������������������������������272

viii
Table of Contents

Connecting an IR Sensor�����������������������������������������������������������������������������273
Mounting the IR Sensors�����������������������������������������������������������������������������276
The Code������������������������������������������������������������������������������������������������������278
Understanding PID Control��������������������������������������������������������������������������������289
Control Loops����������������������������������������������������������������������������������������������289
Implementing the PID Controller�����������������������������������������������������������������292
Summary����������������������������������������������������������������������������������������������������������296

Chapter 9: An Introduction to OpenCV����������������������������������������������297


Computer Vision������������������������������������������������������������������������������������������������297
OpenCV��������������������������������������������������������������������������������������������������������299
Selecting a Camera�������������������������������������������������������������������������������������302
Installing the Camera����������������������������������������������������������������������������������304
OpenCV Basics��������������������������������������������������������������������������������������������������305
Working with Images�����������������������������������������������������������������������������������306
Capturing Images����������������������������������������������������������������������������������������308
Image Transformations��������������������������������������������������������������������������������316
Working with Color��������������������������������������������������������������������������������������319
Blobs and Blob Detection����������������������������������������������������������������������������325
Ball-Chasing Bot�����������������������������������������������������������������������������������������������333
Summary����������������������������������������������������������������������������������������������������������340

Chapter 10: Conclusion���������������������������������������������������������������������343


Types of Robotics����������������������������������������������������������������������������������������������344
Tools�����������������������������������������������������������������������������������������������������������������344
Software������������������������������������������������������������������������������������������������������345
Hardware�����������������������������������������������������������������������������������������������������351
Summary�����������������������������������������������������������������������������������������������������354

Index�������������������������������������������������������������������������������������������������355

ix
About the Author
Jeff Cicolani currently lives in the Austin,
Texas, area with his wife, two dogs, and
dozen or so robots. He is currently working
as an embedded systems engineer, building
robotic and automated platforms for an AI
(artificial intelligence) company in Austin.
His journey to robotics was circuitous, taking
him through an odd career path that included
systems analysis and design and database
programming. In 2012, he joined The Robot
Group in Austin, where he joined a group of
robotics enthusiasts and began building robots as a hobby. In 2016, he
became president of The Robot Group. In this role, he leads the group in
their mission to promote STEM (science, technology, engineering, and
mathematics) education through robotics. He is currently working to
develop a better understanding of advanced robotics through ROS (the
robot operating system) and machine learning.

xi
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
About the Technical Reviewer
Massimo Nardone has more than 22 years
of experiences in security, web/mobile
development, cloud, and IT architecture. His
true IT passions are security and Android.
He has been programming and teaching
how to program with Android, Perl, PHP, Java,
VB, Python, C/C++, and MySQL for more than
20 years.
He holds a Master of Science degree in
Computing Science from the University of
Salerno, Italy.
He has worked as a project manager, software engineer, research
engineer, chief security architect, information security manager, PCI/
SCADA auditor, and senior lead IT security/cloud/SCADA architect for
many years.
His technical skills include security, Android, cloud, Java, MySQL,
Drupal, Cobol, Perl, web and mobile development, MongoDB, D3, Joomla,
Couchbase, C/C++, WebGL, Python, Pro Rails, Django CMS, Jekyll,
Scratch, and more.
He currently works as a chief information security officer (CISO) for
Cargotec Oyj. He worked as visiting lecturer and supervisor for exercises at
the Networking Laboratory of the Helsinki University of Technology (Aalto
University). He holds four international patents (PKI, SIP, SAML, and Proxy
areas).

xiii
Introduction
Robotics does not have to be difficult. In this book, I introduce you to the
field of robotics. The journey will be challenging; it’s intended to be. But
by the end of the book, you will have hands-on exposure to many of the
fundamental—and not so fundamental—aspects of robotics. You will work
with hardware, assemble and solder a circuit board, write code in two
programming languages, install and configure a Linux environment, and
work with computer vision. Everything else you do with robots will be an
extension of the lessons learned in this book.

Who This book Is For


This book is for those who are new to electronics and IoT; those who have
never used a Raspberry Pi or Arduino separately, let alone together.
This book is for the hobbyist who is interested in learning a little more
about working with robots. Perhaps you’ve built a few circuits with an
Arduino or a custom home entertainment system with a Raspberry Pi, and
now you are curious about what goes into building a robot. You will learn
how these two devices work together to provide very powerful capabilities.
This book is for the entrepreneur who needs to learn more about
technology; someone who doesn’t necessarily have the time to read through
many different books on Arduino, Raspberry Pi, electronics, or programming;
someone who is looking for a broad yet condensed introduction to some of
the fundamentals.
This book is also for the student who wants to take their robot-building
experience beyond bricks and puzzle-piece programming; someone who

xv
Introduction

wants to work with hardware and software that more closely resembles
what they might see in college or in the professional world.
No assumptions are made about experience or background in
technology. As you go through the chapters, you may find parts that you
are already familiar with, and you can skip ahead. But if you are new to
these topics, I try to provide you with a quick but easy introduction.

C
 hapter Overview
You start by learning about the Raspberry Pi and how to work with it. You
download and install the Raspbian operating system, and then configure
the Pi for our project. The goal is to set up your system to be able to easily
access your robot and write your code directly on it.
Once you are able to access your Pi remotely, in Chapter 3, you
delve into programming with Python. I’ll show you how to write simple
programs on the Raspberry Pi. I also take you beyond the basics and cover
some intermediate topics, such as modules and classes. This is one of the
longest chapters since there is a lot of material to cover.
From there, you learn how to interface the Raspberry Pi with external
electronics, such as sensors and LEDs, through the Pi’s GPIO header.
Chapter 4 discusses the different ways of addressing the pins on the
header, some of the functionality exposed through the header, and how to
use an ultrasonic rangefinder to detect objects. This gets you ready for the
next chapter, which introduces the Arduino.
In Chapter 5, you connect the Arduino to the Raspberry Pi. I discuss
some of the reasons you want to do this. I show you how to work with the
Arduino IDE to write programs. I cover serial communication between the
two boards and how to pass information back and forth between them. We
do this using the same ultrasonic rangefinder used in the previous chapter.
Chapter 6 has you turning motors with your Raspberry Pi. You use a
special board called a hat, or plate, to control the motors. This is where I
introduce another skill that you will inevitably need in robotics: soldering.

xvi
Introduction

The header and terminals need to be soldered on to the board that was
selected for this purpose. The nice thing about soldering headers and
terminal blocks is that it’s hard to damage anything, and you will get plenty
of practice.
Chapter 7 is where we bring it all together. You build the robot, and I
discuss some of the physical characteristics of robotics. I cover some of
the design considerations that you will need to keep in mind when you
design your own chassis. Although I am listing a specific chassis kit for this
project, you do not need to use the same one. In fact, I encourage you to
explore other options to find the one that is right for you.
In Chapter 8, I introduce another type of sensor—the IR sensor, and
I show you how to use a very common control algorithm called a PID
controller. I talk about the various types of IR sensors and where you want
to use them. (The chapter on PID control discusses what it is and why you
want to use it.)
Chapter 9 is about computer vision, where you see the true power of
the Raspberry Pi. In this chapter, I cover an open source package called
OpenCV. By the end of Chapter 9, your little robot will be chasing a ball
around the table.
I leave you with some parting thoughts in Chapter 10. I provide a few
tips that I picked up, and I give you a glimpse into my workflow and tools.
After that, you will be ready to begin your own adventures in robotics.

xvii
CHAPTER 1

Introduction
to Robotics
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.

© Jeff Cicolani 2018 1


J. Cicolani, Beginning Robotics with Raspberry Pi and Arduino,
https://doi.org/10.1007/978-1-4842-3462-4_1
Chapter 1 Introduction to Robotics

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.

2
Chapter 1 Introduction to Robotics

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.

L inux 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.

3
Chapter 1 Introduction to Robotics

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.

S
 ensors 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.

4
Chapter 1 Introduction to Robotics

All of these headers and GPIO connections are there so we can access
sensors outside the boards themselves. A sensor is a device that gathers
data. There are many different types of sensors, and all serve a purpose.
Sensors can be used for detecting light levels, the range to an object,
temperature, speed, and so forth. In particular, we will use GPIO headers
with an ultrasonic rangefinder and an IR detector.

M
 otion and Control
One thing that most definitions of a robot have in common is that it needs
to be able to move. Sure, you can have a robot that doesn’t actually move,
but this type of device generally falls under the moniker of IoT, the Internet
of Things.
There are many ways to add motion to your project. The most common
is the use of motors. But you can also use solenoids, air, or water pressure. I
discuss motors more in Chapter 6.
Although it is possible to drive a motor directly off a Raspberry Pi
or an Arduino board, it is strongly discouraged. Motors tend to draw
more current than the processors on the boards can handle. Instead,
it is recommended that you use a motor controller. Like motors, motor
controllers come in many forms. The motor control board that we will use
is accessed through the Raspberry Pi’s header. I also discuss how to drive
motors with an L298N dual motor controller.

Raspberry Pi and Arduino


We will use a Raspberry Pi (see Figure 1-1) in conjunction with an Arduino
(see Figure 1-2) as our robot’s processing platform.

5
Chapter 1 Introduction to Robotics

Figure 1-1. Raspberry Pi 3 B+

Figure 1-2. Arduino Uno

6
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
Chapter 1 Introduction to Robotics

The Raspberry Pi is a single board computer that is about the size of a


credit card. Despite its small size, it is a very capable device. The Pi runs
a version of Linux that was customized to work on the ARM processor
that drives it. This puts a lot of functionality into a small device that is
easy to embed into things like robots. But, although it is a great computer,
there are a few places where it does not excel. One area is interfacing with
external devices. It can work with sensors and external devices, but the
Arduino does this much better.
Arduino is another small processing device that is readily available and
easy to use. Unlike a Raspberry Pi, however, it does not have the capacity
for a full operating system. Rather than running a microprocessor like the
ARM, it uses a different type of chip called a microcontroller. The difference
is that a microcontroller is specifically designed to interact with sensors,
motors, lights, and all kinds of devices. It directly interacts with these
external devices. The Pi works through many layers of processing before it
ever reaches the pins that a device is connected to.
By combining the Raspberry Pi and the Arduino, we are able to
leverage what each does best. The Raspberry Pi offers the high-level
processing power of a full computer. Arduino provides the raw control over
external devices. The Pi allows us to process a video stream from a simple
USB camera; whereas the Arduino allows us to gather the information
from the various sensors, and apply logic to make sense of all that data,
and then return concise findings to the Pi.
You will learn more about the Raspberry Pi in Chapter 2. Later on, you
will connect an Arduino to the Pi and learn about programming it, as well
as how to pass information back and forth between the Arduino and the Pi.

7
Chapter 1 Introduction to Robotics

P
 roject Overview
In this book, we will build a small mobile robot. The robot is designed to
demonstrate the lessons that you learn in each chapter. However, before
we can actually build the robot, we need to cover a lot of material and lay
the foundation for future lessons.

T he Robot
The robot that we will build is a small two- or four-wheeled autonomous
rover. It will be able to detect obstacles and the edge of a table, and to
follow a line. The chassis that I selected is a four-wheeled robot, but there
are other designs suitable for this project (see Figures 1-3 and 1-4).

Figure 1-3. The front of our robot shows the ultrasonic sensors and Pi
T Cobbler on a breadboard

8
Chapter 1 Introduction to Robotics

Figure 1-4. The back of our robot shows the Raspberry Pi and motor
control board

Although I provide a list of the parts that I used for the project, you are
welcome to use whatever parts you wish. The important thing is that they
behave in a similar manner as those I have listed.

Bill of Materials (BOM)


For the most part, I tried to keep the list of materials as generic as possible.
There are a couple of items that are vendor specific. I chose them because
they provide a lot of functionality and convenience. The DC & Stepper
motor controller and the Pi T-Cobbler are from an online retailer called
Adafruit, which is a great resource for parts, tutorials, and inspiration.
The chassis kit is from an online retailer called ServoCity, which produces
many mechanical parts for robotics.

9
Chapter 1 Introduction to Robotics

The following are the specialty parts (shown in Figure 1-5) that we use
in this book:

• Runt Rover Junior robot chassis from ServoCity.com

• Adafruit DC & Stepper Motor HAT for Raspberry Pi –


Mini Kit PID: 2348

• GPIO Stacking Header for Pi A+/B+/Pi 2/Pi 3 – Extra-­


long 2×20 Pins PID: 2223 (allows the use of additional
plates and the Cobbler to attach to the breadboard)

• Assembled Pi T-Cobbler Plus – GPIO Breakout – Pi A+,


B+, Pi 2, Pi 3, Zero PID: 2028

Figure 1-5. Runt Rover chassis parts and the Pi T Cobbler, ribbon
cable, motor control hat, and extended header

10
Chapter 1 Introduction to Robotics

The following parts (shown in Figure 1-6) are fairly generic and can be
purchased from most vendors:

• Raspberry Pi 3 – Model B – ARMv8 with 1G RAM

• Arduino Uno

• 4 × AA battery holder with on/off switch (powers the


motors)

• USB Battery Pack – 2200 mAh Capacity – 5V 1A Output


PID: 1959 (powers the Raspberry Pi)

• Half-size breadboard

• Ultrasonic sensors – HC-SR04

You may want to get a few of these. As you will


discover, ultrasonic sensors are unreliable at angles,
and it is good to have an array of them. I use at least
three on most of my projects.

• A collection of jumper wires (see Figure 1-7)

You need both male-to-male jumpers and male-­


to-­female jumpers. It is a good idea to get them
in a number of colors. Black and red are used for
powering your devices. A collection of other colors
helps you make sense of your circuits. Fortunately,
you can get jumpers of all types made out of a
multicolored ribbon cable.

• USB cables for your Arduino

• A micro USB cable for your Raspberry Pi

• A common USB phone charger, preferably one for a


modern smartphone or tablet that can provide 2 amps
of power

11
Random documents with unrelated
content Scribd suggests to you:
The Project Gutenberg eBook of The military
memoirs of an infantry officer, 1809-1816
This ebook is for the use of anyone anywhere in the United States
and most other parts of the world at no cost and with almost no
restrictions whatsoever. You may copy it, give it away or re-use it
under the terms of the Project Gutenberg License included with this
ebook or online at www.gutenberg.org. If you are not located in the
United States, you will have to check the laws of the country where
you are located before using this eBook.

Title: The military memoirs of an infantry officer, 1809-1816

Dubious author: James Archibald Hope

Release date: July 25, 2024 [eBook #74122]

Language: English

Original publication: Edinburgh: Printed for the Author, 1833

Credits: Brian Coe, Graeme Mackreth and the Online Distributed


Proofreading Team at https://www.pgdp.net (This file was
produced from images generously made available by The
Internet Archive)

*** START OF THE PROJECT GUTENBERG EBOOK THE MILITARY


MEMOIRS OF AN INFANTRY OFFICER, 1809-1816 ***
MILITARY MEMOIRS.
EDINBURGH:

PRINTED BY ANDERSON & BRYCE.


THE

MILITARY MEMOIRS
OF AN

INFANTRY OFFICER.
1809-1816.

EDINBURGH:

PRINTED FOR THE AUTHOR,

BY ANDERSON & BRYCE.

MDCCCXXXIII.
Address.
The Work now submitted to the Public, contains an account of the
Author's Campaigns during the most memorable period of the late
French wars. It pretends to no eminence as a literary composition;
but the Author trusts, that it will not be found wanting in accuracy of
detail, as to facts falling under his own notice. He trusts that no one
who opens it in hope of being amused, will shut it disappointed; and
he sincerely hopes that the junior members of his own profession
will find in it something which may prove useful to them when they
are called upon to suffer hardships—to encounter dangers—and to
perform duties similar to those recorded in the following pages.
Perth, 20th March, 1833.
MILITARY MEMOIRS
OF AN

INFANTRY OFFICER.
CHAPTER I.
In the beginning of the summer of 1809, the whole European
commonwealth—Austria, Spain, Portugal, and Sicily excepted, were
arrayed in arms against the British Isles; and ere the autumnal sun
had cheered the heart of the Austrian husbandman, that powerful
empire, after a series of sanguinary conflicts, was compelled to sue
for peace, and join the ranks of the enemy. The latter unfortunate
event reduced the number of our allies from forty to sixteen millions;
and consequently gave to our haughty antagonist a numerical
superiority of one hundred and fourteen millions—France and her
allies forming a body of one hundred and fifty millions, while Britain,
and her little band of faithful friends amounted to thirty-six millions
of souls only! Such was the unequal division of power in Europe in
July 1809, when the grand expedition under the present Earl of
Chatham quitted the British shores, to assail the enemy in a quarter
then looked upon as the most vulnerable point of his widely
extended dominions.
During the awful period of preparation, the eyes of every inhabitant
of these realms were directed to the place of rendezvous; while with
breathless anxiety they watched the movement of every ship, and of
every battalion, as if the fate, not only of the United Kingdom, but of
the civilized world depended on the contemplated assault. From the
Land's End to John O'Groat's, and from Donaghadee to the
southernmost promontory of Erin's green isle, the interest excited on
this occasion was every where the same. Throughout Scotland,
England, and Ireland—in the mansion of the peer, and lowly abode
of the peasant—one prayer only was heard, and that one was for the
success of the expedition wherever bound, and a safe return to
those embarked in it.
At Deal, Ramsgate, and Portsmouth, scenes of a most animated
description were daily presented to the eye of a spectator, from the
commencement of the vast preparations, till the last vessel spread
her white sails to the wind, and bade adieu to the chalky cliffs of the
sea-girt isle. During the whole of that interesting period, the
embarkation of men, horses, artillery, and military stores, continued
without intermission until all the ships in the fleet were filled with
the munitions of war, and those gallant spirits who were destined to
apply them to deadly purposes. At the embarkation of some of the
battalions, it was truly heart-rending to see the poor women taking
leave of their husbands—many of them to meet no more. The
agonizing cries,—the piteous lamentations, and the tears which
flowed in copious streams down their care-worn cheeks, were more
than sufficient to penetrate the hardest heart that ever lay incased in
the breast of man. The feelings of the soldiers, also, were on those
occasions, not only such as to do them honor, but to convince every
individual who witnessed the interesting scenes, that although
soldiers may be said to live and move in a region of danger, and not
unfrequently surrounded with scenes of horror, in every appalling
shape which the field of battle can produce, yet their hearts are
stored with a much larger portion of the finer feelings of the human
breast, than people in private life have hitherto been disposed to
give them credit for. The parting salutations of the distressed
couples, no one could hear without being sensibly affected.—"God
bless you, Mary; be kind to our babes;" or "Farewell, Betsy; think of
me till I return;" were very generally the requests made by the
soldiers, when they grasped the hands of their afflicted partners, to
bid them adieu,—requests which the latter invariably promised to
observe, and then sealed their pledge with a tender embrace.
Scenes of dissipation were also pretty numerous, particularly at
Portsmouth, where it was nothing uncommon to see a jolly tar
locked so fast in the arms of a help-mate on the beach, that it
required considerable exertion to rouse them from their slumber, and
not a little persuasive eloquence to make the happy mortals
relinquish their unseemly couch on the shore, for one more secluded
from public view.
For two weeks previous to the sailing of the expedition, Deal was
literally filled to an overflow with naval and military officers of all
grades, from the admiral to the little middy, and from the general to
the jolly ensign. Every hotel and tavern, and numerous private
houses, were so crowded, that four of my friends were one evening
compelled to pay one pound four shillings for a room and single bed.
Determined to reap a golden harvest, the good honest people of
Deal, demanded most exorbitant prices for almost every article we
required, and which, I am sorry to say, were but too generally paid,
and without a grumble by the thoughtless, and almost countless
host of purchasers. During the day, the principal shops were
crowded almost to suffocation—particularly those confectionary
establishments where the sparkling eyes of the fair shopkeepers
formed a point of attraction too powerful for the youthful portion of
our fraternity to resist.
By the bye, I should like to know the reason why so many
confectioners and fancy snuff retailers, place pretty little interesting
creatures behind their counters, for it is a system which I ever have,
and will continue to condemn as one of a most pernicious tendency
—the giddy and thoughtless portion of our youth viewing it in a light
favourable to immorality. Now, this being a fact which no man can
deny, and as it should be the grand object of all respectable
tradesmen to stand fair with the world, and be at peace with their
own consciences, those individuals who now employ decoy ducks,
cannot too soon lay aside the practice, for they may rest assured,
that no such bare-faced attempts to procure a market for their
commodities, will ever be patronized by any good or honourable
man.
From the rising to the setting of the sun, Deal and its environs daily
presented to the eye of a stranger, a singular and interesting picture.
Afloat and on shore, the first disturbers of our nocturnal repose,
were the morning guns, and reveille. By their united efforts,
thousands of dormant spirits were daily roused into action, some to
prepare for a long and a tough pull at the oar—others for a hard
cruise on shore. From day-break all was life and gaiety on board;
and ere the sun had advanced far on his diurnal journey, hundreds
of boats filled with naval and military heroes, were skimming along
the surface of the briny deep, and with fearful velocity hastening
towards the landing-place. The foraging parties returned to their
ships on procuring the provisions of which they stood in need; those
on pleasure remained on shore to enjoy the sports of the day. On
the departure of the former, stillness reigned through every corner of
the town, till noon, when boats, as formidable in point of numbers
as before, again approached the beach, and poured fresh cargoes of
emigrants into it, to the great annoyance of all, save shopkeepers
and publicans. On landing, each officer pursued the route which
fancy pointed out. The politician retired to some place of
entertainment, and scanned the pages of the newspapers; the
sedate and prudent had an eye to their personal comforts; and the
loungers made arrangements for a cruise through the town, to
torment some unfortunate billiard marker, or make some
confectioner, or milliner's shop girl fancy herself a goddess. Engaged
in similar interesting and honourable employments, the various
groups promenaded the streets, till old father time, pointing to the
hour of four, gave the whole a hint to retire and partake of Deal
hospitality, or the good things which their friends had provided for
them on board. From the latter hour, every hotel, and minor place of
public resort, were crowded with warriors of every description,
whence hundreds of them, after dedicating many a full flowing cup
to those they had left behind, went daily reeling to their boats, as
happy as the juice of the grape, or malt could make them, all the
way singing,
"How merrily we live who soldiers be."
Whenever the surf ran high at the landing place, these thoughtless
mortals afforded their more reflecting brethren a very rich treat; for
having generally dipped deeper into the cup of intemperance than
prudence dictated, they had so much difficulty in stowing themselves
into their skiffs, that a severe bruise or two on the leg, in addition to
a complete ducking, were very frequently the fruits of their
bacchanalian revels, before they accomplished their object.
A more unique, and on the whole, interesting mass of human
beings, was perhaps never before collected within so narrow a
compass. In Deal, were congregated men from every country, of
every religious persuasion, and of every profession under the sun.
So various were the costumes worn, and so numerous the languages
spoken by the dense assemblage of naval, military, and civil
characters, as they paraded the streets, that had that interesting
personage, Mr Paul Pry, been then in existence, and dropped in upon
us, ignorant of the cause which had drawn us together, he most
assuredly would have taken it for granted, that it was our intention
to build a second Babel on one of the heights between Deal and
Dover.
Various as were the costumes of the multitude, their shades of
character were not less diversified. Having occasion one day to wait
upon Sir John Hope, (late Earl of Hopetoun) he, on my taking leave,
requested me to carry a letter to Colonel Cameron of the 92d
regiment, who, with a portion of his battalion, was then on board of
the Superb of 74 guns. On leaving Walmer, I proceeded to the
quarter-deck of the venerable bark, and delivered my charge into
the hands of the Highland chief. Knowing that Sir John Hope was to
take his passage in the Superb, and that orders had been received
for her to sail on the following morning, the Colonel instantly
communicated the contents of Sir John's note to Admiral ——,
whose pendant floated in the wind from the mast of the "Old
Superb," as the nautical gentleman generally denominated her. On
hearing that Sir John Hope did not expect to embark for three or
four days, the Admiral then said he would write to Sir John on the
subject, and requested me to forward his letter the moment I
landed. The Admiral then hurried into his cabin, and in a few
minutes reappeared with the letter in his hand.
On receiving it, I again repeated my pledge to see the letter
delivered, and was on the eve of turning round to regain my boat,
when the Admiral, without uttering a word, snatched the letter out
of my hand, tore it in numerous pieces, and like a flash of lightning,
darted into the cabin. This comic scene drew smiles from many a
weather-beaten countenance, while to me, the whole matter was
totally inexplicable; and in this hopeful state of ignorance I might
have remained to the present day, had not a naval friend the same
day at dinner satisfied me, that with the exception of a few such
occasional occurrences, there was no other draw-back to as gallant
and amiable a character as ever graced the quarter-deck of a British
man-of-war.
To the same friend I am indebted for the following anecdote of
another distinguished naval commander, who held an important
command in the fleet, which wafted us to the pestilential marshes of
the land of frogs.
A few days previous to the memorable battle of Trafalgar, Admiral Sir
R.S. was detached on a special service by Lord Nelson, with several
sail of the line. The gallant chief had not been long absent from the
grand fleet, when one morning he observed an enemy's fleet of four
sail of the line, bearing down, cleared for action. Our lads being as
anxious for a bit of fun as their Gallic opponents, accepted the
challenge, and to it they went, ship to ship. One of the British ships
commanded by Captain ——, less distinguished for beauty than his
unconquerable courage, grappled instantly with a French ship of
superior force, and in a very short time made her opponent feel, that
no enemy, however formidable, is at any time permitted to approach
a British man-of-war with impunity; for
Firm are the sons that Britain leads,
To combat on the main.
On perceiving that the fire of his favourite ship was doing great
execution, the Admiral, in token of his admiration, threw his hat on
the deck, and remained uncovered, amidst dreadful showers of
bullets. The fire from the French vessel growing less vivid, Sir R.'s
heart was so gladdened with this first prospect of victory, that he
began to dance, and with the vigour of years gone by, kept it up, till
his hat was turned into innumerable shapes; and in one of the most
fantastic, removed from under the Admiral's feet, and replaced on
his head. A second favourable omen soon after appearing, the hat
was again doomed to descend from its elevated station, to
experience from its brave owner the same treatment as before. But
fortunately for the chapeau, a third omen of victory soon followed
the last, which operated so powerfully on the mind of the gallant
Admiral, that he ordered his wig to follow its friend, and in a
twinkling again began to trip it on the light fantastic toe, and
continued the youthful amusement till every one of the enemy's
ships had successively hauled down their colours.
The day at length approached, when it became necessary for all and
each of us to lay fun and revelry aside, and prepare for an early
meeting with the enemies of our common country. Early on the
afternoon of the 27th July, the ominous signal, Blue Peter, was
hoisted on board of the head quarter ship. Although nothing had
been permitted to transpire which could mark the exact point of
debarkation, yet from various movements among the vessels of war,
it was not very difficult to discover that our destination was Holland.
This was rather a disagreeable discovery, for it was impossible to
banish from our remembrance the dreadful hardships which our
friends suffered in that country, during the campaigns of 1794 and
1795. These unpleasant recollections, added to the disastrous
dispatches which arrived from the banks of the Danube, a few days
previous to the sailing of the expedition, produced an unfavourable
impression on the minds of almost every individual in both services.
But it may very fairly be questioned, whether the appointment of a
titled general to a high command in the expedition, did not produce
a much more baneful sensation. Report had been for some time
particularly busy in assigning to this General the situation which he
ultimately held in the expedition; but until the appointment actually
appeared in the London Gazette, none attached the smallest credit
to it; for there were more than one general officer then at home, not
only well qualified for the command of such a force, but who having
spent the greater part of their lives on foreign service, looked for
such an appointment as a suitable reward for their long and faithful
services. That some of the best and bravest of our land felt severely
the cold hand of neglect on this occasion, was not only currently
reported, but credited in military circles. In fact, report went so far
as to assert, that promises had been made in a high quarter to some
of the gallant individuals, which, if kept, the noble Earl would have
been compelled to remain at home, and live in expectation. Had the
appointment of commander-in-chief rested with the troops, their
choice would, no doubt, have fallen upon that general, whose
military talents shone so conspicuously in the command of the
British army in Spain, on the fall of his early and bosom friend, the
lamented Moore. Can I adduce a stronger proof in support of this
assertion, than the following little incident, to which I was an eye-
witness. A private soldier of the 36th regiment, actually refused to
embark at Portsmouth; and on being desired to give his reasons for
disobeying the orders of his superiors, very coolly replied, that it was
because Sir John Hope was not to have the command of the
expedition. I may state further, that the soldier was placed in the
boat by force; and on quitting the beach, cried, "Sir John Hope for
ever;" to which the cheers of those on shore most heartily
responded.
So confident were many of my friends that the fleet would never sail
from the Downs, that when the signal of preparation was hoisted,
hundreds were on shore, so totally destitute of the means of leaving
it, that had the fleet got under weigh the same day, a considerable
portion of them must eventually have been left behind. As it was,
many officers did not get on board till four o'clock on the following
morning, and then only on paying the trifling sum of three and four
Guineas for a trip of half as many miles.
The troops employed in this expedition, consisted of twelve
squadrons of cavalry—forty battalions, besides portions of battalions,
of infantry—and from eighty to one hundred pieces of artillery. The
whole were formed into sixteen brigades, and the latter again into
seven divisions as follows, viz.:
Lieutenant General Sir Eyre Coote's Division.
1st Brigade.—Colonel Mahon.
Three Squadrons.—9th Light Dragoons, part of 95th Rifle
Corps, and Detachment of Royal Staff Corps.
2nd Brigade.—Brigadier General Rottenburg.
The 68th, 1st Battalion, 71st, and one Battalion of 95th
Rifle Regiment.
Lieutenant General the Earl of Rosslyn's Division.
1st. Brigade.—Major General Linsingen.
Three Squadrons 3d Dragoon Guards—Three Squadrons
12th Light Dragoons, and Three Squadrons 2d Light
Dragoons, King's German Legion.
2nd Brigade.—Major General Stewart.
The 2d Battalions of the 43d and 52d, and Eight
Companies of 95th Rifle Corps.
3d Brigade.—Brigadier General Baron Alten.
The 1st and 2d Battalions King's German Legion.
Lieutenant General Sir John Hope's Division, or Corps of
Reserve.
1st Brigade.—Brigadier General Disney.
The 1st and 2d Battalions First Foot Guards.
2d Brigade.—Major General the Earl of Dalhousie.
The 1st and 2d Battalions 4th Foot, and 1st Battalion 28th
Regiment.
3d Brigade.—Major General Sir William Erskine.
The 20th Foot, and 1st Battalion 92d Regiment.
Lieutenant General the Marquis of Huntly's Division.
1st Brigade.—Major General Leith.
The 2d Battalions 11th and 59th, and 1st Battalion 79th
Regiment.
2d Brigade.—Brigadier General Ackland.
The 2d Foot, 76th, and 2d Battalion 84th Regiment.
Lieutenant General Mackenzie Fraser's Division.
1st Brigade.—Major General Dyott.
The 1st Battalions of 5th, 58th, and 91st Regiments.
2d Brigade.—Brigadier General Montresor.
The First Battalions 9th, 38th, and 42d Regiments.
Lieutenant General Grosvenor's Division.
1st Brigade.—Major General Brown.
The 2d Battalions 23d, 26th, and 81st, and First Battalion
32d Regiment.
2d Brigade.—Major General Picton.
The 1st Battalion 36th, 2d Battalion 63d, and 77th
Regiments.
Lieutenant General Lord Paget's Division.
1st Brigade.—Major General Graham.
The 3d Battalion 1st Foot, and 85th Regiment.
2d Brigade.—Brigadier General Houston.
The 2d Battalions of the 14th and 51st, and 82d
Regiment.
Commander-in-Chief.
Lieutenant General the Earl of Chatham.
Second in Command.
Lieutenant General Sir Eyre Coote.
Commanding Artillery.
Major General M'Leod.
Chief Officer of Engineers.
General Terrot.
The naval part of the expedition consisted of from 300 to 400
vessels of all denominations, upwards of 100 of whom were ships of
the line—frigates, sloops, and brigs of war, &c. The whole were
placed under the command of Rear Admiral Sir Richard Strachan,
who had Rear Admiral Sir R.G. Keates as his second, on this
interesting and important occasion.
At day-break, on the 28th of July, all hands were piped on deck to
assist at the capstone, and most cheerfully did every man, soldiers
and sailors, join in the good old British cry of "Yeo—heave ho!" In
less than an hour, a considerable portion of the fleet had unfurled
their white sails to the wind, and were ploughing their way towards
the Scheldt, their decks covered with thousands of warriors,
chaunting, as they cast a long and lingering look behind—
"Ye beautuous maids your smiles bestow,
For if ye prove unkind,
How can we hope to beat the foe,
Who leave our hearts behind."
The vessels of war moved outside of the transports, and the gun-
boats, with the assistance of some buoys, marked the route of the
whole. The appearance of the fleet this morning, was even more
magnificent than when it rode at anchor in the Downs. Nothing
could move more beautifully than the largest class of our men-of-
war, as they dashed through the foaming billows, leading the way to
the scene of action. For some hours I paced the deck of our little
brig, admiring with feelings of national pride, the noble—the
unrivalled spectacle before me; and on my eyes being sufficiently
feasted, I descended into our little crib, and there craved from the
Giver of Victory, success in some degree commensurate with the
magnitude of the armament.
On weighing anchor, the wind was favourable, and blowing what our
nautical friends called a gentle breeze; but as we receded from the
British shore, it freshened, and during the rest of the day blew hard.
A few hours after leaving our anchorage, and when something like
order was restored on deck, we retired into the cabin to partake of
our morning repast. The servants, however, having neglected to lash
the table to the cabin floor, we had not been seated many minutes,
when one dire hitch of our little jade, tumbled every thing topsy-
turvy. In an instant, away went seats and sitters, table, tea-pot,
cups, bread, butter, and eggs, all towards one common centre—the
portly person of our worthy quarter-master, a man nearly six feet
four inches in height. The latter no sooner felt an inclination to slide
backwards, than he, like a drowning man grasping at a straw, rather
unluckily caught hold of the table, which being as ready for a piece
of fun as his own seat, at once yielded to the impulse of the
venerable hero, and most cheerfully accompanied him in his trip to
the then lower part of the cabin. Failing in this attempt to preserve
his position, our messmate had now no other alternative than to
permit matters to take their course, so down went the head, and up
flew the heels of the warrior, who in a moment lay weltering—not in
his blood—but in tea, and nearly suffocated with the caresses of his
friends, who in their journey to the same quarter of the cabin, found
the veteran an obstacle not to be avoided.
The wind had increased so much in the night of the 28th, that at
day-break on the 29th, the sailors called it a stiff gale. Two hours
after sun-rise, the sea presented to the view of all on board, such an
unusual appearance, that every one fancied that the vessels in rear
were descending a considerable declivity. As the day advanced, the
wind increased, till the surrounding waters became so agitated, that
when the masters of transports were plying between their own
vessels and those of their respective commodores, they frequently
appeared to us all but engulphed in the roaring element. The small
craft rolled and pitched most fearfully, and the crews of the gun-
boats had work enough on their hands. The decks of the latter being
raised very little above the surface of the water, almost every wave
passed over them, drenching the crews so thoroughly, that the poor
fellows, long ere night, had more the appearance of belonging to
some amphibious tribe, than the human race. In the afternoon, the
cries of some of the latter for help, were truly deplorable. Previous to
the sailing of the expedition from the Downs, the competition
amongst the junior naval officers for the command of the gun-boats,
was extremely keen, each candidate bringing into play all the
interest he could command, to obtain for him the object of his
ambition. But I am pretty certain, that had a sense of honour
permitted them, not a few of those spirited individuals would, on this
occasion, most gladly have made use of the same interest to have
themselves removed back to their former situations.
About nine o'clock in the morning of the 29th, the person on the
look-out duty, descried the Dutch coast a-head, and towards noon, a
great many vessels dropped their anchors in the Room-Pot, but
subsequently moved to a safer anchorage in the Vere-Gat, between
the islands of Schowen, and North Beveland. Here the whole
armament re-assembled the same evening and following day.
Every thing being ready for an immediate descent on the enemy's
coast, part of the army destined to act against Flushing, were
removed into flat bottomed boats; and at four o'clock in the
afternoon of the 30th, moved off in beautiful order towards the
shore. Under cover of a few bomb vessels and gun-brigs, the small
craft advanced with great regularity, till within a short distance of the
landing place, when a general cry of, "Devil take the hindmost," ran
from right to left. The landing of troops in face of an enemy, being
at all times a hazardous operation, considerable anxiety was
apparent in every countenance, till the friends who had preceded us
in the road to honour, had obtained a footing on the enemy's soil.
Having effected a landing on the island of Walcheren, at a place
called the Bree-sand, and about a mile from Fort Der Haak, part of
the troops under General Fraser, were sent against the latter; which,
on his approach, being evacuated by the enemy, he continued his
offensive movement towards Ter-Vere. The governor of this fortress
shewing an unwillingness to resign his command, the place was
regularly invested on the land side, and bombarded from the river,
with great effect during the night of the 30th, and the whole of the
31st. These summary proceedings caused the commandant to listen
to terms, and ultimately to surrender the town, garrison, and military
stores, into our hands on the following day.
Middleburgh, the capital of this little island, surrendered to Sir Eyre
Coote, on the 31st July, and Fort Ramakens on the 3d of August, but
not before the place was regularly invested, and our batteries about
to open on its defences.
Pending these operations, a portion of the fleet under Sir Richard
Keates, having on board the reserve, commanded by Sir John Hope,
proceeded up the eastern branch of the Scheldt, and on the 1st of
August effected a landing on the island of South Beveland, the
whole of which fell into our hands, during that and the following day.
The brigade of guards under General Disney, were pushed forward
towards Fort Batz, a place of some strength, at the upper extremity
of the island, which being evacuated by the enemy, was taken
possession of by them on the 3d of August. The brigade commanded
by the Earl of Dalhousie, was directed to support the Guards in this
movement, and Sir William Erskine's brigade occupied Ter Goes, the
chief town, and some adjacent villages. A few days after, the latter
brigade moved forward six or seven miles, and took possession of
the towns of Capelle, Biesling, &c.
After a good deal of severe fighting between the troops under
Generals Graham, Houston, Lord Paget, and the enemy, Flushing
was closely invested on the 1st of August. From that day the duties
of our companions engaged in the siege were unremitting; and
owing to the natural dampness of the soil, and copious rains which
daily deluged the earth around them, extremely severe. In
constructing their batteries, and carrying forward their other field
operations, the British troops had to contend with most
unseasonable weather, and an active and enterprising enemy. But
every individual bore his allotted portion of privations and danger,
with a firmness and resolution which at once commanded the
admiration and thanks of their superiors. Honour, country, liberty,—
words to the military slave, or mercenary, unknown,—carries the
British soldier through every danger and difficulty, and makes him
lay down with pleasure even life itself, if by such a sacrifice, offered
on the altar of his country, he can transmit to his posterity,
untarnished and unimpaired, the liberties and honour of his native
land.
From the 1st of August, daily affairs of posts took place between the
besieged and besiegers—the French commandant allowing no
opportunity of retarding the progress of his opponents to pass
unimproved. His efforts to prolong the siege, or utterly defeat the
plans of his antagonists, were ceaseless. His dreadful salvos of
artillery from the ramparts, at one time, and his well-planned and
ably executed sorties, at another, caused us a loss in time, as well as
many valuable lives. But notwithstanding all his exertions, our
batteries were constructed, and reported ready to open on the 12th
of August.
Every moment of our time being precious, preparations were made
for a combined attack on Flushing, by land and sea, on the following
morning. The land batteries, accordingly, opened at ten o'clock, and
were for some time gallantly seconded by a number of our vessels of
war. But the fire of the latter not proving so effective as was
anticipated, Sir Richard Strachan withdrew them from under the
enemy's guns, resolved to make another trial on the succeeding day.
Accordingly, at ten o'clock on the morning of the 14th, Sir Richard
Strachan again weighed anchor, and carrying six or eight ships of the
line close under the enemy's batteries, instantly opened his fire upon
the town, and by rapid and dreadful broadsides from his floating
castles, assisted by the batteries on shore, soon set Flushing on fire
in numerous places. For some hours General Monnet returned the
salutes of our batteries and ships with much spirit and considerable
effect; but towards four o'clock the flames had spread over the
greater part of the town, and so many of his guns had been
disabled, that before five o'clock his fire almost entirely ceased.
Conceiving the moment favourable to transmit the governor a
summons to surrender, Sir Eyre Coote accordingly sent in a flag of
truce, about five o'clock, and gave him one hour to consider the
conditions on which his submission would be accepted. No answer
having arrived at the expiry of the above period, the cannonade was
instantly re-commenced, and continued with unabated violence, till
almost the whole of the devoted town was in a complete blaze.
Being now fully convinced that it would only be a waste of human
blood to continue the contest longer, General Monnet offered to
capitulate, on condition of being sent into France. This offer being
refused, he then agreed to accept the terms dictated by the British
commanders, which in substance were,—that he should surrender
himself, and all the troops under his command, prisoners of war, and
deliver up all his cannon, and military stores, into the hands of the
conquerors. The total loss sustained by the enemy on this occasion,
consisted of 6079 men killed, wounded, and prisoners, 224 pieces of
cannon, 2000 barrels of gun-powder, and an immense quantity of
military stores.
The roaring of the artillery, in and around Flushing, had no sooner
reached the ears of the good people in that quarter of South
Beveland where I was then stationed, than the roofs of all the
churches and wind-mills in our vicinity, were crowded with anxious
spectators, almost all of whom had friends or relations residing in
Flushing on that eventful day. Although the distance between us and
the belaboured fortress was considerable, yet the spectacle
produced by the operations of the belligerents, was forced upon our
notice in the most magnificent, but melancholy form, which we could
possibly have desired. None, however, but those who were close to
the scene of action, can form any idea of the dreadful scene which
followed in the wake of the last cannonade. But even at the distance
at which we viewed the conflagration, its appearance was so truly
appalling, that although there was no one thing which we more
ardently wished for than the fall of Flushing, yet as men and as
Christian soldiers, we could not refrain from dropping a tear of
sympathy for the innocent inhabitants, who, surrounded with flames,
and threatened with instant death by our shot and shell, had spent a
day and a night of horror, which none but those who have been
similarly situated can possibly describe.
At day-break on the 15th, Flushing had all the appearance of a vast
charnel-house, for whichever way a person turned his eyes, there
was nothing to be seen but houses
Tottering in frightful ruins, as the flames
Had left them, black and bare;
And half-burnt bodies, which allured from far
The wolf and raven,—and to impious food
Tempted the houseless dog.
Having all along looked forward to the fall of Flushing as a signal for
the simultaneous advance of both army and navy, to prosecute, to a
successful close, our ulterior operations against the enemy, language
cannot express in terms sufficiently strong, the severe
disappointment which all of us experienced, when, instead of being
ordered to act a part worthy of the land of our birth, the whole army
was kept in cantonments, and in the full enjoyment of an inglorious
ease, till the troops became so sickly, that it seemed to be a matter
of doubt how far prudence would lend the sanction of her name to
any further military operations against Antwerp. To settle this point,
however, a council of war was held, but not till ten days after the
surrender of Flushing. The deliberations of the council were, as a
matter of course, kept a profound secret. But report was busy on the
occasion, and if it spoke truth, a naval officer of rank offered, with a
given number of frigates, &c., to lead the way to Antwerp, and there
take, burn, or otherwise destroy the whole of the enemy's fleet and
stores, provided he was supported by Sir John Hope, with a mixed
force of 22,000 men. The offer, though not accepted, must have
shewn the members of the council, that there was one of their
number, who did not occupy that place at their board which his great
military talents entitled him to fill. For on the same day it was also
reported, that on the breaking up of the meeting of the general
officers, more than one of them expressed an intention of returning
to England, that they might no longer be an obstacle in the way of
his appointment to the supreme command of the army in Holland. If
none of the lieutenant-generals, senior to Sir John Hope, expressed
themselves in the manner above stated, then report must have been
amusing its auditors with a tale of fiction; but until the assertion is
shewn to be groundless, by the testimony of one or more of the
lieutenant-generals then present, (two of whom, viz. the Duke of
Gordon, and Earl of Rosslyn, are still alive,) I shall consider myself
entitled to hold the same opinion I have hitherto done in regard to
this matter.
About the 20th of August, the troops were first attacked with fever
and ague. Towards the latter end of the month it had appeared in
the ranks of every battalion, but in some with more virulency than in
others. A great part of the men being quartered in barns, it
frequently occurred that all the inmates, (six or eight,) of some of
those places, were seized with the disease in the same night. This,
however, we were not much surprised at; for the natural dampness
of the barn-floors, and the humidity of a Dutch atmosphere, were of
themselves more than sufficient to engender disease, even had the
barns been placed on situations of much greater altitude. As an
antidote to the pestilential vapours incident to the climate, a
wholesale system of bathing was recommended by our medical
friends. When it was intended to indulge the soldiers with a little of
this cooling amusement, they were generally marched down to the
right bank of the Western Scheldt about mid-day. At a given sound
of the bugle, the lads of our battalion undressed, but not a man
durst move into the water, till the shrill notes of a second bugle
intimated to the interesting group that they had permission to do so,
dressed in Adam's first covering. The scene which followed can only
be pourtrayed by the pencil of a Cruickshank,—language would fail
in the attempt. Some were highly amused with the exhibition; but I
must confess that I looked upon the whole proceedings with loathing
and disgust. I most readily concede, that the feelings of a
considerable portion of the private soldiers are not of a very refined
description,—but as men of various characters are to be found in
every mixed society,—who will assert that there were not many
individuals in the battalion, whose feelings were deeply wounded on
these occasions, by making them figure in an exhibition, no less
novel than indecent. It is bad policy to place men in situations,
where, if any change in their conduct is produced, that change must
be for the worse.
But Sir William Erskine, who was intimately acquainted with the
nature of the malady, strongly recommended to our notice the
following recipe,—one glass of brandy before dressing, one at
breakfast, one after dinner, and another in the evening. This
antidote, being much more congenial to the habits and tastes of a
great majority of his brigade, than an ablution in the Scheldt, raised
the fame of Sir William as a son of Æsculapius, far above others of
greater pretensions.
But regardless of all our antidotes, death appeared in our ranks
about the latter end of August. His power continuing to increase, it
was deemed advisable to remove all our sick to England, on the 1st
of September. On the 2nd, our division, the reserve, received notice
to prepare for embarkation; and on the following morning we
marched to the left bank of the Eastern Scheldt—went on board of
transports ready to receive us, and afterwards dropped down to the
anchorage of the Vere-Gat. Here, by some of those unaccountable
occurrences which but too often follow the failure of a military
enterprise, we were detained nearly a week, inhaling infection at
every breath, when we might have been enjoying the healthful
breezes of our native land. The consequences were such as any man
of common understanding would have anticipated. Fever and ague,
in its worst form, increased so rapidly, that before we reached our
own coast, more than a-half of the men were under medical
treatment, and the whole as uncomfortable as our most inveterate
enemy could wish.
On the morning subsequent to our re-embarkation, between twenty
and thirty of the men on board of the transport in which I took my
passage, were attacked with the pestilence. To prevent it spreading,
the worst cases were removed from the hold, into boats placed
under an awning on deck. In one of these temporary hospitals, ten
or a dozen fine fellows were confined on the evening of the 5th
September, when the first victim on board ship, a tall, handsome
grenadier, took leave of this world. His companions taking it for
granted that their dissolution was also approaching, became so
agitated, that it was with the utmost difficulty they could be
prevailed upon to remain in their berths. Being on deck when the
grenadier died, and perceiving the state into which his melancholy
exit had thrown them, I endeavoured, but unsuccessfully, to soothe
their excited feelings, and banish the dreadful notions which seemed
to haunt their minds; but the prospect of immediate dissolution, and
its attendant horrors, stared them so fully in the face, that no
language I could use seemed to have the smallest effect. Their
situation, at length, was so truly deplorable, that one of the party, a
tall, robust non-commissioned officer, started to his feet with the
agility of the hare, leaped from the boat, and then with the
countenance of a maniac, ran along the deck, crying in all the
bitterness of despair, that he was a dying man, and continued in this
state of temporary delirium, till a fresh attack of ague compelled him
to resume his place in the boat.
In the same group of patients, there was a grenadier, a man of a
most athletic form, but of weak intellect. On perceiving the serjeant
leap from the boat, honest Willie Mill attempted to follow his
example, but was prevented by the sentry on duty. Early next
morning I went on deck, expecting to find Willie in the last stage of
the disease, but to my utter surprise I found him soliciting, not the
grim king of terrors for a short respite, but the pay-sergeant of his
company for a morning repast. Willie's appetite being always keen,
he pressed his suit with so much ardour, that the sergeant was
frequently on the point of yielding. A sense of duty, however, at
length prevailed, and Willie's request was refused. Foiled in his
attempt to obtain a substantial breakfast of beef and bread, Willie
turned round, and with a look that would have sunk deep into the
heart of a savage, very gravely said,—"Weel, weel, sergeant
M'Combie, if ye think thae things are o'er strong for my weak
stamach, just gang to the cook, and tell him to mak me some stir-
about, and to mak it gay'n thick." I need scarcely add, that Willie's
second request excited considerable merriment on deck, in which
some of his boat-companions, ill though they were, heartily joined.
Willie's last appeal was too powerful to be resisted; his appetite was
gratified; he recovered, and I believe still lives to enjoy the bounty of
his sovereign, which enables him to indulge in a daily allowance of
his favourite stir-about.
On the 8th September, the transports containing our regiment,
quitted their anchorage on the Dutch coast, and on the 10th cast
anchor in the Downs. On the following morning we sailed for
Harwich, where, by reason of foul winds, we did not arrive till the
afternoon of the 13th. Early on the 14th our worst cases were
landed and consigned to the care of the medical staff at Harwich,
and a few of those who could with safety be removed farther by
water, were transported in boats to Ipswich. In the afternoon the
rest of the battalion, including all the remaining sick, landed at Land-
Guard Fort, and proceeded to Woodbridge barracks—the former on
foot, the latter on waggons. Never did I witness a spectacle more
heart-rending than the removal of the sick from the transports to the
shore, and thence to Woodbridge. The emaciated figures, and long
thin pale visages of the poor sufferers as they lay stretched in the
boats and on the waggons,—the piercing shrieks and agonizing
groans which the jolting of the latter drew from their death-like lips,
forced tears from my eyes as I moved along with the melancholy
throng. This scene however, distressing as it was, was soon to be
eclipsed by others of a still more mournful description. For several
weeks after our arrival at Woodbridge, our sick-list daily increased,
till upwards of four hundred of our men were immured within the

You might also like