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

Raspberry Pi Computing Analog Measurement Malcolm Maclean all chapter instant download

Analog

Uploaded by

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

Raspberry Pi Computing Analog Measurement Malcolm Maclean all chapter instant download

Analog

Uploaded by

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

Download Full Version ebook - Visit ebookmeta.

com

Raspberry Pi Computing Analog Measurement Malcolm


Maclean

https://ebookmeta.com/product/raspberry-pi-computing-analog-
measurement-malcolm-maclean/

OR CLICK HERE

DOWLOAD NOW

Discover More Ebook - Explore Now at ebookmeta.com


Instant digital products (PDF, ePub, MOBI) ready for you
Download now and discover formats that fit your needs...

Start reading on any device today!

Instant Raspberry Pi The Beginner s Guide to Raspberry Pi


setup 1st Edition Ashwin Pajankar

https://ebookmeta.com/product/instant-raspberry-pi-the-beginner-s-
guide-to-raspberry-pi-setup-1st-edition-ashwin-pajankar/

ebookmeta.com

Expanding Your Raspberry Pi: Storage, printing,


peripherals, and network connections for your Raspberry Pi
Soper
https://ebookmeta.com/product/expanding-your-raspberry-pi-storage-
printing-peripherals-and-network-connections-for-your-raspberry-pi-
soper/
ebookmeta.com

Retro Gaming with Raspberry Pi 2nd Edition

https://ebookmeta.com/product/retro-gaming-with-raspberry-pi-2nd-
edition/

ebookmeta.com

Masculinities in the Court Tales of Daniel Advancing


Gender Studies in the Hebrew Bible 1st Edition Brian
Charles Dipalma
https://ebookmeta.com/product/masculinities-in-the-court-tales-of-
daniel-advancing-gender-studies-in-the-hebrew-bible-1st-edition-brian-
charles-dipalma-2/
ebookmeta.com
Diego s Heart Vampires of the Beloved Gem 1 1st Edition
Taylor Rylan

https://ebookmeta.com/product/diego-s-heart-vampires-of-the-beloved-
gem-1-1st-edition-taylor-rylan/

ebookmeta.com

Calling Mr Nelson Pugh 1st Edition Christopher Opyr

https://ebookmeta.com/product/calling-mr-nelson-pugh-1st-edition-
christopher-opyr/

ebookmeta.com

Stem Mathematics test for Primary junior 1st Edition B■t


Nh■

https://ebookmeta.com/product/stem-mathematics-test-for-primary-
junior-1st-edition-bat-nhi/

ebookmeta.com

The Routledge Handbook on Financial Social Work Direct


Practice with Vulnerable Populations 1st Edition Christine
Callahan
https://ebookmeta.com/product/the-routledge-handbook-on-financial-
social-work-direct-practice-with-vulnerable-populations-1st-edition-
christine-callahan/
ebookmeta.com

Democratizing RPA with Power Automate Desktop 1 /


converted Edition Peter Krause

https://ebookmeta.com/product/democratizing-rpa-with-power-automate-
desktop-1-converted-edition-peter-krause/

ebookmeta.com
Spanish Language and Sociolinguistic Analysis 1st Edition
Sandro Sessarego

https://ebookmeta.com/product/spanish-language-and-sociolinguistic-
analysis-1st-edition-sandro-sessarego/

ebookmeta.com
Contents

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

The History of the Raspberry Pi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

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

Setting up the Raspberry Pi Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52


Web Server, PHP and Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Install NGINX and PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Create a database and a table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

Connecting Analog Sensors to the Raspberry Pi . . . . . . . . . . . . . . . . . . . . . . . . 57


Analog and Digital . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Analog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Digital . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
The Boards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
The Analog Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
The Light Dependant Resistor (LDR or Photoresistor) . . . . . . . . . . . . . . 59
Analog to Digital Conversion (ADC) . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
The ADS1015 Analog to Digital Converter . . . . . . . . . . . . . . . . . . . . . 61
Measure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Hardware required . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Connect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
CONTENTS

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

Directory Structure Cheat Sheet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138


Introduction
Welcome!
Hi there. Congratulations on getting your hands on this book. You’re interested in learning about
connecting analog sensors to the Raspberry Pi. So, you’ve come to the right place.
This will be a journey of discovery for both of us. By experimenting with computers we will
be learning about what is happening in the physical environment. Others have done this sort of
thing, but I have an ulterior motive. I write books to learn and document what I’ve done. The
hope is that by sharing the journey others can learn something from my efforts :-).
Ambitious? Maybe :-). But if you’re reading this, I managed to make some headway. I dare say
that like other books I have written (or are currently writing) it will remain a work in progress.
They are living documents, open to feedback, comment, expansion, change and improvement.
Please feel free to provide your thoughts on ways that I can improve things. Your input would
be much appreciated.
You will find that I eschew a simple “Do this approach” for more of a story telling exercise. Some
explanations are longer and more flowery than might be to everyone’s liking, but there you go,
that’s my way :-).
There’s a lot of information in the book. There’s ‘stuff’ that people with a reasonable under-
standing of computers will find excessive. Sorry about that. I have gathered a lot of the content
from other books I’ve written to create this guide. As a result, it is as full of usable information
as possible to help people who could be using the Pi and coding for the first time. Please bear
in mind, this is the description of ONE simple project. I could describe it in 5 pages but I have
stretched it out into a lot more. If we need to recreate the project from scratch, this guide will
leave nothing out. It will also form a basis for other derivative books (as books before this one
have done). As the Raspberry Pi’s and OS’s improve, the descriptions will evolve.
I’m sure most authors try to be as accessible as possible. I’d like to do the same, but be warned…
There’s a good chance that if you ask me a technical question I may not know the answer. So
please be gentle with your emails :-).
Email: [email protected]
Cover photo via Good Free Photos¹ and fluxworkshop².

¹https://www.goodfreephotos.com
²https://www.ebay.com/usr/fluxworkshop
Introduction 2

What are we trying to do?


Put simply, we are going to examine the wonder that is the Raspberry Pi computer and use it to
accomplish something.
In this specific case we will be connecting an analog sensor (specifically a Light Dependent
Resistor (LDR)) to an Analog to Digital Converter (ADC) which will be connected to the Pi.
We’ll be measuring the values that it returns, recording them in a database and then making
those values available via web a interface!
Along the way we’ll;

• Look at the Raspberry Pi and its history.


• Work out how to get software loaded onto the Pi.
• Learn about networking and configure the Pi accordingly.
• Install and configure a web server and a database.
• Write some code to interface with our ADC and our LDR.

Who is this book for?


You!
By getting hold of a copy of this book you have demonstrated a desire to learn, to explore and
to challenge yourself. That’s the most important criteria you will want to have when trying
something new. Your experience level will come second place to a desire to learn.
It may be useful to be comfortable using the Windows operating system (I’ll be using Windows
7 for the set-up of the devices). You should be aware of Linux as an alternative operating system,
but you needn’t have tried it before. Before you learn anything new, it pretty much always
appears indistinguishable from magic. but once you start having a play, the mystery falls away.

What will we need?


Well, you could just read the book and learn a bit. By itself that’s not a bad thing, but trust me
when I say that actually experimenting with physical computers is fun and rewarding.
The list below is flexible in most cases and will depend on how you want to measure the values.

• A Raspberry Pi (I’m using a Raspberry Pi Model B 2 / 3)


• Probably a case for the Pi
• A MicroSD card
• A power supply for the Pi
• A keyboard and monitor that you can plug into the Pi (there are a few options here, read
on for details)
• A remote computer (like your normal desktop PC that you can use to talk to connect to the
Pi). This isn’t strictly necessary, but it makes the experience way cooler.
Introduction 3

• 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.

Why on earth did I write this rambling tome?


That’s a really good question. This is another project that I wanted to update from an earlier book
(Raspberry Pi: Measure, Record, Explore⁵) and to be brutally hones I picked it at random over
other options. Writing the previous books in this series⁶ was an enjoyable process, so I thought
that I’d carry on and continue to adapt the book for subsequent projects. This is book three in
this series, so I suppose it’s a ‘thing’ by now. Will this continue? Who knows, stay tuned…
Included is a bunch of information from my books on the Raspberry Pi, Linux and d3.js. I hope
you find it useful.

Where can you get more information?


The Raspberry Pi as a concept has provided an extensible and practical framework for introduc-
ing people to the wonders of computing in the real world. At the same time there has been a
boom of information available for people to use them. The following is a far from exhaustive list
of sources, but from my own experience it represents a useful subset of knowledge.
raspberrypi.org⁷
Google+⁸
reddit⁹
Raspberry Pi Stack Exchange¹⁰

³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.

Early Alpha Board (Credit: Paul Downey)

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.

raspberrypi.org blog lights the fuse.

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

Raspberry Pi B+ and Raspberry Pi B2

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.

The Raspberry Pi B+ Board

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+, B2, B3 and B3+

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)

Raspberry Pi B+ USB Ports


Raspberry Pi Versions 10

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.

Raspberry Pi B Models HDMI Video Output

Ethernet Network Connection


There is an integrated Ethernet Port for network access. On the B2 and B3 the connection speed
is fast ethernet (10/100 bps). The B3+ introduced a 300bps connection speed.

