Raspberry Pi Computing Analog Measurement Malcolm Maclean - Quickly access the ebook and start reading today
Raspberry Pi Computing Analog Measurement Malcolm Maclean - Quickly access the ebook and start reading today
com
https://ebookmeta.com/product/raspberry-pi-computing-analog-
measurement-malcolm-maclean/
OR CLICK HERE
DOWLOAD EBOOK
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Welcome! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
What are we trying to do? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Who is this book for? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
What will we need? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Why on earth did I write this rambling tome? . . . . . . . . . . . . . . . . . . . . . . . . 3
Where can you get more information? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Raspberry Pi Versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Raspberry Pi B+, B2, B3 and B3+ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
USB Ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Video Out . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Ethernet Network Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
USB Power Input Jack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
MicroSD Flash Memory Card Slot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Stereo and Composite Video Output . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
40 Pin Header . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Raspberry Pi Peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
SD Card . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Keyboard / Mouse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Video . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Power supply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Operating Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Welcome to Raspbian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Downloading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Writing the Operating System image to the SD Card . . . . . . . . . . . . . . . . . 20
Enabling Secure Shell Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Powering On . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
The Command Line interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Raspberry Pi Software Configuration Tool . . . . . . . . . . . . . . . . . . . . . 24
Software Updates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
CONTENTS
Power Up the Pi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Static IP Address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
The Netmask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
CIDR Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Distinguish Dynamic from Static . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Default Gateway . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Lets edit the dhcpcd.conf file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Remote access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Remote access via SSH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Setting up the Server (Raspberry Pi) . . . . . . . . . . . . . . . . . . . . . . . . . 33
Setting up the Client (Windows) . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
WinSCP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Setting up a WiFi Network Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Built in WiFi Enabling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Make the changes operative . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Make the built in WiFi IP address static . . . . . . . . . . . . . . . . . . . . . . 44
Make the changes operative . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
WiFi Via USB Dongle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Editing files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Make the changes operative . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Make USB WiFi IP address static . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Make the changes operative . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Reconnecting to the wireless network automatically . . . . . . . . . . . . . . . . . . . . 50
Let’s write a script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Lets run our script on a regular schedule . . . . . . . . . . . . . . . . . . . . . . . . . 51
Let’s test it . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Record the readings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Recording data on a regular basis with cron . . . . . . . . . . . . . . . . . . . . . . . 74
Managing database size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Explore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Simple data point API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Extracting a Range of Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Wrap Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Linux Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
What is Linux? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Linux Directory Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
/ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
/bin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
/boot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
/dev . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
/etc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
/etc/cron.d . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
/etc/rc?.d . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
/home . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
/lib . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
/lost+found . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
/media . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
/mnt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
/opt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
/proc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
/root . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
/sbin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
/srv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
/tmp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
/usr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
/usr/bin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
/usr/lib . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
/usr/local . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
/usr/sbin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
/var . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
/var/lib . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
/var/log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
/var/spool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
/var/tmp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Everything is a file in Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Traditional Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
System Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
CONTENTS
File Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
The nano Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Linux Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Executing Commands in Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
The Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Putting it all together . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
apt-get . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
The apt-get command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
apt-get update . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
apt-get upgrade . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
apt-get install . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
apt-get remove . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
cat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
The cat command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Arguments and Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Test yourself . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
cd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
The cd command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Test yourself . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
chmod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
The chmod command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
crontab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
The crontab command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Test yourself . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
ifconfig . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
The ifconfig command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Test yourself . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
ls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
The ls command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
CONTENTS
ping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
The ping command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Test yourself . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
sudo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
The sudo command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
The ‘sudoers’ file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
sudo vs su . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
Test yourself . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
¹https://www.goodfreephotos.com
²https://www.ebay.com/usr/fluxworkshop
Introduction 2
• A Keyes KY-018 LDR³. They are available from lots of places for around $2 US.
• An ADS1015 ADC from Adafruit⁴. The ADS1015 has a 12bit resolution giving it the ability
to convert an analog signal into one of 4096 discrete levels.
• Some 2.54mm header pins for the ADC module (these are widely available) and some
soldering equipment (you could solder directly, but that’s not as flexible).
• Some dupont connectors (that’s what I used, but you could connect to the Pi and the
modules in different ways).
• An Internet connection for getting and updating the software.
As we work through the book we will be covering off the different parts required and you should
get a good overview of what your options are in different circumstances.
³https://www.google.co.nz/search?q=Keyes+KY-018+LDR
⁴http://www.adafruit.com/products/1083
⁵https://leanpub.com/RPiMRE
⁶https://leanpub.com/b/rpc
⁷https://www.raspberrypi.org/
⁸https://plus.google.com/u/0/communities/113390432655174294208
⁹https://www.reddit.com/r/raspberry_pi/
¹⁰https://raspberrypi.stackexchange.com/questions?sort=newest
The History of the Raspberry Pi
The story of the Raspberry Pi starts in 2006 at the University of Cambridge’s Computer
Laboratory. Eben Upton, Rob Mullins, Jack Lang and Alan Mycroft became concerned at the
decline in the volume and skills of students applying to study Computer Science. Typical student
applicants did not have a history of hobby programming and tinkering with hardware. Instead
they were starting with some web design experience, but little else.
They established that the way that children were interacting with computers had changed. There
was more of a focus on working with Word and Excel and building web pages. Games consoles
were replacing the traditional hobbyist computer platforms. The era when the Amiga, Apple II,
ZX Spectrum and the ‘build your own’ approach was gone. In 2006, Eben and the team began
to design and prototype a platform that was cheap, simple and booted into a programming
environment. Most of all, the aim was to inspire the next generation of computer enthusiasts
to recover the joy of experimenting with computers.
Between 2006 and 2008, they developed prototypes based on the Atmel ATmega644 microcon-
troller. By 2008, processors designed for mobile devices were becoming affordable and powerful.
This allowed the boards to support an graphical environment. They believed this would make
the board more attractive for children looking for a programming-oriented device.
Eben, Rob, Jack and Alan, then teamed up with Pete Lomas, and David Braben to form the
Raspberry Pi Foundation. The Foundation’s goal was to offer two versions of the board, priced
at US$25 and US$35.
50 alpha boards were manufactured in August 2011. These were identical in function to what
would become the model B. Assembly of twenty-five model B Beta boards occurred in December
2011. These used the same component layout as the eventual production boards.
Interest in the project increased. They were demonstrated booting Linux, playing a 1080p movie
trailer and running benchmarking programs. During the first week of 2012, the first 10 boards
were put up for auction on eBay. One was bought anonymously and donated to the museum
at The Centre for Computing History in Suffolk, England. While the ten boards together raised
The History of the Raspberry Pi 5
over 16,000 Pounds (about $25,000 USD) the last to be auctioned (serial number No. 01) raised
3,500 Pounds by itself.
The Raspberry Pi Model B entered mass production with licensed manufacturing deals through
element 14/Premier Farnell¹¹ and RS Electronics¹². They started accepting orders for the model
B on the 29th of February 2012. It was quickly apparent that they had identified a need in the
marketplace. Servers struggled to cope with the load placed by watchers repeatedly refreshing
their browsers. The official Raspberry Pi Twitter account reported that Premier Farnell sold out
within few minutes of the initial launch. RS Components took over 100,000 pre orders on the
first day of sales.
Within two years they had sold over two million units.
The the lower cost model A went on sale for $25 on 4 February 2013. By that stage the Raspberry
Pi was already a hit. Manufacturing of the model B hit 4000 units per day and the amount of
on-board ram increased to 512MB.
The official Raspberry Pi blog reported that the three millionth Pi shipped in early May 2014.
In July of that year they announced the Raspberry Pi Model B+, “the final evolution of the
original Raspberry Pi. For the same price as the original Raspberry Pi model B, but incorporating
numerous small improvements”. In November of the same year the even lower cost (US$20) A+
was announced. Like the A, it would have no Ethernet port, and just one USB port. But, like the
B+, it would have lower power requirements, a micro-SD-card slot and 40-pin HAT compatible
GPIO.
On 2 February 2015 the official Raspberry Pi blog announced that the Raspberry Pi 2 was
available. It had the same form factor and connector layout as the Model B+. It had a 900
MHz quad-core ARMv7 Cortex-A7 CPU, twice the memory (for a total of 1 GB) and complete
compatibility with the original generation of Raspberry Pis.
¹¹http://element14.com/
¹²http://www.rs-components.com/index.html
The History of the Raspberry Pi 6
Following a meeting with Eric Schmidt (of Google fame) in 2013, Eben embarked on the design
of a new form factor for the Pi. On the 26th of November 2015 the Pi Zero was released. The Pi
Zero is a significantly smaller version of a Pi with similar functionality but with a retail cost of
$5. On release it sold out (20,000 units) World wide in 24 hours and a free copy was affixed to
the cover of the MagPi magazine.
The Raspberry Pi 3 was released in February 2016. The most notable change being the inclusion
of on-board WiFi and Bluetooth.
In February 2017 the Raspberry Pi Zero W was announced. This device had the same small form
factor of the Pi Zero, but included the WiFi and Bluetooth functionality of the Raspberry Pi 3.
On Pi day (the 14th of March (Get it? 3-14?)) in 2018 the Raspberry Pi 3+ was announced. It
included dual band WiFi, upgraded Bluetooth, Gigabit Ethernet and support for a future PoE
card. The Ethernet speed was actually 300Mpbs since it still needs to operate on a USB2 bus. By
this stage there had been over 9 million Raspberry Pi 3’s sold and 19 million Pi’s in total.
It would be easy to consider the measurement of the success of the Raspberry Pi in the number
of computer boards sold. Yet, this would most likely not be the opinion of those visionaries who
began the journey to develop the boards. Their stated aim was to re-invigorate the desire of
young people to experiment with computers and to have fun doing it. We can thus measure
their success by the many projects, blogs and updated school curriculum’s that their efforts have
produced.
Raspberry Pi Versions
In the words of the totally awesome Raspberry Pi¹³ foundation;
The Raspberry Pi is a low cost, credit-card sized computer that plugs into a computer
monitor or TV, and uses a standard keyboard and mouse. It’s capable of doing every-
thing you’d expect a desktop computer to do, from browsing the internet and playing
high-definition video, to making spreadsheets, word-processing, playing games and
learning how to program in languages like Scratch and Python.
There are (at time of writing) eight different models on the market. The A, B, A+, B+, ‘model B 2’,
‘model B 3’, ‘model B 3+’ (which I’m just going to call the B2, B3 and B3+ respectively), the Zero
and Zero W. A lot of projects will typically use either the the B2, B3 or the B3+ for no reason
other than they offer a good range of USB ports (4), 1024 MB of RAM, an HMDI video connection
and an Ethernet connection. For all intents and purposes either the B2, B3 or B3+ can be used
interchangeably for the projects depending on connectivity requirements as the B3 and B3+ has
WiFi and Bluetooth built in. For size limited situations or where lower power is an advantage,
the Zero or Zero W is useful, although there is a need to cope with reduced connectivity options
¹³http://www.raspberrypi.org/help/what-is-a-raspberry-pi/
Raspberry Pi Versions 8
(a single micro USB connection) although the Zero W has WiFi and Bluetooth built in. Always
aim to use the latest version of the Raspbian operating system (or at least one released on or after
the 14th of March 2018). For best results browse the ‘Downloads¹⁴’ page of raspberrypi.org.
¹⁴https://www.raspberrypi.org/downloads/
Raspberry Pi Versions 9
Raspberry Pi B models
The model B+, B2, B3 and B3+ all share the same form factor and have been a consistent standard
for the layout of connectors since the release of the B+ in July 2014. They measure 85 x 56 x
17mm, weighs 45g and are powered by Broadcom chipsets of varying speeds, numbers of cores
and architectures.
USB Ports
They include 4 x USB Ports (with a maximum output of 1.2A)
Video Out
Integrated Videocore 4 graphics GPU capable of playing full 1080p HD video via a HDMI video
output connector. HDMI standards rev 1.3 & 1.4 are supported with 14 HDMI resolutions from
640×350 to 1920×1200 plus various PAL and NTSC standards.
40 Pin Header
The Raspberry Pi B+, B2, B3 and B3+ include a 40-pin, 2.54mm header expansion slot (Which
allows for peripheral connection and expansion boards).
¹⁵http://www.cablechick.com.au/blog/understanding-trrs-and-audio-jacks/
Raspberry Pi Peripherals
To make a start using the Raspberry Pi we will need to have some additional hardware to allow
us to configure it.
SD Card
Traditionally the Raspberry Pi needs to store the Operating System and working files on a
MicroSD card (actually a MicroSD card all models except the older A or B models which use
a full size SD card). There is the ability to boot from a mass storage device or the network, but it
is slightly ‘non-trivial’, so we won’t cover it.
MicroSD Card
The MicroSD card receptacle is on the rear of the board and on the Model B2 it is a ‘push-push’
type which means that you push the card in to insert it and then to remove it, give it a small
push and it will spring out.
This is the equivalent of a hard drive for a regular computer, but we’re going for a minimal effect.
We will want to use a minimum of an 8GB card (smaller is possible, but 8 is recommended). Also
try to select a higher speed card if possible (class 10 or similar) as this will speed things up a bit.
Raspberry Pi Peripherals 14
Keyboard / Mouse
While we will be making the effort to access our system via a remote computer, we will need
a keyboard and a mouse for the initial set-up. Because the B+, B2, B3 and B3+ models of the Pi
have 4 x USB ports, there is plenty of space for us to connect wired USB devices.
An external wireless combination would most likely be recognised without any problem and
would only take up a single USB port, but if we build towards a remote capacity for using the Pi
(using it headless, without a keyboard / mouse / display), the nicety of a wireless connection is
not strictly required.
Video
The Raspberry Pi comes with an HDMI port ready to go which means that any monitor or TV
with an HDMI connection should be able to connect easily.
Because this is kind of a hobby thing you might want to consider utilising an older computer
monitor with a DVI or 15 pin ‘D’ connector. If you want to go this way you will need an adapter
to convert the connection.
Network
The B+, B2, B3 and B3+ models of the Raspberry Pi have a standard RJ45 network connector on
the board ready to go. In a domestic installation this is most likely easiest to connect into a home
ADSL modem or router.
This ‘hard-wired’ connection is great for getting started, but we will work through using a
wireless solution later in the book.
Raspberry Pi Peripherals 17
Power supply
The Pi can be powered up in a few ways. The simplest is to use the micro USB port to connect
from a standard USB charging cable. You probably have a few around the house already for
phones or tablets.
However, it’s worth thinking about the application that we use our Pi for. Depending on how
much we ask of the unit, we might want to pay attention to the amount of current that our power
supply can deliver. The A+, B+ and Zero models will function adequately with a 700mA supply,
but the B2, B3 and B3+ models will draw more current and if we want to use multiple wireless
devices or supplying sensors that demand increased power, we will need to consider a supply
that is capable of an output up to 2.5A.
Raspberry Pi Peripherals 18
Cases
We should get ourselves a simple case to keep the Pi reasonably secure. There are a wide range
of options to select from. These range from cheap but effective to more costly than the Pi itself
(not hard) and looking fancy.
You could use a simple plastic case¹⁶ that can be brought for a few dollars;
For a very practical design and a warm glow from knowing that you’re supporting a worthy
cause, you could go no further than the official Raspberry Pi case¹⁷ that includes removable
side-plates and loads of different types of access. All for the paltry sum of about $9.
¹⁶http://www.dx.com/p/abs-case-box-for-raspberry-pi-b-black-346332
¹⁷https://www.raspberrypi.org/blog/raspberry-pi-official-case/
Operating Systems
An operating system is software that manages computer hardware and software resources for
computer applications. For example Microsoft Windows could be the operating system that will
allow the browser application Firefox to run on our desktop computer.
Variations on the Linux operating system are the most popular on our Raspberry Pi. Often they
are designed to work in different ways depending on the function of the computer.
Linux¹⁸ is a computer operating system that is can be distributed as free and open-source
software¹⁹. The defining component of Linux is the Linux kernel, an operating system kernel
first released on 5 October 1991 by Linus Torvalds.
Linux was originally developed as a free operating system for Intel x86-based personal comput-
ers. It has since been made available to a huge range of computer hardware platforms and is one
of the most popular operating systems on servers, mainframe computers and supercomputers.
Linux also runs on embedded systems, which are devices whose operating system is typically
built into the firmware and is highly tailored to the system; this includes mobile phones, tablet
computers, network routers, facility automation controls, televisions and video game consoles.
Android, the most widely used operating system for tablets and smart-phones, is built on top of
the Linux kernel. In our case we will be using a version of Linux that is assembled to run on the
ARM CPU architecture used in the Raspberry Pi.
The development of Linux is one of the most prominent examples of free and open-source
software collaboration. Typically, Linux is packaged in a form known as a Linux ‘distribution’, for
both desktop and server use. Popular mainstream Linux distributions include Debian, Ubuntu
and the commercial Red Hat Enterprise Linux. Linux distributions include the Linux kernel,
supporting utilities and libraries and usually a large amount of application software to carry out
the distribution’s intended use.
A distribution intended to run as a server may omit all graphical desktop environments from the
standard install, and instead include other software to set up and operate a solution stack such as
LAMP (Linux, Apache, MySQL and PHP). Because Linux is freely re-distributable, anyone may
create a distribution for any intended use.
Welcome to Raspbian
The Raspbian Linux distribution is based on Debian Linux. At the time of writing there have
been three different editions published. ‘Wheezy’, ‘Jessie’ and ‘Stretch’. Debian is a widely used
Linux distribution that allows Raspbian users to leverage a huge quantity of community based
experience in using and configuring software. The Wheezy edition is the earlier of the three and
was the stock edition from the inception of the Raspberry Pi till the end of 2015. From that point
Jessie was the default distribution until mid 2017 when Stretch took over.
¹⁸http://en.wikipedia.org/wiki/Linux
¹⁹http://en.wikipedia.org/wiki/Free_and_open-source_software
Operating Systems 20
Downloading
The best place to source the latest version of the Raspbian Operating System is to go to
the raspberrypi.org page; http://www.raspberrypi.org/downloads/. We will download the ‘Lite’
version (which doesn’t use a desktop GUI). If you’ve never used a command line environment,
then good news! You’re about to enter the World of ‘real’ computer users :-).
Raspbian Download
You can download via bit torrent or directly as a zip file, but whatever the method you should
eventually be left with an ‘img’ file for Raspbian.
To ensure that the projects we work on can be used with either the B+, B2 or B3 models we
need to make sure that the version of Raspbian we download is from 2015-01-13 or later. Earlier
downloads will not support the more modern CPU of the B2 or B3. To support the newer CPU
of the B3+ (and all the previous CPUs) we will need a version of Raspbian from 2018-03-13 or
later.
Image File
We should always try to download our image files from the authoritative source!
We will work through an example using Windows 7 but the process should be very similar for
other operating systems as we will be using the excellent open source software Etcher²⁰ which
is available for Windows, Linux and macOS.
Download and install Etcher and start it up.
Etcher Start
You will need an SD card reader capable of accepting your MicroSD card (you may require an
²⁰https://etcher.io/
Operating Systems 22
adapter or have a reader built into your desktop or laptop). Place the card in the reader and you
should see Etcher automatically select it for writing (Etcher is very good at presenting options
for installing that are only SD cards).
Etcher in progress
Etcher will write the image to the SD card. The time taken can vary a little, but it should only
take about 3-4 minutes with a class 10 SD card.
Once written, Etcher will validate the write process (this can be disabled if desired).
Operating Systems 23
Flash Complete!
When the process is finished Etcher will automatically unmount the SD card.
Powering On
Insert the card into the slot on the Raspberry Pi and turn on the power.
You will see a range of information scrolling up the screen before eventually being presented
with a login prompt.
Operating Systems 24
raspberrypi login:
We will use the Raspberry Pi Software Configuration Tool to change the locale and keyboard
configuration to suit us. This can be done by running the following command;
sudo raspi-config
The sudo portion of the command makes sure that you will have the permission required
to run the apt-get process.
Operating Systems 25
Use the up and down arrow keys to move the highlighted section to the selection you want to
make then press tab to highlight the <Select> option (or <Finish> if you’ve finished).
Lets change the settings for our operating system to reflect our location for the purposes of
having the correct time, language and WiFi regulations. These can all be located via selection ‘4
Localisation Options’ on the main menu.
Select this and work through any changes that are required for your installation based on
geography.
Localisation Options
Operating Systems 26
Once you exit out of the raspi-config menu system, if you have made a few changes, there is a
probability that you will be asked if you want to re-boot the Pi. That’s a pretty good idea.
Once the reboot is complete you will be presented with the console prompt to log on again;
Software Updates
After configuring our Pi we’ll want to make sure that we have the latest software for our system.
This is a useful thing to do as it allows any additional improvements to the software we will be
using to be enhanced or security of the operating system to be improved. This is probably a good
time to mention that we will need to have an Internet connection available.
Type in the following line which will find the latest lists of available software;
You should see a list of text scroll up while the Pi is downloading the latest information.
Then we want to upgrade our software to latest versions from those lists using;
The Pi should tell you the lists of packages that it has identified as suitable for an upgrade along
with the amount of data that will be downloaded and the space that will be used on the system.
It will then ask you to confirm that you want to go ahead. Tell it ‘Y’ and we will see another list
of details as it heads off downloading software and installing it.
Power Up the Pi
To configure the Raspberry Pi for our purpose we will extend our Pi a little. This makes
configuring and using the device easier and to be perfectly honest, making life hard for ourselves
is so exhausting! Let’s not do that.
Static IP Address
As we mentioned earlier, enabling remote access is a really useful thing. This will allow us to
configure and operate our raspberry Pi from a separate computer. To do so we will want to assign
our Raspberry Pi a static IP address.
An Internet Protocol address (IP address) is a numerical label assigned to each device (e.g.,
computer, printer) participating in a computer network that uses the Internet Protocol for
communication.
There is a strong likelihood that our Raspberry Pi already has an IP address and it should appear
a few lines above the ‘login’ prompt when you first boot up;
My IP address is 10.1.1.25
raspberrypi login:
The My IP address... part should appear just above or around 15 lines above the login line,
depending on the version of Raspbian we’re using. In this example the IP address 10.1.1.25 belongs
to the Raspberry Pi.
This address will probably be a ‘dynamic’ IP address and could change each time the Pi is booted.
For the purposes of using the Raspberry Pi with a degree of certainty when logging in to it
remotely it’s easier to set a fixed IP address.
This description of setting up a static IP address makes the assumption that we have a device
running on our network that is assigning IP addresses as required. This sounds complicated, but
in fact it is a very common service to be running on even a small home network and most likely
on an ADSL modem/router or similar. This function is run as a service called DHCP²¹ (Dynamic
Host Configuration Protocol). You will need to have access to this device for the purposes of
knowing what the allowable ranges are for a static IP address.
²¹http://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol
Power Up the Pi 28
The Netmask
A common feature for home modems and routers that run DHCP devices is to allow the user to
set up the range of allowable network addresses that can exist on the network. At a higher level
we should be able to set a ‘netmask’ which will do the job for us. A netmask looks similar to an
IP address, but it allows you to specify the range of addresses for ‘hosts’ (in our case computers)
that can be connected to the network.
A very common netmask is 255.255.255.0 which means that the network in question can have
any one of the combinations where the final number in the IP address varies. In other words
with a netmask of 255.255.255.0, the IP addresses available for devices on the network ‘10.1.1.x’
range from 10.1.1.0 to 10.1.1.255 or in other words any one of 256 unique addresses.
CIDR Notation
ifconfig -a
(For more information on the ifconfig command check out the Linux commands section)
This will produce an output which will look a little like the following;
Power Up the Pi 29
Be aware that if you don’t have a section of your IP address range set aside for static
addresses you run the risk of having the DHCP service unwittingly assign a device that
wants a dynamic address with the same value that you have already assigned for your
Raspberry Pi. Such a conflict is not a good thing.
For the sake of the upcoming projects we will assume that the address 10.1.1.120 is available.
Default Gateway
Before we start configuring we will need to find out what the default gateway is for our network.
A default gateway is an IP address that a device (typically a router) will use when it is asked to go
to an address that it doesn’t immediately recognise. This would most commonly occur when a
computer on a home network wants to contact a computer on the Internet. The default gateway
is therefore typically the address of the modem / router on your home network.
We can check to find out what our default gateway is from Windows by going to the command
prompt (Start > Accessories > Command Prompt) and typing;
ipconfig
This should present a range of information including a section that looks a little like the following;
Power Up the Pi 30
Remember, the sudo portion of the command makes sure that you will have the
permission required to edit the dhcpcd.conf file, nano is the name of the text editor
and /etc/dhcpcd.conf is telling the computer which file to edit.
The nano²² file editor will start and show the contents of the dhcpcd.conf file which should look
a little like the following;
# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel
# Use the hardware address of the interface for the Client ID.
clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID per RFC4361.
#duid
²²http://www.nano-editor.org/
Power Up the Pi 31
The file actually contains some commented out sections that provide guidance on entering the
correct configuration.
We are going to add the information that tells the network interface to use eth0 at our static
address that we decided on earlier (10.1.1.120) along with information on the netmask to use
(in CIDR format) and the default gateway of our router. To do this we will add the following
lines to the end of the information in the dhcpcd.conf file;
Power Up the Pi 32
Here we can see the IP address and netmask (static ip_address=10.1.1.120/24), the gateway
address for our router (static routers=10.1.1.1) and the address where the computer can also
find DNS information (static domain_name_servers=10.1.1.1).
In a simplistic explanation, the Domain Name System (DNS) makes sure that the Internet
can find resources easily based on a naming convention.
Once you have finished press ctrl-x to tell nano you’re finished and it will prompt you to confirm
saving the file. Check your changes over and then press ‘y’ to save the file (if it’s correct). It will
then prompt you for the file-name to save the file as. Press return to accept the default of the
current name and you’re done!
To allow the changes to become operative we can type in;
sudo reboot
This will reboot the Raspberry Pi and we should see the (by now familiar) scroll of text and when
it finishes rebooting you should see;
My IP address is 10.1.1.120
raspberrypi login:
Which tells us that the changes have been successful (bearing in mind that the IP address above
should be the one you have chosen, not necessarily the one we have been using as an example).
Power Up the Pi 33
Remote access
To allow us to work on our Raspberry Pi from our normal desktop we can give ourselves the
ability to connect to the Pi from another computer. The will mean that we don’t need to have
the keyboard / mouse or video connected to the Raspberry Pi and we can physically place it
somewhere else and still work on it without problem. This process is called ‘remotely accessing’
our computer .
To do this we need to install an application on our windows desktop which will act as a ‘client’
in the process and have software on our Raspberry Pi to act as the ‘server’. There are a couple of
different ways that we can accomplish this task, but because we will be working at the command
line (where all we do is type in our commands (like when we first log into the Pi)) we will use
what’s called SSH access in a ‘shell’.
SSH is already installed and operating but to check that it is there and working type the following
from the command line;
/etc/init.d/ssh status
The Pi should respond with the message that the program sshd is active (running).
sudo raspi-config
Use the up and down arrow keys to move the highlighted section to the selection you want to
make then press tab to highlight the <Select> option (or <Finish> if you’ve finished).
To enable SSH select ‘5 Interfacing Options’ from the main menu.
Interfacing Options
Oh! what a strange, and, at the same time, what a wondrous world
is this in which we live;—and how marvellous is human progress!
The utmost attainments effected by the wisdom of our ancestors
were but ignorance and short-sightedness compared with the
knowledge of the present day. Antiquity had its grand intellects and
its sublime geniuses; but it furnished not the same abundance of
materials to act upon as is afforded by the discoveries and likewise
by the spirit of this age!
But are we proportionately happier, on this account, than were our
forefathers? Is the working-man, for instance, more prosperous,
more comfortable, more enviable as to his condition, than the
aboriginal Briton who lived in a cave or the hollow of a tree, and
who painted his body to protect it against the cold?
With all our prosperity—with all the grandeur, the glitter, and the
refinement of our civilisation—with all our moralising institutions and
our love of social order and mental improvement, we yet find the
national heart devoured, tortured, and preyed upon by that undying
serpent—Pauperism!
Yes: the millions are not so happy, so prosperous, or so comfortable
as they ought to be;—for they are compelled to gnaw the tares of
civilisation's field, while the proud and heartless oligarchy self-
appropriate the corn!
Proud and heartless, indeed, are the rulers and the mighty ones of
this land; and if the millions remain passive and patient, that pride
and that heartlessness will grow, the one more despotic and the
other more selfish.
It was but a few days ago that we marked two distinct articles in the
morning newspapers, which formed a contrast fearfully significant in
its evidence of the pride and the heartlessness which we abominate
on the one hand, and of the distress and suffering which we so
deeply deplore on the other.
One of these articles consisted but of four lines: the other occupied
nearly two columns.
The first stated as laconically as possible that bread had risen to
thirteen-pence the quartern loaf, and recorded a rapidly-disposed of
regret that provisions should be so dear, on account of the poor. The
second gave a laboured, fulsome, and tediously wire-drawn narrative
of "Her Majesty's State Ball."
Thus the misery endured by millions in consequence of dearness and
scarcity, is a trivial matter deserving only of four lines; whereas the
trumpery nonsense and childish tom-foolery of a royal dance are
deemed of sufficient importance to merit nearly two columns!
Oh! instead of giving balls and splendid entertainments at such a
time, if the Sovereign of this land were to say to the people, "Ye are
starving, and it makes my heart bleed to think that from your very
vitals are wrung the hundreds of thousands of pounds which are
wasted by myself and the other members of the Royal Family on our
frivolities, our whims, our caprices, and our wanton extravagances:
therefore will I give ye back one half of the enormous income which
I have hitherto enjoyed, in the full confidence that my example will
be imitated by many others who prey upon you;"—did the Sovereign
thus speak to the nation, the nation would be justly proud of its
Sovereign; and yet this Sovereign would only be performing a duty
dictated by humanity and common justice.
What would be thought of the father of a family who feasted on
turtle and venison, accompanied by generous wines, every day,
while his children were thrust into the cold, humid cellar, to devour a
mouldy crust and drink water?
Yet the Sovereign delights in the attribute of a general and
comprehensive paternal solicitude in the welfare of the people: but it
is an attribute which exists only in the imaginations of grovelling
courtiers or lick-spittle historians.
Royalty and Aristocracy are intensely—necessarily—and thoroughly
selfish: and as for any anxiety on behalf of the toiling and suffering
millions, the idea is absurd—the notion is a mere delusion—the
assertion that such a feeling exists, is a lie—a monstrous, wicked,
atrocious lie!
There is more of the milk of human kindness in a single cottage than
in all the palaces of Europe taken together.
There is more true philanthropy in one poor man's hovel, than in a
thousand mansions of the great and wealthy in the fashionable
quarters of London.
Oh! if the father or the mother can dance and be glad while the
children are famishing, the sooner all ties are severed between such
worthless parents and such an oppressed and outraged offspring,
the better!
Nero danced and sang on the summit of a tower at the spectacle
presented to his eyes by burning Rome;—and festivity and rejoicing
reign in our English palaces, at a moment when scarcity menaces
the land with famine and its invariable attendant—pestilence!
People of England! ye now understand how much sympathy ye may
expect on the part of those who derive all their wealth from the
sweat of your brow!
People of Ireland! ye now comprehend how much pity your starving
condition excites on the part of your rulers!
People of Scotland! ye now perceive how worthy the great ones of
the realm are of your adulation!
But it is sickening, as it is sorrowful, to dwell on this subject. Some
of our readers may perhaps ask us wherefore we broach it at all? We
will reply by means of a few questions. Is not every individual
member of a society interested in the welfare of that society? or
ought he not at least to be so? Is he not justified in denouncing the
errors or the downright turpitude of the magistrates whom that
society has chosen to govern it, and who derive their power only
from its good will and pleasure? or is it not indeed his duty to
proclaim those errors and that turpitude? Should not this duty be
performed, even if it be unpleasant? and can we ever hope to
ameliorate our condition, unless we expose the abuses which
oppress, degrade, and demoralise us?
Oh! let no one rashly and in a random manner say that he cares
nothing about politics! Such an assertion denotes a wilful disregard
not only of his neighbour's interests, but also of his own. Were all
men to entertain such an indifference, the people would be the
veriest slaves that an unrestrained despotism and an unwatched
tyranny could render them. It is as necessary for the industrious
classes to protect their rights and privileges by zealously guarding
them, as to adopt precautions to save their houses from fire.
One word more. It is a common saying, and as absurd as it is
common—"Oh! women have no right to meddle in politics." Women,
on the contrary, have as much right as "the lords of the creation" to
exhibit an interest in the systems and institutions by which they are
governed. For the sake of their children, as well as for their own,
they should assert and exercise that right. It is a lamentable
delusion to suppose that the intellect of woman is not powerful nor
comprehensive enough to embrace such considerations. The intellect
of woman is naturally as strong as that of man; but it has less
chances and less opportunities of developing its capacity. The
masculine study of politics would aid the intellect of woman in
putting forth its strength; and we hope that the day is gone by when
the female sex are to be limited to the occupations of the drawing-
room, the nursery, or the kitchen. We do not wish to see women
become soldiers or sailors, nor to work at severe employment: but
we are anxious to behold them thinkers as well as readers—
utilitarians as well as domestic economists. And we know of no
greater benefit that could be conferred on society in general, than
that which might be derived from the influence of the well developed
intellect of woman. Her mind is naturally better poised than that of
man: far-seeing and quick-sighted is she;—a readiness at devising
and combining plans to meet emergencies, is intuitive with her. Her
judgment is correct—her taste good;—and she profits by experience
far more usefully than does man. Is it not absurd, then—is it not
unjust—and is it not unwise to deny to woman the right of exercising
her proper influence in that society of which she is the ornament and
the delight?
Alas! that there should be such exceptions to the general rule of
female excellence, as Martha Slingsby,—a woman whose principles
were thoroughly corrupt, whose licentious passions were of the most
devouring, insatiable kind, and whose talent for wicked combinations
and evil plottings was unfortunately so great!
Let us return to this hypocritical and abandoned creature, and follow
her in the vile scheme which now occupies all her attention.
Having breakfasted at an early hour, she seated herself at her desk,
whence she drew forth a packet of letters received by her at various
times from Sir Henry Courtenay, and the signatures of which now
became the objects of her special study. The art of counterfeiting
the late baronet's autograph was practised by her for nearly half an
hour; for though she was already tolerably confident of her ability to
forge his signature most successfully,—as she had assured Mr.
Torrens,—she nevertheless deemed it prudent to render the
imitation as perfect as possible.
At last the atrocious deed was accomplished to her complete
satisfaction; and a cheque for two thousand pounds lay, drawn in a
thoroughly business-like manner, upon her desk!
She was bold and courageous in the execution of plots and the
carrying out of deep schemes;—but this dark and dangerous crime
which she had just perpetrated, caused her to shudder from head to
foot! Hitherto all her wickedness had been of a nature calculated
only, if detected, to involve her in disgrace, and not in peril—to ruin
her character, but not place her life in jeopardy! Now she had taken
a step—a bold and desperate step—which at once set her on the
high road that conducts all those who are found treading its
pathway, to the foot of the scaffold!
Yes—she shrank back and she trembled violently as she rose from
the desk whereon the forged cheque now lay; and for a moment she
was inclined to seize it—to rend it into a thousand pieces—and thus
to dispel at once and in an instant the tremendous black cloud of
stormy danger which she had drawn over her own head.
But, no—she had courage enough to be wicked and rash; but she
had not strength of mind sufficient to render her prudent. She
therefore decided on daring all—risking everything, by the
presentation of the forged cheque!
Having dressed herself in a style of unusual elegance, she proceeded
in a hackney-coach to Lombard Street, and alighted at the door of
the banking-house on which the cheque was drawn.
Saying to herself,—"Now for the aid of all my courage!"—she
entered the spacious establishment, and advanced towards the
counter.
One of the numerous clerks in attendance instantly received the
cheque which she handed across to him;—and, as it left her hand, a
chill struck to her heart—and she would at that moment have given
worlds to recall it.
Her composure was now only the effect of utter desperation: but so
unruffled was her countenance, that not a lineament was so
changed as to be calculated to engender suspicion.
The clerk took the cheque to the nearest desk upon the counter;
and after reading it with more than usual attention, as Mrs. Slingsby
thought, he said, "This is dated the day before yesterday, madam.
Have you seen Sir Henry Courtenay since then?"
"I have not," answered Mrs. Slingsby, wondering how she was able
to speak in a tone so cold and collected. "I believe," she added,
"that he is gone out of town."
"Pardon the question, madam," observed the clerk; "but one of his
servants was here last evening, just before closing time, to enquire if
we had seen Sir Henry:"—then, after a few moments' pause, he
said, "How will you have this?"
Immense was the relief suddenly experienced by the guilty woman!
She seemed as if drawn abruptly forth from the depths of an ocean
in which she had been suffocating—drowning. The revulsion of
feeling was so great, that, whereas she had been enabled to stand
without support throughout the few minutes of frightful ordeal just
passed, she was now compelled to cling to the counter, though the
clerk observed not her emotion.
Having specified the manner in which she desired the amount of the
cheque to be paid her, Mrs. Slingsby received the produce of her
crime, and quitted the bank.
She was now so astounded at the complete success of her scheme,
—although, when able to reflect calmly upon it, she had never once
doubted the issue,—that she could scarcely believe in its realization.
Her brain whirled—her heart palpitated violently, as she ascended
the steps of the hackney-coach;—and its motion, as it rolled away
from the door of the bank, increased the excitement under which
she was now labouring.
On her return to Old Burlington Street, she found Mr. Torrens waiting
for her, it being nearly twelve o'clock—the hour appointed for their
visit to the solicitor.
The moment she entered the drawing-room, Mr. Torrens rose from
his seat, and advanced towards her, his eyes fixed intently upon her
countenance.
In fact Mr. Torrens was deeply anxious to learn the result of the bold
venture which Mrs. Slingsby was that morning to make. With him it
was now a matter of pecuniary ruin or salvation; and he had
overcome so many difficulties already,—stifling his own scruples at
taking an immodest woman for his wife, and reducing his daughter
to a belief in the necessity of his submitting to this matrimonial
arrangement,—that he trembled lest some unforeseen accident
should thwart him just at the moment when he appeared to be
touching on the goal of success. Moreover, he had that morning, ere
quitting home, so contrived matters with John Jeffreys as to induce
this man to leave his service without delay; and he had enjoyed the
supreme satisfaction of seeing that dangerous person leave his
house ere he himself had set out to keep his appointment with Mrs.
Slingsby. Thus every thing had progressed in accordance with Mr.
Torrens' views and wishes, so far as the preliminaries to his change
of condition were involved.
"Well, my dear madam, what tidings?" he eagerly demanded, as he
approached to meet Mrs. Slingsby.
"I have succeeded," she said, throwing herself into a chair. "But I
would not for worlds undergo again the same dreadful alternations
between acute suspense and thrilling joy—cold tremor and feverish
excitement."
"And yet the transaction has given a charming glow of animation to
your countenance," observed Mr. Torrens, now for the first time
inflamed by desire in respect to the amorous widow whom he was
shortly to make his wife. "I have procured the license; and——"
"And Rosamond—what of her?" demanded Mrs. Slingsby hastily.
"She will receive you with a respectful welcome at Torrens Cottage,"
was the answer. "By dint of reasoning with her, I overcame all her
scruples, and rendered her pliant and ductile to our purposes."
"All progresses well, then," said Mrs. Slingsby. "Let us now away to
Mr. Howard."
And to that gentleman's office did the pair proceed. Their business
was soon explained to the attorney, who manifested no surprise nor
any particular emotion at the singularity of the transaction; for Mr.
Howard was a perfect man of business, ready to receive instructions
without expressing any feelings at all calculated to annoy his clients,
and never indicating a curiosity to learn more than those clients
might choose to confide to him.
"I am to keep this sum of two thousand pounds until such time as
Mr. Torrens may claim it in the capacity of your husband?" he said,
as coolly and quietly as if he were receiving a deposit on the
purchase of an estate.
"Exactly so," answered Mrs. Slingsby.
"And to-morrow morning, my dear sir," added Mr. Torrens, with a
smile, "I shall come to claim it."
"Good," exclaimed Mr. Howard, locking up the bank-notes and gold
in his iron safe. "I give you joy, Mr. Torrens: Mrs. Slingsby, I wish you
all possible happiness."
Thus speaking, the attorney bowed his clients out of the office.
Mr. Torrens escorted Mrs. Slingsby back to Old Burlington Street, and
then repaired as fast as his horse and gig would take him to his own
dwelling, to sit down to an early dinner, and afterwards dress himself
for the interesting ceremony of the evening.
But on his arrival at the Cottage, he learnt from the female servant
who opened the door, that his daughter Rosamond had left home an
hour previously.
"Left home!" ejaculated Mr. Torrens. "But she will return?" he
continued interrogatively. "Did she not say that she would return?"
"She desired me to give you this note, sir," answered the domestic.
Mr. Torrens tore open the letter placed in his hands, and read the
following impressive lines:—
"Pardon me, dearest father, for the step which I am now taking;
but I cannot—cannot support the idea of dwelling beneath the
same roof with that lady who is soon to be my mother-in-law. I
know that I promised not to desert the paternal home: that
promise was given in sincerity—though maddening reflections
now render me incapable of keeping it. You are well aware how
dreadfully my feelings have been wounded—how cruelly my
heart has been lacerated, during the last few hours; and I have
struggled against the violence of my grief—I have endeavoured
to subdue my anguish;—but the occurrences of last night—the
outrage attempted by that villain Jeffreys—the revelation of the
terrible secret relative to Sir Henry Courtenay——Oh! my dear
father, a mind ten thousand times stronger than that of your
unhappy daughter could not endure the weight of all this
aggregate of misery! Therefore, sooner that my presence should
render my father's house unhappy, I depart thence, hoping to be
followed by your blessing! Grieve not for me, dear father—
heaven will protect me! From time to time I shall write to you;
and should happier days arrive——but of that, alas! I dare
entertain no hope at present. To you must I leave the painful
task of accounting to my dearest, dearest sister and her
esteemed husband for my absence when you see them again.
Farewell—farewell, my beloved father! I scarcely know what I
have written—my brain is on fire—my heart is ready to burst—
my eyes are dimmed with tears."
The servant watched the countenance of her master with evident
interest and curiosity as he perused this note.
"Did Miss Rosamond appear much excited?" he asked, in a
tremulous tone, and without raising his eyes from the letter which he
held in his hand.
"She was crying very much, sir," responded the servant; "and it
made me quite sad to see her. I attempted to comfort her; but she
only shook her head impatiently, and then sobbed as if her heart
would break. I knew that she was going to leave, because she had a
small package in her hand; and she did cry so dreadful when she
told me to give you this note."
Mr. Torrens turned aside, and hastened to his chamber, where he
remained until half-past five o'clock. He then descended to the
parlour, dressed for the nuptial ceremony. To the servant's enquiry
relative to the serving up of the dinner, he replied that he had no
appetite, and immediately gave orders for the horse and gig to be
got ready by a stable-boy, who had been hastily hired in the morning
to take the place of Jeffreys until a more efficient substitute could be
found.
This command was soon obeyed, and shortly before seven o'clock
Mr. Torrens arrived in Old Burlington Street.
The flight of his daughter from home had proved a more severe
shock to him than the reader might imagine, considering the cold
and heartless disposition of this man. It was not that he felt he
should miss her society;—no—he did not love her enough to harbour
a regret of that nature;—but her departure from the paternal
dwelling had made him writhe beneath the maddening—the galling
conviction that his independence was in a measure gone, and that a
stern necessity had compelled him to assent to link his fate with that
of a woman so vile and abandoned, that his own child fled at the
idea of her approach.
Influenced by such feelings as these, it was no easy task for Mr.
Torrens to assume a complacent demeanour suitable to the occasion
of his nuptials. He, nevertheless, managed to conceal the emotions
which wrung him so acutely, and played his part with tolerable
satisfaction to Mrs. Slingsby as she introduced him to Dr. Wagtail and
the other guests, including a clergyman, who were already
assembled at her house.
The ceremony was performed by the reverend gentleman just
alluded to, Dr. Wagtail giving the bride away. A splendid banquet
was then served up; and shortly after ten o'clock Mr. and Mrs.
Torrens departed together for the Cottage.
CHAPTER LXXXIII.
THE REWARD OF CRIME.