100% found this document useful (3 votes)
41 views

Arduino Playground Geeky Projects for the Experienced Maker 1st Edition Andrews all chapter instant download

The document provides information on downloading the ebook 'Arduino Playground: Geeky Projects for the Experienced Maker' by Warren Andrews, along with links to other related ebooks. It includes details about the book's content, chapters, and authorship, as well as a note about its early access status. The document emphasizes the interactive nature of the projects and encourages feedback from readers.

Uploaded by

iinananazmy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (3 votes)
41 views

Arduino Playground Geeky Projects for the Experienced Maker 1st Edition Andrews all chapter instant download

The document provides information on downloading the ebook 'Arduino Playground: Geeky Projects for the Experienced Maker' by Warren Andrews, along with links to other related ebooks. It includes details about the book's content, chapters, and authorship, as well as a note about its early access status. The document emphasizes the interactive nature of the projects and encourages feedback from readers.

Uploaded by

iinananazmy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 87

Visit https://ebookultra.

com to download the full version and


explore more ebooks

Arduino Playground Geeky Projects for the


Experienced Maker 1st Edition Andrews

_____ Click the link below to download _____


https://ebookultra.com/download/arduino-playground-
geeky-projects-for-the-experienced-maker-1st-edition-
andrews/

Explore and download more ebooks at ebookultra.com


Here are some suggested products you might be interested in.
Click the link to download

Python Playground Geeky Projects for the Curious


Programmer 1st Edition Mahesh Venkitachalam

https://ebookultra.com/download/python-playground-geeky-projects-for-
the-curious-programmer-1st-edition-mahesh-venkitachalam/

The Geeky Chef Cookbook Real Life Recipes for Fantasy


Foods Geeky Chef 4 Cassandra Reeder

https://ebookultra.com/download/the-geeky-chef-cookbook-real-life-
recipes-for-fantasy-foods-geeky-chef-4-cassandra-reeder/

Practical Arduino Cool Projects for Open Source Hardware


Technology in Action 1st Edition. Edition Jonathan Oxer

https://ebookultra.com/download/practical-arduino-cool-projects-for-
open-source-hardware-technology-in-action-1st-edition-edition-
jonathan-oxer/

The Maker s Guide to the Zombie Apocalypse Defend Your


Base with Simple Circuits Arduino and Raspberry Pi 1st
Edition Simon Monk
https://ebookultra.com/download/the-maker-s-guide-to-the-zombie-
apocalypse-defend-your-base-with-simple-circuits-arduino-and-
raspberry-pi-1st-edition-simon-monk/
The Arduino Inventor s Guide Learn Electronics by Making
10 Awesome Projects 1st Edition Huang

https://ebookultra.com/download/the-arduino-inventor-s-guide-learn-
electronics-by-making-10-awesome-projects-1st-edition-huang/

Arduino Project Handbook 25 Practical Projects to Get You


Started 1st Edition Mark Geddes

https://ebookultra.com/download/arduino-project-handbook-25-practical-
projects-to-get-you-started-1st-edition-mark-geddes/

Arduino For Dummies 1st Edition John Nussey

https://ebookultra.com/download/arduino-for-dummies-1st-edition-john-
nussey/

Programming Grails Best Practices for Experienced Grails


Developers 1st Edition Burt Beckwith

https://ebookultra.com/download/programming-grails-best-practices-for-
experienced-grails-developers-1st-edition-burt-beckwith/

Make Arduino Bots and Gadgets Six Embedded Projects with


Open Source Hardware and Software 1st Edition Tero
Karvinen
https://ebookultra.com/download/make-arduino-bots-and-gadgets-six-
embedded-projects-with-open-source-hardware-and-software-1st-edition-
tero-karvinen/
Arduino Playground Geeky Projects for the Experienced
Maker 1st Edition Andrews Digital Instant Download
Author(s): Andrews, Warren
ISBN(s): 9781593277444, 159327744X
Edition: 1
File Details: PDF, 7.90 MB
Year: 2017
Language: english
N o S t a r c h p r e ss
e a r ly a c c e ss p r o g r a m :
Feedback welcome!

Welcome to the Early Access edition of the as yet unpublished Arduino


Playground by Warren Andrews! As a prepublication title, this book may
be incomplete and some chapters may not have been proofread.
Our goal is always to make the best books possible, and we look forward
to hearing your thoughts. If you have any comments or questions, email us
at [email protected]. If you have specific feedback for us, please
include the page number, book title, and edition date in your note, and
we’ll be sure to review it. We appreciate your help and support!
We’ll email you as new chapters become available. In the meantime,
enjoy!
A r d u i n o P l ayg r o u n d
Warren andre ws
Early Access edition, 9/8/16

Copyright © 2016 by Warren Andrews.

ISBN-10: 1-59327-744-X
ISBN-13: 978-1-59327-744-4

Publisher: William Pollock


Production Editor: Laurel Chun
Cover Illustration: Josh Ellingson
Developmental Editor: Jennifer Griffith-Delgado
Technical Reviewer: Scott Collier
Copyeditor: Julie Jigour

No Starch Press and the No Starch Press logo are registered trademarks of No Starch Press,
Inc. Other product and company names mentioned herein may be the trademarks of their
respective owners. Rather than use a trademark symbol with every occurrence of a trade-
marked name, we are using the names only in an editorial fashion and to the benefit of the
trademark owner, with no intention of infringement of the trademark.

All rights reserved. No part of this work may be reproduced or transmitted in any form or by
any means, electronic or mechanical, including photocopying, recording, or by any informa-
tion storage or retrieval system, without the prior written permission of the copyright owner
and the publisher.

The information in this book is distributed on an “As Is” basis, without warranty. While every
precaution has been taken in the preparation of this work, neither the author nor No Starch
Press, Inc. shall have any liability to any person or entity with respect to any loss or damage
caused or alleged to be caused directly or indirectly by the information contained in it.
Brief Contents
Chapter 1: The Reaction-Time Machine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

Chapter 2: An Automated Agitator for PCB Etching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

Chapter 3: The Regulated Power Supply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

Chapter 4: A Watch Winder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

Chapter 5: The Garage Sentry Parking Assistant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105

Chapter 6: The Battery Saver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133

Chapter 7: A Custom pH Meter

Chapter 8: The Ballistic Chronograph

Chapter 9: The Square Wave Generator

Chapter 10: The Rainbow Thermometer

Appendix
Conte nt s in De ta il

1
The Reaction-Time Machine 1
Parts List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Reaction vs. Reflex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
How Does the Game Work? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Measuring Time with the Arduino Nano . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Expected Speed Ranges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
The Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
The Breadboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
The Arduino Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Customized Reaction Commentary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
What Happens in the Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Construction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Preparing a Sturdy Case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Mounting the Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Ideas for Customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

2
An Automated Agitator for PCB Etching 17
Special Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Parts List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
How Automatic Motor Reversal Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
The Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Determining the Reversal Threshold . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Using an H-Bridge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
The Breadboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
The Shield . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
PCB Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Shield Design Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Construction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
The Limit Wires . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
The Crank Bushing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Packaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
The Etching Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

3
The Regulated Power Supply 45
Parts List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Required Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
A Flexible Voltage Regulator Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
The Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
How the Circuit Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
The Breadboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Preparing the Arduino Pro Mini and LCD . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Building the Breadboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
The Shield . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Construction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Preparing the Enclosure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Mounting the Circuit Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

4
A Watch Winder 65
Why a Watch Winder? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Required Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Parts List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Acrylic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Other Hardware and Circuit Components . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Basic Watch Winder Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Using an Arduino to Control Winder Revolutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Using a Hall Effect Sensor to Monitor Rotations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
The Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
The Breadboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
The Shield . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Overview of the Motor Assembly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Construction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Preparing the Motor Plate and Bearing Box Acrylic . . . . . . . . . . . . . . . . . . . . 87
Bonding the Acrylic for the Bearing Box . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
The Stand . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Preparing the Motor and the Driveshaft . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
Making the Watch Basket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Adding the LEDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Leaving the Components on Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Keeping the Watches in the Basket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Design Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Total Rotation Adjustment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
How Many LEDs to Use and Where to Put Them . . . . . . . . . . . . . . . . . . . . . 101
Motor Voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
How Many Rotations Does the Watch Winder Make? . . . . . . . . . . . . . . . . . 102
Closing Thoughts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

5
The Garage Sentry Parking Assistant 105
Required Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Parts List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Optional Parts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Basics of Calculating Distance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
How the Garage Sentry Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
The Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111

iv   Chapter 
The Breadboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Inside the setup() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Inside the loop() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Determining Distance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Triggering the Alarm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Construction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Drilling Holes for the Electronics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Mounting Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Soldering the Transistors and Current-Limiting Resistors . . . . . . . . . . . . . . . . . 123
Wiring the Pieces Together . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
The Deluxe Garage Sentry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
The Deluxe Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
A Bigger Box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
The Shield . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
The Sketch for the Deluxe Garage Sentry . . . . . . . . . . . . . . . . . . . . . . . . . . 128

6
The Battery Saver 133
Boats, Tractors, and Other Vehicles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
Parts List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
Special Tool Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
The Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
How the Battery Saver Prevents Draining . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Arduino to the Rescue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
The Breadboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
The Shield . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
The PCB Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Preparing the Shield and Pro Mini Controller . . . . . . . . . . . . . . . . . . . . . . . . 148
Construction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
Preparing the Enclosure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
The Contact Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
Preparing the Copper Contact Assembly . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
Mounting Supplies for the Solenoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
Preparing the Release Rod, Springs, and E-Clip . . . . . . . . . . . . . . . . . . . . . . 153
Making the Release Lever and Pylon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Assembling All the Parts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Installing the Battery Saver into a Vehicle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Operating the Battery Saver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Normal Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Setting the Threshold Voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Protection from the Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Applying Cool Amp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161

Contents in Detail   v
Arduino Playground (Early Access), © 2016 by Warren Andrews

1
T h e R e a c t i o n -T i m e M a c h i n e

In this chapter, I will show you how to


build a time machine—that is, a Reaction-
Time Machine. I’d love to say that this
project will bring you “back to the future,”
but alas, it won’t. The “time” it’s looking at is the time
it takes you to react to a stimulus, which makes for a
fun game. This project is designed to accurately mea-
sure an individual’s reaction time and provide an area
for comments on the level of the individual’s perfor-
mance (see Figure 1-1). There is also plenty of room
to personalize the game to make it even more fun for
you, your friends, and your family.
Arduino Playground (Early Access), © 2016 by Warren Andrews

stop button

Figure 1-1: Completed Reaction-Time Machine

Parts List
This project has one of the smallest parts counts of all the projects in this
book, but don’t let that attenuate its value for you. My family and friends
have enjoyed playing the game repeatedly, and it’s portable, so you can take
it with you to get-togethers and other events.
Here’s what you’ll need:

• One Arduino Nano or clone


• Two SPST momentary switches (preferably one with a red button and
one with a button of a different color)
• One SPST toggle switch
• One red LED
• Two 10-kilohm resistors
• One 470-ohm resistor
• (Optional) One audible annunciator, Mallory Sonalert or similar
• One 4 × 20 LCD display
• One I2C adapter, if not included with the display (see “LCD Displays”
on page XX)
• One 9V battery

2   Chapter 1
Arduino Playground (Early Access), © 2016 by Warren Andrews

• One 9V battery clip


• One 3.5 mm jack (if remote switch is used)
• One Hammond 1591 BTCL enclosure
• 28–30 gauge hookup wire
• Solder

Downloads
Before you start this project, check the following resource files for this book
at https://www.nostarch.com/arduinoplayground/:

• Sketch file: Reaction.ino


• Drilling template for case: Filename

Reaction vs. Reflex


People often confuse reactions and reflexes, so I will start by defining both.
Reflexes are involuntary, automatic responses to a stimulus. In a reflex action,
the stimulus bypasses the brain and travels from the source of the stimulus
to the spinal cord and back to the receptor that controls the response, with-
out any cognitive acknowledgment. (Though I know many people for whom
almost all stimuli—and information—seem to bypass the brain, often just
getting lost instead.) Think of the doctor hitting your knee with a patellar
hammer to trigger your knee-jerk reflex.
Reactions, on the other hand, take the stimulus to the brain to be pro-
cessed, and then a return reaction travels to a receptor to result in some
motor action. This process takes somewhat longer than a typical reflex,
though some athletes are said to have reaction times so fast that it’s possible
their response is more similar to a reflex than a reaction.

NOTE Sports Illustrated has done interesting work in this area, with eye-opening articles
on baseball players and other athletes who have what appear to be exceptional reac-
tion times.

How Does the Game Work?


The Reaction-Time Machine game measures how long it takes an individual
to press a button in response to a visual stimulus—in this case an LED. With
a minor modification, you can add an auditory stimulus to the game: simply
replace the LED with an audible annunciator, such as a Mallory Sonalert.
Reaction time is measured in milliseconds or seconds (your choice), and it
is the time between the moment the stimulus is activated and the moment
the participant presses the button.

The Reaction-Time Machine   3


Arduino Playground (Early Access), © 2016 by Warren Andrews

His tory of Re ac t ion-T ime De v ice s

Over the years, there have been many devices to measure reaction time. One
of the simplest I remember from years ago required you to keep your fingers
on either side of a ruler held by another person in mid-air. When the ruler was
dropped, you would see how far it traveled before you could grasp it. The dis-
tance was translated to time using the algebraic equation
1 2
S= AT ,
2
where S is the distance traveled, A is the acceleration due to gravity, and T
is the reaction time. After you build this project, try both the ruler test and the
Reaction-Time Machine to see how close your times are between devices.

Measuring Time with the Arduino Nano


While there are many ways to measure elapsed time, this project takes advan-
tage of the Arduino Nano’s ability to keep accurate time. Microcontrollers
keep time exceptionally well, and they measure the time that elapses between
one input and another with a minimum latency. In addition to timing your
reactions, the Nano shows the result on an LCD display.
The Nano does almost all of the work in this project; the other compo-
nents are basically passive. After testing some early builds, I added features to
the sketch to make the game more interesting and accurate. For example, I
initially used a simple push button to reset the Nano and start a counter. The
participant would press the red stop button as soon as the LCD display indi-
cated so, and the Nano measured the time between pressing the reset and
stop buttons. I found, however, that the player could anticipate the reset but-
ton being pushed and come up with some amazing reaction times.
To prevent the player from anticipating when the stimulus is about to
occur, I had the Nano start the timer on a delay instead. The version in this
book generates a random delay from when the reset button is depressed,
activates the stimulus after the random delay, and counts the time from the
stimulus to the moment the participant responds by depressing the stop
button. That solved one problem.
Then, one of the participants tried to jump the gun and get an early
start by holding down the stop button. I solved this problem by setting
a minimum reaction time in the sketch. Any time under that minimum
throws an error, and the LCD displays “Jumped the Gun” to indicate that
the player pressed the button too soon.
I used a relatively large display—4 lines with 20 characters each—so
there would be enough room to display the reflex time and some commen-
tary on the relative prowess of the player. You can make your commentary as
funny or serious as you want, but it must not exceed 60 characters in length—
that is, three lines of 20 characters each. While I leave the commentary up to
you, the sketch for this project includes some ideas that I used when putting it