Raspberry Pi Model B Ethernet Connector


Raspberry Pi Versions 11

USB Power Input Jack


The boards include a 5V 2A Micro USB Power Input Jack.

Raspberry Pi Model B+ USB Power Input

MicroSD Flash Memory Card Slot


There is a microSD card socket on the ‘underside ‘of the board. On the Model B2 this is a ‘push-
push’ socket. On the B3 and later this is a simple friction fit.

Raspberry Pi B+ MicroSD Card Socket


Raspberry Pi Versions 12

Stereo and Composite Video Output


The B+, B2, B3 and B3+ includes a 4-pole (TRRS¹⁵) type connector that can provide stereo sound
if you plug in a standard headphone jack and composite video output with stereo audio if you
use a TRRS adapter.

Raspberry Pi B+ A/V Connector

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).

Raspberry Pi B+ GPIO Connector

¹⁵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.

MicroSD Card Positioning

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.

Wired Keyboard and Mouse

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.

Wireless Keyboard and Mouse


Raspberry Pi Peripherals 15

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.

HDMI Connected Monitor

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.

VGA to HDMI Adapter


Raspberry Pi Peripherals 16

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.

HDMI Connected Monitor

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.

Power Supply Connection

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;

Simple ABS plastic case

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.

Official Raspberry Pi case

¹⁶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!

Writing the Operating System image to the SD Card


Once we have an image file we need to get it onto our SD card.
Operating Systems 21

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

Select the img file that you want to install.

Etcher SD Card Selection

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).

Flash the drive

Then click on ‘Flash!’ to burn the card.

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.

Enabling Secure Shell Access


One of the awesome things when learning to use a Raspberry Pi comes when you begin to access
it remotely from another computer. This is a bit of an ‘Ah Ha!’ moment for some people as they
begin to appreciate just how networks and the Internet is built. We are going to enable and use
remote access via what is called ‘SSH’. We’ll start using it later in the book, but for now we can
take the opportunity to enable it for later use. We do this by creating a file called ‘ssh’ on our
freshly written SD card. Then, when the Pi then boots up it sees the file and automatically knows
to enable SSH.
SSH used to be enabled by default, but doing so presents a potential security concern, so it has
been disabled by default as of the end of 2016. In our case it’s a feature that we want to use.
Eject the card from the computer and then re-insert it. When the computer recognises the card,
open it and right-click in the folder to create a new file. This can be a simple txt file so long as
the file prefix is ‘ssh’. It doesn’t need to have anything in it, there just needs to be a file there.
Now we can unmount the SD card and eject it again.

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

The Command Line interface


Because we have installed the ‘Lite’ version of Raspbian, when we first boot up, the process
should automatically re-size the root file system to make full use of the space available on your SD
card. If this isn’t the case, the facility to do it can be accessed from the Raspberry Pi configuration
tool (raspi-config) that we will look at in a moment.
Once the reboot is complete (if it occurs) you will be presented with the console prompt to log
on;

Raspbian GNU/Linux 7 raspberrypi tty1

raspberrypi login:

The default username and password is:


Username: pi
Password: raspberry
Enter the username and password.
Congratulations, you have a working Raspberry Pi and are ready to start getting into the thick
of things!
Firstly we’ll do a bit of house keeping.

Raspberry Pi Software Configuration Tool

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.
Discovering Diverse Content Through
Random Scribd Documents
not libel or slander of which the law takes notice. Many privileged
occasions have been recognized. The occasion, with which we now
have to deal, is that a defamatory statement has been made either in
words or by writing in the course of an inquiry regarding the
administration of the law. It is beyond dispute that statements made
under these circumstances are privileged as to some persons, and it
has been admitted by the plaintiff’s counsel that one set of these
persons are advocates: it could not be denied that advocates are
privileged in respect of at least some defamatory statements made by
them in the course of an inquiry as to the administration of the law.
It was admitted that so long as an advocate acts bona fide and says
what is relevant, owing to the privileged occasion, defamatory
statements made by him do not amount to libel or slander, although
they would have been actionable if they had not been made whilst he
was discharging his duty as an advocate. But it was contended that
an advocate cannot claim the benefit of the privilege unless he acts
bona fide, that is, for the purpose of doing his duty as an advocate,
and unless what he says is relevant. That is the question which we
now have to determine. Certain persons can claim the benefit of the
privilege which arises as to everything said or written in the course of
an inquiry as to the administration of the law, and without making
an exhaustive enumeration I may say that those persons are judges,
advocates, parties, and witnesses. There have been decisions with
regard to three of these classes, namely, judges, parties, and
witnesses, and it has been held that whatever they may have said in
the course of an inquiry as to the administration of the law, has been
said upon a privileged occasion, and that they are not liable to any
action for libel or slander. But it has been suggested that only some
of these classes of persons can successfully claim the privilege of the
occasion, and those are judges, parties, and witnesses, who make
statements without malice and relevantly; and that those judges,
parties, and witnesses, who either speak or write without relevancy
and with malice, cannot successfully claim the privilege of the
occasion. I am inclined to think that with regard to these classes of
persons the law has not always been stated in the same manner by
the judges, and some judges have a strong objection to carry the
privilege beyond the point to which they are obliged by authority to
carry it; they are disinclined to admit the existence of the privilege.
Other judges are inclined to carry the privilege to its full extent, and
we must see what is the doctrine which has been finally adopted.
With regard to witnesses, the chief cases are, Revis v. Smith, 18 C. B.
126, 25 L. J. C. P. 195, and Henderson v. Broomhead, 4 H. & N. 569,
and with regard to witnesses, the general conclusion is that all
witnesses speaking with reference to the matter which is before the
court—whether what they say is relevant or irrelevant, whether what
they say is malicious or not—are exempt from liability to any action
in respect of what they state, whether the statement has been made
in words, that is, on viva voce examination, or whether it has been
made upon affidavit. It was at one time suggested that although
witnesses could not be held liable to actions upon the case for
defamation, that is, for actions for libel and slander, nevertheless
they might be held liable in another and different form of action on
the case, namely, an action analogous to an action for malicious
prosecution, in which it would be alleged that the statement
complained of was false to the knowledge of the witness, and was
made maliciously and without reasonable or probable cause. This
view has been supported by high authority; but it seems to me wholly
untenable. If an action for libel or slander cannot be maintained,
how can such an action as I have mentioned be maintained, it being
in truth an action for defamation in an altered form? Every objection
and every reason, which can be urged against an action for libel or
slander, will equally apply against the suggested form of action.
Therefore, to my mind, the best way to deal with the suggested form
of action is to dispose of it in the words of Crompton, J., in
Henderson v. Broomhead, where he said: “The attempts to obtain
redress for defamation having failed, an effort was made in Revis v.
Smith, 18 C. B. 126, 25 L. J. C. P. 195, to sustain an action analogous
to an action for malicious prosecution. That seems to have been done
in despair.” Nothing could be more strong, nothing could show more
clearly his entire disbelief in the possibility of supporting that new
form of action. The answer to the suggested form of action was that
during the hundreds of years which had elapsed such an action never
had been sustained. No reported case from the time of the
commencement of the common law until the present day can be
found in which the suggested form of action has been maintained,
and yet it is impossible to suppose that opportunities for bringing
actions of that kind and of carrying them to a conclusion have not
occurred again and again. However, the question is not as to the
form of the action, but whether an action of any kind will lie for
defamation uttered in the course of a judicial proceeding. Crompton,
J., in Henderson v. Broomhead, also said: “No action will lie for
words spoken or written in the course of any judicial proceeding. In
spite of all that can be said against it, we find the rule acted upon
from the earliest times. The mischief would be immense if the person
aggrieved, instead of preferring an indictment for perjury, could turn
his complaint into a civil action. By universal assent it appears that in
this country no such action lies. Cresswell, J., pointed out in Revis v.
Smith, 18 C. B. 126, that the inconvenience is much less than it would
be if the rule were otherwise. The origin of the rule was the great
mischief that would result, if witnesses in courts of justice were not
at liberty to speak freely, subject only to the animadversion of the
court.” It is there laid down that the reason for the rule with regard
to witnesses is public policy. In Scott v. Stansfield it was held that all
judges, inferior as well as superior, are privileged for words spoken
in the course of a judicial proceeding, although they are uttered
falsely and maliciously and without reasonable or probable cause.
The ground of the decision was that the privilege existed for the
public benefit: of course it is not for the public benefit that persons
should be slandered without having a remedy; but upon striking a
balance between convenience and inconvenience, between benefit
and mischief to the public, it is thought better that a judge should not
be subject to fear for the consequences of anything which he may say
in the course of his judicial duty. Therefore the cases of both
witnesses and judges fall within the rule as to privileged occasions,
notwithstanding it may be proved that any defamatory words spoken
by them were uttered from an indirect motive and to gratify their
own malice. In Dawkins v. Lord Rokeby, Law Rep. 8 Q. B. 255, it was
assumed for the purposes of the decision, that the defendant had
been guilty of both falsehood and malice; nevertheless it was held
that no action would lie against him for statements made by him as a
witness. The ground of the decision was no doubt that a witness in
giving his evidence should not be afraid of being sued for anything
that he might say. A similar view of the law was taken in Seaman v.
Netherclift; and the same rule has been applied to the parties. If
upon the grounds of public policy and free administration of the law
the privilege be extended to judges and witnesses, although they
speak maliciously and without reasonable or probable cause, is it not
for the benefit of the administration of the law that counsel also
should have an entirely free mind? Of the three classes—judge,
witness, and counsel—it seems to me that a counsel has a special
need to have his mind clear from all anxiety. A counsel’s position is
one of the utmost difficulty. He is not to speak of that which he
knows: he is not called upon to consider, whether the facts with
which he is dealing are true or false. What he has to do, is to argue as
best he can, without degrading himself, in order to maintain the
proposition which will carry with it either the protection or the
remedy which he desires for his client. If amidst the difficulties of his
position he were to be called upon during the heat of his argument to
consider whether what he says is true or false, whether what he says
is relevant or irrelevant, he would have his mind so embarrassed that
he could not do the duty which he is called upon to perform. For,
more than a judge, infinitely more than a witness, he wants
protection on the ground of benefit to the public. The rule of law is
that what is said in the course of the administration of the law, is
privileged; and the reason of that rule covers a counsel even more
than a judge or a witness. To my mind it is illogical to argue that the
protection of privilege ought not to exist for a counsel, who
deliberately and maliciously slanders another person. The reason of
the rule is, that a counsel, who is not malicious and who is acting
bona fide, may not be in danger of having actions brought against
him. If the rule of law were otherwise, the most innocent of counsel
might be unrighteously harrassed with suits, and therefore it is better
to make the rule of law so large that an innocent counsel shall never
be troubled, although by making it so large counsel are included who
have been guilty of malice and misconduct. In Rex v. Skinner, Lofft,
55, Lord Mansfield, a judge most skilful in enunciating the principles
of the law, treated a counsel as standing in the same position as a
judge or a witness. In Dawkins v. Lord Rokeby, Law Rep. 8 Q. B. 255,
at pp. 263, 264, 268, a most careful judgment was delivered on
behalf of all the judges in the Exchequer Chamber, and the opinion
of Lord Mansfield was cited and adopted. If the authority of these
two cases is to be followed, counsel are equally protected with judges
and witnesses. I will refer to Kennedy v. Hilliard, 10 Ir. C. L. Rep. N. S.
195, and in that case Pigott, C. B., delivered a most learned
judgment, in the course of which he said: “I take this to be a rule of
law, not founded (as is the protection in other cases of privileged
statements) on the absence of malice in the party sued, but founded
on public policy, which requires that a judge, in dealing with the
matter before him, a party in preferring or resisting a legal
proceeding, and a witness in giving evidence, oral or written, in a
court of justice, shall do so with his mind uninfluenced by the fear of
an action for defamation or a prosecution for libel.” 10 Ir. C. L. Rep.,
at p. 209. Into the rule thus stated the word “counsel” must be
introduced, and the rule may be taken to be the rule of the common
law. That rule is founded upon public policy. With regard to counsel,
the questions of malice, bona fides, and relevancy, cannot be raised;
the only question is, whether what is complained of has been said in
the course of the administration of the law. If that be so, the case
against a counsel must be stopped at once. No action of any kind, no
criminal prosecution, can be maintained against a defendant, when it
is established that the words complained of were uttered by him as
counsel in the course of a judicial inquiry, that is, an inquiry before
any court of justice into any matter concerning the administration of
the law.
I am of opinion that the rule of law is such as I have pointed out,
that it ought to be applied in the present case, and therefore that this
action cannot be maintained.
From our judgments it is obvious that we dissent from the opinion
of Lord Denman, C. J., expressed by him at Nisi Prius in Kendillon v.
Maltby, Car. & M. 402; 2 M. & R. 438.
Appeal dismissed.[457]

SEAMAN v. NETHERCLIFT
In the Court of Appeal, December 15, 1876.
Reported in 2 Common Pleas Division, 53.

Appeal from the decision of the Common Pleas Division, ordering judgment to
be entered for the defendant. 1 C. P. D. 540.
Claim: That defendant said of a will, to the signature of which the plaintiff was a
witness, “I believe the signature to the will to be a rank forgery, and I shall believe
so to the day of my death,” meaning that the plaintiff had been guilty of forging the
signature of the testator, or of aiding and abetting in the forgery.
Defence: That defendant spoke the words in the course of giving his evidence as
a witness on a charge of forgery before a magistrate.
Reply: That the words were not bona fide spoken by defendant as a witness, or
in answer to any question put to him as a witness, and he was a mere volunteer in
speaking them for his own purposes otherwise than as a witness and maliciously
and out of the course of his examination.[458]
Cockburn, C. J. The case is, to my mind, so abundantly clear, and I believe to
the minds of my learned brothers, that I think we ought not to hesitate to at once
pronounce our decision.
The plaintiff brings his action against the defendant for slander, alleged to have
been uttered on the occasion of a prosecution for forgery before a magistrate of the
city of London. The defence set up is: “True, I did utter the words imputed to me,
but I spoke them when I was a witness in a case in which I was called as a witness.”
The plaintiff’s answer to that is, “Yes, you were called as a witness, but you spoke
these words when you were no longer giving evidence, and not only knowing them
to be false, but also not in the inquiry, and dehors altogether the subject-matter of
the inquiry, for your own purpose of maliciously defaming me.” At the trial before
Lord Coleridge it appeared that in the Probate suit of Davies v. May the defendant
had been examined, as an adept, to express his opinion as to the genuineness of a
signature to a will, and he gave it as his opinion that the signature was a forgery.
The president of the court, in addressing the jury, made some very strong
observations on the rashness of the defendant in expressing so confident an
opinion in the face of the direct evidence. Soon afterwards, on a prosecution for
forgery before the magistrate, the defendant was called as an adept by the person
charged, when he expressed an opinion favorable to the genuineness of the
document. He was then asked by the counsel for the prosecution whether he had
been a witness in the suit of Davies v. May. He answered, “Yes.” And he was then
asked, “Did you read a report of the observations which the presiding judge made
on your evidence?” He again said, “Yes.” And then the counsel stopped. I presume
the circumstances of the trial were well known, and the counsel thought he had
done enough. The defendant, the witness, expressed a desire to make a statement.
The magistrate told him he could not hear it. Nevertheless the defendant persisted
and made the statement, the subject-matter of this action of slander.
On the proof of these facts Lord Coleridge reserved leave to the defendant to
move to enter judgment, if the court should be of opinion that there was no
evidence on behalf of the plaintiff which ought to be left to the jury. It occurred to
him, however, that it would be as well to take the opinion of the jury, and they
found that the replication was true, viz., that the words were spoken, not as a
witness in the course of the inquiry, but maliciously for his own purpose, that is,
with intent to injure the plaintiff. Upon these findings judgment was entered for
the plaintiff, leave being again reserved to enter judgment for the defendant, and
the Court of Common Pleas gave judgment for the defendant.
Now, if the findings of the jury had been founded upon evidence by which they
could have been supported, I might have had some hesitation about the decision.
But they were not; and we are asked to come to a conclusion contrary to what has
been established law for nearly three centuries.
If there is anything as to which the authority is overwhelming it is that a witness
is privileged to the extent of what he says in course of his examination. Neither is
that privilege affected by the relevancy or irrelevancy of what he says; for then he
would be obliged to judge of what is relevant or irrelevant, and questions might be,
and are, constantly asked which are not strictly relevant to the issue. But that,
beyond all question, this unqualified privilege extends to a witness is established
by a long series of cases, the last of which is Dawkins v. Lord Rokeby, Law Rep. 7
H. L. 744, after which to contend to the contrary is hopeless. It was there expressly
decided that the evidence of a witness with reference to the inquiry is privileged,
notwithstanding it may be malicious; and to ask us to decide to the contrary is to
ask what is beyond our power. But I agree that if in this case, beyond being spoken
maliciously, the words had not been spoken in the character of a witness or not
while he was giving evidence in the case, the result might have been different. For I
am very far from desiring to be considered as laying down as law that what a
witness states altogether out of the character and sphere of a witness, or what he
may say dehors the matter in hand, is necessarily protected. I quite agree that what
he says before he enters or after he has left the witness-box is not privileged, which
was the question in the case before Lord Ellenborough. Trotman v. Dunn, 4 Camp.
211. Or if a man when in the witness-box were to take advantage of his position to
utter something having no reference to the cause or matter of inquiry in order to
assail the character of another, as if he were asked, “Were you at York on a certain
day?” and he were to answer, “Yes, and A. B. picked my pocket there;” it certainly
might well be said in such a case that the statement was altogether dehors the
character of witness, and not within the privilege.
If, therefore, the findings of the jury, that the defendant had ceased to be a
witness when he spoke the words, were justified by the evidence, I should hesitate
before I decided in his favor. But I think the defendant was entitled to judgment on
the first reservation. There was no evidence to go to the jury upon the plaintiff’s
case. What the defendant said was said in his character of witness; for there can be
no doubt that the words were spoken in consequence of the question put to him by
counsel for the prosecution, the object and effect of the cross-examination having
been to damage his credibility as a witness before the magistrate, and of this the
witness was conscious. The counsel, having put the question, stops; and if there
had been counsel present for the prisoner who had re-examined the witness, he
would have put the proper questions to rehabilitate him to the degree of credit to
which he was entitled. That such questions would have been relevant I cannot
bring myself for a moment to doubt, relating as they do to the credibility of the
witness, which is part of the matter of which the magistrate has to take cognizance.
That being so, the witness himself, who is sworn to speak the whole truth, is
properly entitled, not only with a view to his own vindication, but in the interest of
justice, to make such an observation in explanation of his former answer as is just
and fair under the circumstances. That is what the defendant did. The sitting
magistrate having allowed the disparaging question to be put and answered, ought
not to have interfered to prevent the defendant from giving an explanation. I think
the statement, coming immediately after the damaging question had been put to
him, must be taken to be part of his testimony touching the matter in question, as
it affects his credibility as a witness in the matter as to which he was called. It was
given as part of his evidence before he had become divested of his character of
witness; and but for the question of the opposite counsel he never would have
made the statement at all.
As to the finding of malice, it is true that what the defendant said might possibly
have the effect of damaging the plaintiff’s character; but can any one suppose that
the defendant had this in his mind when he spoke, or that he intended to injure the
plaintiff? He thought only of his own credit as a witness, which had been attacked.
He spoke, on the impulse of the moment, no doubt very foolishly; and it was
probably his foolish persistence in maintaining the same attitude and setting up
his own opinion against the positive testimony of the other witnesses that
prejudiced the jury against him, and led them to return the findings they did,
founded, in reality, upon no evidence at all. In my opinion, the Lord Chief Justice
should have nonsuited the plaintiff, which is the conclusion at which the Court of
Common Pleas ultimately arrived; for there really was no evidence that the
defendant was speaking otherwise than as a witness and relevantly to the matters
in issue, because relevantly to his own character and credibility as a witness in the
matter. That being so, even if express malice could have been properly inferred
from the circumstances, the case of Dawkins v. Lord Rokeby, Law Rep. 7 H. L. 744,
conclusively decides that malice has ceased to be an element in the consideration
of such cases, unless it can be shown that the statement was made not in the course
of giving evidence, and therefore not in the character of a witness. A long series of
authorities, from the time of Elizabeth to the present time, has established that the
privilege of a witness while giving evidence is absolute and unqualified. Allardice v.
Robertson, 1 Dow, N. S. 495, 515, was relied upon by Mr. Chambers. That was the
case of an action against a magistrate for words spoken on the bench, and Lord
Wynford expressly distinguishes the two cases, and says that the privilege of a
judge of the superior courts does not apply to the judge of an inferior court; and
that in the case of the latter the privilege is not absolute and unqualified, and that a
“subordinate judge” would be liable to an action if malice were proved. It does not,
therefore, touch the present case; and as to a witness speaking with reference to
the subject-matter of the issue, it is clear that the privilege is unqualified.
The judgment of the Common Pleas Division must, therefore, be affirmed.
Bramwell, J. A. I am of the same opinion. The judgment of the Common Pleas
affirmed two propositions. First, that what the defendant said was said as a
witness, and was relevant to the inquiry before the magistrate; secondly, that, that
being so, the Lord Chief Justice should have stopped the trial of the action by
nonsuiting the plaintiff.
As to the first proposition, I am by no means sure that the word “relevant” is the
best word that could be used; the phrases used by the Lord Chief Baron and the
Lord Chancellor in Dawkins v. Lord Rokeby, Law Rep. 7 H. L., at p. 744, would
seem preferable, “having reference,” or “made with reference to the inquiry.” Now,
were the judges of the Common Pleas Division right in holding that this statement
of the defendant had reference to the inquiry? I think that they were. There can be
no doubt that the question put by the cross-examining counsel ought not to have
been allowed: “Have you read what Sir James Hannen is reported to have said as
to your evidence in Davies v. May?” What Sir James Hannen had said in a former
case was not evidence. It was, therefore, an improper question, and the answer to
it, if untrue, would not have subjected the witness to an indictment for perjury. But
the question having been put, and the answer having been in the affirmative—and
the question being, as Lord Coleridge observed, “ingeniously suggestive,” viz., that
the way the defendant had been dealt with on the former occasion did not redound
to his credit as a witness—the defendant insisted on making in addition the
statement complained of. He did so, in my opinion, very foolishly. It would have
been better to have been satisfied with retaining his own opinion without setting it
up in direct opposition to the positive testimony of eye-witnesses. But he foolishly,
as I think, and coarsely exclaimed, “I believe that will to be a rank forgery, and
shall believe so to the day of my death.” Suppose after he had said “yes,” he had
added in a decent and becoming manner, “and I am sorry Sir James Hannen said
what he did, for I took great pains to form my own opinion, and I shall always
retain it, as I still think it right.” Would not that have had reference to the inquiry
before the magistrate? And would it not have been reasonable and right that the
witness should have added that statement in justification of himself? Surely, yes.
Mr. Clarke said he was prepared to maintain that as long as a witness spoke as a
witness in the witness-box, he was protected, whether the matter had reference to
the inquiry or not. I am reluctant to affirm so extreme a proposition. Suppose
while the witness is in the box, a man were to come in at the door, and the witness
were to exclaim, “That man picked my pocket.” I can hardly think that would be
privileged. I can scarcely think a witness would be protected for anything he might
say in the witness-box, wantonly and without reference to the inquiry. I do not say
he would not be protected. It might be held that it was better that everything a
witness said as a witness should be protected, than that witnesses should be under
the impression that what they said in the witness-box might subject them to an
action. I certainly should pause before I affirmed so extreme a proposition, but
without affirming that, I think the words “having reference to the inquiry” ought to
have a very wide and comprehensive application, and ought not to be limited to
statements for which, if not true, a witness might be indicted for perjury, or the
exclusion of which by the judge would give ground for a new trial; but ought to
extend to that which a witness might naturally and reasonably say when giving
evidence with reference to the inquiry as to which he had been called as a witness.
Taking that view, I think the first proposition is established, that the statement of
the defendant was made as witness and had reference to the inquiry.
As to the second proposition, that, if the first be made out, no inquiry can be
gone into as to whether the statement was false or malicious or as a volunteer, we
are bound by authority. The case of Dawkins v. Lord Rokeby, Law Rep. 7 H. L. 744,
is directly in point, and binding upon us even if we disliked the decision. Mr.
Chambers has not attempted to distinguish that case except on the ground that the
inquiry in that case was before a military court. But it is clearly not distinguishable
on that ground. The learned Lords determined that what is true of a civil tribunal is
true of a military court of inquiry; and they affirmed most distinctly the
proposition that if the evidence has reference to the inquiry, the witness is
absolutely privileged. There is also the case in the Court of Error of Henderson v.
Broomhead, 4 H. & N. 569, which is precisely to the same effect, and
undistinguishable from the present case.
I am, therefore, of opinion that the judgment of the Common Pleas Division was
right, and must be affirmed.
Judgment affirmed.[459]