4   Chapter 1
Arduino Playground (Early Access), © 2016 by Warren Andrews

together. You can always edit the commentary and reload the sketch to show
comments specific to a set of users, like friends or relatives.

Expected Speed Ranges


Most individuals’ reaction times seem to vary greatly, based on the small
sample I tested. Interestingly, age doesn’t seem to be a factor. The average
reaction time was around 200 ms, and that is the average reaction time
identified by many researchers.
The fastest response of anyone I sampled was 105 ms; however, the indi-
vidual was not able to repeat that performance. Several individuals scored
between 105 and 125 ms, but not consistently. Significantly lower reaction
times may well be anomalous or the result of an individual actually antici-
pating the stimulus. My players’ failure to repeat extremely fast reaction
times would tend to bolster that idea. (I wouldn’t want to accuse anyone of
successfully pre-guessing the release moment.)

The Schematic
While the display could have been wired directly, using the I2C inter­
connect made it a lot simpler and reduced the interface to only four wires:
positive, ground, data, and clock (see Figure 1-2).

Figure 1-2: Schematic diagram of the Reaction-Time Machine

The Reaction-Time Machine   5


Arduino Playground (Early Access), © 2016 by Warren Andrews

The only components needed are the Nano, three switches (one toggle
switch for power and two momentary push-button switches for activate and
reset), an LED, the display, and three resistors. Despite the relatively sparse
parts count, the project performs elegantly.

The Breadboard
As is the case for most of my Arduino projects, the first step is to prepare a
breadboard to prove the concept and test the sketch. Here’s how to wire up
the breadboard:

1. Connect the red strips (5V) on the breadboard together.