WHITE v. CARROLL
Court of Appeals, New York, March 18, 1870.
Reported in 42 New York Reports, 161.

Sutherland, J.[460] On the trial of this action, before Mr. Justice


Potter and a jury at the circuit, it appeared, that in 1858 and 1859, a
proceeding was going on before the surrogate of Montgomery county
in which the contested point or question was the testamentary
capacity of one Jay Phillips; that the plaintiff and the defendant were
both at the time, and for some years previously had been, practising
as physicians at Amsterdam, Montgomery county, the plaintiff as a
homœopathic physician, and the defendant as an allopathic
physician; that both had been sworn as witnesses, and testified in the
proceedings before the surrogate, the defendant some time after the
plaintiff; that on the examination of the defendant as such witness,
he was asked whether any other physician was in attendance on Jay
Phillips, at the time he was attending him, and that he answered:
“Not as I know of.” That he was then asked: “Did not any physician
attend him at the time he was at Mrs. Moore’s, when you did not?”
That to this question, the defendant answered: “Not as I know of; I
understand he had a quack, I would not call him a physician; I
understood that Dr. White, as he is called, had been there.” That this
evidence was reduced to writing by the surrogate, and filed in the
surrogates’ office; and thereupon this action was brought, the
complaint in which contains two counts, one for libel, or for words
written; and the other for slander, or for words spoken.
No point was made on the trial of the action, that the words
alleged in the complaint had not been proved to have been spoken by
the defendant, but a motion was made on his part to dismiss the
complaint, substantially upon the ground that the words spoken by
the defendant were not actionable, because they were spoken on his
examination as a witness, and were spoken as pertinent and
responsive to the questions asked him.
Justice Potter denied the motion to dismiss the complaint, and the
defendant excepted.
In submitting to the jury the question, “whether the defendant, at
the time he so testified and used the words in question, believed the
words so used by him were relevant or pertinent to the question then
on trial,” Justice Potter charged the jury as follows: “That if the jury
believed, from all the circumstances proved, from the questions put
to him, and from his manner of answering, and from the answers
themselves, that he testified in good faith, or in the belief that his
answers were pertinent and relevant, then the law protected him in
what he said; it was privileged, and their verdict should be for the
defendant. That if, on the contrary, they should believe from this
evidence, that the defendant, though testifying at the time as a
witness, and as such entitled to the protection of the law, in so using
the words proved, was actuated by malice; that he used the words for
the mere purpose of defaming the plaintiff, then the law withdrew
the protection it would otherwise have afforded him, and he became
amenable to the consequences of uttering the slander, or of
publishing the libel.”
There is certainly some doubt whether the defendant’s exception
which he claims applies to this part of the charge, was sufficiently
specific or definite to raise the question as to its correctness; but I
shall assume that it was; and I shall also assume, in view of what I
have said preliminarily, as the counsel for the defendant assumed on
the argument, and assumes in his points, that the only material
questions presented by this appeal, are those presented by the two
exceptions referred to.
Now, as to the first, it is perfectly clear, that the question, whether
the defendant was protected under the circumstances, was not a
question of law for the court, but was a question of fact for the jury. It
was really a question of conduct, of motive, of good faith and honest
purpose, or of bad faith and malicious purpose.
The question was, whether the defendant did, or did not, avail
himself of the occasion to maliciously answer the questions put to
him as a witness, in the way he did.
This question was most emphatically a question for the jury; and, I
think it was submitted to the jury as favorably for the defendant as
he had a right to expect or ask.
It is true, that in submitting it to the jury, Justice Potter assumed
that the defendant, when he answered the questions as he did, knew
what the question in the proceeding before the surrogate was; but
Justice Potter had a right to assume this under the circumstances.
I think the judgment should be affirmed, with costs.
All concur for affirmance.
Judgment affirmed.[461]