2. Connect the blue strips (GND) on the breadboard together.
3. Insert the Arduino Nano (or clone) in the breadboard, leaving two
rows on one side and three on the other. (If the Nano does not come
with stakes soldered in, prepare the board according to “Preparing the
Nano and Pro Mini for Use” on page XX.
4. Connect the 5V terminal on the Nano to one of the red strips on the
breadboard.
5. Connect the GND terminal on the Nano to one of the blue strips on
the breadboard.
6. Connect the negative wire from the battery connector to the blue strip
(GND). Remember that the breadboard has no switch, so you must dis-
connect the battery to turn it off.
7. Connect the positive lead from the battery connector to VIN on the
Nano. (Do not connect the positive terminal of the battery to the red
strip—it could permanently damage the Nano.)
8. Attach 5-inch wires to two normally open momentary push-button
switches. (I use #22 solid conductor wire so it can plug in to the bread-
board directly.)
9. Prepare a wire harness for the LCD display (see “Preparing LCD
Displays” on page XX).
10. Connect the red wire from the LCD display to the red strip on the
breadboard (5V) and the black wire from the LCD display to the blue
strip (GND).
11. Insert the yellow wire from the display (SDA) to pin A4 on the Nano.
12. Insert the green wire from the display (SCL) to pin A5 on the Nano.
13. Connect one side of each push-button switch to the blue strip (GND).
14. Connect the other side of the red reaction switch (SW2) to pin D7 on
the Nano.
15. Connect the other side of the yellow reset switch (SW1) to pin D2 on
the Nano.

6   Chapter 1
Arduino Playground (Early Access), © 2016 by Warren Andrews

16. Connect a 10-kilohm resistor from pin D7 on the Nano to the red
strip (5V).
17. Connect a 10-kilohm resistor from pin D2 on the Nano to the red
strip (5V).
18. Connect the anode side of the LED (the longer leg) to the red strip
on the breadboard (5V) and the cathode side to an empty row on the
breadboard.
19. Connect a 470-ohm resistor from the cathode side of the LED to pin D4
on the Nano.

Upload the Reaction_19.ino sketch to the Arduino Nano (see “Uploading


a Sketch to the Arduino” on page XX), and you should now be ready to go.
Figure 1-3 shows the breadboard laid out with the switches dangling from
their wires.

Figure 1-3: The breadboard setup for the Reaction-Time Machine. Because there is no
on/off switch, you have to disconnect the battery to shut it off.

The Arduino Sketch


The sketch is the actual computer program that tells the Arduino what
to do and when to do it. It is written in a language of its own that com-
prises structures, variables, arrays, functions, and so on, which represent a
recipe for the microcontroller to follow. This language is converted into a
sequence of zeros and ones that are routed to various parts of the control-
ler and can perform storage, timing, comparison, arithmetic functions,
and more.

The Reaction-Time Machine   7


Arduino Playground (Early Access), © 2016 by Warren Andrews

The process of converting a computer language to a sequence of zeros


and ones is called compiling. The compiling routine in the Arduino Integrated
Development Environment (IDE) is activated when you click the Verify and
Compile buttons in the upper-left side of the Sketch window.
The sketch gets pretty long because of all the comments that can be
inserted when it checks the score; however, the basic operation uses only a
handful of code lines. You can use the scoring function as is, modify it, or
copy and paste it to make a new scoring function. As you’ll see in my com-
ment options, I’ve had fun with it.
The following code has been truncated to minimize the number of lines.
However, you can simply go to https://www.nostarch.com/arduinoplayground/ to
download the entire sketch, which includes a number of comments.

/*
Includes score function, random number generation, false start
"jump the gun" indicator, and multiple comments spaced 10 ms apart

Mod for "jump the gun" gives response if time <70 ms


*/

#include <Wire.h> //Libraries included


#include <LiquidCrystal_I2C.h>

int start_time = 0;
int stop_time = 0;
int reacttime = 0;
int x;
int R;
int randnumber1;
int z;

LiquidCrystal_I2C lcd (0x3F, 20, 4); //Initiate LCD

void setup() {
Serial.begin (9600);
pinMode(2, INPUT);
pinMode(4, OUTPUT);
pinMode(7, INPUT);
lcd.init();
lcd.backlight();
}
//Begin function "score"
void score() {
lcd.clear();
lcd.print("Reaction Time ");
lcd.print(reacttime);
lcd.print(" ms");
lcd.setCursor (0, 1);

if((reacttime >= 105) && (reacttime < 135)) {


lcd.print("Approaching Superman");
lcd.setCursor(0, 2);
lcd.print("but you can still do");

8   Chapter 1
Arduino Playground (Early Access), © 2016 by Warren Andrews

lcd.setCursor(0, 3);
lcd.print("a lot better");
}

if((reacttime >= 135) && (reacttime < 180)) {


lcd.print("Superhero Status");
lcd.setCursor(0, 2);
lcd.print("but not yet");
lcd.setCursor(0, 3);
lcd.print("Superman");
}

if((reacttime >= 180) && (reacttime < 225)) {


lcd.print("You are trying ??");
lcd.setCursor(0, 2);
lcd.print("but not hard enough");
lcd.setCursor(0, 3);
lcd.print("still a loser");
}

if(reacttime > 225) {


lcd.print("Lost your touch");
lcd.setCursor(0, 2);
lcd.print("If you ever had it");
lcd.setCursor(0, 3);
lcd.print("on the border of wimpy");
}
}

//Begin main program


void loop() {
digitalWrite(4, HIGH);
lcd.clear();
lcd.print("System is Armed");
delay(1000);
lcd.setCursor(0, 1);
lcd.print(" READY ");
lcd.setCursor(0, 2);
lcd.print(" Push Red Button");
lcd.setCursor(0, 3);
lcd.print("When Red lamp lights");

randnumber1 = random(5, 25); //Generate random number between 5 and 25


R = randnumber1;
for(x = 0; x < R; x++);
delay(5000);
if(x == R) {

digitalWrite(4, LOW); //Turn on start lamp


start_time = millis(); //Initiate timer
lcd.clear();
lcd.print("Mash React Button");
lcd.setCursor(0, 1);
lcd.print(" ");
lcd.setCursor(0, 2);

The Reaction-Time Machine   9


Arduino Playground (Early Access), © 2016 by Warren Andrews

lcd.print(" ");
lcd.setCursor(0, 3);
lcd.print(" ");

while(digitalRead(7) == 1); //Wait for response

stop_time = millis(); //Complete timing cycle


}

reacttime = stop_time - start_time;

if(reacttime < 70) { //Jump the gun indicator


lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Too anxious. You");
lcd.setCursor(0, 1);
lcd.print("(Jumped the Gun)");
lcd.setCursor(0, 3);
lcd.print("Could be Fatal!");
}
score();
Halt:
while(digitalRead(2) == 1);
}

2
The #include lines initiate the libraries: the I C library, Wire.h, establishes
2
the rules for I C communications, and the LiquidCrystal library allows the
Arduino to control LCDs. Then, we define the seven variables used to calcu-
late reaction time. Next, setup () sets up the serial communication—in case
you want to adjust the code and view it on the serial monitor—and defines
various pins as inputs and outputs. Inputs are required for the reset and
stop buttons, and an output pin is defined for the LED that tells the player
when to press the stop button.

Customized Reaction Commentary


One of the most entertaining aspects of this project is the chance to get
creative when displaying the player’s reaction time. After setup(), the sketch
shows a function called score(), which lists different comments that could
be displayed on the LCD based on the participant’s response speed. A func-
tion may not necessarily be the most efficient approach (a look-up table or
other approach could also have been used), but it works well enough. I used
only a single scoring function in this iteration; however, you could easily
define as many as you like and change your sketch to select one. For example,
you might write a second function called score1() that could include a dif-
ferent set of comments and timing. Then, to switch from one function
to the other, you’d have to change only the line that calls score() to call
score1() instead.

10   Chapter 1
Arduino Playground (Early Access), © 2016 by Warren Andrews

To customize the sketch to include comments that could refer to your


own friends or family members, you can simply enter your comments in
place of the ones that are in my sketch. Don’t forget to keep the text you
want to print to the LCD in quotes so the Arduino recognizes the printable
characters.
A word on the reaction time itself: each comment is for a range of reac-
tion times of either 5 or 10 ms. I selected these ranges arbitrarily. After
you play with the Reaction-Time Machine for a bit, you may wish to change
these ranges based on the fact that users’ responses may cluster around
a particular area, such as from 195 to 225 ms. I found that many reaction
times were in the 190 to 250 ms range, but your friends and family may be
different. In that case, you can separate the comments by as little as 1 or
2 ms so players don’t keep getting the same comment.
You can add as many comments as you wish, up to one comment per
milli­second. If you accidentally overlap the times, the sketch may not compile.

NOTE You can find reaction-time measurement tools on the Web if you want to see how
your game’s measurements compare. However, their accuracy is suspect because of
the latency in the PC itself.

On W riting Code to Se t Up LCDs

There are a few points to note about the setup of the LCD display. The sketch
uses a LiquidCrystal library, LiquidCrystal_I2C.h. If this library is not included
in your Arduino IDE, you can easily download it using the instructions pro-
vided in the reference section on the Arduino website (http://www.arduino​
.cc/reference/).
2 2
In addition, each I C device comes with its own I C address. This allows
2
several I C devices to be used on a single serial line. Usually the device docu-
2
mentation provides the address—in the case of the I C LCD I used, the address
was 0x3F. Thus, when the sketch initiates the LCD, the code looks like this:

LiquidCrystal_I2C lcd (0x3F, 20, 4);

However, different displays come with different addresses. If you have an


2
I C device that you do not have an address for, you can easily find the address
by hooking up the device to an Arduino, downloading a scanner sketch from
http://playground.arduino.cc/Main/i2cScanner/, and running the sketch. The
2
scanner sketch should display the I C address on the serial monitor.
Many projects in this book use similar code to work with an LCD, so refer
to this box any time you need a refresher on how that code works.

The Reaction-Time Machine   11


Arduino Playground (Early Access), © 2016 by Warren Andrews

What Happens in the Loop


Now let’s look at the sketch’s loop. After void loop () initiates the start of
the program, the program calls digitalWrite (4, HIGH) to turn off the active
light. Then, the LCD screen is cleared, and text is written to the LCD to
indicate that the system is armed and ready for a player to push the reaction
button as soon as the red LED illuminates, as shown in Figure 1-3.
Next, a random number between 5 and 25 is generated, and the pro-
gram calls delay(5000) to count every five seconds from zero to the random
number. As soon as the random number is reached, three things happen:
first, the annunciator lamp illuminates; second, an internal timer is started
in the Nano; and third, the display then changes to read “Mash the React
Button.”

NOTE A wider range of random numbers might make this game even more interesting for
players. You can easily experiment by changing the random number count, the delay,
or both.

The Nano is then instructed by while (digitalRead (7) == 1); to wait


until the reaction button is depressed. After the button is depressed, the
Nano calculates the reaction time with reacttime = stop_time - start_time.
This time will be displayed on the LCD and used to select the appropriate
comment in the score() function. Also, if the player’s reaction time is less
than 70 ms at this point, then the conditional statement looking for a par-
ticipant to be “ jumping the gun” displays appropriate wording for the LCD.
The system is then halted and ready to be reset.
Otherwise, the serial print block is included in case you want to
adjust the code and view it on a serial monitor. It also helps for debugging
purposes.
Finally, the score() function is invoked, followed by the Halt command,
and the system is ready to have the reset button depressed.

Construction
Building the Reaction-Time Machine can be as simple or as complex as
you want. Initially, I placed all the components in the vinyl package that
a flexible wrist brace came in. I cut a hole for the display connectors with
an X-ACTO knife and punched the holes for the switches and LED with a
paper punch, followed by a tapered reamer. The result was somewhat crude,
as shown in Figure 1-4.

12   Chapter 1
Arduino Playground (Early Access), © 2016 by Warren Andrews

Figure 1-4: This was the Reaction-Time Machine’s original, primitive package, which
worked but turned out to be too flimsy. The vinyl was only 0.018 inches thick.

Preparing a Sturdy Case


Of course, a real case makes the game much sturdier, which is important
when you have competitive players mashing those buttons. To keep things
as simple as possible, I employed one of the clear ABS plastic cases from
Hammond (1591 STCL). The clear top of the case allowed me to place the
display behind the cover rather than machining out a hole for the display to
protrude through. To mount the components, I simply drilled holes in the
cover according to the drawing in Figure 1-5.
1/4" 3/8" 1/4"

0.75"

0.75"
1/4" 1/4"

Figure 1-5: Drilling template for the Reaction-Time Machine

The Reaction-Time Machine   13


Arduino Playground (Early Access), © 2016 by Warren Andrews

Quarter-inch holes work well for the momentary push-button switches,


as well as for the toggle switch and 3.5 mm jack. For the 10 mm LED, I used
a 3/8-inch drill and then reamed the hole out to make a tight fit. No other
mounting hardware for the LED was necessary.

NOTE The 3.5 mm jack is wired in parallel to the execute switch. If you want to use an
external stand-alone switch, it can simply plug in to the jack. I abandoned the effort,
however, as most participants preferred to hold the box in their hands.

Mounting the Hardware


To mount the display to the case, I used two-sided 3M Indoor/Outdoor
Super Heavy Duty mounting tape. I cut two sections the size of the LCD
display’s end bezel sections and bonded the display directly to the cover.
The tape is difficult to remove, so make sure to place it right the first time.
I used the same tape to mount the Nano and the battery holder to the
back of the display. When mounting the display, I also used wire cutters
to carefully cut off the corners of the display circuit board so it would fit
far enough into the case without hitting the cover mounting pylons. See
Figure 1-6 for the finished product, viewed from the underside.

3.5 mm jack Toggle Push buttons LED I2C adapter

Battery Display Arduino Nano

Figure 1-6: This is the rear of the unit mounted in the ABS plastic enclosure. Notice that
the corners of the display (lower left and right) have been clipped off to fit around the
top mounting pylons. The 3.5 mm jack is not wired, as I decided not to use it in this
implementation.

14   Chapter 1
Arduino Playground (Early Access), © 2016 by Warren Andrews

Once all the components are in place, all that remains is to solder the
components together, inserting the resistors where required. Take par-
ticular note of the I2C adapter, which is the black paddleboard just below
the switches and LED. While I could have bent the connectors and used a
header to wire that up, the case may not have closed, depending on how
carefully I crimped the connectors. Instead, I elected to solder the wires
directly. It was only four wires, and it worked without much trouble. Finally,
I printed out and attached labels from a Brother label maker. Figure 1-7
shows the completed unit.

Figure 1-7: The completed Reaction-Time Machine mounted in the Hammond 1591 STCL
clear plastic enclosure

Ideas for Customization


There are many variations you could implement to increase the versatility
and enjoyment of the Reaction-Time Machine. For example, as I developed
it, I connected a Hall effect switch to one of the analog inputs and modi-
fied the sketch to automatically decrease the reaction time by a percentage
when the Hall effect switch is activated. Then, I taped a small magnet to my
finger that sat opposite the Hall effect switch so as I grabbed the box, it acti-
vated the switch. When I played, my reaction time was reduced by around
20 percent, while others had an actual reading. Far be it from me to suggest
that readers try to hoodwink their adversaries, of course!

The Reaction-Time Machine   15


Arduino Playground (Early Access), © 2016 by Warren Andrews

There are other modifications that can be made, such as incorporating


a tone sound, or beep, as the sketch counts up to the random number. This
can easily be accomplished with the addition of an annunciator and a few
lines of code. If you’re ingenious, there are other sound effects you could
add, such as a vulgar sound that plays when poor scores are achieved.
You can also exercise your brain and add code to the sketch that will
average scores after, for example, three tries before you reset it. I experi-
mented with many variations as I played with the device, but I would cau-
tion that you can spend a great deal of time for minimal advantage. Put the
game together and enjoy.

16   Chapter 1
Arduino Playground (Early Access), © 2016 by Warren Andrews

2
A n Au t o m a t e d A g i t a t o r
f o r  P C B E t c h i n g

This project uses the Arduino micro­


controller to sense change in a motor’s
current drain and then reverse the direc-
tion of the motor. There are numerous applica-
tions for the measurement and use of current drain,
and this project provides an example method that
can prove useful in the development of future elec-
tronics projects.
“Designing and Building Your Own Circuit Boards” on page XX illus-
trates different ways to design and make circuit boards at home for a very
modest cost using readily available and environmentally safe household
products. Part of this process includes etching the copper off a clad board.
The process is more efficient when the board is agitated in the etching solu-
tion, resulting in a laminar flow of liquid across the surface of the board
in both directions. Depending on the chemical activity of the etchant and
thickness of copper to be etched, this process can take anywhere from
Arduino Playground (Early Access), © 2016 by Warren Andrews

10 or 15 minutes to well over half an hour! Standing there stirring the pot is
pretty boring, but you can create a device that dunks the board in and out
of the solution for you (see Figure 2-1).
Hub to hold crank
Set screw
Screw holding crank Motor
Motor
Limit

Limit Limit
Crank Crank

Rotation

Line Line

Etching vessel Etching vessel

Circuit board Circuit board

Etchant Etchant

Figure 2-1: Illustration of the motor, crank, and etching vessels set up to dip a circuit board
in and out of the etchant. While there are many ways to agitate a circuit board, dipping it
into and out of the etching solution works well, especially for small boards.

In this project, the Arduino microcontroller, under the control of


a sketch, waits to get real-world information from a system. The micro­
controller then processes that information and uses it to make something
happen.

Inspir at ion Be hind the


Au tom at ic Motor Re v e rs a l Projec t
This project has its roots in a problem my friend had with a model train set
accessory. The accessory included a tramway to take make-believe skiers up
and down a miniature mountain. The original mechanism failed, so I created
a little circuit to drive a DC motor that moved the skiers up and down. My
idea was that when the tramcar reached either the top or bottom of its run, the
motor would slow down or stall, resulting in an increase in current drain. That
excessive current drain would reverse the motor by changing the polarity and
thereby send the car back the other way. To date, the skiers are still at the bot-
tom of the mountain because my friend and I never installed the board, but the
core circuit works well and promises other interesting applications.

18   Chapter 2
Arduino Playground (Early Access), © 2016 by Warren Andrews

The ability to receive an input, process the information, and produce


an output is the fundamental function of any microcontroller. In this case,
the Arduino starts the motor turning, waits until it detects the motor draw-
ing more current than usual, and then reverses the motor’s rotational direc-
tion. This simple function has a number of different applications: you could
use the voltage drop to provide a safety turn-off for an overloaded motor,
create a system to limit motion, and more.

Special Tools
There are only a couple of special tools you will need. One is a 6-32 tap you
can buy at Ace Hardware for a little over $1. But if you want a complete tap
and die set for future projects—which is probably a good idea, as they’re
also just handy to have around the house—you can pick up a set at Harbor
Freight (http://www.harborfreight.com/) for under $10 (item #69679). Other
vendors offer similar items.
A handful of drill bits are also required. You can purchase drill bits
individually, or you might think about getting an entire set. Once again,
our friends at Harbor Freight have drill sets starting at under $4. It’s always
useful to have some drill bits around, so if you can afford it, a numbered
drill set— #1 through #60—would be a good investment.
Of course, a drill is also useful—and necessary. See “Tools” on page XX.

Parts List
• One Arduino Nano (Available from Newegg, Mouser Electronics,
and other retailers. You could also purchase a clone on eBay for just
under $6.)
• One SN754410 quad H-bridge IC, with socket if desired (Available from
eBay, Newark Electronics, Mouser Electronics, Digi-Key Electronics,
and other suppliers. Note that if you use the socket, you lose whatever
value the PCB offers as a heat sink.)
• One printed circuit board (PCB) or perf board
• One current-limiting resistor (You should have a selection available
for experimentation, from 1 ohm to 10 ohm. You can buy resistors
from many suppliers, including Jameco, MCM, Mouser, Digi-Key, and
Newark, for under $0.05. A 1/8 W resistor will work for smaller motors,
but get a 1/4 or 1/2 W resistor for larger loads.)
• Two 330-ohm, 1/8 W resistors (Available through previously listed
suppliers)
• Two LEDs, one red, one green (Available on eBay and elsewhere for
under $0.10 each. Consider buying an assortment, as we’ll use them in
upcoming projects.)

An Automated Agitator for PCB Etching   19


Arduino Playground (Early Access), © 2016 by Warren Andrews

• One LM7805 voltage regulator (Many suppliers—including eBay,


Amazon, Jameco, MCM, Mouser, Digi-Key, Newark, and others—will
have this part.)
• One plastic box (I recommend the Hammond 1591 XXATBU available
from Newark Electronics, Mouser Electronics, and Digi-Key.)
• Two 2-pin female headers to connect the motor to the shield (Pololu
Robotics & Electronics item #1012)
• Four 4-pin female headers to plug the Nano into (Pololu Robotics &
Electronics item #1014)
• One small solder lug
• One 3.5 mm, 2-conductor jack and plug for power supply (Any supplier
listed previously should carry this.)
• One SPST toggle switch (Any supplier listed previously should carry
this.)
• One plug-in wall adapter with an output of 5 to 12V at 200 mA or bet-
ter (Try eBay, Jameco, MCM, or Electronic Goldmine. Refer to “The
Voltage Regulator” on page XX for some important considerations
before buying an adapter.)
• One gear head motor (I used a 6V motor from Amazon, the Amico
20 RPM 6VDC, and I’ve seen similar motors on eBay for about $6 and
change. Later projects use the same motor, so you might buy a few. You
can find motors as low as 8 RPM and on in the same price range. There
are many places to buy motors with 10 to 50 RPM and 5 to 15V on the
Web, including surplus houses like Electronic Goldmine.)

Downloads
Before you start this project, check the following resource files for this book
at https://www.nostarch.com/arduinoplayground/:

• Sketch: Reverse_IV_3.ino
• Shield (PCB): Reverse.pcb
• Template: Motormount.pdf

How Automatic Motor Reversal Works


The Arduino is perfect for this project because it can control the whole
system, and it simplifies the problem of accommodating different motors
with different current requirements. Implementing the project in discrete
components would require several more components than the equivalent
Arduino circuit. Further, changing values for different motors or differ-
ent reversal thresholds would mean changing a lot of hardware, but with
Arduino, you just have to make a simple program change. The Arduino also
provides the flexibility to add delays at each end of the run if desired.

20   Chapter 2
Arduino Playground (Early Access), © 2016 by Warren Andrews

The motor circuit you’ll connect to the Arduino uses a resistor between
the power supply and the motor (see Figure 2-2). When the motor slows or
stalls, the current increases, creating a voltage drop across the resistor.

Voltage drop
R
measured here

Motor

Figure 2-2: A voltage is created across the resistor


between the positive supply and the input to the
motor. It is this voltage that triggers the operation
of the circuit.

The voltage drop across resistor R is the real-world input to the micro-
controller. In this project, that voltage drop is fed to the Arduino Nano’s two
analog input pins that straddle the dropping resistor. The micro­controller
digests this input and creates an output designated by your program.

NOTE You could implement the circuit with only a single analog input, but that would
curtail some of the flexibility of the circuit—particularly if you use motors that run
at different voltages.

The Schematic
The agitator circuit feeds the voltage that appears across resistor R1 into
two of the Arduino’s analog input pins, A0 and A1, setting up the real-world
input (see Figure 2-3).
All grounds in this circuit are connected together, and the voltage
across pins A0 and A1 is the voltage your program will use to decide
when to reverse the motor’s direction. Note that this voltage is not refer-
enced to either the positive or negative rail, but it must be between 0 and
5V to prevent damage to the microcontroller. If you get stuck on wiring the
H-Bridge, see “Using an H-Bridge” on page 25.

An Automated Agitator for PCB Etching   21


Arduino Playground (Early Access), © 2016 by Warren Andrews

Figure 2-3: The completed schematic for this project shows the 5.6-ohm voltage-drop resistor (R1), the two
LEDs (D), the 330-ohm current-limiting resistors (R2 and R3), and the quad H-bridge (SN754410), of which
half is used.

The analog-to-digital converter (ADC) behind each analog pin pro-


vides 10 bits of resolution, which means the converter can deliver up to
1,024—that is, 210—different values, from 0 to 1,023, depending on the
input.
Thus, if the power supply is 5V, each increment is roughly
5 V ÷ 1, 023 ≈ 0.0048 V .

Determining the Reversal Threshold


In order to write a program that tells the Arduino when to reverse your
motor, you have to determine that point yourself, with some math and a
little bit of faith.
First, determine the current drain of the motor you’re using. It’s usually
printed on the motor’s label. The motor I used has a current drain of about
40 milliamps (mA), or 40 thousandths of an ampere (see Figure 2-4). Now
we get into the heavy math. You’re going to have to use a formula known as
Ohm’s law to determine the voltage threshold to set in the sketch.

22   Chapter 2
Arduino Playground (Early Access), © 2016 by Warren Andrews

Figure 2-4: I used an Asian import motor, shown here with


one limit pin installed, that has demonstrated reliability and
performance. The screws are M3 – 0.05.

I used a 5.6-ohm resistor in series with my motor circuit. Using Ohm’s


law, which states that voltage equals current times resistance (V = IR, with
voltage in volts, current in amperes, and resistance in ohms), we’re able to
calculate that 40 mA times the resistance of 5.6 ohm is about 0.224V:

40 A
× 5.6Ω = 0.224 V
1000

Now, go back to the ADC. It has 1,024 units to represent 5V, so each
unit represents 0.0049V. A little arithmetic reveals that the 0.224V dropped
represents about 46 units out of the 1,024:

0.224 V
= 45.85 units
0.0049 V per unit

There are some estimates you have to take on faith—at least until you
confirm with a test. This is one. As a motor is slowed or stalled, the current
drain increases. Depending on the motor, the increase in current is typi-
cally somewhere between two and four times the normal current drain, but
possibly more.

NOTE With no load (or minimal load), current drain on the motor is minimal. With a
usual running load, current can be four to five times the no-load current. With a
heavy load, current can be as much as 10 times that, depending on the motor design.

So according to our good-faith model, a good place to start setting the


threshold for reversing the motor would be in the area of 90 to 100 units of
the ADC’s 1,024 units.
Alternatively, you could use a digital multimeter to measure the exact
current drain first (see Figure 2-5). To use a multimeter to measure current
drain, set its indicator to 200 mA to start; you may need to set it as high as
10A if the motor doesn’t move when you build the circuit described here.

An Automated Agitator for PCB Etching   23


Arduino Playground (Early Access), © 2016 by Warren Andrews

Figure 2-5: Multimeters are handy for


many projects and useful to have around
the house. They’re available from a variety
of sources at a range of prices. I use this
cheap one from Electronic Goldmine, but
if you plan to do high-voltage experiments,
invest in a really good multimeter.

Build the circuit as shown in Figure 2-6, and then connect the red
lead of the multimeter to the power supply. Connect the black lead of the
multimeter to the motor lead to complete the circuit. If the reading is nega-
tive, reverse the red and black leads of the multimeter. Depending on your
power supply voltage and the motor’s voltage requirement, you may also
need to connect the motor to power through a voltage regulator circuit, as
described in “The Voltage Regulator” on page 34.

Black lead Digital multimeter Red lead


Motor
200 mA scale

Power supply/battery
Negative terminal Positive terminal

Figure 2-6: Connection diagram for measuring the current drain of the motor

To check the current drain, hold the shaft of the motor to slow it, and
watch the readout on the multimeter. You can get an accurate indication of
the number of ADC steps by plugging your readout in to Ohm’s law, calcu-
lating the voltage, and converting into steps, as I did.

24   Chapter 2
Arduino Playground (Early Access), © 2016 by Warren Andrews

NOTE In the sketch, I use a value of 100 as the threshold for reversing. You could also calcu-
late the absolute value of the voltage drop by multiplying 100 by 0.0049V:
100 steps 0.0049V per step = 0.49V

Remember, the exact threshold depends on the type of motor you


use. Different motors will have different current capabilities and may even
require a different value resistor. The description and model of the motor
I used is included in the “Parts List” on page 19. Also, note that the value
of current drain is not precise. The nature of permanent magnet motors is
such that the current drain under load will be a range, not an exact number.
As the current increases, the voltage drop increases until it reaches the
point where the microcontroller is instructed to do something. At that point,
the difference in analog voltage that appears between A0 and A1 is above the
preset threshold, which will set the Arduino into action. Once the threshold
is reached, the Arduino tells the H-bridge to reverse the current to the motor.

Using an H-Bridge
You’ll likely encounter an H-bridge driver in future projects because it’s a
very versatile part and can serve numerous functions. There is quite a selec-
tion of H-bridge chips available, but I’ve been using the Texas Instruments
SN754410 quad H-bridge. It’s popular because it operates over a wide volt-
age range and is extremely flexible—and inexpensive. The logic operates at
a 5V level, while the drive can be as much as 36V with a continuous output of
1A (and a peak output of 2A), making it capable of driving a wide variety of
hobby motors, solenoids, and even relays. It comes in a standard 16-pin dual
inline package (DIP). The DIP package was a longtime standard but is slowly
being replaced by newer types (see “Dealing with Small ICs” on page XX).
It’s the conventional centipede-looking circuit.
Figure 2-7 shows the pinout for the SN754410 H-bridge, and Table 2-1
shows its function table. You’ll find more information in Texas Instruments’
data sheet at http://www.ti.com/lit/ds/slrs007b/slrs007b.pdf.

1,2EN 1 16 VCC1
1A 2 15 4A

1Y 3 14 4Y

Heat sink 4 13 Heat sink


and ground 5 12 and ground

2Y 6 11 3Y

2A 7 10 3A

VCC2 8 9 3,4EN

Figure 2-7: The pinout for the SN754410 quad H-bridge chip
used in this project. Note that pin 1 is in the top-left corner of
the chip when viewed from the top with the notch pointing up.

An Automated Agitator for PCB Etching   25


Arduino Playground (Early Access), © 2016 by Warren Andrews

Table 2-1: Function Table for the SN754410

Inputs Output (Y)


A EN
H H H
L H L
X L Z

According to the data sheet, in this function table, H stands for high
level, L stands for low level, X means the level is irrelevant to the circuit
behavior, and Z indicates high impedance, which turns the motor off.
The H-bridge is an elegant motor-control solution for several reasons.
It allows you to reverse the polarity from a single supply, and it provides for
different logic and control voltages. In addition, if both inputs of the dual
H-bridge are either high or low, there will be no output. The sketch takes
advantage of that in a function written to stop the motor. Other projects in
this volume also use this capability.

The Breadboard
For most Arduino projects, I suggest building the circuit on a breadboard
first to make sure you’re going in the right direction and to prove your ini-
tial hypothesis. Use a standard breadboard and the plug-in wires that are
sold as accessories for the breadboard (see Figure 2-8).

Figure 2-8: Typical small breadboard and plug-in wires

26   Chapter 2
Arduino Playground (Early Access), © 2016 by Warren Andrews

Before you begin building the circuit on the breadboard, look over
your Arduino. Many Arduino boards come complete with the male headers
already soldered in place. However, that’s not always the case; some Asian
suppliers include the headers loose with the processor board. If your board
lacks headers, see “Preparing Arduino and LCD Boards” on page XX for
complete instructions on attaching them.
Most breadboards include a red and blue strip on the entire length of
each side of the board; the holes next to these strips are used for power (+)
and ground (-), respectively. Before you hook up the circuit, use a wire to
connect the red column on the right to the red column on the left. Connect
the blue columns to each other, too.

Warning Do not connect the red column to the blue column! This will cause a short circuit and
will burn out the electronics.

Figure 2-9 shows my breadboard for this project, and the schematic
from Figure 2-3 lays out the connections.

Figure 2-9: This is the breadboard I used as a proof-of-concept to make sure every-
thing worked as anticipated.

Warning Don’t plug the Arduino in to the computer while it is actually receiving power from
the voltage regulator. This could burn out the Arduino.

I suggest prototyping your circuit as follows:

1. Insert the Nano board into the breadboard, leaving a couple of rows of
holes at one end.
2. Place a wire from the pin labeled 5V on the Nano (pin 27) to the posi-
tive (red) strip on the breadboard.

An Automated Agitator for PCB Etching   27


Arduino Playground (Early Access), © 2016 by Warren Andrews

3. Place a wire from GND on the Nano (pin 29) to the negative (blue)
strip on the breadboard.
4. Find three consecutive holes on the board where they will not connect
to anything and insert the three leads of the LM7805 into them.
5. The input lead of the LM7805 will go to the 9V power supply, the
ground of the LM7805 will go to the blue negative rail, and the output
of the chip will go to the red stripe. (See Figure 2-11 for the LM7805
pinout.)
6. Insert the H-bridge into the breadboard with the notch facing the
Nano, and leave a couple of rows between the H-bridge and the Nano.
7. Use a wire to connect pin 1 and pin 16 of the H-bridge together (see
Figure 2-7). Then, use another wire to connect pin 1 to the positive
connection on the breadboard. This connection from pins 1 and 16
provides the voltage to run the logic on the H-bridge and also to enable
the section of the H-bridge used.
8. Use a wire to connect pins 4 and 5 of the H-bridge, and then connect
them to the negative terminal on the breadboard. Running a wire from
either pin 4 or pin 5 to ground will do the trick.
9. Similarly, connect pins 12 and 13 of the H-bridge together, and connect
them to ground.
10. Use a wire to connect one side of the motor (it doesn’t matter which) to
pin 3 of the H-bridge, and connect pin 6 of the H-bridge to the other
side of the motor.
11. Connect digital pin D12 of the Nano to pin 2 of the H-bridge.
12. Connect digital pin D13 of the Nano to pin 7 of the H-bridge.
13. Connect one side of the 5.6-ohm resistor (R1) to pin 8 of the H-bridge.
14. Connect the other side of resistor R1 to the breadboard’s positive strip.
15. Insert a wire from pin 8 of the H-bridge to analog pin A0 of the Nano.
16. Insert a wire from the positive (red) connector to analog pin A1 of
the Nano.
17. Insert the positive side (long lead) of one LED to D12 of the Nano.
18. Insert the negative side of the LED into an empty row on the
breadboard.
19. From that row with the negative side of the LED, connect a 300-ohm
resistor (R2) to ground (blue strip).
20. Insert the positive side (long lead) of the second LED to D13 of
the Nano.
21. Insert the negative side of the second LED into an empty row on the
breadboard.
22. From that row with the negative side of the second LED, connect a 330-
ohm resistor (R3) to ground.

28   Chapter 2
Arduino Playground (Early Access), © 2016 by Warren Andrews

The VCC2 supply drives the output to the motor. It goes from the posi-
tive side of the supply—the output pin of the regulator in the schematic—
through resistor R1 to pin 8 of the H-bridge. VCC2 becomes the low-voltage
side of resistor R1; it will have a lower voltage as the load on the motor
increases because the other end of the resistor is attached to the positive of
the power supply. The VCC2 supply voltage can be anywhere from the 5V
that the logic uses to the 36V limit of the H-bridge. For this project, I simply
tied the voltage-drop resistor directly to the 5V supply, which worked well
with a 6V motor.
The Nano’s D12 and D13 output pins drive the A inputs of the
H-bridge, while A0 and A1 inputs straddle the voltage-drop resistor, R1.
It’s this voltage-drop value that tells the Arduino to change the outputs
to instruct the H-bridge to reverse the motor. When output D13 is high
and D12 is low, output pin 2Y on the H-bridge becomes positive while 1Y
remains negative. When D12 is high and D13 is low, the reverse happens,
and 1Y becomes positive while 2Y stays negative. When both pins have high
or low output, they are at the same potential (or voltage), and the motor is
not driven. (Refer to the function table in the H-bridge chip’s data sheet, or
see Table 2-1.)

The Sketch
The following sketch is written so that when the motor reaches its limits
in one direction, both outputs go low, and when it reaches its limits in the
other direction, both outputs go high. When both outputs are either high
or low, there is no potential across the motor and it is stopped for a speci-
fied delay time. After the delay is satisfied, the motor starts in the other
direction. Because LEDs are wired to pins D12 and D13, you’ll also get a
visual indication. Both LEDs are illuminated when the motor pauses in
one direction, and both LEDs are off whe the motor pauses in the other
direction.

/* Sketch for the Automatic Motor Reversal Project


*/

//Identify pins that will not change


const int ledPin1 = 12; //LED1 in schematic
const int ledPin2 = 13; //LED2 in schematic
const int analog0 = A0;
const int analog1 = A1;
int analogValue0 = 0; //Identify variables for analog inputs
int analogValue1 = 0;
int analogdifference = 0;
int threshold = 100; //The threshold value calculated to stop the motor

int reading;
int state;
int previous = LOW;

An Automated Agitator for PCB Etching   29


Arduino Playground (Early Access), © 2016 by Warren Andrews

int count = 0;
int numberstops = 250;
int time = 0; //The last time the motor reversed

//Amount of time to wait to get rid of the jitters when the motor reverses
int debounce = 400;

u void setup() { //This is the setup routine


//Initializes pins as input or output
pinMode(analog0, INPUT);
pinMode(analog1, INPUT);
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);

Serial.begin(9600); //Was used in setting up the parameters


}

v void loop() { //This begins the processing section


//Enter an endless do-nothing loop after the counter reaches the limit
while(count > numberstops) {
digitalWrite(ledPin1, LOW);
digitalWrite(ledPin2, LOW);
}

analogValue0 = (analogRead(analog0)); //Read the analog values


analogValue1 = (analogRead(analog1));

 //Setting up the analog difference


analogdifference = analogValue1 - analogValue0; //This is the voltage drop
//analogValue1 will be greater than analogValue0

//These were added to view what was happening on the serial monitor
Serial.print("count = ");
Serial.println(count);
Serial.print("analogdifference = ");
Serial.println(analogdifference);
Serial.println();
Serial.print("numberstops = ");
Serial.println(numberstops);

//This comparator looks at the difference or drop across the resistor


 if(analogdifference > threshold) {
reading = HIGH;
}
else {
reading = LOW;
}

//Toggles the output and includes the debounce


y if(reading == HIGH && previous == LOW && millis() - time > debounce) {
if(state == HIGH) {
state = LOW;
}
else {
state = HIGH;

30   Chapter 2
Arduino Playground (Early Access), © 2016 by Warren Andrews

}
//Increments the counter each time the motor reverses
z count++;
time = millis();
}

//Writes the state to the output pins that drive the H-Bridge
digitalWrite(ledPin1, state);
digitalWrite(ledPin2, !state);

previous = reading;

This sketch sets up human-understandable aliases for the pins the proj-
ect uses and adds convenient constants and variables for referencing analog
inputs and other key values. After the sketch defines and initializes the input
and output pins at , it starts the main loop at .
Inside the main loop, the sketch finds the voltage drop across the resis-
tor in terms of analog steps . At , the sketch determines whether the
reading was high or low. Threshold values from 100 to 120 work reliably for
the 6V, 20 RPM motor I used, but you may need to experiment to find the
right value for your motor. See “Determining the Reversal Threshold” on
page 22 for more on how to estimate the threshold value. The reading
at  dictates whether to reverse the motor.

The Dropping Re sis tor is Ke y to Se nsing Curre nt

I’ve tried this reversing circuit with several similar motors, and I’ve only ever
needed to make a slight adjustment to the threshold value in the sketch. But
for a motor with extremely high or low current drain, you may need to antici-
pate a much different value for analogdifference and/or use a different drop-
ping resistor, which was R1 in the schematic. You might need to reduce the
value of the dropping resistor to something like 2.2 ohm, which then requires
a reduction in the value you compare analogdifference to.
For most small motors, the lower the value of the dropping resistor—which
is usually between 1 and 10 ohm—the better, as the analog difference tends
to be more stable. For other motors, experiment to find the resistor value that
works best.

When the sketch checks reading to see whether the motor needs revers-
ing, it also uses the debounce value to assure that a high reading wasn’t caused
by electrical noise created by the motor’s commutator or brushes during a
legitimate reversal. I set debounce to 400, but you may have to adjust that for
different motors. For larger motors specifically, this may need to be set a
little higher.

An Automated Agitator for PCB Etching   31


Arduino Playground (Early Access), © 2016 by Warren Andrews

This sketch also includes a few functions that aren’t strictly necessary to
reversing the motor but are helpful when using the motor as a PCB agitator.
These aspects of the project may appeal to you in other applications, too, so
let’s look at them in more detail.
One of the things that I added was a counter to track the number of
times that the motor reversed. In the sketch, the count increment appears
at z as count++. In the project, when a certain value of count is reached,
the motor stops (if count = numberstops). If you wanted to set off an alarm,
such as an audible noisemaker, to tell you it’s finished, that can easily be
accomplished by adding a line to write to one of the digital outputs. I set
a maximum count value in the sketch, using numberstops = 250, so the motor
will reverse 250 times and then stop. That provides a little more than 15
minutes of etching time with the motor I’ve selected running at 5V, which
should be enough to etch most circuit boards.
The stop function is just a do-nothing loop: when the maximum count
is reached, the sketch enters the while loop at the beginning, stopping the
agitation. This basically stalls the processor, and you have to hit the power
switch to restart, or reset, the agitator. The placement of this loop near the
beginning of the software is just a reminder that it’s there.

Mod: Adjus ta ble S top A mount

If setting a fixed stop maximum in a sketch doesn’t leave you satisfied, try
connecting a potentiometer between power and ground with the adjust pin,
which is usually the center pin on the potentiometer, to the A2 input pin of the
Arduino. Then, set numberstops equal to the value of A2, which should range
from 0 to 1,023, depending on the position of the potentiometer wiper.
Here’s how the sketch would differ. First, change

numberstops=250

to

numberstops = setNumber;

Then, add the following:

int setNumber;
int analogPin2 = A2;
int analogValue2;
setNumber = analogRead (analogPin2);

Because the timing is relative, you could use a 270-degree rotation linear
potentiometer and make some rough markings on the enclosure to indicate the
number of counts.

32   Chapter 2
Arduino Playground (Early Access), © 2016 by Warren Andrews

The thinking behind the count, optional alarm, and stop capabilities
is that a reminder to check on your board is helpful. If the board has com-
pleted etching, continued agitation would speed undercutting of the traces,
which is not a good thing because it weakens (and can break!) small copper
traces. On the other hand, if it fails to etch in a reasonable time, you might
need to refresh the etchant.

The Shield
For this project, I recommend making a small PCB shield, which is basically
a host board designed to plug into the Arduino Nano. With a shield, your
motor reversal project can remain compact, and you can design and build it
with a minimum of effort.

PCB Layout
You could just solder the parts for your project directly to a piece of perfo-
rated project board, but I believe creating and populating the shield takes
less time than putting the parts on a perforated board and wiring them by
hand. You’ll also gain invaluable experience by preparing, etching, drill-
ing, and assembling your own PCB. And in the end, some projects are com-
plex enough that wiring by hand just won’t be an attractive option. (See
Figure 5-12 on page 69 for an example.)
To make my printed circuit layouts, I use a free software program
called ExpressPCB. If you’ve never laid out a PCB before, check out
“Making Your Own PCBs” on page XX to learn how to use ExpressPCB.
Figure 2-10 shows my layout of the PCB.

Figure 2-10: This is the actual PCB pattern I used in the


project. The Arduino Nano can be soldered directly to
the board or can plug in if you use header connectors.

An Automated Agitator for PCB Etching   33


Arduino Playground (Early Access), © 2016 by Warren Andrews

If you don’t want to lay out your own PCB but still want to make
the board, download the Reverse.pcb file from https://www.nostarch.com/
arduinoplayground and follow the directions in “Making Your Own PCBs”
on page X. When you’ve made your PCB, just solder all the components
to it in the right places, and you’ll be done with the shield.

Shield Design Notes


If you lay out your own shield, there are a few design factors you should
definitely keep in mind.

Analog Inputs
Be certain to connect the A1 and A0 inputs to the correct sides of resis-
tor R1, according to the schematic in Figure 2-3. A1 should attach to the
power supply side and A0 to the H-bridge side. In the sketch, to compare
the analog values, we take the difference as analogdifference = analogValue1 –
analogValue0, with analogValue1 as the input at the high end of the resistor. In
this case, analogValue0 is A0, and analogValue1 is A1.

Grounding and Heat Sink


Pins 4, 5, 12, and 13 are ground on the H-bridge, and they are also a heat
sink to keep the chip from overheating. A small area on the proposed shield
is included to increase the heat sink area. If you’re using a relatively small
motor—such as the 6V, 20 mA unit—no more heat sinking is required. If
you’re using a much larger motor or driving a heavy load, consider using
the second side of the PCB as a heat sink.

The Voltage Regulator


This project uses its own 5V regulator to supply power to the Nano. A 9V,
200 mA plug-in wall adapter is connected to the voltage regulator LM7805
on the shield, which reduces the voltage from about 9V to 5V. An external
regulator is included so a more powerful regulator than the one built into
the Nano can be used. Make sure to connect the pins of the regulator cor-
rectly. Figure 2-11 shows the pinout of the regulator.

Output
Common
Input

Figure 2-11: Pinout of LM7805 5V regulator

You could feed a 7.5V DC or 9V DC wall supply directly to the VIN pin
of the Nano and use the onboard regulator, which worked with my motor.
But if you use a larger motor—or higher-current LEDs—it might tax the
onboard regulator and could conceivably burn it out.
The higher the voltage of the power supply, the more work the regula-
tor has to do to bring it down to 5V. Overtaxing the regulator could cause

34   Chapter 2
Arduino Playground (Early Access), © 2016 by Warren Andrews

it to heat up and fail. For example, feeding the regulator 12V is probably
at the high end for 5V regulation. A 9V input is better, and a 7.5V input
is better yet. If the regulator chip gets warm, add a heat sink to the tab. A
small piece of aluminum is often sufficient, but a regular heat sink can be
used (see “The Mini Voltage Regulator” on page X). And while it’s good to
have the supply voltage as close to the output voltage as possible, remember
that the regulator needs at least 1V above the regulated output to work, so
it must be fed with at least 6V, which is a 5V-regulated output plus 1V. Input
voltages above 12V are feasible, too, but just be sure not to exceed the limits
of the device.

Mod: Using a Highe r Voltage

If you use a higher-voltage motor for this project, it will turn faster, have more
torque, and so on. But you can’t simply connect the higher voltage to the high
end of the dropping resistor connected to pin 8 of the H-bridge. That would
cause the voltage between both A0 and A1 and ground to exceed 5V, which
is hazardous to the health of the ATmega328 microcontroller on the Arduino.
(This is the only time that the voltage referenced to ground is important.) Thus,
a modification is required. Look at R1 in the schematic in Figure 2-12. The sup-
ply first goes to resistor R2; R2 joins with resistor R3, which goes to ground.

Figure 2-12: If you elect to use a higher voltage and drive a


faster motor, you will have to modify the circuit by adding
voltage dividers in front of both the A0 and A1 inputs.
(continued)

An Automated Agitator for PCB Etching   35


Arduino Playground (Early Access), © 2016 by Warren Andrews

To avoid damage to the Nano processor, you will want to keep the volt-
age that appears at that joining point under 5V, referenced to ground. The
easiest way to do this is to use a voltage divider. Two resistor pairs divide the
higher voltage: the first pair is R2 and R3; the second is R4 and R5. The value
of these resistors should be such that the output at the joining of each pair—R1
and R2, and R4 and R5—is somewhat less than 5V for whatever value of input
voltage you use.
Use this formula:
R2
Vout = Vin ×
R1 + R 2

and the schematic in Figure 2-13 to determine the values of the resistors to use
in a voltage-divider circuit.
For example, if you start with 9V and arbitrarily Vin
select a 10-kilohm resistor in series, you would have to
shunt it with a 12.5-kilohm resistor to ground, accord-
ing to the calculator. The closest resistor I had was R1
12 kilohm, and it worked fine. If you can’t find a stan-
dard resistor to fit your needs, you can also combine Vout
two standard values in parallel to achieve the value you R2
want with this formula:

R1 R2 Ground
Rtotal =
R1 + R2
Figure 2-13: A basic
If you don’t want to do the algebra yourself, you voltage divider. To
find the resistors you
could use one of the convenient online voltage-divider should use, plug the
calculators such as http://www.sengpielaudio.com/ values from your
calculator-paralresist.htm or http://www.raltron.com/ own divider into the
formula as if your
cust/tools/voltage_divider.asp. SparkFun also has an divider were this
excellent tutorial on voltage dividing, with a calcula- circuit.
tor of its own: http://learn.sparkfun.com/tutorials/
voltage-dividers/.

Directional LEDs
Of course, what Arduino project would be complete without blinking
LEDs? As you’ll see in the schematic and on the shield PCB, I included
two LEDs: a red one for clockwise rotation and a green one for counter­
clockwise rotation. But which direction belongs to which LED is your
choice: simply reverse the motor leads to change the LED status.

36   Chapter 2
Another Random Scribd Document
with Unrelated Content
The 5th we marched nine miles through deep mud and rain to the
battlefield in front of Williamsburg, the last four and a half on the
double quick and a run. The men, exhausted, in profuse
perspiration, and wet to the skin, were obliged to lie on their arms
during the night without either blankets or fires. From that hour the
sickness of the regiment increased frightfully, six or eight new cases
occurring daily. We left twenty-seven men in hospital at
Williamsburg, sent six to transports at West Point when opposite that
place, sent sixty away at Cumberland Landing, left forty-eight at
Baltimore Store, and had sixty-four on the sick list at Bottom's Bridge
on the 31st of May.
At the battle of Fair Oaks, on the last day of May, we lost of men and
officers eleven killed and forty-nine wounded. Of the last, twenty-
three were wounds of the upper extremities, two requiring
amputation of the arm, and one exsection of the elbow joints;
twelve of the lower extremities, four of thigh, seven of leg, and one
of knee joint, eight of trunk (three serious); six of head (one
serious), and two of both upper and lower extremities.
While at Fair Oaks from the 1st to the 29th of June, the regiment
suffered greatly from fever and dysentery, the first of miastamic
origin, which, together with the effect of constant apprehension,
rendered the nervous system highly impressible. Hence the marked
effect of the malaria upon the nervous centers, especially the spine,
as evidenced by the almost constantly present—to a greater or less
degree—numbing of the extremities with partial paralysis of the
lower, usually severe pain in the hips and lumbar region, with great
depression of spirits, etc.
The diarrhoea, as well as all diseases resulting from bad digestion or
affections of the digestive organs, were caused mainly, if not
entirely, by improper habits of cooking and eating. Each soldier
cooked for himself, having no other implements than a small tin pail
made from fruit can, a tin cup and a borrowed frying pan. Every
leisure moment was devoted to cooking and eating; meat of every
description was fried instead of being boiled. All regularity in eating
was lost, except that uncertain kind, produced by relief from the
routine of duty. Nor can any remedy be suggested short of the entire
removal of the cooking business from the hands of the soldier, and
placing it in charge of a competent corps organized for that special
purpose. Soldiers cannot march and fight each with a complete stock
of cooking furniture on his back.
In an active campaign like that on the Peninsula, officers suffer from
bad cooking equally with the men. Servants are an uncertain kind of
dependencies and often obliged to cook for himself, the officer is of
course as unskilled as the soldier. A regimental mess for the officers
of this regiment under charge of a competent cook, established a
few weeks ago, has already proved decidedly advantageous. A
similar arrangement for the men, for instance by companies, would
be found to be as great an improvement.
For five days before commencing the retreat from before Richmond
to Harrison's Landing our men were almost constantly on duty. On
the 29th of June they skirmished all day, then marched half of the
night. The next day (30th) they fought at Charles City Cross Roads,
losing seven killed and fifty-six wounded, most of whom fell into the
hands of the enemy. They watched until two o'clock a. m., July 1st,
then marched to Malvern Hill, fought there, losing two killed and
eight wounded; remained on picket until 9 a. m. next morning, then
marched twelve miles through deep mud and hard rain to Harrison's
Landing, camped at night in the mud, then moved three miles and
camped permanently for outpost duty.
All were exhausted and disheartened, scarcely a well man in the
regiment, two hundred and thirty on the sick list for the first few
days. Scurvy made its appearance to a small extent, yet sufficient to
complicate and multiply other ailments. However, a few weeks' rest,
abundance of fresh vegetables, lemons and ice, and we were ready
to commence the retreat from the Peninsula with two hundred and
fifty men for duty, having lost four by death at Harrison's Landing—
two by typhoid fever, one from entraperitonitis and one from phthisis
pulmonalis.
On reaching Alexandria we immediately moved to the
Rappahannock, had no sickness of moment except two cases of
sunstroke, being actively engaged, yet not overworked.
We had three wounded at Bull Run, one in the hand, one in the hip,
and one in the breast and face. These last two have since died.
The present health of the regiment is good and its moral condition
excellent.
The general conclusions we arrive at are:
First.—That constant seasonable activity is necessary to promote the
health of the regiment.
Second.—Men accustomed to exposure in the open air when
attacked by fever of any kind, recover with much more certainty and
much sooner in tents than in general hospitals in houses, probably
because less crowded and admitting more perfect ventilation, and
free access to light.
J. W. LYMAN,
Surgeon 57th Reg't., Pa. Vols.
APPENDIX C.
THE 57th PA. VETERAN VOLUNTEERS.

THEIR SERVICES TO THE STATE AND TO THE NATION.

Address of Col. L. D. Bumpus to His Comrades at Gettysburg, July 2, 1888, on


the Occasion of the Dedication of the Battlefield Monument of the 57th
Pennsylvania Veteran Volunteers.

The 57th Regt., Pa. Vet. Vols., which was made up largely of Mercer
county men, dedicated, on Monday, July 2d, one of the finest
monuments on the Gettysburg field.
The exercises were opened with prayer by Rev. Dr. Sayres,
Department Chaplain of the G. A. R., after which Col. L. D. Bumpus,
President of the Monument Committee, introduced Capt. H. H.
Hinds, who made a few remarks on the movements of the 3d corps
and the work done by the 57th regiment. When Captain Hinds had
concluded, the audience sang the hymn "America," after which Capt.
D. W. Gore, Secretary of the Monument Association, introduced Col.
L. D. Bumpus in the following speech:
It would not be necessary to introduce the orator for this occasion to an
audience composed of the members of the old 57th regiment, but as there
are many strangers present it would perhaps be proper for me to say that he
is a man who was identified, with the 57th regiment during the entire history
of its eventful existence. He was with us in our various marches, in our
numerous encampments, and in our many hard-fought battles. He entered
the army as a mere boy and rose from the ranks to the command of the
regiment before reaching his majority. He was known throughout the army as
the boy captain. It is largely due to his tireless efforts that we are enabled to
dedicate this beautiful monument today. He was true to his country, true to
himself, and true to the men of his command. No braver officer ever drew a
sword in defence of the old flag and no man enjoyed to a greater degree the
respect and regard of his old comrades in arms than does Col. L. D. Bumpus,
whom I now introduce to you as the orator for this occasion.

COLONEL BUMPUS' ADDRESS.

Comrades of the 57th Pennsylvania Veteran Volunteers:


In obedience to your command, I have appeared before you in many
different characters. I have, with you, trudged along on the weary
march and carried my gun, knapsack and forty rounds. And in
obedience to your call, I rose rank by rank, until I had the honor to
command the grand old regiment. Today, in obedience to your call, I
stand before you in a new role; that of orator for this occasion.
However well I may have been able to fill the positions to which you
have called me heretofore, I do not hope to meet your expectations
today. I am what President Lincoln was pleased to call one of the
plain people; and you will not be treated today to any flights of
oratory or grand play of words. But I shall try to speak words of
truth with soberness; and whatever else of merit my remarks may
lack, I trust you will do me the justice to believe that they emanate
from an honest heart.
Our good historian, Captain Strouss, has relieved me of the necessity
of going into history, and I shall confine my remarks to the trials and
triumphs of the grand regiment to which we had the honor to
belong. I need not speak of the causes that led to the war, for they
were so well understood by every man who marched in the ranks
that they are as familiar as household words. We are met here today
as Pennsylvanians on Pennsylvania soil, on one of the greatest
battlefields of the war; and I propose to speak of the part
Pennsylvania and more particularly the part the 57th regiment, took
in suppressing the rebellion.
When war came, it found us ill prepared. We had a little army
scattered throughout the territories; a weak navy, lying at anchor in
distant waters; a bankrupt treasury, and a government without
credit. What added to the uncertainty of the result, the people of the
North were divided on party issues, and many honest men believed
that there was no power in the Constitution to coerce a State. All
these difficulties confronted President Lincoln, and he was appalled
at their magnitude. He called upon the Governors of several of the
loyal States to counsel with him in his dread emergency. They met at
the White House. The President informed them of the terrible cloud
that hung like a pall over our fair land, and asked their advice about
issuing a proclamation, calling upon the people for troops to put
down the rebellion, and with his hands folded behind him awaited
their answer. The six or seven Governors who formed his auditors
had each expressed his opinion, but they were punctuated by too
many "ifs" or "ands." While this was going on, Governor Andrew G.
Curtin, fresh from his mountain home, stood looking through the
window. He had not yet been approached by the President,
personally. There was profound but awful silence in that small but
thoughtful party of distinguished men.
President Lincoln finally broke the silent spell, and, turning to
Governor Curtin, said: "Governor, what will Pennsylvania do, if I
issue my proclamation?" Silence more profound prevailed. It was a
momentous question. It seemed as if the fate of a nation depended
upon the reply about to be made. Manifest destiny seemed
trembling in the balance. Governor Curtin faced the President and
said: "What will Pennsylvania do? Why, sir, if you issue your
proclamation, Pennsylvania will give you a hundred thousand men in
one week." Thank God for that noble answer! Truly Andrew G. Curtin
was the right man in the right place. He was the Richelieu who
thwarted the conspirators of the American rebellion.
But how did the boys of 1861 fulfill the promises of Governor Curtin?
The call to arms came, and before that tornado of patriotism which
followed, "men came as the winds come when forests are rended;
came as the waves come when navies are stranded." You all know
the story: how the flag went down amidst the smoke of battle; how
the fight was long and bloody; how, finally, the great waves of
Secession, Slavery and Rebellion rolled across our bordering line and
rebaptised the soil of Pennsylvania with the blood of patriots. And
then,
"Through every vale and glen,
Beating like resolute pulses,
She feels the tread of men;
But she stands like an ocean break-water
In fierce rebellion's path,
To shiver its angry surges
And baffle its frantic wrath.
And the tide of Slavery's treason
Dashed on her in vain,
Rolling back from the ramparts of freedom,
In the land: of 'Mad Anthony Wayne.'"

I will not attempt to recount the deeds of the soldiers of


Pennsylvania; to do so would be to repeat the history of the war. For
with but few exceptions there is not a battlefield from Gettysburg to
Mobile where the ground has not been stained with the blood of the
soldiers of Pennsylvania. There is not a State, loyal or
insurrectionary, which was the seat of war, that does not hold within
it the honored and sacred remains of the slain heroes of
Pennsylvania. When Beauregard first trained his murderous guns
upon Fort Sumter, Pennsylvania was there. Pennsylvania volunteers
were the first to reach the National Capitol. We were at Appomattox
when traitors fired their last volley; and in all those terrible
intermediate struggles in every rebellious State, in every important
battle on land or water, where treason was to be confronted or
rebellion subdued, the soldiers and sailors of Pennsylvania were ever
found, confronting the one and conquering the other. Therefore, it
was in true historic order that the wicked struggle to terminate the
Union should culminate upon our soil, that its topmost wave should
be dashed against our Capital; that its decisive defeat should be
secured here where literal bulwarks of upheaved slain preserved the
North from the despoiling foot of a traitor, and, accordingly, the
rebellion staggered back from Gettysburg to its grave. Remember
that at Gettysburg the blood of the people of eighteen loyal States,
rich, precious blood, mingling together, sank into the soil of
Pennsylvania, and by that red covenant she is pledged for all time to
Union, to Patriotism and to Nationality.
Comrade, with a record like this have we not much to be proud of?
Such heroism as I have recounted is too sublime for the common
language of humanity; a heroism which is patriotic, and a heroism
which is heroic; a heroism which blends in beautiful symmetry the
moral and the physical; a heroism which will shine with increasing
luster as generations pass away. No longer need we look back
through the centuries for deeds of noble daring. We can point with
pride to our own record in the great War of the Rebellion for
achievements that will rival Spartan valor or Roman fortitude.
The 57th regiment was organized early in the fall of 1861, at Camp
Curtin, Pennsylvania, and in December of that year was ordered to
Washington and went into camp on the Bladensburg pike, near the
old toll gate, and subsequently became a part of the Army of the
Potomac. From that time until you were mustered out, the history of
the Army of the Potomac was your history. You received your first
baptism of fire at Yorktown on April 11, 1862, and from that time
until the close of the war you participated in every important
engagement of that Army, excepting Antietam. That you did your
duty faithfully and well your list of casualties will prove. The records
of the War Department show that in every engagement you lost men
and in some of them from forty to sixty per cent. of the whole
number engaged. The original strength of the regiment was eight
hundred and fifty men, and your casualties were over eight hundred
during the war; and at the final muster out but one of the original
officers of the regiment remained to be mustered out with you,
Chaplain W. T. McAdam.
I will now quote from the speech of Hon. Chauncey Depew, before
the Society of the Army of the Potomac. He says: "Each of the great
armies had its distinguishing merit; but in the achievements and in
the records of the Western forces, following the precedent of
previous wars, are largely represented the genius and personality of
great commanders." To the Army of the Potomac belongs the unique
distinction of being its own hero. It fought more battles and lost
more in killed and wounded than all others; it shed its blood like
water to teach incompetent officers the art of war, and political
tacticians the folly of their plans; but it was always the same
invincible and undismayed Army of the Potomac. Loyal ever to its
mission and to discipline, the only sound it gave in protest was the
cracking of the bones as the cannon balls ploughed through its
decimated ranks. A good soldier does full honor to his adversary.
Although Americans on the wrong side, no more formidable force of
equal number ever marched or fought than the Army of Northern
Virginia, and it had the rare fortune of being always under the
command of one of the most creative and accomplished military
minds of his time, Gen. Robert E. Lee.
To conquer and capture such an army the captain of the Army of the
Potomac must overcome what the greatest tactician has said was
impossible, "an armed enemy in his own country," with the whole
population venomously hostile; acting as spies; furnishing
information, removing supplies; preparing ambuscades, and
misleading the invaders. But it did accomplish this military miracle. It
was hard and trying to be marched and countermarched for naught;
to be separated and paralyzed at the moment when a supreme
effort meant victory; to be hurled against impassable defenses, and
then waste in repairing the mistake. The Army of the Potomac, was
composed of thinking bayonets. Behind each musket was a man who
knew for what he was fighting, and who understood the plan of
campaign, and with unerring and terrible accuracy sized up his
commander. The one soldier in whom he never lost confidence was
himself.
This army operated so near the Capitol that Congressmen and
newspapers directed its movements, changed its officers and
criticised its failures to conquer on blue lines penciled on Washington
maps. It suffered four years under unparalleled abuse, and was
encouraged by little praise, but never murmured. It saw all its corps
and division commanders sign a petition to the President to remove
its general, and then despairingly but heroically marched to certain
disaster at his order. It saw its general demand the resignation or
court martial of its corps or division officers, and yet, undemoralized
and undismayed, it charged under his successor in a chaos of
conflicting commands. "On to Richmond!" came the unthinking cry
from every city, village and cross roads in the North. "On to
Richmond!" shouted grave Senators and impetuous Congressmen.
"On to Richmond!!" ordered the Cabinet. No longer able to resist the
popular demand, the raw and untrained recruits were hurled from
their unformed organizations and driven back to Washington. Then,
with discipline and drill, out of chaos came order; the self-deserting
volunteer has become an obedient soldier; the mass has become
moulded into a complex but magnificent machine; and it was the
Army of the Potomac! Overcoming untold difficulties, fighting with
superb courage, it comes in sight of the spires of Richmond, and
then, unable to succeed, because McDowell and his corps of thirty
thousand men are held back, it renews each morning and carries on
every night in retreat the Seven Days' Battle for existence; and,
brought to bay at Malvern Hill, asserts its undaunted spirit in hard
won victory. It follows Pope and marches and falls back; pursues
enemies who are not before it, and finds foes for which it is
unprepared, and fights and is beaten under orders so contradictory
and councils so divided, that an army of European veterans would
have disbanded. Immediately, it recognizes a general in whom it has
confidence. The stragglers come from the bush and the wounded
from the hospitals; regiments, brigades, divisions and corps reform,
and at Antietam it is invincible and irresistible.
Every man in the ranks knew that the fortified heights of
Fredericksburg were impregnable, that the forlorn hope would
charge, not into the imminent deadly breach, but into a death trap,
and yet with unfaltering step this grand army salutes its blind
commander and marches to the slaughter!
"Theirs not to reason why,
Theirs not to make reply,
Theirs but to do and die!"

Every private was aware of the follies of the Rappahannock


campaign. He knew that the opportunity to inflict an irreparable blow
upon the army of Lee had been trifled away, and that after reckless
delays to make a movement which at first would have been a
surprise, conceived by the very genius of war, was then mere mid-
summer madness; and yet this incomparable army, floundered
through swamps, lost in almost impenetrable forests, outflanked,
outmaneuvered, outgeneraled, decimated, no sooner felt the firm
hand of Meade than it destroyed the offensive and aggressive power
of the Confederacy in the three days' fighting at Gettysburg.
At last, this immortal army had at its head a great Captain, who had
never lost a battle. Every morning for thirty days came the order to
storm the works in front and every evening for thirty nights the
survivors moved to the command of "By the left flank, forward!" and
at the end of that fateful month, with sixty thousand comrades dead
or wounded in the Wilderness, the Army of the Potomac once more,
after four years, saw the spires of Richmond. Inflexible of purpose,
insensible to suffering, inured to fatigue and reckless of danger, it
rained blow on blow upon its heroic but staggering foe; and the
world gained a new and better and freer and more enduring republic
than it had ever known, in the surrender of Appomattox. All the
trials and triumphs, all the hardships and privations, all the defeats
and humiliations I have enumerated you shared in common with the
Army of the Potomac.
In addition to this, in March, 1864, upon the reorganization of the
army, the grand old 3d corps, to which you belonged, was broken
up; a corps with a name and a record as brilliant as any organization
in the army, a corps that had furnished a galaxy of names second to
none in brilliancy; such names as Heintzelman, Hamilton and Sickles,
Kearny and Hooker, and Birney and Berry. You must lose your
identity, and were ordered to lay off the badge which you had
honored, the old diamond which you loved; the badge that was put
there in obedience to the orders of the dashing Kearny, and in its
stead put on the badge of another corps. Against these humiliating
orders there was no insubordination, no murmur, or protest; but with
heroic courage you marched to victory under other officers and as a
part of another organization. You asked the powers to allow you to
wear the old badge, and, thanks to General Grant's love of fair play,
you were allowed to retain the old diamond, and from that time until
the surrender in every game of war diamonds were trump, and if
you did not have a full hand, you could always be depended on to
take a trick. Another humiliation which you had to endure as a
regiment was in January, 1865, when the regiment, having been
greatly reduced in strength by the severity of the summer's
campaign, was, in obedience to special orders of the War
Department, dated January 11, 1865, broken up and consolidated
into a battalion of six companies, and you saw your officers who had
risen from the ranks, officers of your own choosing, officers whom
you loved, mustered out and sent home as supernumeraries. Like
Moses of old, who was not permitted to gaze upon the Promised
Land, so some of your officers, after nearly four years of war, after
having passed through more than a score of battles, after having
endured all the hardships and privations that I have enumerated,
within sixty days of reaching the goal for which they had been
fighting, were mustered out and were not permitted with you to
stand at Appomattox and gaze upon the shattered relics of the
Southern Confederacy.
Comrades, if I had the time I would like to name each loved
comrade who fell in battle, died of wounds or sank down from
exhaustion on the weary march; and those who died a lingering
death of starvation in prison pens, or died of disease in some
hospital, far from home and mother and friends, and who lie
scattered through the South, in graves that only God shall know until
the resurrection morning. I would like to follow you from the time of
your enlistment until the time the regiment came home, few and
worn, with many a powder breath upon its flag and many a bullet
hole through its folds. I would also speak of Sides and Neeper and
Perkins and Lyons and Hill and McCartney and Morse and Crossley
and Comstock and Burns and scores of others who seemed to have
borne charmed lives and who were discharged and sent home when
the war was over, but who have at last been mustered out. They
have passed to the other side of the silent river. They have been
made noble by God's patent. They have responded to the roll-call
among men for the last time, until that day when the names of all
the living and the dead shall be sounded before the Great White
Throne.
I would go back through the haze of years to hear the rattling
drums, the bugle's call, the loud hooray, the tramp of soldier boys. I
see the waving flags, the red cheeked lads, the bearded men; I see
long lines marching out to do and die; I hear the mothers' cries, the
sobs of wives, the sisters' wail, the sweethearts' moan; and then
comes waiting, day by day and night by night, the women in
darkened homes, the men amidst the dangers of the field. Today is
hope; tomorrow comes the news, the dreadful news, the battle's
crash, the roar of guns, the din of war, the sharp command, the fire
and smoke, the whirl, the charge, the awful shock, the iron hoof, the
swinging sword, the gush of blood, the piteous groan, the dying
hero and the dead. Oh, bitterness of victory! Oh, homes made
desolate! How many hearts the battle breaks that never laid a hand
to sword! How many tears must flow for wrong from eyes that only
saw the right! The lesson that we read in blood is one we never can
forget, and God has taught us this, as long ago he taught the lesson
of the cross. Not for his friends alone was that blood shed, but for
his enemies as well; and by this latter blood not one but all of us
shall live; and on foundations firm as heaven itself the new Republic
rises strong and towering upward to the sky; its glistening summits
lift their points until they touch the far off blue, and overtopping all
the world, they stand up clear against the clouds, so that the very
lowest down may see, and, seeing, know that what they see is
Freedom's home.
After nearly four years of war, with the great Rebellion subdued, with
not an armed enemy within our borders, the 57th Pennsylvania
Volunteers was mustered out June 29, 1865, and we write "finis" on
the last page of the military history of one of the grandest
organizations that ever took up arms for the preservation of a
"Government of the people, for the people and by the people."
Upon separating for your homes, your officers issued an address to
the surviving members, from which I quote: "Parting as a band of
brothers, let us cling to the memory of those tattered banners under
which we have fought together and which, without dishonor, we
have just now restored to the authorities, who placed them in our
hands. Till we grow gray-headed and pass away, let us sustain the
reputation of this noble old regiment." That you have observed the
injunction of your officers in that address, the testimony of your
neighbors in every place in which you have lived since the war will
prove. When you were discharged you had but one ambition. In that
one supreme moment of triumph, your only thought was of home
and family and friends. You went back into the localities from which
you came, into the ranks as citizens; taking up the daily burden of
life where you had thrown it down when enlisting, ceasing to be
soldiers and becoming again private citizens. There was no evidence
of the contaminating influence of camp life in your characters. There
was no disorder where you went. On the contrary, your presence
became the sign of order. You showed the world that great as you
had been as soldiers, you had never forgotten that you were
citizens.
Most speakers who have made similar addresses upon this great
battlefield of the war have made more extended remarks upon the
movements of the army during the three days' fighting here, and
some have censured certain commanders. The battle of Gettysburg
has given rise to a great many controversies, and each commander
has been censured and complimented in turn. Doubleday charges
that Howard's troops gave way; Howard affirms that Doubleday's
troops broke. General Meade is charged with ordering a retreat. One
speaker charges that General Sickles made a great blunder in taking
up a position too far in advance, which well nigh proved disastrous
to our army. With all these charges I have nothing to do. I am not
here to censure or find fault. I have only to do with the part you
took as a regiment. Whether, as some speakers claim, Sickles saved
the day and gained a victory by taking and holding an advanced line
on July 2d, until the Roundtops could be occupied, or whether, as
others assert, Hancock, the "Superb," gained the victory by brilliant
generalship and magnificent fighting on the 3d, I will leave the
historian to decide. Suffice it to say, the 57th did her duty by
obeying orders, and that is all that is required of any soldier or set of
soldiers. You went as far as the farthest and left seventy per cent. of
your number behind, when you were obliged to abandon the line. In
regard to the movements of the 3d corps, I will simply read what
President Lincoln wrote to General Sickles in reply to a request that a
court of inquiry should be convened to inquire into his conduct
during the battle. The President writes:
"My Dear Sickles: You ask for a court of inquiry. They say you took up an
advanced position on July 2d. They say you crowded the enemy and brought
on an engagement. I guess what they say is true; but, thank God, you gained
a great victory. There were honors enough won at Gettysburg to go all round.
History will do you justice. Don't ask for a court of inquiry.
[Signed] A. Lincoln."

Comrades, in all countries and in all ages the people have reared
monuments to the memory of their dead heroes; their deeds of valor
have been told in song and story, and the people have delighted to
do them honor. The great Commonwealth of Pennsylvania,
recognizing the services of her brave soldiers, during the sitting of
the last Legislature passed an act appropriating fifteen hundred
dollars to build a monument to each regiment that participated in
the battle of Gettysburg. In accordance with the provisions of that
act, Capt. D. W. Gore, Capt. H. H. Nelson, Lieut. George Miller,
Comrade Theodore Catlin and myself, were elected as a committee
by the surviving members of the regiment to select the location,
submit designs, and erect a monument.
We organized at Gettysburg by electing your speaker chairman, and
Captain Gore secretary. Not knowing the magnitude of the work
before us, July 2d was agreed upon as the day upon which our
monument should be dedicated. Scattered as the members of the
committee were, over two States and the District of Columbia, thus
rendering it difficult to convene them, it was thought best that the
chairman and secretary be authorized to act for the committee. The
labor and expense thus devolved upon us have been considerable.
We have been met with many and unlooked for obstacles; but one
by one they have been overcome, and the result of our work is
before you.
As chairman of your committee, in the name of the taxpayers of the
Commonwealth of Pennsylvania, I present you with this beautiful
monument, which will stand while generations pass away, as a
monument to the valor and patriotism of the 57th regiment, and to
the generosity of the citizens of this grand old State. Pennsylvania
honors herself in thus honoring the memory of those who fell in her
defence. We dedicate this memorial shaft, not to those who fell at
Gettysburg alone, but to the eight hundred who were swallowed up
by the tide of death on other fields; in prison pens, in hospitals, and
on the lonely picket line. We dedicate it to every member of that
grand old regiment, either living or dead. We dedicate it to our
children and our children's children forever.
And when the few of us who yet survive shall have passed on to
"join the innumerable caravan," may coming generations, as they
gather 'round this granite shaft and read the record chisled here,
learn lessons of patriotism and heroic devotion and here may they
gain inspiration and strength, which shall make them brave
defenders of their country's institutions and her flag, which we so
much love.
Comrades, I cannot refrain from saying a few parting words to you.
As I look over this audience, I am reminded that the boys of 1861
are now men on the down-hill side of life. The hand of time has
silvered the hair and plowed deep furrows in the cheeks of the
comrades I see gathered about me, and this will probably be the last
roll-call to which a considerable number of the old regiment will
respond. Soon these pleasant meetings, these delightful and
hallowed associations, with each and all of us must come to an end.
Let us live all the more closely together, then, in the brief road that
remains to us. Let us be truer to our common name and common
fame, so that we shall leave nothing behind us which will tarnish the
polished and war-worn escutcheons of the grand old 57th regiment.
Let us continue to be good citizens. Let us lead such lives that when
we hear the last tattoo and the lights are ordered out on earth, we
shall be awakened by the reveille at the tent of the Great
Commander and bidden to seats at Headquarters.

The following is a letter from General Longstreet to General Sickles:


Gen. D. E. Sickles, Gettysburg, Pa.:
My Dear General Sickles: My plan and desire was to meet you at Gettysburg
on the interesting ceremony attending the unveiling of the Slocum
monument; but today I find myself in no condition to keep the promise made
to you when last we were together. I am quite disabled from a severe hurt in
one of my feet, so that I am unable to stand more than a minute or two at a
time. Please express my sincere regrets to the noble Army of the Potomac,
and to accept them, especially, for yourself.
On that field you made your mark that will place you prominently before the
world as one of the leading figures of the most important battle of the Civil
War. As a Northern veteran once remarked to me: "General Sickles can well
afford to leave a leg on that field."
I believe that it is now conceded that the advanced position at the Peach
Orchard, taken by your corps and under your orders, saved that battlefield to
the Union cause. It was the sorest and saddest reflection of my life for many
years; but, today, I can say, with sincerest emotion, that it was and is the
best that could have come to us all, North and South; and I hope that the
nation reunited, may always enjoy the honor and glory brought to it by that
grand work.
Please offer my kindest salutations to your Governor and your fellow-
comrades of the Army of the Potomac.
Always yours sincerely,
[Signed] James Longstreet,
Lieut.-Gen. Confederate Army.
APPENDIX D.

Reminiscences of the Fifty-Seventh Regiment, by Gen. William


Birney.

Comrades:—It gives me pleasure to respond to your desire for my


reminiscences of the 57th Regiment, Pennsylvania Volunteers. They
are all agreeable.
My first knowledge of it was from the gallant and chivalrous General
Philip Kearny, under whom I had served in the New Jersey Brigade.
August 12, 1862, I was exchanged as prisoner of war. August 13,
the General sent for me and offered me the command of the 57th.
speaking in very high terms of the intelligence, bravery and moral
stamina of the men. All it needed, he said, to become one of the
best regiments in the army was drill and discipline. I accepted his
offer, was detailed by General McClellan from my own regiment and
corps to General Kearny's, took command next day at the camp on
James river, at Harrison's Landing, and kept it until October 12.
These two months were filled with active service.
Your historian, in his kindly notice, has given a wrong version of the
only unpleasantness that ever existed between General Kearny and
me. Allow me to correct it. At a division drill, in the winter of 1861-2,
conducted by General Torbert, I commanded a regiment. Receiving a
wrong order from the brigade commander, I executed the
movement, as was my duty. General Kearny, who was on the field,
rode rapidly up behind me, hissed in my ears: "Major Birney, you'd
better study your tactics, sir," rode off about fifty yards and halted.
Being very angry at this unmerited reproof given me while at the
head of my regiment, I followed him, expressed my resentment in
bitter words and went back to my command. Ten minutes afterward,
the General put me under arrest. The same evening he sent his
adjutant to offer me a release if I would apologize. I refused on the
ground that he should apologize first to me. He preferred charges, I
was court-martialed, and, for lack of proof, acquitted. Not long after
that, at an accidental meeting between us, the General offered me
his hand after making a handsome apology for his haste. His
magnanimity gave me occasion to express a conclusion I had
reached on reflection, that my language to him had been
insubordinate, and to express my regrets that I had not kept my
temper; if I had waited for the General to learn the facts from
General Torbert and other witnesses, he would have made amends.
From the date of that reconciliation, we were better friends than
ever before.
Before that bad break, he had recommended me for the vacant
colonelcy of the 1st and, on my declining, had procured my
appointment as major of the 4th. He had cordially approved
choosing me as teacher of the Officers' School of Tactics and had
shown in many ways his confidence in me. It was, therefore, with
pleasure that I accepted the command of the 57th in his division and
corps, though the regiment was not from my state.
My first special effort was to increase the number of the regiment by
recalling absentees; and this I continued during the whole time of
my command.
Our first honor was being appointed with a Maine regiment to guard
the flank of the army when on its march from Harrison's Landing to
Yorktown. I was in command of both. We were menaced by the
rebel cavalry and had to form the hollow square twice. Nevertheless,
we made longer marches than had been made in the army up to
that time, marching in order, keeping proper rests, and having our
water canteens well filled. We reached our destination in excellent
condition, after serving as buffer for more than two days between
our army and the enemy.
Our trip by water to Alexandria was uneventful. Our short stay in
that city was made memorable by the drunken carouse of nearly all
the troops. It was a day of debauchery; staggering and reeling men
filled the street and drunken men the cars which were to take the
troops to the Rapidan. The striking exception was the 57th; it
maintained its sobriety and good order. While I was standing near
the regiment and feeling great pride in it, General Kearny rode by.
"Well, General, what do you think of that?" said I, pointing to the
boozy crowd. He shrugged his shoulders but said nothing. This was
the only time I ever knew him fail to make his expression adequate
to circumstances. He could express himself vigorously, as you all
remember. But the Alexandria spree was too much for him.
We went to the Rapidan on cars and for a few days and one night
did a great deal of marching as part of Pope's army. The night march
was to Bristow's station; and your merit is the greater because it
was the very night when General Porter said his part of the army
could not see to march. Your eyes were good enough. From
Bristow's we marched to Centreville and thence to the battlefield of
Groveton. On that day, we guarded artillery from attacks. Late at
night, we marched to what was known as the "rail barricade," on the
extreme right of the Union army, arriving about 1 a. m. The General
had told me I would find two regiments of our troops there. What I
did find there was nothing but a picket of sixteen Irishmen and a
sergeant, posted in a clump of small trees at the right end of a steep
and very high hill, quite level on top, which seemed to extend a
great way to the left. In the valley below was a rebel camp which,
the sergeant said, contained at least two brigades, two batteries of
small artillery and a squadron of cavalry. The outlook was squally; at
daybreak, the rebels would attack; what could the 57th do against
such odds? I at once sent to General Kearny a report and a request
for supports, threw out a company of skirmishers to the left along
the edge of the hill, formed the regiment behind the rail barricade,
ordered the Irish picket to stand fast where they were and
everybody to fire at will and with good aim at any rebel who should
try to reach the top of the hill. I knew that if the enemy should once
gain the level ground with their artillery, the little 57th would be
swept off as by a cyclone. Until about 8 a. m., the firing was
continuous, the enemy making several attempts that failed. From the
Irish picket on the right to the last skirmisher on the left, our line of
fire was at least a half mile long; the enemy probably thought we
had a large force. I was greatly relieved when about 8 a. m., General
——, U. S. A., appeared in our rear with two brigades of infantry in
close order and two howitzers mounted on mules. "Who is in
command here?" asked the General. I saluted. "You may withdraw
your men." I briefly informed him of the conditions, asking him if he
would not send his men to replace mine and adding that the rebels
would follow up my men closely and occupy every position
abandoned by them. His reply was: "You may withdraw them, sir;
we'll attend to the enemy." I ordered my bugler to sound the quick
recall; my skirmishers and the Irish picket came in on the run, and
the regiment, being quite ready, retired on the double quick. It was
not many minutes before the rebels had gained the high ground,
placed their batteries in positron and forced the conceited general to
retreat with heavy loss.
Rejoining our division, we took part in the movements until dark,
when the order came to retreat. To reach the road to Centreville, we
had to march back to a road that ran almost at right angles to ours
and crossed the creek. On our side of the crossing, two hundred
yards away, was a large residence with a front yard of ample
proportions. We had occupied it two hours earlier. As I rode up at
the head of our column, an officer in Confederate uniform passed in
the dusk into the yard through the front gate. The yard was full of
rebel soldiers! They had occupied it after we had left it. I sent the
adjutant to keep the regiment moving to the crossing, to enjoin
silence and quicken step. The next ten minutes were anxious ones
with me. The rebels might, at any moment, open fire on us from the
flank. But they were probably as afraid of us as I was of them. They
couldn't see how many we were. When our last man had crossed the
creek, I followed. Within about twenty feet of a yard full of rebels, I
had watched for any movement; but they had not stirred. Not a
word was spoken on either side. We were both glad to get rid of
each other. It was a close rub for the 57th!
We marched in retreat and found the road blocked by General Poe's
brigade. I asked him to let us pass. "No," he answered. "The 57th is
just the buffer I need between my men and the rebels." I made no
reply, but hastening to the regiment, marched it, single file and in
silence, past Poe's brigade by a side path on the left of the road. My
orders from General Kearny were to rejoin him as soon as
practicable; and I did not care to have General Poe use the 57th as I
had used the Irish picket. His brigade was a brave one and well able
to defend its own rear. The good marching legs of the 57th stood us
in good stead. Next morning, as I lay on a stretcher in bivouac at
Centreville, below the road, I was conscious that somebody was
looking intently at me. It was General Poe, on horseback, in the road
above, at the head of his brigade. "How in — did you get here?" he
asked.
At Chantilly, the 57th held the picket line, at midnight, in a heavy
rain, across a large corn field, a few feet only from the picket line of
the enemy. Orders were, that we should withdraw quietly at 2
o'clock a. m. and follow the other troops in retreat. If the 57th had
not been in good discipline, the movement could not have been
successfully made; there would have been some whispering or
noise. As it was, the rebels did not find out before daybreak that we
were gone.
Our march to Washington and thence to the Monocacy was without
event worthy of notice now.
You cannot have forgotten how you forded the Potomac on a sudden
march to Leesburg to surprise the rebels in that town. The water
was up to the necks of all the short men. and all of you had to hold
above your heads your muskets and cartridge boxes. But you got
through and succeeded in capturing and paroling a great many
skulkers and shirks who were hiding in that pleasant Virginia town;
how many, I forget, but one of your officers who was there tells me
we paroled more men than were in the 57th. Not much glory in that
kind of work, though!
The "Jeb Stuart raid"' around our army was the most striking
incident of our Monocacy campaign. We heard of Jeb before he
came. Contrabands and Union men told us. Ward's brigade was to
intercept him. Our brigade was placed, for that purpose, I suppose,
on the brow of the steep hill that overlooked the road which ran
between the hill and the Potomac. The 57th was next the brow of
the hill. The hill was too steep for cavalry to climb; the road was
narrow; the river deep. Jeb Stuart was never in greater danger than
he was in that beautiful morning. When I heard the distant tramp of
his horses, not having received any orders, I galloped over to
General Ward, who was not further off than two hundred yards, and
asked for leave to attack. He said he could not give it without orders
from General Stoneman! I urged the emergency, but he refused to
take the responsibility. And so, I had to stand quietly on that hill-top
and look at the gallant Jeb and his gay horsemen as they went
riding by!
The great opportunity of the 57th and of its temporary commander
passed with them; if we had received the leave asked for, the 57th
would have made itself the crack regiment of the army, and its
commander would have sported a star on his shoulder strap
eighteen months earlier than he did. But such are the fortunes of
war!
When Colonel Campbell returned to his regiment, I asked General
Stoneman to give me an order to report to my own regiment. He
responded by putting me in command of the 38th New York. Here
was a change! But the New York boys who had run with the machine
gave me no reason to complain of them. In the battle of
Fredericksburg, where some of the fighting was hand to hand, the
Sergeant-Major saved me by a timely pistol shot, from being
bayonetted by a rebel soldier.
The only time I ever saw the 57th after I left it was on the battlefield
of Chancellorsville, on the morning General Howard's corps was
surprised and routed by Stonewall Jackson. I had volunteered on
General Hooker's staff, my own regiment being temporarily on
detached service, and had been sent by him to rally the flying
troops. The smoky field was covered by the disordered masses;
batteries of artillery were driving on full gallop in retreat; shot and
shell were whistling; fugitives were flying, and officers trying to
make themselves heard in the awful din of cannon and musketry.
Amid the confusion and uproar, I saw but one regiment moving in
order, officers at their posts, companies in line and flag flying. It was
the 57th Pennsylvania! When the men recognized me, they gave me
three cheers, a compliment I have never recalled except with a full
heart and, must I admit it, with grateful tears. The 57th has a right
to be proud of its service, discipline and veteran courage on the
battlefield of Chancellorsville.
And now, I bid you adieu as friends, tried and true. We shall never
meet again; but as long as life lasts, I shall never think of the 57th
and our "auld lang syne" without a heart-thrill of gratitude and pride.

Transcriber's Notes:
Missing or obscured punctuation was corrected.
Typographical errors were silently corrected.
*** END OF THE PROJECT GUTENBERG EBOOK HISTORY OF THE
FIFTY-SEVENTH REGIMENT, PENNSYLVANIA VETERAN VOLUNTEER
INFANTRY ***

Updated editions will replace the previous one—the old editions


will be renamed.

Creating the works from print editions not protected by U.S.


copyright law means that no one owns a United States
copyright in these works, so the Foundation (and you!) can copy
and distribute it in the United States without permission and
without paying copyright royalties. Special rules, set forth in the
General Terms of Use part of this license, apply to copying and
distributing Project Gutenberg™ electronic works to protect the
PROJECT GUTENBERG™ concept and trademark. Project
Gutenberg is a registered trademark, and may not be used if
you charge for an eBook, except by following the terms of the
trademark license, including paying royalties for use of the
Project Gutenberg trademark. If you do not charge anything for
copies of this eBook, complying with the trademark license is
very easy. You may use this eBook for nearly any purpose such
as creation of derivative works, reports, performances and
research. Project Gutenberg eBooks may be modified and
printed and given away—you may do practically ANYTHING in
the United States with eBooks not protected by U.S. copyright
law. Redistribution is subject to the trademark license, especially
commercial redistribution.

START: FULL LICENSE


THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK

To protect the Project Gutenberg™ mission of promoting the


free distribution of electronic works, by using or distributing this
work (or any other work associated in any way with the phrase
“Project Gutenberg”), you agree to comply with all the terms of
the Full Project Gutenberg™ License available with this file or
online at www.gutenberg.org/license.

Section 1. General Terms of Use and


Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand,
agree to and accept all the terms of this license and intellectual
property (trademark/copyright) agreement. If you do not agree
to abide by all the terms of this agreement, you must cease
using and return or destroy all copies of Project Gutenberg™
electronic works in your possession. If you paid a fee for
obtaining a copy of or access to a Project Gutenberg™
electronic work and you do not agree to be bound by the terms
of this agreement, you may obtain a refund from the person or
entity to whom you paid the fee as set forth in paragraph 1.E.8.

1.B. “Project Gutenberg” is a registered trademark. It may only


be used on or associated in any way with an electronic work by
people who agree to be bound by the terms of this agreement.
There are a few things that you can do with most Project
Gutenberg™ electronic works even without complying with the
full terms of this agreement. See paragraph 1.C below. There
are a lot of things you can do with Project Gutenberg™
electronic works if you follow the terms of this agreement and
help preserve free future access to Project Gutenberg™
electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright
law in the United States and you are located in the United
States, we do not claim a right to prevent you from copying,
distributing, performing, displaying or creating derivative works
based on the work as long as all references to Project
Gutenberg are removed. Of course, we hope that you will
support the Project Gutenberg™ mission of promoting free
access to electronic works by freely sharing Project Gutenberg™
works in compliance with the terms of this agreement for
keeping the Project Gutenberg™ name associated with the
work. You can easily comply with the terms of this agreement
by keeping this work in the same format with its attached full
Project Gutenberg™ License when you share it without charge
with others.

1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside
the United States, check the laws of your country in addition to
the terms of this agreement before downloading, copying,
displaying, performing, distributing or creating derivative works
based on this work or any other Project Gutenberg™ work. The
Foundation makes no representations concerning the copyright
status of any work in any country other than the United States.

1.E. Unless you have removed all references to Project


Gutenberg:

1.E.1. The following sentence, with active links to, or other


immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project
Gutenberg™ work (any work on which the phrase “Project
Gutenberg” appears, or with which the phrase “Project
Gutenberg” is associated) is accessed, displayed, performed,
viewed, copied or distributed:

This eBook is for the use of anyone anywhere in the United


States and most other parts of the world at no cost and
with almost no restrictions whatsoever. You may copy it,
give it away or re-use it under the terms of the Project
Gutenberg License included with this eBook or online at
www.gutenberg.org. If you are not located in the United
States, you will have to check the laws of the country
where you are located before using this eBook.

1.E.2. If an individual Project Gutenberg™ electronic work is


derived from texts not protected by U.S. copyright law (does not
contain a notice indicating that it is posted with permission of
the copyright holder), the work can be copied and distributed to
anyone in the United States without paying any fees or charges.
If you are redistributing or providing access to a work with the
phrase “Project Gutenberg” associated with or appearing on the
work, you must comply either with the requirements of
paragraphs 1.E.1 through 1.E.7 or obtain permission for the use
of the work and the Project Gutenberg™ trademark as set forth
in paragraphs 1.E.8 or 1.E.9.

1.E.3. If an individual Project Gutenberg™ electronic work is


posted with the permission of the copyright holder, your use and
distribution must comply with both paragraphs 1.E.1 through
1.E.7 and any additional terms imposed by the copyright holder.
Additional terms will be linked to the Project Gutenberg™
License for all works posted with the permission of the copyright
holder found at the beginning of this work.

1.E.4. Do not unlink or detach or remove the full Project


Gutenberg™ License terms from this work, or any files
containing a part of this work or any other work associated with
Project Gutenberg™.

1.E.5. Do not copy, display, perform, distribute or redistribute


this electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1
with active links or immediate access to the full terms of the
Project Gutenberg™ License.

1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if
you provide access to or distribute copies of a Project
Gutenberg™ work in a format other than “Plain Vanilla ASCII” or
other format used in the official version posted on the official
Project Gutenberg™ website (www.gutenberg.org), you must,
at no additional cost, fee or expense to the user, provide a copy,
a means of exporting a copy, or a means of obtaining a copy
upon request, of the work in its original “Plain Vanilla ASCII” or
other form. Any alternate format must include the full Project
Gutenberg™ License as specified in paragraph 1.E.1.

1.E.7. Do not charge a fee for access to, viewing, displaying,


performing, copying or distributing any Project Gutenberg™
works unless you comply with paragraph 1.E.8 or 1.E.9.

1.E.8. You may charge a reasonable fee for copies of or


providing access to or distributing Project Gutenberg™
electronic works provided that:

• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”

• You provide a full refund of any money paid by a user who


notifies you in writing (or by e-mail) within 30 days of receipt
that s/he does not agree to the terms of the full Project
Gutenberg™ License. You must require such a user to return or
destroy all copies of the works possessed in a physical medium
and discontinue all use of and all access to other copies of
Project Gutenberg™ works.

• You provide, in accordance with paragraph 1.F.3, a full refund of


any money paid for a work or a replacement copy, if a defect in
the electronic work is discovered and reported to you within 90
days of receipt of the work.

• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.

1.E.9. If you wish to charge a fee or distribute a Project


Gutenberg™ electronic work or group of works on different
terms than are set forth in this agreement, you must obtain
permission in writing from the Project Gutenberg Literary
Archive Foundation, the manager of the Project Gutenberg™
trademark. Contact the Foundation as set forth in Section 3
below.

1.F.

1.F.1. Project Gutenberg volunteers and employees expend


considerable effort to identify, do copyright research on,
transcribe and proofread works not protected by U.S. copyright
law in creating the Project Gutenberg™ collection. Despite these
efforts, Project Gutenberg™ electronic works, and the medium
on which they may be stored, may contain “Defects,” such as,
but not limited to, incomplete, inaccurate or corrupt data,
transcription errors, a copyright or other intellectual property
infringement, a defective or damaged disk or other medium, a
computer virus, or computer codes that damage or cannot be
read by your equipment.

1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES - Except


for the “Right of Replacement or Refund” described in
paragraph 1.F.3, the Project Gutenberg Literary Archive
Foundation, the owner of the Project Gutenberg™ trademark,
and any other party distributing a Project Gutenberg™ electronic
work under this agreement, disclaim all liability to you for
damages, costs and expenses, including legal fees. YOU AGREE
THAT YOU HAVE NO REMEDIES FOR NEGLIGENCE, STRICT
LIABILITY, BREACH OF WARRANTY OR BREACH OF CONTRACT
EXCEPT THOSE PROVIDED IN PARAGRAPH 1.F.3. YOU AGREE
THAT THE FOUNDATION, THE TRADEMARK OWNER, AND ANY
DISTRIBUTOR UNDER THIS AGREEMENT WILL NOT BE LIABLE
TO YOU FOR ACTUAL, DIRECT, INDIRECT, CONSEQUENTIAL,
PUNITIVE OR INCIDENTAL DAMAGES EVEN IF YOU GIVE
NOTICE OF THE POSSIBILITY OF SUCH DAMAGE.

1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If you


discover a defect in this electronic work within 90 days of
receiving it, you can receive a refund of the money (if any) you
paid for it by sending a written explanation to the person you
received the work from. If you received the work on a physical
medium, you must return the medium with your written
explanation. The person or entity that provided you with the
defective work may elect to provide a replacement copy in lieu
of a refund. If you received the work electronically, the person
or entity providing it to you may choose to give you a second
opportunity to receive the work electronically in lieu of a refund.
If the second copy is also defective, you may demand a refund
in writing without further opportunities to fix the problem.

1.F.4. Except for the limited right of replacement or refund set


forth in paragraph 1.F.3, this work is provided to you ‘AS-IS’,
WITH NO OTHER WARRANTIES OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.

1.F.5. Some states do not allow disclaimers of certain implied


warranties or the exclusion or limitation of certain types of
damages. If any disclaimer or limitation set forth in this
agreement violates the law of the state applicable to this
agreement, the agreement shall be interpreted to make the
maximum disclaimer or limitation permitted by the applicable
state law. The invalidity or unenforceability of any provision of
this agreement shall not void the remaining provisions.

1.F.6. INDEMNITY - You agree to indemnify and hold the


Foundation, the trademark owner, any agent or employee of the
Foundation, anyone providing copies of Project Gutenberg™
electronic works in accordance with this agreement, and any
volunteers associated with the production, promotion and
distribution of Project Gutenberg™ electronic works, harmless
from all liability, costs and expenses, including legal fees, that
arise directly or indirectly from any of the following which you
do or cause to occur: (a) distribution of this or any Project
Gutenberg™ work, (b) alteration, modification, or additions or
deletions to any Project Gutenberg™ work, and (c) any Defect
you cause.

Section 2. Information about the Mission


of Project Gutenberg™
Project Gutenberg™ is synonymous with the free distribution of
electronic works in formats readable by the widest variety of
computers including obsolete, old, middle-aged and new
computers. It exists because of the efforts of hundreds of
volunteers and donations from people in all walks of life.

Volunteers and financial support to provide volunteers with the


assistance they need are critical to reaching Project
Gutenberg™’s goals and ensuring that the Project Gutenberg™
collection will remain freely available for generations to come. In
2001, the Project Gutenberg Literary Archive Foundation was
created to provide a secure and permanent future for Project
Gutenberg™ and future generations. To learn more about the
Project Gutenberg Literary Archive Foundation and how your
efforts and donations can help, see Sections 3 and 4 and the
Foundation information page at www.gutenberg.org.

Section 3. Information about the Project


Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a non-
profit 501(c)(3) educational corporation organized under the
laws of the state of Mississippi and granted tax exempt status
by the Internal Revenue Service. The Foundation’s EIN or
federal tax identification number is 64-6221541. Contributions
to the Project Gutenberg Literary Archive Foundation are tax
deductible to the full extent permitted by U.S. federal laws and
your state’s laws.

The Foundation’s business office is located at 809 North 1500


West, Salt Lake City, UT 84116, (801) 596-1887. Email contact
links and up to date contact information can be found at the
Foundation’s website and official page at
www.gutenberg.org/contact
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookultra.com

You might also like