RICE v. COOLIDGE
Supreme Judicial Court, Massachusetts, December 1,
1876.
Reported in 121 Massachusetts Reports, 393.

Morton, J. This is an action of tort. The principal question raised


by the demurrer is, whether the plaintiff’s declaration states any legal
cause of action. Each count alleges, in substance, that a proceeding
for a divorce was pending in the courts of the State of Iowa, between
Joseph S. Coolidge and Mary L. Coolidge, in which the latter alleged
that the said Joseph S. Coolidge had been guilty of adultery with the
plaintiff; that the defendants conspired together and with the said
Mary L. Coolidge to procure and suborn witnesses to falsely testify in
support of said charges of adultery; and that the defendants, in
pursuance and execution of said conspiracy, did procure and suborn
certain witnesses named, to testify in said divorce suit, and to falsely
swear to criminal sexual intercourse between the plaintiff and said
Joseph S. Coolidge, and between the plaintiff and other persons, and
to various other acts and things which, if believed, would tend to
bring disgrace and infamy upon the plaintiff.
Three of the counts also allege that the defendants, in pursuance
and execution of the conspiracy, published or caused to be published
a printed pamphlet in which the false testimony of such witnesses
was repeated, and made the pretext for false and malicious charges
upon the plaintiff’s character and good name.
The gist of the plaintiff’s case is that the defendants have suborned
witnesses to falsely swear to defamatory statements concerning her,
and have done other connected acts in pursuance of a scheme or plan
to defame her. The alleged conspiracy or combination is not one of
the elements of the cause of action. That is not created by the
conspiracy, but by the wrongful acts done by the defendants to the
injury of the plaintiff. If the acts charged, when done by one alone,
are not actionable, they are not made actionable by being done by
several in pursuance of a conspiracy. Wellington v. Small, 3 Cush.
145; Parker v. Huntington, 2 Gray, 124; Bowen v. Matheson, 14
Allen, 499.
The question is presented, therefore, whether the plaintiff can
maintain an action of tort, in the nature of the common-law action
on the case, against the defendants for suborning witnesses to falsely
swear to defamatory statements concerning the plaintiff in a suit in
which neither of the parties to this suit was a party.
It requires no argument to show that the acts charged as done by
the defendants, if proved, are a great wrong upon the plaintiff. It is a
general rule of the common law that a man shall have a remedy for
every injury. The plaintiff should have a remedy for the injury done
to her by the defendants, unless there are some other rules of law, or
some controlling considerations of public policy, which take the case
out of this rule.
The defendants contend that the witnesses who uttered the
defamatory statements are protected from an action, because they
were statements made in the course of judicial proceedings, and that
therefore a person, who procured and suborned them to make the
statements, is not liable to an action.
It seems to be settled by the English authorities that judges,
counsel, parties, and witnesses are absolutely exempted from liability
to an action for defamatory words published in the course of judicial
proceedings. Henderson v. Broomhead, 4 H. & N. 569; Revis v.
Smith, 18 C. B. 126; Dawkins v. Rokeby, L. R. 8 Q. B. 255, and cases
cited; affirmed, L. R. 7 H. L. 744; Seaman v. Netherclift. The same
doctrine is generally held in the American courts, with the
qualification, as to parties, counsel, and witnesses, that, in order to
be privileged, their statements made in the course of an action must
be pertinent and material to the case. White v. Carroll, Smith v.
Howard, 28 Iowa, 51; Barnes v. McCrate, 32 Maine, 442; Kidder v.
Parkhurst, 3 Allen 393; Hoar v. Wood, 3 Met. 193. In the last-cited
case, Chief Justice Shaw says: “We take the rule to be well settled by
the authorities, that words spoken in the course of judicial
proceedings, though they are such as impute crime to another, and
therefore, if spoken elsewhere, would import malice and be
actionable in themselves, are not actionable if they are applicable
and pertinent to the subject of inquiry.”
We assume, therefore, for the purposes of this case, that the
plaintiff cannot maintain an action against the witnesses in the suit
in Iowa, for their defamatory statements, though they were false. But
it does not follow that she may not maintain an action against those
who, with malice and intent to injure her, procured and suborned
those witnesses to testify falsely.
The reasons why the testimony of witnesses is privileged are that it
is given upon compulsion and not voluntarily, and that, in order to
promote the most thorough investigation in courts of justice, public
policy requires that witnesses shall not be restrained by the fear of
being vexed by actions at the instance of those who are dissatisfied
with their testimony.[462] But these reasons do not apply to a stranger
to the suit, who procures and suborns false witnesses, and the rule
should not be extended beyond those cases which are within its
reasons.
The argument, that an accessory cannot be held civilly liable for an
act for which no remedy can be had against the principal, is not
satisfactory to our minds. The perjured witness and the one who
suborns him are joint tort-feasors, acting in conspiracy or
combination to injure the party defamed. The fact that one of them is
protected from a civil suit by a personal privilege does not exempt
the other joint tortfeasor from such suit. A similar argument was
disregarded by the court in Emery v. Hapgood, 7 Gray, 55, where it
was held that the defendant, who instigated and procured an officer
to arrest the plaintiff upon a void warrant, was liable to an action of
tort therefor, although the officer who served the warrant was
protected from an action, for reasons of public policy.
The defendants rely upon the cases of Bostwick v. Lewis, 2 Day,
447, and Smith v. Lewis, 3 Johns. 157. But those cases turn upon a
principle which does not apply in the case at bar. The facts in those
cases were as follows: Lewis brought an action in Connecticut against
several defendants, in which he prevailed. Afterwards Bostwick, one
of the defendants in the original action, brought an action in
Connecticut against Lewis, for suborning a witness in that action;
and Smith, another of the defendants, brought a similar action in
New York. It was held in each case that the action could not be
maintained, because, in the language of Mr. Justice Kent, it was “an
attempt to overhaul the merits” of a former suit. The case of Dunlap
v. Glidden, 31 Maine, 435, is to the same effect. Although the parties
to a former action cannot retry its merits, while a judgment therein is
in force and unreversed, yet any person who was not a party to the
action, or in privity with a party, may in a collateral action impeach
the judgment and overhaul the merits of the former action. Those
cases, therefore, are not decisive of the case at bar.[463]
The defendants argue that an action of this nature ought not to be
maintained, because the plaintiff therein might, by the testimony of a
single witness, prove that a witness in another action had committed
perjury. The rule of law, that a man cannot be convicted of perjury
upon the unaided testimony of one witness, is a rule applicable only
to criminal proceedings. The argument may go to show that the rule
ought to be extended to civil cases in which perjury is charged
against a witness, but it does not furnish a satisfactory reason why a
plaintiff should be altogether deprived of a remedy for an injury
inflicted upon him.
It is also urged, as an argument against the maintenance of this
action, that it is a novelty. The fact that an action is without a
precedent would call upon the court to consider with care the
question whether it is justified by correct principles of law; but if this
is found, it is without weight. In answer to the same argument, Lord
Chief Justice Willes said: “A special action on the case was
introduced for this reason, that the law will never suffer an injury
and a damage without a remedy, but there must be new facts, in
every special action on the case.” Winsmore v. Greenbank, Willes,
577.
Upon a careful consideration of the case, we are of opinion that
there are no rules of law and no reasons of public policy which
deprive the plaintiff of her remedy for the wrong done her by the
defendants by suborning witnesses to defame her character.[464]
Demurrer overruled.

RYALLS v. LEADER
In the Exchequer, May 26, 1866.
Reported in Law Reports, 1 Exchequer, 296.

Declaration on a libel published of the plaintiff by the defendants,


in a newspaper called the “Sheffield and Rotherham Independent.”
Plea. Not guilty. Issue thereon.
The libel complained of was contained in a report of an
examination of a debtor in custody, held in York Castle, before the
registrar of the Leeds Bankruptcy Court, pursuant to the provisions
of the Bankruptcy Act, 1861 (24 & 25 Vict. c. 134), ss. 101, 102; and it
conveyed an imputation on the solvency of the plaintiff, who had
been the debtor’s partner. The cause was tried at the last Leeds
spring assizes before Keating, J., when, the publication of the
defamatory matter having been proved, the learned judge told the
jury that “the libel was a privileged communication, and that the
defendants were entitled to the verdict if the jury thought that the
libel was a fair report of the proceedings before the registrar of the
Court of Bankruptcy, and published without malice.” The report
contained no original comment on what passed. The jury found a
verdict for the defendants.
In Easter Term last, a rule nisi was obtained for a new trial.[465]
Pollock, C. B. I am of opinion that my Brother Keating was right
in his ruling. The complaint here made is that certain proceedings
held by a registrar in bankruptcy in York Castle, and published by the
defendant, were libellous on the plaintiff. The defence is, that the
alleged libel was contained in a fair, correct, and bona fide report of
what took place; and if these proceedings were in a public court, and
the publication was fair, there is no foundation for this action.[466]
The only question then is, whether the registrar’s court was under
the circumstances a public court. I think that it was. We ought, in my
opinion, to make as wide as possible the right of the public to know
what takes place in any court of justice, and to protect a fair bona
fide statement of proceedings there. The jury found that the
publication of this report was bona fide, and the verdict, therefore,
ought not to be set aside.
Bramwell, B. I am of the same opinion. I think that this court was
a public court. That is shown from the terms of ss. 101 and 102. And
even if it were not so, yet if the officer who holds it chooses to make it
public, it would be public for this purpose. Then as to the point
made, that nothing ought to be published affecting a third party,
even when relevant to the inquiry, I think there is no such restriction.
Those who are present hear all the evidence, relevant or irrelevant,
and those who are absent, may, as far as I can see, have all that is
said reported to them. The doctrine contended for is an entire
novelty, because, if sound, every witness might bring an action
against the newspaper publisher reporting his evidence, and call
upon that publisher to prove all the libellous statements which might
be contained in his examination or cross-examination. I do not think
that there is any such qualification as that suggested, nor do I concur
in the other suggestion made to us, viz., that what is irrelevant and
libellous on a third person is not protected. There are cases where an
individual must suffer for the public good, and it is difficult to draw
the line between relevancy and irrelevancy. My opinion is, that when
once you establish that a court is a public court, a fair bona fide
report of all that passes there may be published. Possibly this
privilege is applied to courts of justice, because needless scandals are
usually avoided in them. I am therefore of opinion that this rule
should be discharged.
Rule discharged.

USILL v. HALES
In the Common Pleas Division, January 30, 1878.
Reported in 3 Common Pleas Division, 319.

Lord Coleridge, C. J.[467] I am of opinion that this rule must be


discharged.
This was an action against the proprietor of a newspaper for
publishing a bona fide and fair report of proceedings before a
magistrate. Three persons, surveyors, who had been employed by a
civil engineer to assist in the construction of a railway in Ireland,
hearing that their employer had been paid, and conceiving that the
money due to them had been improperly withheld by him, went
before a police magistrate in London, and (I must take it for the
purpose of my judgment, and do so take it) applied to him for a
summons or order under the Masters and Workman’s Act. In the
result, the magistrate thought that the facts stated by the
complainants showed no ground for a summons against the plaintiff
under the Act; and therefore in the result it turned out that, in a
certain sense, an application had been made to the magistrate with
regard to a matter as to which he had no jurisdiction. I say in a
certain sense: but it has been long held, and I think most properly
held, that it is not the result but the nature of the application made to
the magistrate which founds his jurisdiction: and that, wherever an
application is made to a magistrate as to a matter over which,
supposing the facts to bear out the statement, he has jurisdiction, he
then has jurisdiction to ascertain whether the facts make out a case
for the exercise of that jurisdiction which, if the facts make out the
case, undoubtedly he has.
It has been laid down again and again in broad terms that the
publication of the proceedings in courts of justice is privileged if the
report of such proceedings be fair and honest; and this is so found to
be. An attempt however has been made (and Mr. Shortt will allow me
to say that, if it were possible to have succeeded, I think his
argument would have succeeded, because he has said everything that
could be said, and has said it well) to distinguish this case and take it
out of the general proposition, by bringing it within an undoubted
qualification which has been grafted upon that general proposition,
viz., that the application to the magistrate here was what may be
called an ex parte or a preliminary proceeding. Now, there is no
doubt that, in many cases to which Mr. Shortt has referred, the term
“ex parte proceeding” has been over and over again used by judges of
great eminence, sometimes affirmatively to say that an ex parte
proceeding is not privileged, and sometimes negatively to say, this,
being a proceeding not ex parte, is privileged; and I do not doubt for
my own part that, if this argument had been addressed to a court
some sixty or seventy years ago, it might have met with a different
result from that which it is about to meet with to-day. Speaking
frankly,—and it is useless, if a case has made a certain impression
upon your mind after you have done the best you can to understand
it, to say it has not made that impression,—it seems to me quite plain
that in such cases as Rex v. Fleet, 1 B. & A. 379, judgments of great
judges do lay down the rule that an ex parte or preliminary
proceeding is not privileged on the ground, good or bad, that it is
very hard upon an individual to have a matter stated against him
behind his back which he has no means of answering; and that
oftentimes an accused person will come to trial, if he be tried, with a
heavy weight of prejudice; where the case against him has been
reported in the public newspapers, and his own answer, if he has
one, from the necessities of the case has not been similarly made
known. No doubt there are very strong observations in those cases
adopted in Duncan v. Thwaites, 3 B. & C. 556, which go very far to
maintain that proposition. There is also a dictum of one of the
greatest authorities in our law, Lord Eldon, than whom few greater
lawyers have ever sat in Westminster Hall, who is reported, by Mr.
Starkie, Starkie on Libel, 4th ed., p. 191 (9), to have once observed
that he recollected the time when it would have been matter of
surprise to every lawyer in Westminster Hall to learn that the
publication of ex parte proceedings was legal.
But we are not now living, so to say, within the shadow of those
cases: and it is idle to deny that there are cases since that time, in
which the decisions I have just now referred to have been brought to
the attention of the learned judges, where the courts have been
pressed with the authority of those decisions, and have come to
conclusions which it is not for me to say are inconsistent, but which I
am perfectly unable to reconcile with those earlier cases; and I find
what I think is excellent good sense in the judgment of the Court of
Queen’s Bench in the case of Wason v. Walter, which explains how
that is. It is a passage which one of the learned counsel read to us,
and it is a passage which upon the whole I should desire to adopt and
adhere to: “Whatever disadvantages attach to a system of unwritten
law,—and of this we are fully sensible,—it has at least this advantage,
that its elasticity enables those who administer it to adapt it to the
varying conditions of society and to the requirements and habits of
the age in which we live, so as to avoid the inconveniences and
injustice which arise where the law is no longer in harmony with the
wants and usages and interests of the generation to which it is
immediately applied. Our law of libel has in many respects only
gradually developed itself into anything like satisfactory and settled
form. The full liberty of public writers to comment on the conduct
and motives of public men has only in very recent times been
recognized.” And then the passage goes on,—“Even in quite recent
days judges, in holding the publication of the proceedings of courts
of justice lawful, have thought it necessary to distinguish what we
call ex parte proceedings as a probable exception from the operation
of the rule. Yet ex parte proceedings before magistrates, and even
before this court, as, for instance, on applications for criminal
informations, are published every day; but such a thing as an action
or indictment founded on a report of such an ex parte proceeding is
unheard of; and, if any such action or indictment should be brought,
it would probably be held that the true criterion of the privilege is not
whether the report was or was not ex parte, but whether it was a fair
and honest report of what had taken place, published simply with a
view to the honest publication, and innocent of all intention to do
injury to the reputation of the party affected.” Now, to the general
line of argument in that passage, and to the accuracy of the
statement in the last sentence I have read, I entirely adhere; and it is
familiar that not only are unimportant cases and ex parte
proceedings published, but a particular class of inquiries which in
some of the earlier cases I find actually by name excluded from the
privilege,—I mean inquiries before a coroner,—are in cases which
may be supposed to interest the public reported in all the
newspapers in the kingdom; and yet no one ever heard, at least since
I have known Westminster Hall, of an action being brought by a
person injuriously affected by such publication, where the report is
honest and bona fide, and published without intention to injure.
That, therefore, seems to introduce this element into the
determination of these cases, that there is a certain elasticity in the
rules which apply to questions of privilege (development is perhaps
the more correct expression), and that the courts have from time to
time applied as best they may what they think is the good sense of
the rules which exist to cases which have not been positively decided
to come within them. If there had been a case directly in point in
which a proceeding such as this, where the matter was at an end, and
where the publication had been found by the jury to have been bona
fide, honest, and fair, had been held by a court of co-ordinate
jurisdiction not to be privileged, I do not hesitate to say for my own
part that I should have gladly acted upon it, because I do not disguise
that my own judgment is not at all satisfied with the enormous
advantage to the public of having every small personal matter
reported day by day, often to the extreme pain and injury of
individuals, which is supposed to form its justification. Nevertheless,
I feel it to be the duty of a judge not to declare what he considers the
law ought to be, but to decide according to what to the best of his
judgment he finds it is: and, if he finds a principle laid down upon
competent authority, it is far better to accept and apply it broadly
and honestly, even if he is not in his own mind satisfied with the
foundation of the rule, than to attempt to fritter it away in its
application to cases which manifestly come within it.
I come therefore to the consideration of this case feeling that the
general tendency of the law has been to hold such a publication as
this to be within the protection of the privilege. Now, I do find one
case which to the best of my judgment appears to cover this case, and
from which I am unable, according to the principle laid down in it, to
distinguish the case now before us. It is a case to which much
reference has been made, and which Mr. Shortt has dealt with at
considerable length, viz., Lewis v. Levy; and it has no doubt a most
important bearing upon this question. I do not propose to read the
elaborate judgment delivered by Lord Campbell in that case: it is well
summed up in these words: “The rule, that the publication of a fair
and correct report of proceedings taking place in a public court of
justice is privileged, extends to proceedings taking place publicly
before a magistrate on the preliminary investigation of a criminal
charge terminating in the discharge by the magistrate of the party
charged.” I am perfectly aware that there may be subtle distinctions,
—distinctions which I will not say are merely shadowy, but which are
subtle,—between the facts of that case and those of the case now
before us: but I cannot disguise from myself that the ratio decidendi
and the argument by which the court was there led to hold such
proceedings to be privileged, do in effect cover this case. I am of
opinion that this is a case in which there was a judicial proceeding
terminating, not in the discharge of the party accused, because there
was no such person before the magistrate, but terminating in a
refusal to proceed with the charge and to set the criminal process in
motion. I am unable to distinguish the principle of Lewis v. Levy
from that involved in the present case; and I adopt what is said there
of the old,—and I may say great case, because it was decided by
judges of high authority,—of Curry v. Walter, so far back as the year
1796. That case is adopted by the Court of Queen’s Bench in a written
judgment in the year 1858, as a ground of their decision; and,
whatever may have been said about it in some of the intermediate
cases, and the doubts that have been thrown upon it by some
eminent judges, it must I think be considered to be completely
rehabilitated by the judgment of the Court of Queen’s Bench in Lewis
v. Levy, E. B. & E. 537. I am content, therefore, to rest my judgment
in this case upon the principles laid down in Curry v. Walter, 1 B. &
P. 525, and deliberately reaffirmed in Lewis v. Levy, E. B. & E., at p.
559, and to say that, upon the principles there laid down, I am of
opinion that this rule must be discharged.
Rule discharged.[468]

WASON v. WALKER
In the Queen’s Bench, November 25, 1868.
Reported in Law Reports, 4 Queen’s Bench, 73.

The judgment of the court was delivered by


Cockburn, C. J.[469] This case was argued a few days since before
my Brothers Lush, Hannen, and Hayes, and myself, and we took
time, not to consider what our judgment should be, for as to that our
minds were made up at the close of the argument, but because,
owing to the importance and novelty of the point involved, we
thought it desirable that our judgment should be reduced to writing
before it was delivered.
The main question for our decision is, whether a faithful report in
a public newspaper of a debate in either house of parliament,
containing matter disparaging to the character of an individual, as
having been spoken in the course of the debate, is actionable at the
suit of the party whose character has thus been called in question.
We are of opinion that it is not.
Important as the question is, it comes now for the first time before
a court of law for decision. Numerous as are the instances in which
the conduct and character of individuals have been called in question
in parliament during the many years that parliamentary debates
have been reported in the public journals, this is the first instance in
which an action of libel founded on a report of a parliamentary
debate has come before a court of law. There is, therefore, a total
absence of direct authority to guide us. There are, indeed, dicta of
learned judges having reference to the point in question, but they are
conflicting and inconclusive, and, having been unnecessary to the
decision of the cases in which they were pronounced, may be said to
be extrajudicial.

The case of Stockdale v. Hansard, 9 Ad. & E. 1, which was much


pressed upon us by the counsel for the defendant, is ... beside the
question. In that case a report from the inspectors of prisons relative
to the jail of Newgate, in which a work published by the plaintiff, a
bookseller, and which had been permitted to be introduced into the
prison, had been described as “of a most disgusting nature,” and as
containing, “plates obscene and indecent in the extreme,” had been
presented to the House in conformity with the Act of 5 & 6 Wm. 4, c.
38. In another report, being a reply to a report of the court of
aldermen on the same subject, the inspectors had reiterated their
charges as to the character of the book, adding that it had been
described by medical booksellers, to whom they (the inspectors) had
applied for information as to its character, as “one of Stockdale’s
obscene books.” These papers the House had ordered to be printed,
not only for the use of members, but also, in conformity with a
modern practice, for public sale, the proceeds to be applied to the
general expenses of printing by the House. An action of libel having
been brought by Stockdale against the defendants, the printers of the
House of Commons, for publishing these papers, the defence as
raised by the plea which this court had to consider was, first, that the
papers in question had been published by order of the House of
Commons; secondly, that the House having resolved (as it had done
with a view to such an action) that the power of publishing such of its
reports, votes, and proceedings, as it should deem necessary, was an
essential incident to the functions of parliament, the question
became one of privilege, as to which the decision of the House was
conclusive, and could not be questioned in a court of law.
From the doctrines involved in this defence, namely, that the
House of Commons could by their order authorize the violation of
private rights, and, by declaring the power thus exercised to be
matter of privilege, preclude a court of law from inquiring into the
existence of the privilege,—doctrines which would have placed the
rights and liberties of the subject at the mercy of a single branch of
the Legislature,—Lord Denman and his colleagues, in a series of
masterly judgments which will secure to the judges who pronounced
them admiration and reverence so long as the law of England and a
regard for the rights and liberties of the subject shall endure,
vindicated at once the majesty of the law and the rights which it is
the purpose of the law to uphold.
To the decision of this court in that memorable case we give our
unhesitating and unqualified adhesion. But the decision in that case
has no application to the present. The position, that an order of the
House of Commons cannot render lawful that which is contrary to
law, still less that a resolution of the House can supersede the
jurisdiction of a court of law by clothing an unwarranted exercise of
power with the garb of privilege, can have no application where the
question is, not whether the act complained of, being unlawful at
law, is rendered lawful by the order of the House or protected by the
assertion of its privilege, but whether it is, independently of such
order or assertion of privilege, in itself privileged and lawful.
Decided cases thus leaving us without authority on which to
proceed in the present instance, we must have recourse to principle
in order to arrive at a solution of the question before us, and
fortunately we have not far to seek before we find principles in our
opinion applicable to the case, and which will afford a safe and sure
foundation for our judgment.
It is now well established that faithful and fair reports of the
proceedings of courts of justice, though the character of individuals
may incidentally suffer, are privileged, and that for the publication of
such reports the publishers are neither criminally nor civilly
responsible.
The immunity thus afforded in respect of the publication of the
proceedings of courts of justice rests upon a twofold ground. In the
English law of libel, malice is said to be the gist of an action for
defamation. And though it is true that by malice, as necessary to give
a cause of action in respect of a defamatory statement, legal, and not
actual malice, is meant, while by legal malice, as explained by Bayley,
J., in Bromage v. Prosser, is meant no more than the wrongful
intention which the law always presumes as accompanying a
wrongful act without any proof of malice in fact, yet the presumption
of law may be rebutted by the circumstances under which the
defamatory matter has been uttered or published, and, if this should
be the case, though the character of the party concerned may have
suffered, no right of action will arise. “The rule,” says Lord Campbell,
C. J., in the case of Taylor v. Hawkins, 16 Q. B., at p. 321, “is that, if
the occasion be such as repels the presumption of malice, the
communication is privileged, and the plaintiff must then, if he can,
give evidence of malice.”
It is thus that in the case of reports of proceedings of courts of
justice, though individuals may occasionally suffer from them, yet, as
they are published without any reference to the individuals
concerned, but solely to afford information to the public and for the
benefit of society, the presumption of malice is rebutted, and such
publications are held to be privileged.
The other and the broader principle on which this exception to the
general law of libel is founded is, that the advantage to the
community from publicity being given to the proceedings of courts of
justice is so great, that the occasional inconvenience to individuals
arising from it must yield to the general good. It is true that with a
view to distinguish the publication of proceedings in parliament from
that of proceedings of courts of justice, it has been said that the
immunity accorded to the reports of the proceedings of courts of
justice is grounded on the fact of the courts being open to the public,
while the houses of parliament are not; as also that by the
publication of the proceeding of the courts the people obtain a
knowledge of the law by which their dealings and conduct are to be
regulated. But in our opinion the true ground is that given by
Lawrence, J., in Rex v. Wright, 8 T. R., at p. 298, namely, that
“though the publication of such proceedings may be to the
disadvantage of the particular individual concerned, yet it is of vast
importance to the public that the proceedings of courts of justice
should be universally known. The general advantage to the country
in having these proceedings made public, more than counterbalances
the inconvenience to the private persons whose conduct may be the
subject of such proceedings.” In Davison v. Duncan, 7 E. & B., at p.
231, Lord Campbell says: “A fair account of what takes place in a
court of justice is privileged. The reason is, that the balance of public
benefit from publicity is great. It is of great consequence that the
public should know what takes place in court; and the proceedings
are under the control of the judges. The inconvenience, therefore,
arising from the chance of injury to private character is
infinitesimally small as compared to the convenience of publicity.”
And Wightman, J., says: “The only foundation for the exception is
the superior benefit of the publicity of judicial proceedings which
counterbalances the injury to individuals, though that at times may
be great.”
Both the principles, on which the exemption from legal
consequences is thus extended to the publication of the proceedings
of courts of justice, appear to us to be applicable to the case before
us. The presumption of malice is negatived in the one case as in the
other by the fact that the publication has in view the instruction and
advantage of the public, and has no particular reference to the party
concerned. There is also in the one case as in the other a
preponderance of general good over partial and occasional evil. We
entirely concur with Lawrence, J., in Rex v. Wright, 8 T. R., at p. 298,
that the same reasons which apply to the reports of the proceedings
in courts of justice apply also to proceedings in parliament. It seems
to us impossible to doubt that it is of paramount public and national
importance that the proceedings of the houses of parliament shall be
communicated to the public, who have the deepest interest in
knowing what passes within their walls, seeing that on what is there
said and done, the welfare of the community depends. Where would
be our confidence in the government of the country or in the
Legislature by which our laws are framed, and to whose charge the
great interests of the country are committed,—where would be our
attachment to the constitution under which we live,—if the
proceedings of the great council of the realm were shrouded in
secrecy and concealed from the knowledge of the nation? How could
the communications between the representatives of the people and
their constituents, which are so essential to the working of the
representative system, be usefully carried on, if the constituencies
were kept in ignorance of what their representatives are doing? What
would become of the right of petitioning on all measures pending in
parliament, the undoubted right of the subject, if the people are to be
kept in ignorance of what is passing in either house? Can any man
bring himself to doubt that the publicity given in modern times to
what passes in parliament is essential to the maintenance of the
relations subsisting between the government, the Legislature, and
the country at large? It may, no doubt, be said that, while it may be
necessary as a matter of national interest that the proceedings of
parliament should in general be made public, yet that debates in
which the character of individuals is brought into question ought to
be suppressed. But to this, in addition to the difficulty in which
parties publishing parliamentary reports would be placed, if this
distinction were to be enforced and every debate had to be critically
scanned to see whether it contained defamatory matter, it may be
further answered that there is perhaps no subject in which the public
have a deeper interest than in all that relates to the conduct of public
servants of the state,—no subject of parliamentary discussion which
more requires to be made known than an inquiry relating to it. Of
this no better illustration could possibly be given than is afforded by
the case before us. A distinguished counsel, whose qualification for
the judicial bench had been abundantly tested by a long career of
forensic eminence, is promoted to a high judicial office, and the
profession and the public are satisfied that in a most important post
the services of a most competent and valuable public servant have
been secured. An individual comes forward and calls upon the House
of Lords to take measures for removing the judge, in all other
respects so well qualified for his office, by reason that on an
important occasion he had exhibited so total a disregard of truth as
to render him unfit to fill an office for which a sense of the solemn
obligations of truth and honor is an essential qualification. Can it be
said that such a subject is not one in which the public has a deep
interest, and as to which it ought not to be informed of what passes
in debate? Lastly, what greater anomaly or more flagrant injustice
could present itself than that, while from a sense of the importance
of giving publicity to their proceedings, the houses of parliament not
only sanction the reporting of their debates, but also take measures
for giving facility to those who report them, while every member of
the educated portion of the community from the highest to the
lowest looks with eager interest to the debates of either house, and
considers it a part of the duty of the public journals to furnish an
account of what passes there, we were to hold that a party publishing
a parliamentary debate is to be held liable to legal proceedings
because the conduct of a particular individual may happen to be
called in question?
The learned counsel for the plaintiff scarcely ventured as of his
own assertion to deny that the benefit to the public from having the
debates in parliament published was as great as that which arose
from the publishing of the proceedings of courts of justice, but he
relied on the dicta of Littledale, J., and Patteson, J., in Stockdale v.
Hansard, 9 Ad. & E. 1, and on the opinions of certain noble and
learned lords in the course of debates in the House of Lords on bills
introduced by Lord Campbell for the purpose of amending the law of
libel.[470] There is no doubt that in delivering their opinions in
Stockdale v. Hansard, the two learned judges referred to denied the
necessity and in effect the public advantage of the proceedings in
parliament being made public. The counsel for the defendant in that
case having insisted, as a reason why the power to order papers to be
printed and published should be considered within the privileges of
the House of Commons, on the advantage which resulted from the
proceedings of parliament being made known, the two learned
judges, not satisfied with demonstrating, as they did, by conclusive
arguments, that the House had not the power to order papers of a
libellous character and forming no part of the proceedings of the
House to be published, still less to conclude the legality of such a
proceeding by the assertion of privilege, thought it necessary to
follow the counsel into the question of policy and convenience, and
in so doing took what we cannot but think a very short-sighted view
of the subject. This is the more to be regretted, as their observations
apply not only to the printing of papers by order of the House, the
only question before them, but also to the publication of
parliamentary proceedings in general, the consideration of which
was not before them, and therefore was unnecessary. Lord Denman,
in his admirable judgment, than which a finer never was delivered
within these walls, and in which the spirit of Holt is combined with
the luminous reasoning of a Mansfield, while overthrowing by
irresistible arguments the positions of the Attorney-General, was
content to answer the argument as to the policy of allowing papers to
be published by order of either of the houses of parliament, not by
denying the policy of giving power to the House to order the printing
and publishing of papers, but by saying that such power must be
provided for by legislation. On the subject of the publication of
parliamentary debates he said nothing, nor was he called upon to say
anything. That the Legislature did not concur with the two judges in
their view of the policy is manifest from the Act of 3 Vict. c. 9, passed
in consequence of the decision in Stockdale v. Hansard, 9 Ad. & E. 1,
the preamble of which statute recites that “it is essential to the due
and effectual exercise and discharge of the functions and duties of
parliament and to the promotion of wise legislation that no
obstructions or impediments should exist to the publication of such
of the reports, papers, votes, or proceedings of either house of
parliament as such house of parliament may deem fit or necessary to
be published.” After which the Act proceeds to provide for the
prevention of actions being brought in respect of papers published by
order of either house of parliament.
As regards the attempt of Lord Campbell to fix the legality of the
publication of parliamentary debates on the sure foundation of
statutory enactment,[471] we think it may be as well accounted for by
the apprehension, as to the result of any proceeding at law in which
the legality of such publication should come in question, produced in
his mind by the language of the judges in Stockdale v. Hansard, as by
any conviction of the defectiveness of the law....
We, however, are glad to think that, on closer inquiry, the law
turns out not to be as on some occasions it has been assumed to be.
To us it seems clear that the principles on which the publication of
reports of the proceedings of courts of justice have been held to be
privileged apply to the reports of parliamentary proceedings. The
analogy between the two cases is in every respect complete. If the
rule has never been applied to the reports of parliamentary
proceedings till now, we must assume that it is only because the
occasion has never before arisen. If the principles which are the
foundation of the privilege in the one case are applicable to the other,
we must not hesitate to apply them, more especially when by so
doing we avoid the glaring anomaly and injustice to which we have
before adverted. Whatever disadvantages attach to a system of
unwritten law, and of these we are fully sensible, it has at least this
advantage, that its elasticity enables those who administer it to adapt
it to the varying conditions of society, and to the requirements and
habits of the age in which we live, so as to avoid the inconsistencies
and injustice which arise when the law is no longer in harmony with
the wants and usages and interests of the generation to which it is
immediately applied. Our law of libel has, in many respects, only
gradually developed itself into anything like a satisfactory and settled
form. The full liberty of public writers to comment on the conduct
and motives of public men has only in very recent times been
recognized. Comments on government, on ministers and officers of
state, on members of both houses of parliament, on judges and other
public functionaries, are now made every day, which half a century
ago would have been the subject of actions or ex officio informations,
and would have brought down fine and imprisonment on publishers
and authors. Yet who can doubt that the public are gainers by the
change, and that, though injustice may often be done, and though
public men may often have to smart under the keen sense of wrong
inflicted by hostile criticism, the nation profits by public opinion
being thus freely brought to bear on the discharge of public duties?
Again, the recognition of the right to publish the proceedings of
courts of justice has been of modern growth. Till a comparatively
recent time the sanction of the judges was thought necessary even for
the publication of the decisions of the courts upon points of law.
Even in quite recent days, judges in holding publication of the
proceedings of courts of justice lawful, have thought it necessary to
distinguish what are called ex parte proceedings as a probable
exception from the operation of the rule. Yet ex parte proceedings
before magistrates, and even before this court, as, for instance, on
applications for criminal informations, are published every day, but
such a thing as an action or indictment founded on a report of such
an ex parte proceeding is unheard of, and, if any such action or
indictment should be brought, it would probably be held that the
true criterion of the privilege is, not whether the report was or was
not ex parte, but whether it was a fair and honest report of what had
taken place, published simply with a view to the information of the
public, and innocent of all intention to do injury to the reputation of
the party affected.

You might also like