SlideShare a Scribd company logo
Arduino A Technical Reference A Handbook For
Technicians Engineers And Makers 1st Edition J M
Hughes download
https://ebookbell.com/product/arduino-a-technical-reference-a-
handbook-for-technicians-engineers-and-makers-1st-edition-j-m-
hughes-9948270
Explore and download more ebooks at ebookbell.com
Here are some recommended products that we believe you will be
interested in. You can click the link to download.
Arduino A Beginners Guide To Arduino Programming 1st Edition George
Gibson
https://ebookbell.com/product/arduino-a-beginners-guide-to-arduino-
programming-1st-edition-george-gibson-48621802
Arduino A Quick Start Guide 1st Edition Maik Schmidt
https://ebookbell.com/product/arduino-a-quick-start-guide-1st-edition-
maik-schmidt-2284674
Arduinoa Quick Start Guide For Beginners To Getting Started With
Electronics And Coding Schmidt Tech Guru
https://ebookbell.com/product/arduinoa-quick-start-guide-for-
beginners-to-getting-started-with-electronics-and-coding-schmidt-tech-
guru-58532632
Mastering Arduino A Projectbased Approach To Electronics Circuits And
Programming Jon Hoffman
https://ebookbell.com/product/mastering-arduino-a-projectbased-
approach-to-electronics-circuits-and-programming-jon-hoffman-7222508
Introduction To Arduino A Piece Of Cake Alan G Smith
https://ebookbell.com/product/introduction-to-arduino-a-piece-of-cake-
alan-g-smith-5521690
An Essential Guidebook On Arduino A Handson Introduction With Guidance
For Those Getting Started Arduino Projects Book Lowell Songster
https://ebookbell.com/product/an-essential-guidebook-on-arduino-a-
handson-introduction-with-guidance-for-those-getting-started-arduino-
projects-book-lowell-songster-232322260
An Essential Guidebook On Arduino A Handson Introduction With Guidance
For Those Getting Started Arduino Projects Book Songster
https://ebookbell.com/product/an-essential-guidebook-on-arduino-a-
handson-introduction-with-guidance-for-those-getting-started-arduino-
projects-book-songster-232815978
Optimizing Pharmacotherapy In Older Patients An Interdisciplinary
Approach Antonio Cherubini
https://ebookbell.com/product/optimizing-pharmacotherapy-in-older-
patients-an-interdisciplinary-approach-antonio-cherubini-50581092
Arduino Uno A Handson Guide For Beginner Agus Kurniawan
https://ebookbell.com/product/arduino-uno-a-handson-guide-for-
beginner-agus-kurniawan-44454870
Arduino A Technical Reference A Handbook For Technicians Engineers And Makers 1st Edition J M Hughes
J. M. Hughes
Arduino
ATechnical
Reference
A HANDBOOK FOR TECHNICIANS,
ENGINEERS, AND MAKERS
Arduino A Technical Reference A Handbook For Technicians Engineers And Makers 1st Edition J M Hughes
J. M. Hughes
Arduino: A Technical Reference
A Handbook for Technicians, Engineers, and Makers
Boston Farnham Sebastopol Tokyo
Beijing Boston Farnham Sebastopol Tokyo
Beijing
978-1-491-92176-0
[LSI]
Arduino: A Technical Reference
by J. M. Hughes
Copyright © 2016 John Hughes. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are
also available for most titles (http://safaribooksonline.com). For more information, contact our corporate/
institutional sales department: 800-998-9938 or corporate@oreilly.com.
Editor: Dawn Schanafelt
Production Editor: Colleen Lobner
Copyeditor: Rachel Head
Proofreader: Kim Cofer
Indexer: Ellen Troutman-Zaig
Interior Designer: David Futato
Cover Designer: Randy Comer
Illustrator: John M. Hughes
and Rebecca Demarest
May 2016: First Edition
Revision History for the First Edition
2016-05-05: First Release
See http://oreilly.com/catalog/errata.csp?isbn=9781491921760 for release details.
The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. Arduino: A Technical Reference, the
cover image, and related trade dress are trademarks of O’Reilly Media, Inc.
While the publisher and the author have used good faith efforts to ensure that the information and
instructions contained in this work are accurate, the publisher and the author disclaim all responsibility
for errors or omissions, including without limitation responsibility for damages resulting from the use of
or reliance on this work. Use of the information and instructions contained in this work is at your own
risk. If any code samples or other technology this work contains or describes is subject to open source
licenses or the intellectual property rights of others, it is your responsibility to ensure that your use
thereof complies with such licenses and/or rights.
Table of Contents
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii
1. The Arduino Family. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
A Brief History 1
Types of Arduino Devices 2
Arduino Galleries 4
Arduino-Compatible Devices 7
Hardware-Compatible Devices 7
Software-Compatible Devices 8
The Arduino Naming Convention 9
What Can You Do with an Arduino? 10
For More Information 12
2. The AVR Microcontroller. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Background 14
Internal Architecture 14
Internal Memory 17
Peripheral Functions 17
Control Registers 18
Digital I/O Ports 18
8-Bit Timer/Counters 19
16-Bit Timer/Counters 21
Timer/Counter Prescaler 21
Analog Comparator 21
Analog-to-Digital Converter 22
Serial I/O 24
USART 24
SPI 25
iii
TWI 25
Interrupts 26
Watchdog Timer 29
Electrical Characteristics 29
For More Information 29
3. Arduino-Specific AVR Microcontrollers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
ATmega168/328 32
Memory 32
Features 32
Packages 34
Ports 34
Pin Functions 34
Analog Comparator Inputs 34
Analog Inputs 34
Serial Interfaces 35
Timer/Clock I/O 36
External Interrupts 37
Arduino Pin Assignments 38
Basic Electrical Characteristics 38
ATmega1280/ATmega2560 39
Memory 39
Features 41
Packages 41
Ports 42
Pin Functions 42
Analog Comparator Inputs 42
Analog Inputs 43
Serial Interfaces 44
Timer/Clock I/O 45
External Interrupts 46
Arduino Pin Assignments 46
Electrical Characteristics 49
ATmega32U4 49
Memory 49
Features 51
Packages 51
Ports 51
Pin Functions 52
Analog Comparator Inputs 53
Analog Inputs 53
Serial Interfaces 54
iv | Table of Contents
Timer/Clock I/O 55
External Interrupts 56
USB 2.0 Interface 57
Electrical Characteristics 58
Arduino Pin Assignments 59
Fuse Bits 60
For More Information 62
4. Arduino Technical Details. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Arduino Features and Capabilities 63
Arduino USB Interfaces 64
Arduino Physical Dimensions 66
Full-Size Baseline Arduino PCB Types 67
Mega Form-Factor Arduino PCB Types 68
Small Form-Factor Arduino PCB Types 69
Special-Purpose PCB Types 73
Arduino Pinout Configurations 73
The Baseline Arduino Pin Layout 74
The Extended Baseline Pin Layout 76
The Mega Pin Layout 81
Nonstandard Layouts 83
For More Information 87
5. Programming the Arduino and AVR Microcontrollers. . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Cross-Compiling for Microcontrollers 90
Bootloaders 92
The Arduino IDE Environment 94
Installing the Arduino IDE 95
Configuring the Arduino IDE 96
Cross-Compiling with the Arduino IDE 98
The Arduino Executable Image 101
The Arduino Software Build Process 101
Sketch Tabs 103
Arduino Software Architecture 104
Runtime Support: The main() Function 106
An Example Sketch 107
Constants 110
Global Variables 111
Libraries 112
Using Libraries in Sketches 112
Adding a Library to the Arduino IDE 116
Creating Custom Libraries 118
Table of Contents | v
Arduino Source Code 119
6. Life Without the Arduino IDE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
IDE Alternatives 121
PlatformIO 122
Ino 124
The AVR Toolchain 125
Installing the Toolchain 127
make 130
avr-gcc 131
binutils 132
avr-libc 135
Building C or C++ Programs from Scratch 137
Compiling with avr-gcc or avr-g++ 137
Multiple Source Files and make 138
AVR Assembly Language 140
The AVR Programming Model 141
Creating AVR Assembly Language Programs 143
AVR Assembly Language Resources 146
Uploading AVR Executable Code 146
In-System Programming 147
Programming with the Bootloader 148
Uploading Without the Bootloader 149
JTAG 151
AVRDUDE 152
Using an Arduino as an ISP 154
Bootloader Operation 154
Replacing the Bootloader 156
Summary 156
7. Arduino Libraries. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Library Components 158
Contributed Libraries 211
8. Shields. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
Electrical Characteristics of Shields 216
Physical Characteristics of Shields 217
Stacking Shields 219
Common Arduino Shields 220
Input/Output 221
I/O Extension Shields 222
I/O Expansion Shields 226
vi | Table of Contents
Relay Shields 230
Signal Routing Shields 232
Memory 235
Communication 237
Serial I/O and MIDI 237
Ethernet 239
Bluetooth 241
USB 243
ZigBee 244
CAN 246
Prototyping 249
Creating a Custom Prototype Shield 253
Motion Control 253
DC and Stepper Motor Control 254
PWM and Servo Control 255
Displays 257
Instrumentation Shields 263
Adapter Shields 266
Miscellaneous Shields 268
Uncommon Arduino Shields 272
Sources 274
9. Modules and I/O Components. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
Modules 276
Physical Form Factors 277
Interfaces 277
Module Sources 280
Module Descriptions 282
Grove Modules 309
Sensor and Module Descriptions 310
Sensors 312
Temperature, Humidity, and Pressure Sensors 312
Tilt Sensors 318
Audio Sensors 319
Light Sensors 320
Magnetic Sensors 324
Vibration and Shock Sensors 324
Motion Sensors 325
Contact and Position Sensors 327
Range Sensors 331
Communications 332
APC220 Wireless Modules 332
Table of Contents | vii
315/433 MHz RF Modules 332
ESP8266 Transceiver 333
Output Devices and Components 334
Light Sources 335
Relays, Motors, and Servos 339
Analog Signal Outputs 342
User Input 343
Keypads 343
Joysticks 344
Potentiometers and Rotary Encoders 345
User Output 345
Text Displays 345
Graphical Displays 347
Support Functions 347
Clocks 348
Timers 350
Connections 351
Working with Naked Jumper Wires 351
Module Connection Systems 351
Building Custom Connectors 352
Choosing a Connection Method 354
Sources 355
Summary 355
10. Creating Custom Components. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
Getting Started 360
Custom Shields 365
Physical Considerations 366
Stacking Shields 367
Electrical Considerations 369
The GreenShield Custom Shield 369
Objectives 370
Definition and Planning 370
Design 371
Prototype 379
Final Software 385
Fabrication 393
Final Acceptance Testing 397
Operation 399
Next Steps 400
Custom Arduino-Compatible Designs 400
Programming a Custom Design 401
viii | Table of Contents
The Switchinator 401
Definition and Planning 402
Design 403
Prototype 416
Software 420
Fabrication 423
Acceptance Testing 427
Next Steps 428
Resources 428
11. Project: A Programmable Signal Generator. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431
Project Objectives 433
Definition and Planning 434
Design 435
Functionality 436
Enclosure 437
Schematic 438
Prototype 441
Control Inputs and Modes 441
Display Output 443
DDS Module 444
Software 446
Source Code Organization 447
Software Description 448
The DDS Library 456
Testing 457
Final Assembly 460
Pull-up Resistor Array 460
Input Protection 461
Chassis Components 462
DC Power 465
Final Testing and Closing 466
Reducing the Cost 466
Cost Breakdown 468
Resources 469
12. Project: Smart Thermostat. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471
Background 471
HVAC Overview 472
Temperature Control Basics 473
Smart Temperature Control 476
Project Objectives 477
Table of Contents | ix
Definition and Planning 477
Design 478
Functionality 478
Enclosure 480
Schematic 482
Software 482
User Input/Output 485
Control Output 488
Prototype 489
DHT22 Sensor 491
Rotary Encoder 491
Real-Time Clock Module 493
LCD Shield 493
Software 493
Source Code Organization 494
Software Description 494
Testing 497
Final Version 498
Assembly 498
Testing and Operation 501
Cost Breakdown 502
Next Steps 503
Resources 503
13. Model Rocket Launcher: A Design Study. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505
Overview 505
The Design Cycle 506
Objectives 508
Selecting and Defining Functional Requirements 510
Creating the Preliminary Design 514
Design Feasibility 517
Preliminary Parts List 520
Prototype 521
Final Design 522
Electrical 522
Physical 527
Software 529
Testing and Operation 532
Cost Analysis 533
A. Tools and Accessories. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535
x | Table of Contents
B. AVR ATmega Control Registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549
C. Arduino and Compatible Products Vendors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 575
D. Recommended Reading. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581
E. Arduino and AVR Software Development Tools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585
Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589
Table of Contents | xi
Arduino A Technical Reference A Handbook For Technicians Engineers And Makers 1st Edition J M Hughes
Preface
Since its introduction in 2005 the Arduino has become one of the most successful
(some might argue the most successful) open source hardware projects in the world.
Boards based on the open designs released by the Arduino team have been fabricated
in countries around the world, including Italy, Brazil, China, the Netherlands, India,
and the United States. One can purchase a fully functional Arduino-compatible board
for around $15, and the Arduino development environment is readily available for
download and is completely free. Originally based on the 8-bit AVR family of micro‐
controllers (the AVR is itself an interesting device with an equally interesting history),
the Arduino has moved into the realm of 32-bit processing with the addition of the
Due model with an ARM processor, the Yún with an on-board module running the
OpenWrt version of Linux, and the upcoming Zero model. Arduinos have been used
for everything from interactive art to robotics, and from environmental sensors to the
smarts in small “CubeSat” satellites built by small teams and launched for a fraction
of what a full-size satellite would cost.
I bought my first Arduino (a Duemilanove) many years ago, more out of curiosity
than anything else. I had worked with microprocessor and microcontroller develop‐
ment systems since the early 1980s, starting with the 6502, 6800, and 8051, and then
moving on to the 8086, the Z80, the 80186, and the 68000 family. Early on I usually
programmed these devices in assembly language or PL/M, since these were really the
only rational choices at the time for embedded systems. Later it became feasible to
use C or Ada, as the capabilities of the microprocessors improved and the software
tools matured. In each case, however, I came to expect having loads of reference
material available: datasheets, hefty manuals, handbooks, and reference design docu‐
mentation that would arrive along with the development circuit board and its acces‐
sories. It usually showed up in a large, heavy box.
xiii
When my new Arduino arrived and I opened the very small box I found that there
was only a circuit board, a plug-in power pack, a few LEDs and resistors, some
jumper wires, and a solderless breadboard block. No manuals, no handbooks, and no
datasheets. Not even a CD with documents and software on it. Nothing more than a
few sheets of paper with a manifest of what was in the box and a URL to a web page
where I could read some “how to get started” material and find links to the software I
needed. I was, to say the least, surprised.
I was also ignorant. When I bought the Arduino I didn’t know its full backstory, nor
was I aware of its intended audience. It turns out that it was originally meant primar‐
ily for people with little or no hardcore technical background who just wanted to
experiment (in a playful sense) with something cool and make things go. In other
words, artists and tinkerers, not engineers who have a penchant for technical details
and an addiction to project plans, specifications, and, of course, manuals.
Once I understood this, it all made a lot more sense. Reading Massimo Banzi’s book
Getting Started with Arduino (O’Reilly) gave me a better understanding of the Ardu‐
ino philosophy, and it was a good starting place in my quest for additional details.
Also, unlike semiconductor manufacturers with their development kits, the folks on
the Arduino team aren’t in the business of selling chips—they’re working to inspire
creativity. The AVR microcontroller was chosen because it was inexpensive and it
could be easily integrated into their vision for a device that could be readily applied to
a creative endeavor. The AVR has enough computational “horsepower” and sufficient
built-in memory to do complex and interesting things, unlike earlier generations of
microcontrollers that usually needed expensive development tools and provided only
scant amounts of internal on-chip memory.
Simplicity and low cost aside, the real secret to the success of the Arduino is the firm‐
ware bootloader on the AVR chip, coupled with a simple and easy-to-use integrated
development environment (IDE) and the code libraries supplied with it—all provided
free under open source and Creative Commons licensing. The Arduino philosophy is
to make it as easy as possible to use an Arduino. By clearing away the bulk of the
technical details and simplifying the development process, the Arduino invites the
user to experiment, try new things, and yes, play. For the first time in a long time I
found myself actually having a lot of fun just connecting things in different combina‐
tions to see what I could make it do. I wish that the Arduino had been around when I
was teaching introductory embedded systems design—it would have helped reduce a
lot of frustration for the people in the class trying to wade through assembly language
listings, memory maps, and flowcharts.
Since my first Arduino arrived I’ve found many sources for useful and interesting
add-on components for the Arduino family, some of them quite amazing in terms of
xiv | Preface
1 Entering “Arduino” into the search field on eBay will return a multitude of things like ultrasonic range sen‐
sors, temperature and humidity sensors, various Arduino clones, Bluetooth and ZigBee shields, and much
more. But, unfortunately, some of the items come with little or no documentation, and even if there is some it
may not be particularly up-to-date or accurate. That doesn’t mean you shouldn’t consider these sellers (the
prices are usually excellent and the build quality is generally very good), but as always when buying things
online, caveat emptor.
both price and capabilities.1
In fact, I became something of an Arduino pack rat, buy‐
ing inexpensive shields and modules and building up a sizable collection of various
bits. But, sadly, I have to say that many times I’ve opened a package with a nifty new
gizmo in it, only to discover that there is no documentation of any kind. Not even a
simple wiring diagram.
As an engineer, it is particularly frustrating to me to purchase something interesting,
only to have it show up with no documentation. I then have to embark on a quest to
determine if any documentation actually does exist, and in a form that I can read (I
can’t read Chinese). Sometimes that search is fruitless, and I’m forced to resort to
component datasheets and reverse engineering the circuit board to figure out the wir‐
ing. Other times the information I’m seeking does exist, but it is scattered across mul‐
tiple websites in various bits and pieces. This situation is slowly improving, but it can
still be a real pain. After years of collecting stacks of notes, web page links, and data‐
sheets, I finally decided to get organized and assemble it in one place.
So, what does this book have that can’t be found somewhere on the Internet? Not that
much, to be perfectly honest, but hopefully what it will do is reduce a lot of the poten‐
tial frustration and wasted time—and of course there are all the bits that I’ve discov‐
ered on my own. The official technical data comes from manufacturers such as
Atmel, the Arduino team, and numerous other sources, both well known and
obscure. Some overseas vendors do have at least rudimentary websites, whereas oth‐
ers have very nice web pages with links to other sites for the documentation. This
book contains as much of the essential data as I could find or reverse engineer, all in
one convenient place, with as many of the holes plugged as I could manage. I wanted
to save others the frustration I’ve experienced trying to run down some mundane lit‐
tle technical detail about the USB interface, or figure out why a shield wasn’t working
correctly, or why that really neat sensor I bought from someone through eBay didn’t
seem to work at all.
The result of my frustrations is this book, the one I’ve been wanting for working with
the Arduino boards and shields. I really wanted something physical that I could keep
near at hand on my workbench. It isn’t always practical to have to refer to a web page
to look something up, and to make things even more interesting, sometimes access to
the Internet just isn’t available (like when you’re trying to debug a remote data log‐
ging device on a mountaintop with just a little netbook for company and no wireless
service for 60 miles in any direction). I wanted something that I could use to quickly
Preface | xv
2 The books Environmental Monitoring with Arduino and Atmospheric Monitoring with Arduino (O’Reilly), both
by Emily Gertz and Patrick Di Justo, offer some good ideas for doing just this with cheap and readily available
sensors and an Arduino.
look up the answer to a question when working with the Arduino and associated add-
on components, no matter where I was. As far as I know, such a thing didn’t exist
until now. I hope you find it as useful as I have as I assembled my notes for this book.
Intended Audience
This book is intended for those people who need or want to know the technical
details. Perhaps you’ve gone as far as you can with the introductory material and the
“99 amazing projects” type of books, and you now need to know how to do some‐
thing novel and unique. Or, you might be a working engineer or researcher who
would like to incorporate an Arduino into your experimental setup in the lab. You
might even be someone who wants to install an Arduino into an RC airplane, use one
as part of a DIY weather station,2
or maybe do something even more ambitious (a
CubeSat, perhaps?).
Ideally you should have a basic knowledge of C or C++, some idea of how electrons
move around in a circuit, and some experience building electronic devices. If I may
be so bold, I would suggest that you have a copy of my book Practical Electronics:
Components and Techniques (also from O’Reilly) on hand, along with some reference
texts on programming and electronics (see Appendix D for some suggestions).
What This Book Is
This book is a reference and a handbook. I have attempted to organize it such that
you can quickly and easily find what you are looking for. I have included the sources
of my information whenever possible, and those insights that are the result of my
own investigations are noted as such.
What This Book Is Not
This book is not a tutorial. That is not its primary purpose. I don’t cover basic elec‐
tronics, nor is there any discussion of the dialect of the C++ language that is used to
create the so-called “sketches” for programming an Arduino. There are some excel‐
lent tutorial texts available that cover general electronics theory and programming,
and I would refer the reader to those as a place to get started with those topics.
This book is also not an Arduino-sanctioned guide to the products produced by the
Arduino team. It is based on information gleaned from various sources, some more
xvi | Preface
obscure than others, along with my own notes and comments based on my experien‐
ces with the Arduino. As such, I am solely responsible for any errors or omissions.
About Terminology
The distinctions between processors, microprocessors, and microcontrollers arose
sometime in the early 1980s as manufacturers were trying to distinguish their prod‐
ucts based on size and amount of external circuitry required for the devices to do
something useful. Full-size mainframe processors and the smaller microprocessors
like those found in desktop PCs both typically require some external components
(sometimes a lot of them) in order to be useful. A microcontroller, on the other hand,
has everything it needs to do its job already built in. Also, a microprocessor will typi‐
cally support external memory, whereas a microcontroller may have only limited sup‐
port (if any at all) for adding additional memory to what is already on the chip itself.
Throughout this book I will use the terms “microcontroller” and “processor” inter‐
changeably. Although “microcontroller” might be considered to be technically more
correct, in my mind it is still a processor of data, just a smaller version of the huge
machines I once worked with in the distant past. They all do essentially the same
thing, just at different scales and processing speeds.
What’s in This Book
Chapter 1 presents a brief history of the Arduino in its various forms. It also introdu‐
ces the AVR microcontrollers used in the Arduino boards, and discusses the differ‐
ences between software-compatible and hardware-compatible products based on the
Arduino.
The Atmel AVR microcontroller is the subject of Chapter 2. This is intended as an
overview of what is actually a very sophisticated device, and so this chapter provides a
quick tour of the highlights. This includes the timer logic, the analog comparator, the
analog input, the SPI interface, and other primary subsystems on the chip.
Chapter 3 takes a closer look at the AVR microcontrollers used in Arduino boards,
namely the ATmega168/328, the ATmega1280/2560, and the ATmega32U4 devices. It
builds on the overview presented in Chapter 2, and provides additional low-level
details such as internal architecture, electrical characteristics, and chip pinouts.
Chapter 4 covers the physical characteristics and interface functions of various Ardu‐
ino boards. This includes the USB interface types, printed circuit board (PCB)
dimensions, and board pinout diagrams.
What really makes the Arduino unique is its programming environment, and that is
the subject of Chapter 5. This chapter defines the Arduino sketch concept and how it
utilizes the C and C++ languages to create sketches. It introduces the Arduino boot‐
Preface | xvii
loader and the Arduino main() function. This chapter also describes how you can
download the Arduino source code and see for yourself what it looks like under the
hood.
Chapter 6 describes the AVR-GCC toolchain and presents techniques for program‐
ming an Arduino board without using the Arduino IDE. It also covers makefiles and
includes a brief overview of assembly language programming. The chapter wraps up
with a look at the tools available to upload code into an AVR.
The focus of Chapter 7 is on the standard libraries supplied with the Arduino IDE.
The Arduino IDE is supplied with numerous libraries, and more are being added all
the time. If you want to know if a library module exists for a particular sensor or for a
specific operation, then this is a good starting point.
Chapter 8 presents the various types of shields available for the Arduino. It covers
many of the commonly available types, such as flash memory, prototyping, input/
output, Ethernet, Bluetooth, ZigBee, servo control, stepper motor control, LED dis‐
plays, and LCD displays. It also covers using multiple shields, and presents some hints
and tips for getting the most from a shield.
Chapter 9 describes some of the various add-on components available that can be
used with an Arduino. These include sensors, relay modules, keypads, and other
items that aren’t specific to the Arduino, but work with it quite nicely. Electrical pin‐
out information and schematics are provided for many of the items discussed.
Sometimes there just isn’t a readily available shield to do what needs to be done.
Chapter 10 describes the steps involved in creating a custom shield. It also describes
how to use an AVR microcontroller without an Arduino-type circuit board but still
take advantage of the Arduino IDE.
Chapters 11, 12, and 13 cover some projects that illustrate the capabilities of the AVR
microcontrollers and the Arduino boards. They are intended to demonstrate how an
Arduino can be applied in various situations, not as how-to guides for building a
board or device. You can, however, build any of the items described yourself, if you
feel so inclined, and they might serve as jumping-off points for your own projects.
Each example project description includes theory of operation, schematics, a detailed
parts list, PCB layouts (if required), and an overview of the software necessary to
make it go.
Because the main emphasis of this book is on the Arduino hardware and related
modules, sensors, and components, the software shown is intended only to highlight
key points; my aim was not to present complete, ready-to-run examples. The full
software listings for the examples and projects can be found on GitHub.
Chapter 11 describes a basic programmable signal generator, a handy thing to have
around when working with electronic circuits. With this project you can generate
xviii | Preface
pulses at various duty cycles, output a sequence of pulses in response to a trigger
input, generate sine waves, and also create programmable patterns of pulses.
Chapter 12 covers the design and construction of a “smart” thermostat suitable for
use with a home HVAC (heating, ventilation, and air conditioning) system. Instead of
paying for something that is already built and sealed into a plastic case, you can build
it yourself and program it to behave exactly the way you want it to. I’ll show you how
to incorporate more than just a temperature sensor: features include multiple temper‐
ature and humidity sensors, and the use of your HVAC system’s fan to provide a
comfortable environment without the cost of running the compressor or lighting up
the heater.
In Chapter 13 we will look at how to build an automatic model rocket launcher with a
programmable sequencer and automatic system checks. Even if you don’t happen to
have a model rocket handy, this project describes techniques that can be applied to
many types of sequentially controlled processes, be it on a production line or a
robotic material handling device in a laboratory.
Appendix A is an overview of the basic tools and accessories you may need if you
want to go beyond prefabricated circuit boards and modules.
Appendix B is a compilation of the control registers for the ATmega168/328, the
ATmega1280/2560, and the ATmega32U4 microcontrollers.
Appendix C is a summary listing of the Arduino and compatible products distribu‐
tors and manufacturers listed in this book. It is by no means exhaustive, but hopefully
it will be enough to get you started on your quest to find what you need.
Appendix D lists some recommended books that cover not just the Arduino, but also
C and C++ programming and general electronics.
Finally, Appendix E is a summary of some of the readily available Arduino and AVR
software development tools that are currently out there.
Endorsements
Other than references to the Arduino team and the folks at Arduino.cc, there aren’t
any specific endorsements in this book—at least, not intentionally. I’ve made refer‐
ence to many different component manufacturers, suppliers, and other authors, but
I’ve tried to be evenhanded about it, and I don’t specifically prefer any one over
another. My only criteria in selecting those I do mention are that I own one or more
of their products and that I’ve successfully managed to use a shield, module, sensor,
or Arduino main PCB (or clone PCB in some cases) from the supplier in something,
even if just in a demonstration of some type. Any trademarks mentioned are the
property of their respective owners; they appear here solely for reference. As for the
photography, I tried to use my own components, tools, circuit boards, modules, and
Preface | xix
other items as much as possible, and although an image may show a particular brand
or model, that doesn’t mean it’s the only type available—it likely just happens to be
the one that I own and use in my own shop. In some cases I’ve used images with per‐
mission from the vendor or creator, works in the public domain, or images with a
liberal Creative Commons (CC) license, and these are noted and credited as appro‐
priate. I created all the diagrams, schematics, and other nonphotographic artwork,
and I am solely responsible for any errors or omissions in these figures.
Conventions Used in This Book
The following typographical conventions are used in this book:
Italic
Indicates new terms, URLs, email addresses, filenames, and file extensions.
Constant width
Used for program listings, as well as within paragraphs to refer to program ele‐
ments such as variable or function names, databases, data types, environment
variables, statements, and keywords.
Constant width italic
Shows text that should be replaced with user-supplied values or by values deter‐
mined by context.
This element signifies a tip or suggestion.
This element signifies a general note.
This element indicates a warning or caution.
xx | Preface
Safari® Books Online
Safari Books Online is an on-demand digital library that deliv‐
ers expert content in both book and video form from the
world’s leading authors in technology and business.
Technology professionals, software developers, web designers, and business and crea‐
tive professionals use Safari Books Online as their primary resource for research,
problem solving, learning, and certification training.
Safari Books Online offers a range of product mixes and pricing programs for organi‐
zations, government agencies, and individuals. Subscribers have access to thousands
of books, training videos, and prepublication manuscripts in one fully searchable
database from publishers like O’Reilly Media, Prentice Hall Professional, Addison-
Wesley Professional, Microsoft Press, Sams, Que, Peachpit Press, Focal Press, Cisco
Press, John Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt,
Adobe Press, FT Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett,
Course Technology, and dozens more. For more information about Safari Books
Online, please visit us online.
How to Contact Us
Please address comments and questions concerning this book to the publisher:
O’Reilly Media, Inc.
1005 Gravenstein Highway North
Sebastopol, CA 95472
800-998-9938 (in the United States or Canada)
707-829-0515 (international or local)
707-829-0104 (fax)
We have a web page for this book, where we list errata, examples, and any additional
information. You can access this page at http://bit.ly/arduino-a-technical-reference.
To comment or ask technical questions about this book, send email to bookques‐
tions@oreilly.com.
For more information about our books, courses, conferences, and news, see our web‐
site at http://www.oreilly.com.
Find us on Facebook: http://facebook.com/oreilly
Follow us on Twitter: http://twitter.com/oreillymedia
Watch us on YouTube: http://www.youtube.com/oreillymedia
Preface | xxi
Acknowledgments
This book would not have been possible without the enduring patience and support
of my family. Writing appears to be habit-forming, but they’ve been very encouraging
and supportive, and will even bring me things to eat and occasionally check to make
sure I’m still alive and kicking in my office. It doesn’t get much better than that. I
would particularly like to thank my daughter Seren for her photographic assistance
and help in keeping my collection of various bits and pieces cataloged and organized.
I would also like to thank the editorial staff at O’Reilly for the opportunity to work
with them once again. As always, they have been helpful, patient, and willing to put
up with me. Special thanks goes to Brian Sawyer and Dawn Schanafelt for their excel‐
lent editorial support and guidance, and to Mike Westerfield for his insightful techni‐
cal review of the material.
xxii | Preface
CHAPTER 1
The Arduino Family
This chapter provides a brief history of the Arduino, along with a terse genealogy of
the various board types created since 2007. It doesn’t cover boards produced before
2007, nor does it attempt to be comprehensive in its coverage of the various clones
and derivatives that have been produced. The main focus here is on the differences
between the various primary types of Arduino boards, with a specific focus on the
types of processors used and the physical design of the boards. It also takes a quick
look at the range of possible applications for Arduino circuit boards.
Chapter 2 provides general information about the internal functions of the Atmel
AVR processors, and Chapter 3 covers the specific processors used in Arduino
boards. With the exception of the Yún, Chapter 4 describes the physical characteris‐
tics of different official Arduino boards introduced in this chapter.
A Brief History
In 2005, building upon the work of Hernando Barragán (creator of Wiring), Massimo
Banzi and David Cuartielles created Arduino, an easy-to-use programmable device
for interactive art design projects, at the Interaction Design Institute Ivrea in Ivrea,
Italy. David Mellis developed the Arduino software, which was based on Wiring.
Before long, Gianluca Martino and Tom Igoe joined the project, and the five are
known as the original founders of Arduino. They wanted a device that was simple,
easy to connect to various things (such as relays, motors, and sensors), and easy to
program. It also needed to be inexpensive, as students and artists aren’t known for
having lots of spare cash. They selected the AVR family of 8-bit microcontroller
(MCU or µC) devices from Atmel and designed a self-contained circuit board with
easy-to-use connections, wrote bootloader firmware for the microcontroller, and
packaged it all into a simple integrated development environment (IDE) that used
programs called “sketches.” The result was the Arduino.
1
Since then the Arduino has grown in several different directions, with some versions
getting smaller than the original, and some getting larger. Each has a specific
intended niche to fill. The common element among all of them is the Arduino run‐
time AVR-GCC library that is supplied with the Arduino development environment,
and the on-board bootloader firmware that comes preloaded on the microcontroller
of every Arduino board.
The Arduino family of boards use processors developed by the Atmel Corporation
of San Jose, California. Most of the Arduino designs utilize the 8-bit AVR series of
microcontrollers, with the Due being the primary exception with its ARM Cortex-M3
32-bit processor. We don’t cover the Due in this book, since it is radically different
from the AVR devices in many fundamental ways and really deserves a separate
discussion devoted to it and similar microcontrollers based on the ARM Cortex-M3
design.
Although an Arduino board is, as the Arduino team states, just a basic Atmel AVR
development board, it is the Arduino software environment that sets it apart. This is
the common experience for all Arduino users, and the cornerstone of the Arduino
concept. Chapter 5 covers the Arduino IDE, the libraries supplied with the IDE, and
the bootloader. Chapter 6 describes the process of creating software for an AVR MCU
without using the Arduino IDE.
Types of Arduino Devices
Over the years the designers at Arduino.cc have developed a number of board
designs. The first widely distributed Arduino board, the Diecimila, was released in
2007, and since its initial release the Arduino family has evolved to take advantage of
the various types of Atmel AVR MCU devices. The Due, released in 2012, is the first
Arduino to utilize a 32-bit ARM Cortex-M3 processor, and it breaks from the rest of
the family in terms of both processing power and board pinout configuration. Other
boards, like the LilyPad and the Nano, also do not have the same pinout as the other
members of the family, and are intended for a different range of applications—weara‐
bles in the case of the LilyPad; handheld devices for the Esplora; and compact size in
the case of the Mini, Micro, and Nano.
With each passing year new types of Arduino boards appear, so what is listed here
may be out of date by the time you’re reading it. The newer versions have more
advanced processors with more memory and enhanced input/output (I/O) features,
but for the most part they use the same pinout arrangements and will work with
existing add-on boards, called shields, and various add-on components such as sen‐
sors, relays, and actuators. Table 1-1 lists the Arduino types that have appeared since
2005. The newer versions of the Arduino will also run most of the sketches created
for older models, perhaps with a few minor tweaks and newer libraries, but sketches
written for the latest versions may or may not work with older models.
2 | Chapter 1: The Arduino Family
Table 1-1 is not a buyer’s guide. It is provided to give a sense of historical context to
the Arduino. As you can see, the years 2007 and 2008 saw the introduction of the
LilyPad; the small form-factor boards like the Nano, Mini, and Mini Pro; and the
introduction of the Duemilanove as a natural evolutionary step based on the Dieci‐
mila. While there are no significant physical differences between the Diecimila and
the Duemilanove, the Duemilanove incorporates some refinements in the power sup‐
ply, most notably in its automatic switchover between USB power and an external DC
(direct current) power supply. Later versions of the Duemilanove also utilize the
ATmega328 MCU, which provides more memory for programs.
Table 1-1 doesn’t include the Arduino Robot, which is a PCB with motors and wheels
attached. One of the newest boards in the Arduino lineup is the Yún, an interesting
beast that has both an ATmega32U4 microcontroller and a Linino module with an
Atheros AR9331 MIPS-based processor capable of running a version of the Linux-
based OpenWrt operating system. I won’t get into the OpenWrt end of the Yún, but
the Arduino side is basically just a standard Arduino (a Leonardo, to be specific). If
you want to learn more about the Yún, I would suggest checking it out on the Ardu‐
ino website.
Table 1-1. Timeline of Arduino products
Board name Year Microcontroller Board name Year Microcontroller
Diecimila 2007 ATmega168V Mega 2560 2010 ATmega2560
LilyPad 2007 ATmega168V/ATmega328V Uno 2010 ATmega328P
Nano 2008 ATmega328/ATmega168 Ethernet 2011 ATmega328
Mini 2008 ATmega168 Mega ADK 2011 ATmega2560
Mini Pro 2008 ATmega328 Leonardo 2012 ATmega32U4
Duemilanove 2008 ATmega168/ATmega328 Esplora 2012 ATmega32U4
Mega 2009 ATmega1280 Micro 2012 ATmega32U4
Fio 2010 ATmega328P Yún 2013 ATmega32U4 + Linino
When more than one microcontroller type is shown in Table 1-1, it indicates that a
particular version of an Arduino board was made initially with one microcontroller,
and later with the other (usually more capable) device. For example, an older version
of the Duemilanove will have an ATmega168, whereas newer models have the
ATmega328. Functionally the ATmega168 and the ATmega328 are identical, but the
ATmega328 has more internal memory.
The latest additions to the Arduino family, the Leonardo, Esplora, Micro, and Yún, all
use the ATmega32U4. While this part is similar to an ATmega328 it also incorporates
an integrated USB-to-serial interface component, which eliminates one of the integra‐
ted circuit (IC) parts found on boards like the Uno and Duemilanove.
Types of Arduino Devices | 3
The programming interface also behaves slightly differently with the boards that
use the ATmega32U4, but for most people this should be largely transparent. Chapter
2 describes the general functionality of AVR microcontrollers, Chapter 3 contains
descriptions of the specific AVR MCU types found in Arduino devices, and Chapter 4
provides descriptions of the primary Arduino circuit boards and their pinout defini‐
tions.
Arduino Galleries
Tables 1-1 through 1-5 show some of the various types of Arduino boards, both past
and present. It is not completely inclusive, since new types and updates to existing
types occur periodically. The following images show the wide diversity in physical
shapes and intended applications of the Arduino.
Physically, an Arduino is not a large circuit board. The baseline boards, which have
the physical pin arrangement commonly used for add-on boards (called shields,
described in Chapter 8), are about 2.1 by 2.7 inches (53.3 by 68.6 mm) in size.
Figure 1-1 shows a selection of Arduino boards with a ruler for scale, and Figure 1-2
shows a Nano mounted on a solderless breadboard.
Figure 1-1. Relative sizes of Arduino boards
Chapter 4 contains reference drawings with dimensions and pin definitions for most
of the common Arduino boards. Note that while it is small, a board like the Nano has
all of the same capabilities as a Duemilanove, except for the convenient pin sockets
and regular (type B) USB connector. It is ideal for applications where it will not be
disturbed once it is installed, and where small size is a requirement. Some applica‐
tions that come to mind are autonomous environmental data collection devices
4 | Chapter 1: The Arduino Family
(automated solar-powered weather data stations or ocean data collection buoys, for
example), timing and data collection for model rockets, security systems, and perhaps
even a “smart” coffee maker.
Figure 1-2. An Arduino Nano on a solderless breadboard
Table 1-2. Baseline layout of Arduino boards
Type Year introduced
Diecimila 2007
Duemilanove 2008
Uno (R3 version) 2010
Arduino Galleries | 5
Type Year introduced
Ethernet 2011
Leonardo 2012
Table 1-3. Mega layout of Arduino boards
Type Year introduced
Mega 2009
Mega 2560 2009
Mega ADK 2011
Table 1-4. Small form factor Arduino boards
Type Year introduced
Nano 2008
Mini 2008
Fio 2010
Micro 2012
6 | Chapter 1: The Arduino Family
Table 1-5. Special form factor Arduino boards
Type Year introduced
LilyPad 2007
Esplora 2012`
Arduino-Compatible Devices
In addition to the various board types designed or sanctioned by Arduino.cc, there
are many devices that are either hardware compatible or software compatible. What
makes these devices Arduino compatible is that they incorporate the Arduino boot‐
loader (or something that works like it), and they can be programmed with the Ardu‐
ino IDE by selecting the appropriate compatible Arduino board type from the IDE’s
drop-down list.
Hardware-Compatible Devices
An Arduino hardware–compatible device is one where the various I/O pins on the
board have been arranged to match one of the existing Arduino form factors. A
hardware-compatible board can (usually) accept any of the shields and plug-in mod‐
ules created for an official Arduino board. The reasons behind this are covered in
“The Arduino Naming Convention” on page 9.
In most cases hardware-compatible boards look like any other Arduino board, except
that the official Arduino logo and silkscreen graphics are missing. Other hardware-
compatible products might not look anything like a typical Arduino board, but do
provide the pin sockets in the correct arrangement for using a standard Arduino-type
shield board. Some hardware-compatible products include additional connections,
like the SainSmart version of the Uno with additional connectors for I/O functions.
Table 1-6 lists a few Arduino clones and compatible boards that are available. There
are many more than what is shown here, but this should give some idea of what
is available.
Arduino-Compatible Devices | 7
Table 1-6. Arduino hardware–compatible devices
Name Type Origin
SainSmart UNO Uno clone China
SainSmart Mega2560 Mega 2560 clone China
Brasuino Similar to the Uno,
with minor changes
Brazil
Diavolino An Arduino layout–compatible
clone kit
USA
Note that Diavolino is a kit and requires assembly.
Software-Compatible Devices
There are many Arduino software–compatible boards available. These utilize the
Arduino bootloader and development environment, but do not have a completely
Arduino-compatible physical form factor. Software-compatible devices can be pro‐
grammed with the Arduino development tools, but may use a different arrangement
of I/O pins, or perhaps use some other types of connectors in place of the pin sockets
found on stock Arduino boards. Custom circuits based on an AVR microcontroller
and built into some larger device or system would fall into the software-compatible
category if the Arduino bootloader is installed in the microcontroller.
The core of the Arduino is the processor and the preinstalled bootloader. Using that
definition, one could have just a bare ATmega AVR IC with the Arduino firmware
loaded into it. It could then be used with a solderless breadboard and the Arduino
development environment. AVR MCU ICs with preloaded bootloader code are avail‐
able for purchase from multiple sources, or you could do it yourself. Chapter 5
describes the steps necessary to load an AVR MCU with the Arduino bootloader
firmware.
8 | Chapter 1: The Arduino Family
It is interesting to note that some of the boards from Arduino, such as the Mini,
Micro, Nano, LilyPad, and Esplora, are not hardware compatible in terms of using the
“standard” I/O connector layout. They can’t be used directly with a conventional
shield, but they are still Arduino boards, and they are supported by the Arduino IDE.
The Boarduino from Adafruit Industries is one example of an Arduino software–
compatible device. This board is designed to mount on a standard solderless bread‐
board much like a full-size 40-pin IC. It is available in two styles: DC and USB. The
DC version does not have an on-board USB chip, so an external USB adapter is
needed to program it. Another example of a software-compatible board is the Drag‐
onfly from Circuit Monkey, which uses standard Molex-type connectors instead of
the pins and sockets used on a conventional Arduino. It is intended for high-
vibration environments, such as unmanned aerial vehicles (UAVs) and robotics.
The Raspduino is designed to mount onto a Raspberry Pi board, and it is functionally
equivalent to an Arduino Leonardo. This results in a combination that is roughly
equivalent to the Yún, but not exactly the same. Each setup has its own strengths and
weaknesses. Table 1-7 lists a few Arduino software–compatible boards.
Table 1-7. Arduino software–compatible devices
Name Description Origin
Boarduino DC Designed to fit on a solderless breadboard USA
Boarduino USB Designed to fit on a solderless breadboard USA
Dragonfly Uses Molex-type connectors for I/O USA
Raspduino Designed to fit on a Raspberry Pi board Netherlands
This is just a small selection of the various boards that are available. Because the AVR
microcontroller is easy to integrate into a design, it has found its way into numerous
applications. With the Arduino bootloader firmware, programming a device is greatly
simplified and the design possibilities are vast.
The Arduino Naming Convention
While the circuit design and software for the Arduino are open source, the Arduino
team has reserved the use of the term “Arduino” for its own designs, and the Arduino
The Arduino Naming Convention | 9
logo is trademarked. For this reason you will sometimes find things that behave and
look like official Arduino devices, but which are not branded Arduino and have not
been produced by the Arduino team. Some of them use “-duino” or “-ino” as part of
the product name, such as Freeduino, Funduino, Diavolino, Youduino, and so on.
Some, like the boards made by SainSmart, use just the model name (Uno and
Mega2560, for example).
At the time of this writing, there was an ongoing dispute between
the company created by the original founders (Arduino LLC) and a
different company started by one of the original founders (Arduino
SRL). As a result, Arduino LLC uses the trademark Arduino within
the United States and Genuino elsewhere.
Occasionally someone will produce a board that claims to be an Arduino, but is in
fact just a copy that uses the Arduino trademark without permission. The silkscreen
mask used to put the logo and other information on an official Arduino is also copy‐
righted, and the Arduino folks don’t release the silkscreen with the PCB layout files.
Massimo Banzi has a section of his blog devoted specifically to these unauthorized
boards, and his examination of blatant and shameless copies is interesting, to say the
least. Just search for the “hall of shame” tag.
The bottom line here is that you are welcome to copy the schematics, the bootloader
code, and the Arduino IDE, and use these to create your own version of an Arduino.
It is, after all, open source. Just don’t call it an Arduino or use the artwork from Ardu‐
ino.cc without permission.
What Can You Do with an Arduino?
In addition to the ease of programming made possible by the Arduino IDE, the other
big feature of the Arduino is the power and capability of the AVR microcontroller it is
based on. With a handful of readily available add-on shields (described in Chapter 8)
and a wide selection of low-cost sensor and actuator modules (these are described in
detail in Chapter 9), there really isn’t a whole lot you can’t do with an Arduino pro‐
vided that you keep a few basic constraints in mind.
The first constraint is memory. The AVR MCU just doesn’t have a whole lot of mem‐
ory available for program storage and variables, and many of the AVR parts don’t
have any way to add more. That being said, the ATmega32 and ATmega128 types can
use external memory, but then the I/O functions for those pins are no longer readily
available. Arduino boards were not designed to accommodate external memory, since
one of the basic design assumptions was that the AVR chip itself would have the nec‐
essary I/O and that the user would be running a relatively short program. The Ardu‐
ino was not intended to be a replacement for a full-on computer system with
10 | Chapter 1: The Arduino Family
gigabytes of RAM and a hard disk drive (HDD). There are inexpensive Intel-based
single-board computers that fit that description, but they won’t fit into an old mint
tin, a section of PVC tubing strapped to a pole or a tree, a small robot, or the payload
section of a model rocket. An Arduino will.
The second constraint is speed. The Arduino CPU clock rate is typically between 8
and 20 MHz (see Chapter 4 for a detailed comparison of Arduino AVR device types).
While this may sound slow, you should bear in mind two key facts: first, the AVR is a
very efficient RISC (reduced instruction set computer) design, and second, things in
the real world generally don’t happen very quickly from a microcontroller’s perspec‐
tive. For example, how often does a so-called smart thermostat need to sample the
temperature in a home or office? Once a second is probably overkill, and once every 5
or even 10 seconds will work just fine. How often does a robot need to emit an ultra‐
sonic pulse to determine if there is an obstacle ahead? A pulse every 100 ms is proba‐
bly more than enough (unless the robot is moving very, very fast). So, for an Arduino
running at 16 MHz (like the Leonardo, for example), there will be on the order of
1,000,000 or more CPU clock ticks between sensor pulses, depending on whatever
else the CPU is doing with the pulses. Given that an AVR can execute many instruc‐
tions in one or two clock cycles, that’s a lot of available CPU activity in between each
pulse of the ultrasonic sensor.
The third main constraint is electrical power. Since the Arduino hardware is actually
nothing more than a PCB for an AVR IC to sit on, there is no buffering between the
microcontroller and the external world. You can perform a fast “charcoal conversion”
of an AVR (in other words, overheat the IC and destroy it) if some care isn’t taken to
make sure that you aren’t sourcing or sinking more current than the device can han‐
dle. Voltage is also something to consider, since some of the AVR types have 3.3V I/O,
whereas others are 5V tolerant. Connecting 5V transistor-transistor logic (TTL) to a
3.3V device usually results in unhappy hardware, and the potential for some smoke.
With the preceding constraints in mind, here are just a few possible applications for
an Arduino:
• Real-world monitoring
— Automated weather station
— Lightning detector
— Sun tracking for solar panels
— Background radiation monitor
— Automatic wildlife detector
— Home or business security system
• Small-scale control
— Small robots
What Can You Do with an Arduino? | 11
— Model rockets
— Model aircraft
— Quadrotor UAVs
— Simple CNC for small machine tools
• Small-scale automation
— Automated greenhouse
— Automated aquarium
— Laboratory sample shuttle robot
— Precision thermal chamber
— Automated electronic test system
• Performance art
— Dynamic lighting control
— Dynamic sound control
— Kinematic structures
— Audience-responsive artwork
In Chapters 11, 12, and 13 we will look at applications such as a smart thermostat, a
programmable signal generator, and an automated rocket launch control system to
help fulfill your suborbital yearnings. These are just the tip of the iceberg. The possi‐
bilities are vast, and are limited only by your imagination. So long as you don’t try to
make an Arduino do the job of a full-on computer system, you can integrate one into
all sorts of interesting applications—which is exactly what the folks at Arduino.cc
want you to do with it.
For More Information
The boards listed in this chapter are just a small selection of what is available, and
there is much more to the story of the Arduino. Entering “Arduino” into Google’s
search bar will produce thousands of references to explore.
The official Arduino website can be found at http://www.arduino.cc.
Massimo Banzi’s blog is located at http://www.massimobanzi.com.
Also, check the appendixes for more website links and book recommendations.
12 | Chapter 1: The Arduino Family
CHAPTER 2
The AVR Microcontroller
Because an AVR-based Arduino is really just a physical platform for an AVR micro‐
controller (i.e., a breakout board), the electrical characteristics of an Arduino are
essentially those of the AVR device on the PCB. Understanding the low-level details
of an Arduino is really a matter of understanding the AVR device that powers it.
To that end, this chapter presents broadly applicable material consisting of high-level
descriptions of the main functions utilized in the AVR family. This includes the AVR
CPU and the so-called peripheral functions such as timers, counters, serial interface
logic, analog-to-digital (A/D) converters, analog comparators, and discrete digital I/O
ports.
AVR microcontrollers are available in a wide variety of configurations and package
types, which makes writing a chapter like this something of a challenge. Fortunately,
the various types of 8-bit AVR devices use a common central processing unit (CPU)
and a modular internal architecture built around an internal data bus. This allows for
each variant to incorporate different combinations and quantities of functional mod‐
ules into the AVR’s internal circuitry to meet specific design requirements and sup‐
port different intended applications.
Due to practical limitations of space, the descriptions in this chapter are necessarily
terse and focused on the essential characteristics, and don’t provide may of the low-
level details that can be found in the reference documentation available from Atmel.
If you need or want to know the logic circuit and register-level details of what’s inside
a particular AVR microcontroller, datasheets, user’s guides, and application notes are
available from Atmel free of charge.
13
Background
The AVR microcontroller began life in the early 1990s as a student project at the Nor‐
wegian Institute of Technology. Two students, Alf-Egil Bogen and Vegard Wollan,
devised an 8-bit device with a RISC-type internal architecture while working at a
local semiconductor facility in Trondheim, Norway. The design was later sold to
Atmel, where Bogen and Wollan continued to work on it and refine it.
The AVR microcontrollers are highly configurable and very versatile, and they
embody several unique features that set them apart from other 8-bit microcontrollers
like the 8051 or 68HC05 components. The AVR is a modified Harvard architecture 8-
bit RISC microcontroller. In a Harvard architecture read-only program, code and
modifiable data (variables) are stored in separate memory spaces. By way of compari‐
son, a microprocessor like the 68040 uses the Von Neumann architecture, in which
programs and data share the same memory space.
The AVR family of devices was one of the first to incorporate on-board flash memory
for program storage, instead of the one-time programmable ROM (read-only mem‐
ory), EPROM (erasable programmable read-only memory), or EEPROM (electrically
erasable programmable read-only memory) found on other microcontrollers. This
makes reprogramming an AVR microcontroller simply a matter of loading new pro‐
gram code into the device’s internal flash memory. Most AVR parts do have a small
amount of EEPROM for storing things like operating parameters that must persist
between changes in the flash memory.
Internal Architecture
Internally, an AVR ATmega microcontroller consists of an AVR CPU and various
input/output, timing, analog-to-digital conversion, counter/timer, and serial interface
functions, along with other functions depending on the part number. These are
referred to by Atmel as peripheral functions. Besides the I/O functions, the main
differences between the AVR microcontroller types lie in the amount of on-board
flash memory and available I/O functions. The 8-bit parts all use essentially the same
AVR CPU core. The following list shows just some of the basic features of AVR
microcontrollers:
• RISC architecture
— 131 instructions
— 32 8-bit general-purpose registers
— Up to 20 MHz clock rate (20 MIPS operation)
• On-board memory
— Flash program memory (up to 256K)
14 | Chapter 2: The AVR Microcontroller
— On-board EEPROM (up to 4K)
— Internal SRAM (up to 32K)
• Operating voltage
— VCC = 1.8 to 5.5V DC
Figure 2-1 shows a simplified block diagram of the AVR CPU core found on 8-bit
AVR devices. Figure 2-2 shows a generic high-level block diagram of an AVR device.
This is not intended to represent any specific AVR device, just an AVR in general.
Figure 2-1. AVR CPU block diagram
Internal Architecture | 15
The peripheral functions are controlled by the CPU via an internal high-speed data
bus. Control registers (separate from the CPU registers) are used to configure the
operation of the peripherals. All peripheral functions share port pins with the discrete
digital I/O capabilities.
Figure 2-2. Generic AVR microcontroller block diagram
16 | Chapter 2: The AVR Microcontroller
Atmel makes many different types of AVR microcontrollers, which allows hardware
designers to pick the part that meets their specific needs and reduce the number of
unused pins and wasted space on a printed circuit board. Some, like the tinyAVR
parts, come in small surface-mount packages with as few as six pins. Each has one or
more discrete digital I/O ports, which can be programmed to perform multiple func‐
tions (see “Peripheral Functions” on page 17).
For example, the ATTINY13-20SQ comes in an eight-pin DIP (dual in-line pin) or
SOIC (small-outline IC) surface-mount package. Six of the device’s pins are connec‐
ted to an internal 8-bit I/O port (port B). The other two are VCC (power) and
ground. The six port B pins can be configured as analog inputs, oscillator outputs,
interrupt inputs, SPI signals, or discrete digital inputs or outputs. Internally, the
device—even one this small—is still an AVR microcontroller, and it has 1K of built-in
flash memory for programs, and 64 bytes of RAM for variables.
On the other end of the spectrum there are AVR parts like the ATmega649, with nine
8-bit ports (A through J, but no I, since I can be confused for the numeral 1), 64K of
flash memory, 4K of RAM, 2K of EEPROM, 54 general-purpose I/O pins, and an
integrated LCD interface. The AVR32 series of parts are 32-bit AVR processors with
up to 256K of flash memory, 32K of RAM, an integrated DSP (digital signal process‐
ing) unit, protected memory, and 36 general-purpose I/O pins.
No Arduino boards use an AVR part as small as a tinyAVR (it would be a real chal‐
lenge to squeeze the Arduino bootloader into something with only 1K of flash and
still have room left for a useful program), or anything like the ATmega649 or an
AVR32, but the point here is that the AVR family offers many choices, and the parts
that have been selected for use in Arduino devices aren’t the only AVR parts that
could be used.
Internal Memory
AVR devices all contain various amounts of three types of memory: flash, SRAM
(static random-access memory), and EEPROM. The flash memory is used to store
program code, the SRAM is used to hold transient data such as program variables
and the stack, and the EEPROM can hold data that needs to persist between software
changes and power cycles. The flash and EEPROM can be loaded externally, and both
will retain their contents when the AVR is powered off. The SRAM is volatile, and its
contents will be lost when the AVR loses power.
Peripheral Functions
The heart of an AVR microcontroller is the 8-bit CPU, but what makes it a truly use‐
ful microcontroller is the built-in peripheral functions integrated into the IC with the
CPU logic. The peripheral functions of an AVR device vary from one type to another.
Internal Memory | 17
Some have one timer, some have two or more (up to six for some types). Other parts
may have a 10-bit A/D converter (ADC), whereas others feature a 12-bit converter.
All AVR parts provide bidirectional I/O pins for discrete digital signals. Some ver‐
sions also support a touchscreen and other types of interactive interfaces.
This section contains general descriptions of the peripheral functions that are used
with the various types of AVR devices found in Arduino products, with the
ATmega168 serving as a baseline example. This section does not attempt to provide
an exhaustive reference for each type of AVR microcontroller, but instead covers the
general functionality of each type of peripheral function. Refer to Chapter 3 for spe‐
cific information regarding the processors used in the Arduino boards described in
this book, and also see the Atmel technical documentation for low-level details not
provided here.
Control Registers
In addition to 32 general-purpose registers in the CPU, AVR devices also have a num‐
ber of control registers that determine how the I/O ports, timers, communications
interfaces, and other features will behave. The control register set will vary from one
type of device to another, since different types may have more or less ports than
others, and different peripheral function configurations. The control registers for
the AVR parts used in the Arduino boards covered in this book can be found in
Appendix B. They are also described in detail in the documentation available directly
from Atmel.
Even a modest AVR part like the ATmega168 has far more internal functionality than
it has pins available to dedicate to each function. For this reason, most of the pins on
an AVR microcontroller can be configured to perform specific functions based on the
settings contained in the control registers. Because the pin functions are dynamically
configurable, it is possible to have a pin perform one type of function at one point
in time, and then perform a different function once the control register value has
been modified.
For example, pin 12 of an ATmega168 in a 28-pin DIP package is connected to PD6
(Port D, bit 6), but it can also be configured to act as an interrupt source (PCINT22),
as the positive input for the AVR’s internal analog comparator (AIN0), or as the out‐
put of a timer comparison logic circuit (the Timer/Counter0 output compare match
A), which can be used to generate a PWM (pulse width modulation) signal.
Digital I/O Ports
AVR microcontrollers use bidirectional I/O ports to communicate with the external
world. A port is an 8-bit register wherein some or all of the bits are connected to
physical pins on the AVR device package. Different types of AVR devices have differ‐
18 | Chapter 2: The AVR Microcontroller
ent numbers of ports, ranging from one for the ATTINY13-20SQ up to nine for the
ATmega649. Ports are labeled as A, B, C, and so on.
Each pin of a port is controlled by internal logic that manages the signal direction, the
state of an internal pull-up resistor, timing, and other functions. A simplified sche‐
matic is shown in Figure 2-3. The Px in Figure 2-3 refers to port bit/pin x (0 through
7). For a detailed description of the AVR port logic, see the AVR technical references.
Figure 2-3. AVR I/O port block diagram
Because of the sophisticated logic used to control functionality, an AVR port can per‐
form many different functions—some of them simultaneously. When a port is config‐
ured as an output it is still possible to read data from it, and an output can be used to
trigger an interrupt (discussed in “Interrupts” on page 26).
8-Bit Timer/Counters
There are two forms of 8-bit timer/counter available in AVR microcontrollers. In the
first type the clock input is derived from the primary system clock, and hence the
timer/counter is synchronous. The second form has the ability to operate in an asyn‐
chronous mode using an external clock source. Figure 2-4 shows a simplified sche‐
Peripheral Functions | 19
matic of an AVR timer. The control registers for the timer/counter are defined in
Appendix B and described in detail in the Atmel technical documentation.
Figure 2-4. AVR timer/counter block diagram
The Timer/Counter0 module in an AVR 8-bit timer/counter peripheral function is a
general-purpose timer and/or counter that features two independent output compari‐
son circuits with four modes of operation. The timer/counter modes of operation are
as follows:
Normal mode
This is the simplest mode of timer/counter operation. The count always incre‐
ments and no counter clear is performed when the counter reaches its maximum
8-bit value. When this occurs, the counter overflows and returns to zero. When
the counter wraps back to zero, the Timer/Counter Overflow Flag (TOV0) is set.
The TOV0 flag can be viewed as a ninth bit, but it is only set, not cleared, by a
timer overflow. The timer overflow interrupt will automatically clear the over‐
flow flag bit, and the interrupt can be used to increment a second software-based
counter in memory. A new counter value can be written to the TCNT0 register at
any time.
Clear Timer on Compare (CTC) mode
In the Clear Timer on Compare mode, the OCR0A register is used to manipulate
the counter resolution by defining the maximum value of the counter. This
results in greater control of the compare match output frequency and helps to
simplify external event counting.
20 | Chapter 2: The AVR Microcontroller
Fast PWM mode
The fast pulse width modulation mode supports high-frequency PWM waveform
generation.
Phase correct PWM mode
The phase correct PWM mode provides a high-resolution phase correct PWM
waveform generation option.
In addition, some AVR devices contain an 8-bit timer/counter with the ability to
operate asynchronously using external clock inputs (the TOSC1 and TOSC2 clock
input pins). It is functionally equivalent to the synchronous 8-bit timer/counter cir‐
cuit described previously.
16-Bit Timer/Counters
The 16-bit timer/counter is similar to the 8-bit version, but with an extended count
range. It is true 16-bit logic, which allows for 16-bit variable period PWM generation.
The module also features two independent output comparison circuits, double-
buffered output comparison registers, and an input capture circuit with noise cancel‐
ing. In addition to PWM generation the 16-bit timer/counter can be used for high-
resolution external event capture, frequency generation, and signal timing
measurement. It has the ability to generate four different interrupts (TOV1, OCF1A,
OCF1B, and ICF1).
Timer/Counter Prescaler
In an AVR device one or more counters may share the same prescaler logic, but with
different settings. The prescaler is essentially a divider circuit that generates a deriva‐
tive of the system I/O clock at f/8, f/64, f/256, or f/1024, which are referred to as taps.
One timer/counter might use the f/64 tap, whereas another might use the f/1024 tap.
The use of a prescaler allows the range of a timer/counter to be extended to more
closely match the rate at which an external event occurs, and also increases the time
in between timer/counter overflows and resets.
Analog Comparator
The analog comparator section of an AVR microcontroller is used to compare the
input voltages on the AIN0 and AIN1 pins. Although AIN0 is defined as the positive
input and AIN1 as the negative, this refers to the relationship between them, not the
actual polarity of the input voltages. Figure 2-5 shows a simplified schematic of the
analog comparator circuit of an AVR.
Analog Comparator | 21
Figure 2-5. AVR analog comparator block diagram
When AIN0 is greater than AIN1, the comparator logic sets the comparator flag
ACO. The output of the comparator can be configured to trigger the input capture
function of one of the timer/counter modules, and it can also generate an interrupt
specific to the comparator. The interrupt event can be configured to trigger on com‐
parator output rise, fall, or toggle.
The analog comparator circuit can do more than just compare the voltages on the
AIN0 and AIN1 inputs. The input of the analog comparator may also be configured
such that the AIN1 input can be compared to the internal bandgap reference voltage,
or AIN0 can be compared to the output of the ADC multiplexer (and this voltage is
still available to the input of the ADC). The unusual symbols with four arrows are
analog gates. How a gate will respond to a control input is indicated by the inversion
circle—when the inverting control input is used it will pass an analog signal when the
control is low, and otherwise it will pass a signal when it is high.
Analog-to-Digital Converter
Most AVR microcontrollers contain an 8-bit, 10-bit, or 12-bit analog-to-digital con‐
verter. The 8-bit converters are found in the ATtiny6 and ATtiny10 parts. Some of the
automotive versions of AVR microcontrollers have no ADC.
When an ADC is part of the AVR design, it will have anywhere from 4 to 28 inputs.
The actual number of available inputs depends largely on the physical package. Each
input is selected one at a time via an internal multiplexer—they are not all active
22 | Chapter 2: The AVR Microcontroller
simultaneously. In addition, some of the I/O pins used by the ADC input multiplexer
may also be assigned to other functions.
ATmega168 devices have either six or eight ADC input channels, depending on the
package type. The PDIP (plastic DIP) package has a 10-bit ADC with six input chan‐
nels. The TQFP and QFN/MFL surface-mount packages have a 10-bit ADC with
eight input channels. Figure 2-6 shows a block diagram of the AVR ADC peripheral
function.
Figure 2-6. AVR analog-to-digital converter block diagram
Analog-to-Digital Converter | 23
Notice in Figure 2-6 that the AVR employs what is called a “successive approxima‐
tion” converter. This type of converter isn’t particularly fast, but it is simple to imple‐
ment, requiring only a DAC (digital-to-analog converter) and a comparator. The
typical conversion time for a 10-bit AVR ADC in free-running mode, while still
maintaining full resolution, is around 65 microseconds (µs) per sample.
Serial I/O
The ATmega168 provides three primary forms of serial interface: synchronous/asyn‐
chronous serial, SPI master/slave synchronous, and a byte-oriented two-wire inter‐
face similar to the Philips I2C (Inter-Integrated Circuit) standard.
USART
A common component of many AVR parts is a built-in USART (universal synchro‐
nous/asynchronous receiver-transmitter), also referred to as a UART (universal asyn‐
chronous receiver-transmitter). This function can be used to implement an RS-232 or
RS-485 interface, or used without external interface logic for chip-to-chip communi‐
cations. The baud rate is determined by the frequency of the clock used with the
microcontroller, with 9,600 being a typical speed. Higher rates are possible with a fast
external crystal. The USART can also be used in SPI (serial peripheral interface)
mode, in addition to the dedicated SPI logic found in AVR devices. Figure 2-7 shows
the basic internal components of the AVR USART peripheral function.
Figure 2-7. AVR USART block diagram
24 | Chapter 2: The AVR Microcontroller
1 Master out, slave in; master in, slave out; and serial clock.
SPI
The SPI peripheral logic of the AVR supports all four standard SPI modes of opera‐
tion. I/O pins on the AVR device may be configured to act as the MOSI, MISO, and
SCK1
signals used by SPI. These pins are different from the RxD and TxD (recieve
data and transmit data) pins used by the USART. Figure 2-8 shows a high-level view
of the SPI logic.
Figure 2-8. AVR SPI block diagram
TWI
The third form of serial I/O supported by many AVR devices is the two-wire interface
(TWI). This interface is compatible with the Philips I2C protocol. It supports both
master and slave modes of operation, and a 7-bit device address. The TWI interface
can achieve transfer speeds of up to 400 kHz with multimaster bus arbitration and
has the ability to generate a wakeup condition when the AVR is in sleep mode. Inter‐
Serial I/O | 25
nally, the TWI peripheral is rather complex—much more so than either the USART
or SPI peripherals. Figure 2-9 shows an overview of the TWI interface.
Figure 2-9. AVR TWI (I2C) block diagram
Interrupts
Interrupts are an essential function of a modern processor. They allow the processor
to respond to events, either internal or external, by switching to a special block of
interrupt handler code to deal with the interrupt. Once the block of code has been
executed, control returns to the program that was interrupted at the place where the
interrupt occurred. In the AVR an interrupt response may be enabled or disabled via
26 | Chapter 2: The AVR Microcontroller
Exploring the Variety of Random
Documents with Different Content
CHAPTER VI.
JEWISH APOSTATES AND THE DISPUTATION
AT TORTOSA.
The Marranos—The Satirists—Pero Ferrus of Alcala, Diego de
Valencia, and Villasandino—Astruc Raimuch and Solomon
Bonfed—Paul de Santa Maria and his Zealous Campaign
against the Jews—Joshua Ibn-Vives—Profiat Duran
(Efodi)—Meïr Alguades—The Philosophy of Crescas—
Death of Henry III of Castile and Unfavorable Change in
the Position of the Jews—Messianic Dreams of the
Kabbalists—Jews seek an Asylum in Northern Africa—
Simon Duran—Geronimo de Santa Fé, Vincent Ferrer and
Benedict XIII—Anti-Jewish Edict of Juan II—Special
Jewish Costume—Conversion of Jews owing to Ferrer's
Violent Efforts—Disputation at Tortosa—The Jewish
Spokesmen at the Conference—Incidents of the Meeting
—Geronimo instigates the Publication of a Bull for the
Burning of the Talmud—Pope Martin V befriends the
Jews.
1391–1420 C.E.
The baptized Jews who had abandoned their faith during the
terrible persecution of 1391 became a source of considerable trouble
to their Spanish brethren. They had embraced the cross only to save
their lives, or the lives of those dear to them; for, surely, they had
found no convincing demonstration of the truth of the Christian
religion in the violence of its missionaries, or in the death agonies of
their brethren in race who had perished rather than apostatize.
Dazed and broken-hearted, these forced converts (Anusim) to
Christianity felt more intense antipathy to their new religion than
when they had been openly opposed to it. It was natural for them to
resolve to take the first opportunity of casting away their disguise,
and returning to Judaism with increased zeal. Many of these new
Christians emigrated to the neighboring Moorish countries; to
Granada or across the straits to Morocco, Tunis, or Fez, where the
people, wiser and more tolerant than Christian Europe, gladly
opened their doors to a wealthy and industrious race. The majority,
unable to leave Spanish territory, yet averse to wholly discarding
their ancient faith, joined in Jewish ceremonies and celebrations
whilst outwardly appearing Christians. The kings of Castile, Aragon
and Majorca, who had disapproved of conversions by mob violence,
allowed the Jews to do as they pleased. The authorities either did
not or would not see their relapse into Judaism, and the Inquisition
had not yet been established in Spain. These forced converts
gradually formed themselves into a peculiar class, outwardly
Christians, at heart Jews. By the populace, who nicknamed them
Marranos, or "The Damned," they were regarded with more distrust
and hatred than the openly observant Jews, not because of their
secret fidelity to Judaism, but on account of their descent and inborn
intelligence, energy, and skill. Baptized Jews, who had been glad to
disencumber themselves of their Judaism, shared in these feelings of
aversion. They were the worldlings who valued wealth, rank, and
luxury above religion, or the over-educated whose philosophy had
led them to skepticism, and whose selfishness induced them to
welcome a change which brought them out of the narrow confines
of a small community, and opened up a wider world to them. Their
hearts had never been with Judaism, and they had adhered to it
only out of respect or a certain compunction. To them, forced
baptism was a relief from chafing fetters, a welcome coercion to
overcome scruples which had always sat lightly upon them. For their
own advantage they simulated devotion to Christianity, but were on
that account neither better nor more religious men. The
unscrupulous among them found special pleasure in the persecution
of their former religion and its followers. To gratify their malice, they
brought charges against rabbis and other representative Jews, or
any member of the community, thus endangering the existence of
the whole body of Jews in the country. It was bad enough that the
latter had been robbed of so many able and learned men—
physicians, authors, poets—and that the church had been enriched
by their wealth and intelligence; but these very forces were used to
inflict further mischief on the Jews that had remained steadfast.
Knowing the faults of their former brethren, the converts could easily
attack them. Don Pero Ferrus, a baptized Jew, made the community
and rabbis of Alcala the target for his ridicule. In a poem he
represents himself exhausted from want of sleep finding repose at
last in the synagogue of this town, when suddenly he is disturbed,
and scared away without mercy by "Jews with long beards and
slovenly garments come thither for early morning prayer." A sharp
rejoinder to this effort of Ferrus' "buffoon tongue" was put forth by a
Jewish poet in the name of the Alcala community. Spanish poetry
reaped considerable advantage from these passages at arms. Verse,
up to that period starched, solemn, and stately as the punctilious
ceremonial of the Madrid court, in the hands of Judæo-Christian
satirists acquired the flexibility, wit and merriment of neo-Hebraic
poetry at its best. This tone and style were gradually adopted by
Christian poets, who borrowed expressions from Jewish writers to
give point to their epigrams. Not only the apostate, the monk, Diego
de Valencia, used Hebrew words in lampoons on the Jews, but the
same practice was adopted with surprising dexterity by the Christian
satirist, Alfonso Alvarez de Villasandino, the "poet prince" of his day.
A malicious critic might have been inclined to say that Spanish
poetry was in process of being Judaized.
A few of the new-Christians showed as active a zeal in the
propagation of Christianity as if they had been born Dominicans, or
as if they felt isolated in their new faith among the old Christians,
and yearned for the companionship of their former friends. A newly-
baptized physician, Astruc Raimuch, of Fraga, who, as a Jew, had
been a pillar of orthodoxy, exerted himself to make converts, taking
to himself the name of Francisco God-flesh (Dios-Carne). He spread
his snares particularly with a view to entrapping one of his young
friends. A fluent writer of Hebrew, Astruc-Francisco drew up a letter
in that language, dwelling on the decline of Judaism and
enthusiastically propounding the dogmas of Christianity. His
applications of Biblical texts to the doctrines of the Trinity, Original
Sin, Redemption, and the Lord's Supper, appear almost droll in
Hebrew. His friend's answer was meek and evasive, every word
carefully weighed to avoid offending the delicate sensibilities of the
church and its zealous servants. More spirited was the reply of the
satirical poet, Solomon ben Reuben Bonfed, who in rhymed prose
set himself to confute Astruc-Francisco's arguments with unsparing
incisiveness. Apologizing in his introduction for interfering between
two friends, he proceeded to point out that as a Jew the questions
discussed concerned him nearly, whilst the misstatements made
rendered it impossible for him to remain silent. Solomon Bonfed
examined somewhat minutely the dogmas of the Incarnation,
Original Sin, and Transubstantiation, showing them to be irrational
and untenable. He justly said: "You twist and distort the Bible text to
establish the Trinity. Had you a Quaternity, you would demonstrate it
quite as strikingly and convincingly from the books of the Old
Testament."
Of all the Jews baptized in 1391, however, none inflicted so
much injury on his former brethren as Rabbi Solomon Levi of Burgos
(born 1351–1352, died 1435), who as a Christian rose to very
important ecclesiastical and political dignities under the name of Paul
Burgensis, or de Santa Maria. Previous to his change of creed he had
been a rabbi, and he was well versed in Biblical, Talmudical, and
Rabbinical literature. As a Jew he was extremely orthodox and
punctilious, passing in his own circle for a pillar of the faith. His
nature was, however, shrewd and calculating. Ambitious and vain to
the last degree, he soon began to regard as too narrow his sphere of
action within the walls of the college, which during a long period
counted him amongst its students and teachers. He longed for a life
of bustling activity. To obtain a state appointment, he sought access
to court, and began to live like a grandee, with equipage and horses
and numerous retinue. It was his ambition to become a Jewish
Almoxarif or even to obtain a higher appointment. His occupations
bringing him into daily contact with Christians, and frequently
involving him in religious controversies, he devoted some attention
to church literature, in order to be able to make a display of
learning. The massacres of 1391 dissipated his last hope of obtaining
high preferment as a Jew, and he consequently resolved, in his
fortieth year, to be baptized. To derive the best advantage from his
conversion, the new Christian, Paul de Santa Maria, caused it to be
understood that he had embraced Christianity willingly, as a result of
the convincing arguments put forth in the theological writings of the
schoolman Thomas Aquinas. The Jews received such protestations
with distrust. Knowing him well, they did not scruple to ascribe his
conversion to a craving for rank and power. After his change of
creed, his family, wife and sons, renounced him.
For a commoner, the only road to high office lay through the
church. Solomon-Paul knew this well, and at once proceeded to Paris
and attended the University, where he pursued theology. His
knowledge of Hebrew gave him a great advantage, and helped him
to distinguish himself. It was not long before the quondam rabbi
became a duly ordained Catholic priest. Then he betook himself to
the papal court at Avignon, where the haughty, obstinate, and
proselytizing cardinal, Pedro de Luna, reigned as anti-pope under the
title of Benedict XIII. Here, during the stormy church schism,
favorable opportunities for intrigue and personal advancement
presented themselves. Paul won the pope's favor by his shrewdness,
zeal, and eloquence. He was appointed archdeacon of Trevinjo and
canon of Seville, his first steps on the ladder of the Catholic
hierarchy. He abandoned himself to the most ambitious dreams: he
might become a bishop, a cardinal, and why not the pope? The
times were propitious. He boasted that he was descended from the
most ancient and the noblest branch of the Hebrew race, the tribe of
Levi, the same that had given birth to Mary, the mother of Jesus. He
was not an ordinary priest sprung from the people, but had
ancestors bound to be acknowledged and distinguished by the
church. On the recommendation of the pope, he was later on
overwhelmed with honors and favors by the king of Castile, Don
Henry III, and his ambition was satisfied.
The apostasy of so respected a rabbi as Solomon Burgensis not
only created the greatest astonishment among Jews, but filled them
with anxiety. Would this example not find imitators in a time of so
much trouble and temptation? Would it not bias waverers, or at least
encourage pretending Christians to persevere in the course begun?
The prevailing disquietude was increased when it was found that
after his own conversion Paul considered it his duty to convert his
former co-religionists. To this end he left no stone unturned. With
voice and pen he assailed Judaism, seeking his weapons in Jewish
literature itself. Not long after his conversion he addressed a letter to
his former acquaintance, Joseph (José) Orabuena, physician in
ordinary to King Charles III of Navarre, and chief rabbi of the
Navarrese communities, in which he stated that he acknowledged
and honored Jesus as the Messiah whose advent had been foretold
by the prophets, and invited Orabuena to follow his example. To
another chief rabbi, Don Meïr Alguades, physician in ordinary to the
Castilian king, Don Henry III, Paul de Santa Maria addressed a
Hebrew satire in prose and verse, in which he ridiculed the innocent
celebration of the Jewish feast of Purim. As if grudging the Jews the
moderate pleasures in which they indulged during this festival, he
exaggerated their love of drink, and boasted of his own sobriety.
Paul evinces in this satire considerable skill in handling the new-
Hebrew language, but, notwithstanding his opportunities, he exhibits
little wit.
As soon as he had acquired a position at the papal court at
Avignon, he devoted himself to calumniating the Jews with a view to
bringing about new persecutions. His purpose became so obvious
that the cardinal of Pampeluna himself, and other ecclesiastics,
ordered him to desist. It is true the Jews had to pay dearly for his
silence. He also intrigued against Chasdaï Crescas. So far did this
apostate carry his enmity to Judaism that he advised the king, Don
Henry III, to abstain from employing both Jews and new-Christians
in state offices. Did he wish to render impossible the rivalry of some
fellow-Hebrew, his superior in adroitness? In his writings Paul de
Santa Maria exhibited as much hatred of Judaism as of Jews. While
the Franciscan monk, Nicholas de Lyra, a born Christian, held up the
works of Jewish commentators like Rashi as models of simple
exegesis, the former rabbi found every observation of a Rabbinical
writer insipid, nonsensical, and scandalous. On the other hand, the
most ridiculous commentary of a church writer was to him a lofty,
unsurpassable work.
Thoughtful Jews were not slow to recognize their bitterest foe in
this new-Christian, and they prepared for a severe struggle with him,
notwithstanding that their choice of weapons was limited. Christians
were not only free to say what they pleased in demonstration and
defense of their doctrines, but could appeal to the summary
authority of the sword and the dungeon. Jews were forced to all
kinds of circumlocution and ambiguity to avoid provoking the
violence of their adversaries. The gallant stand of a mere handful of
Jews against power and arrogance should excite the admiration of
all whose sympathies are not with victorious tyranny, but with
struggling right.
The campaign against Paul de Santa Maria was opened by a
young man, Joshua ben Joseph Ibn-Vives of Lorca (Allorqui), a
physician and an Arabic scholar, who had formerly sat at the feet of
the renegade rabbi. In an humble epistle, as though a docile pupil
were addressing an illustrious master, Joshua Allorqui administered
many a delicate reproof to his apostate teacher, and at the same
time, by his naïve doubts, dealt destructive blows at the
fundamental doctrines of Christianity. He observes in his introduction
that the conversion of his beloved teacher had to him more than to
others been a source of astonishment and reflection, as his example
had been a main support of his own religious belief. He was at a loss
to conceive the motives of the sudden change. He could not think
that he had been led away by desire for worldly distinction, "for I
well remember," he says, "how, surrounded by riches and
attendants, thou didst yearn for thy former humble state with its life
of retirement and study, and how it was thy wont to speak of thy
high position as empty mockery of happiness." Nor could he suppose
that Paul's Jewish convictions had been disturbed by philosophic
doubt, as up to the moment of his baptism he had conscientiously
observed all the ceremonial laws, and had known how to
discriminate between the kernel of philosophic truth which
harmonizes with religion and the pernicious shell which so often
passes for the real teaching. Could it be that the sanguinary
persecution of the Jews had led him to doubt the possibility of the
enduring power of Judaism? But even this theory was untenable, for
Paul could not be unaware of the fact that only a minority of Jews
live under Christian rule, that the larger numbers sojourn in Asia,
and enjoy a certain degree of independence; so that if it pleased
God to allow the communities in Christian lands to be extirpated, the
Jewish race would not by any means disappear from the face of the
earth. There remained, continued Joshua Vives of Lorca, the
assumption that Paul had carefully studied Christianity, and had
come to the conclusion that its dogmas were well founded. He
begged him, therefore, to impart to him the convictions at which he
had arrived, and thus dissipate the doubts which he (Joshua) still
entertained as to the truth of Christianity. Allorqui then detailed the
nature of his doubts, covertly but forcibly attacking the Christian
system. Every sentence in this epistle was calculated to cut the Jew-
hating new-Christian to the quick. The evasive and embarrassed
reply, which Paul indited later on, clearly indicated how he had
winced under this attack.
The philosopher, Chasdaï Crescas, also came forward in gallant
defense of the religion of his fathers. He composed (1396) a
polemical treatise (Tratado), in which he tested philosophically the
Christian articles of faith, and demonstrated their untenableness.
This work was addressed to Christians more than to Jews, and was
particularly intended for the perusal of Spaniards of high rank whose
friendship Chasdaï Crescas enjoyed. Hence it was written not in
Hebrew but in Spanish, which the author employed with ease, and
its tone was calm and moderate. Chasdaï Crescas set forth the
unintelligibility of the doctrines of the Fall, the Redemption, the
Trinity, the Incarnation, the Immaculate Conception, and
Transubstantiation, and examined the value of baptism, the coming
of Jesus, and the relation of the New Testament to the Old, with
dispassionate deliberation, as if he did not know that he was dealing
with questions which might at any moment light the fires of an auto-
da-fé.
At about the same time an accomplished Marrano, who had
relapsed into Judaism, published a pungent attack on Christianity
and the new-Christians. In the entire history of Judæo-Christian
controversy no such stinging satire had been produced on the
Jewish side as that now issued by the physician, astronomer,
historical student, and grammarian Profiat Duran. During the bloody
persecution of 1391 in Catalonia, Profiat Duran, otherwise Isaac ben
Moses, or, as he called himself in his works, Efodi (Ephodæus), had
been forced to simulate conversion to Christianity. He was joined by
his friend David Bonet Buen-Giorno. Both resolved at a convenient
opportunity to abandon their hated mask and emigrate to Palestine,
where they could freely acknowledge Judaism. Their affairs being
arranged, Profiat Duran traveled to a seaport town in the south of
France, and there awaited his friend. The latter, in the meantime,
was sought out by or came across the Jew-hating apostate, Solomon
Paul de Santa Maria, and was prevailed upon to remain a Christian.
What was Profiat Duran's astonishment when he received a letter
announcing, with much exultant vaporing, the definite
acknowledgment of Christianity by En Bonet, who exhorted him also
to remain in the pale of his adopted faith. The letter contained an
enthusiastic panegyric of Paul de Santa Maria, who had been taken
into the favor of the king of Castile. Profiat Duran could not remain
silent. In reply, he inflicted punishment on his friend, and more
particularly on the proselytizing Paul, in an epistle characterized by
the keenest irony, which has not yet lost its sting. It pretends to
assent to everything advanced by Bonet, and to confirm him in his
resolve to remain a Christian. "Be not ye like your fathers" (Altehi
ka-Abothecha) is the refrain throughout, and so artfully is this
admonition employed that Christians used it (under the title Alteca
Boteca) as an apology for Christianity. Whilst thus pretending to
criticise the errors of the older faith, Profiat Duran dwells on the
Christian dogmas, naïvely describing them in their most
reprehensible form. He concentrates on the weaknesses of
Christianity the full light of reason, Scriptural teaching and
philosophic deduction, apparently with no desire to change his
friend's intention. A portion of the satire is directed against the Jew-
hater Paul de Santa Maria, upon whom Bonet had bestowed
unstinted praise. "Thou art of opinion that he may succeed in
becoming pope, but thou dost not inform me whether he will go to
Rome, or remain at Avignon"—a cutting reference to the papal
schism distracting the church. "Thou extollest him for having made
efforts to free Jewish women and children from the obligation of
wearing the Jew badge. Take the glad tidings to the women and
children. For myself, I have been told that he preached mischief
against the Jews, and that the cardinal of Pampeluna was compelled
to order him to be silent. Thou art of opinion that he, thy teacher,
will soon receive the miter or a cardinal's hat. Rejoice, for then thou
also must acquire honors, and wilt become a priest or a Levite."
Towards the end Profiat Duran changes irony into a tone of
seriousness: he prays his former friend not to bear as a Christian the
name of his respected father who, had he been alive, would sooner
have had no son than one faithless to his religion. As it is, his soul in
Paradise will bewail the faithlessness of his son. This satirical epistle
was circulated as a pamphlet. Its author sent copies not only to his
former friend, but also to the physician of the king of Castile, the
chief rabbi, Don Meïr Alguades. So telling was the effect produced,
that the clergy, as soon as they discovered its satirical character,
made it the subject of judicial inquiry, and committed it to the
flames. At the request of Chasdaï Crescas, Profiat Duran wrote
another anti-Christian work, not, however, a satire, but in the grave
language of historical investigation. In this essay he showed, from
his intimate acquaintance with the New Testament and the literature
of the church, how in course of time Christianity had degenerated.
Favored and promoted by the anti-pope, Benedict XIII, of
Avignon, Paul of Burgos rose higher and higher; he became bishop
of Carthagena, chancellor of Castile and privy counselor to the king,
Don Henry III. His malice did not succeed in prejudicing the king
against the Jews, or inducing him to bar them from state
employment. Don Henry had two Jewish physicians, in whom he
reposed especial confidence. One, Don Meïr Alguades, an
astronomer and philosopher, he appointed, perhaps in imitation of
Portugal, to the chief rabbinate of the various Castilian communities.
He was always in the king's train, and it is probable that to some
extent he influenced him favorably towards his co-religionists. The
other was Don Moses Zarzel (Çarçal), who celebrated in rich Spanish
verse the long wished for birth of an heir to the Castilian throne,
borrowing the beauties of the neo-Hebraic poetry to do honor to the
newly-born prince, in whose hands, he prophesied, the various
states of the Pyrenean Peninsula would be united. The calm, as
between two storms, which the Spanish Jews enjoyed during the
reign of Don Henry was favorable to the production of a few literary
fruits, almost the last of any importance brought forth in Spain.
None of these works was epoch-making; they were useful, however,
in keeping alive the spirit of better times, and in preventing the
treasures of Jewish literature from being forgotten. Profiat Duran
managed to make people forget his baptism and to settle down
quietly in Spain or Perpignan, where he commentated Maimuni's
philosophy, and some of Ibn-Ezra's works. He also composed a
mathematical and calendarial essay (Chesheb-Efod) and an historical
account of the persecutions to which his race had been subjected
since the dispersion. His best work is a Hebrew grammar ("Maasé
Efod," written about 1403), in which he summarizes the results of
older writers, rectifies their errors, and even attempts to formulate
the principles of Hebrew syntax.
A production of more than common merit was written by
Chasdaï Crescas, now on the brink of the grave, his spirits shattered
by persecution. He was a profound, comprehensive thinker, whose
mind never lost itself in details, but was forever striving to
comprehend the totality of things. His scheme for a work treating, in
the manner of Maimuni, of all phases and aspects of Judaism,
investigating the ideas and laws out of which Jewish teaching had
gradually developed, and reharmonizing the details with the whole
where the connection had ceased to be apparent, bears witness to
the extraordinary range of his learning and the perspicacity of his
mind. The work was to be at once a guide to Talmudical study and a
practical handbook. Death appears to have prevented the
accomplishment of this gigantic enterprise, only the philosophic
portion, or introduction, being completed. In this introduction
Chasdaï Crescas deals, on the one hand, with the principles of
universal religion, the existence of God, His omniscience and
providence, human free-will, the design of the universe, and, on the
other, with the fundamental truths of Judaism, the doctrines of the
creation, immortality, and the Messiah.
Crescas was less dominated by the Aristotelian bias of mediæval
philosophy than his predecessors. It had lost its halo for him; he
perceived its weaknesses more clearly than others, and probed them
more deeply. With bold hands he tore down the supports of the vast
edifice of theory constructed by Maimuni on Aristotelian grounds to
demonstrate the existence of God and His relation to the universe,
and, conversant with the whole method of scholastic philosophy, he
combated it with destructive force.
While the philosophy of his day appeared to him thus vague and
illusory, he considered the foundations of Judaism unassailable, and
set himself to show the futility of the criticisms of the former. The
acknowledgment of Divine omniscience led him to the daring
statement that man in his actions is not quite free, that everything is
the necessary result of a preceding occurrence, and that every
cause, back to the very first, is bound to determine the character of
the final action. The human will does not follow blind choice, but is
controlled by a chain of antecedent circumstances and causes. To
what extent can the doctrine of reward and punishment be
admitted, if the will is not free? Chasdaï Crescas' answer to this is
that reward and punishment wait on intentions, not on actions. He
who, in purity of heart, wishes to accomplish good—which must, of
course, necessarily follow—deserves to be rewarded, as the man
who willingly promotes evil, deserves punishment. The highest good
to which man can aspire, and the end of all creation, is spiritual
perfection, or bliss everlasting, not to be obtained, as the
philosophers imagine, by filling the mind with metaphysical theories,
but only through the active love of God. This is the substance of all
religion and particularly of Judaism. From this point of view it may
with justice be said that "the world was created for the sake of the
Torah," for the aim of the Law is to lead to immortality by means of
ideas and commandments and the guidance of thoughts and
actions.
Chasdaï Crescas, the first to distinguish between universal
religion and specific forms, such as Judaism and Christianity,
propounded, deviating from Maimuni's system, only eight peculiarly
Jewish tenets. His just objection to Maimuni's thirteen articles of
faith was that they were either too many or too few, inasmuch as
they blended indiscriminately fundamental truths common to all
religions, and teachings peculiar to Judaism.
Together with Profiat Duran and Chasdaï Crescas, Don Meïr
Alguades, the Castilian chief rabbi, appeared, in the brief interval
between two bloody persecutions in Spain, as a writer of philosophic
works. He was not an independent inquirer; he merely translated the
ethics of Aristotle (1405, in collaboration with Benveniste Ibn-Labi)
into Hebrew, making the work accessible to Jews, who, in practical
life, lived up to its principles better than the Greeks, who produced
them, or the Christians, who, in the pride of faith and church
doctrine, considered themselves above the necessity of conforming
to the requirements of morality.
Throughout the reign of Don Henry III of Castile the life of the
Jews was tolerable. The young but vigorous monarch severely
punished Fernan Martinez, the prime mover in the massacres of
1391, as a warning against further excesses. He permitted the Jews
to acquire land, renewed the law of his ancestor, Alfonso XI, and
relieved his Jewish tax-farmers and finance administrators from
restrictions. As soon as he died (the end of 1406) the affairs of the
Jews again took an unfavorable turn, foreshadowing unhappy times.
The heir to the crown, Juan II, was a child, barely two years old.
The regency devolved on the queen-mother, Catalina (Catherine) of
Lancaster, a capricious, arrogant and bigoted young woman, who
imagined that she ruled, while she was herself ruled by her various
favorites. The co-regent, Don Ferdinand, later king of Aragon, who
was intelligent and kind, allowed himself to be guided by the clergy.
By his side in the council of state sat the apostate rabbi, Solomon
alias Paul de Santa Maria, another and more mischievous Elisha-
Acher, in whose eyes Judaism was an abomination, and every Jew a
stumbling-block. The deceased king, Don Henry III, had appointed
him executor of his will and tutor to his heir; he consequently had an
influential voice in the council of the regency. What a prospect for
the Jews of Castile! It was not long before they were made to feel
the hostile spirit of the court. First it exhibited itself in attempts to
humiliate the more notable Jews who had intercourse with the court
circle and the grandees of the kingdom, and occupied positions of
distinction. The intention was to dismiss them from these positions
with the reminder that they belonged to a despised caste.
An edict was issued (October 25th, 1408), in the name of the
infant king, reviving the anti-Jewish statutes of the code of Alfonso
the Wise. "Whereas the exercise of authority by Jews may conduce
to the prejudice of the Christian faith," their occupation of posts in
which they might possess such authority was forbidden for all future
time. Every Jew permitting himself to be invested with official
functions, either by a nobleman or a municipality, was to be fined
twice the amount of the revenue of such post, and, if his fortune did
not suffice to make up the required amount, it would be confiscated,
and the delinquent become liable to a punishment of fifty lashes. A
Christian appointing a Jew to a post of influence would also be
punished with a fine. To insure the working of the edict, it was
enacted that the informer and the court of law concerned in a case
should secure each one-third of the confiscated estates. Officials
were charged to make the edict known everywhere, and carefully to
watch that its injunctions were carried out. It is impossible not to
suspect the hand of Paul de Santa Maria in this decree. No one knew
better than he the strong and the weak points in the character of
the Spanish Jews, and he doubtless calculated that Jewish notables,
in danger of losing their official employment and high social position,
would go over to Christianity, while the faithful, excluded from
intercourse with Christian society and from participation in the public
life of the country, would suffer a decline similar to that of the
German Jews.
At the same time he vented his hate on Meïr Alguades, the
physician of the dead king. The queen-regent had no cause to injure
this Jewish notable; only Paul could desire his ruin, because he was
the mainstay of his opponents and the leader of those who held him
up to contempt. With the object of procuring his downfall, a
vindictive accusation was trumped up against him. While the queen-
mother, with the infant king, was staying at Segovia, some priests
charged a Jew of the town with having bought a consecrated host
from the sacristan, in order to blaspheme it. They further stated that
the holy wafer had worked such terrible wonders while in the
possession of the Jew, that in fear and trembling he had delivered it
up to the prior of a monastery. Whether this story was fabricated, or
whether there was a grain of truth in a bushel of fiction, it is
impossible to say; it sufficed, however, to attract the serious
attention of the bishop, Velasquez de Tordesillas, who caused a
number of Jews to be arrested as accomplices in the crime, among
them Don Meïr Alguades. Criminal proceedings were formally
commenced by order of the queen-regent, and Alguades and his
fellow-prisoners were subjected to torture, and confessed their guilt.
It is stated that in his agony Meïr Alguades made a confession of
another kind—that the king, Henry III, had come by his death at his
hands. Although everybody knew that the king had been ailing from
his youth, Don Mëir—who must have been specially interrogated
while under torture as to whether he had poisoned the king—was
put to death in the most inhuman manner. He was torn limb from
limb. The same fate befell the other prisoners. Still not satisfied, the
bishop of Segovia accused some Jews of having bribed his cook to
poison his food, and they also were put to death. At about this time
one of the synagogues in Segovia was transformed into a church.
The troubled times, projecting shadows of a still more unhappy
future, produced the melancholy phenomenon of another Messianic
frenzy. Again it arose in the minds of mystics. The Zohar having
adroitly been raised to the dignity of an approved authority, the
Kabbala daily acquired more influence, although it was not studied in
proportion to the zeal with which its authority was advocated. Three
Kabbalists were particularly active in exciting the emotions and
turning the heads of the people—Abraham of Granada, Shem Tob
ben Joseph, and Moses Botarel. The first composed (between 1391
and 1409) a Kabbalistic work, a farrago of strange names of the
Deity and the angels, of transposed letters, and jugglery with vowels
and accents. Abraham of Granada had the hardihood to teach that
those who could not apprehend God by Kabbalistic methods
belonged to the weak in faith, were ignorant sinners, and like the
depraved and the apostate were overlooked by God, and not found
worthy of His special providence. He thought that the relinquishment
of their religion by cultured Jews was explained by their fatal
application to scientific study, and their contempt for the Kabbala.
On the other hand, he professed to see in the persecutions of 1391,
and in the conversion of so many prominent Jews to Christianity, the
tokens of the Messianic age, the suffering that must precede it, and
the approach of the redemption. Shem Tob ben Joseph Ibn-Shem
Tob (died 1430) accused the Jewish philosophers, Maimuni,
Gersonides, and others, of seducing the people to heresy and
infidelity, and with being the real cause of apostasy in troubled
times. In a work entitled "Emunoth" he made violent attacks on
Jewish thinkers and philosophic studies generally, and taught that
the salvation of Israel lies in the Kabbala, the oldest Jewish tradition,
and the genuine, pure truth. The entire book is composed of grave
charges against the more enlightened school of Jewish thinkers, and
panegyrics of Kabbalistic nonsense.
These two men, Abraham of Granada and Shem Tob, though
narrow-minded, were sincere, differing in this respect from Moses
Botarel (or Botarelo), also a Spaniard, from Cisneros, in Castile, who
pursued his course with fraudulent intent. He gave out that he was a
thaumaturge and prophet; he announced himself even as the
Messiah. He prophesied that in the spring month of 1393 the
Messianic age would be ushered in by extraordinary marvels. Later
on he wrote a work full of lies and delusions. In his pride and
boastfulness, he addressed a circular letter to all the rabbis of Israel,
declaring that he was in a position to solve all doubts, and throw
light on all mysteries, that he was the chief of the great Synhedrin,
and a great deal more in the same charlatanic strain.
As in the days of the oppression by the Visigothic kings, an
asylum for persecuted Jews was formed on that portion of the
African coast facing Spain. Many of the north African towns, such as
Algiers, Miliana, Constantine, Buja, Oran, Tenes, and Tlemçen, were
filled with Jews fleeing from the massacres of 1391, and with new-
Christians anxious to get rid of the Christianity which they had been
forced to embrace, but which they hated cordially. Almost daily there
came fresh troops of refugees from all parts of Spain and Majorca.
They transplanted to their new fatherland their intelligence, wealth,
industry, and commercial enterprise. The Mahometan Berber princes,
then more tolerant and humane than the Christians, received them
without imposing a poll tax. At first the Mahometan population
grumbled a little at so sudden and considerable an increase in the
number of inhabitants, fearing that the price of provisions would be
raised. When, however, the narrow-mindedness and selfishness of
their complaints were pointed out to them by an intelligent kadi they
were satisfied, and the Jews were allowed to settle in their midst in
peace. The small Berber communities formed since the cessation of
the Almohade persecution a century before, acquired greater
importance through this immigration. The new-comers
preponderated in numbers over the native Jews, so that the latter, to
a certain extent, were forced to adopt the Spanish communal
organization and the Sephardic ritual. The Spaniards, in fact,
became the leading element in the old African communities.
The distinguished rabbi, Isaac ben Sheshet-Barfat, who had
escaped from Spain and settled in Algiers, was recognized by the
king of Tlemçen as chief rabbi and judge of all the communities. This
he owed to the influence of one of his admirers, Saul Astruc Cohen,
a popular physician and an accomplished man, who not only
practiced his art gratuitously, but spent his fortune in relieving both
Mahometan and Jewish poor. In the name of the king the local
rabbis were forbidden to assume clerical or judicial functions without
the authority of the chief rabbi, Isaac ben Sheshet. This in no way
detracted from the esteem in which Ben Sheshet was held, and
applications for the decision of difficult questions continued to pour
in upon him. In Algiers he continued to oppose wrong-doing with the
conscientiousness and impartiality that had always characterized
him. Among the members of his community was a mischievous
personage (Isaac Bonastruc?), who had considerable influence with
the Algerian authorities. Actuated by self-interest he was desirous of
stopping the daily increasing immigration of Marranos, and to this
end persuaded the kadi to impose a tax of one doubloon on every
immigrant. Finding that troops of fugitives continued to arrive, he set
himself to work upon the selfishness of the community, so that they
might oppose any further influx of their brethren. Fifty-five new-
Christians, who had recanted, from Valencia, Barcelona, and
Majorca, were waiting to land in the harbor of Algiers, but were
refused permission by Jews. This was tantamount to throwing them
on the mercy of Christian executioners. Such selfishness and
injustice the chief rabbi, Isaac ben Sheshet, could not tolerate, and
he laid the ban on the heartless Jews, who tried to escape the
punishment. So determined was his attitude that, with the
assistance of Astruc Cohen and his brother, the Marranos were
ultimately brought safe to land. In Africa Ben Sheshet-Barfat worked
for nearly twenty years, promoting the welfare of his co-religionists
and the interests of religion and morality. His declining years were
embittered by the persistent attacks of a young rabbi, Simon ben
Zemach Duran, an able Talmudist, who had emigrated from Majorca.
Ben Sheshet was succeeded on his death by Simon Duran (born
1361, died 1444). The community of Algiers elected him on
condition that he did not seek a ratification of his appointment from
the king, probably because the authority derived by his predecessor
from the royal confirmation had been too uncontrolled. Simon
Duran, an accomplished mathematician and physician, was the first
Spanish-Jewish rabbi to take pay. He publicly excused himself for
doing so, on the ground of his necessitous circumstances. During the
persecutions in Majorca a portion of his large fortune had been lost,
and the remainder had been sacrificed in bribing the informers who
threatened to deliver him as a Judaizing Christian to the Dominican
Moloch. He had arrived in Algiers almost a beggar, and the healing
art, by which he had hoped to earn a subsistence, had brought him
nothing, physicians enjoying but little consideration among the
Berbers. Subsequently Simon Duran justified the payment of rabbis
from the Talmud. Were the abbots, bishops, and princes of the
church equally conscientious?
As if the Jews of Spain had not had enough enemies in the poor,
indolent burghers and nobles, who regarded their opulence with so
much jealousy, in the clergy, who cloaked their immorality with zeal
for the propaganda of the faith, or in the upstart converts, who
sought to disguise their Jewish origin by a show of hatred of their
former brethren, there arose at about the beginning of the fifteenth
century three new Jew-haters of the bitterest, most implacable type.
One was a baptized Jew, another a Dominican friar, and the third an
abandoned anti-pope. On these three men, Joshua Lorqui, Fra
Vincent Ferrer, and Pedro de Luna, or Benedict XIII, the
responsibility must rest for the events which directly conduced to the
most terrible tragedy in the history of the Jews of Spain. Joshua
Lorqui of Lorca assumed on his baptism the name Geronimo de
Santa Fé, became physician in ordinary to the Avignon pope,
Benedict, and, like his teacher, Solomon-Paul de Santa Maria,
considered it his mission in life to draw his former brethren over to
Christianity by every possible means. Vincent Ferrer, afterwards
canonized, was one of those gloomy natures to whom the world
appears a vale of tears, and who would wish to make it one. In
saint-like virtue, indeed, he stood alone among the clergy and
monks of his day. The pleasures of life had no charm for him; for
gold and worldly distinction he thirsted not; he was penetrated with
true humility, and entered on his work with earnestness.
Unfortunately, the degeneracy and foulness of society had impressed
him with the fantastic idea that the end of the world was at hand,
and that mankind could be saved only by adopting the Christian faith
and a monastic mode of life. Vincent Ferrer consequently revived
flagellation. He marched through the land with a troop of fanatics
who scourged their naked bodies with knotted cords, and incited the
masses to adopt the same form of penance, believing that it would
bring about the salvation of the world. Gifted with a sympathetic
voice, an agreeable manner, and considerable eloquence, this
Dominican friar soon obtained ascendancy over the public mind.
When amid sobs he recalled the sufferings of Jesus, and depicted
the approaching end of the world, the emotions of his auditors
became violently agitated, and he could lead them to good or to evil.
He had given up a high position at the papal court to lead the life of
a flagellant and barefooted friar. This helped to increase the number
of his admirers and disciples, for renunciation of position and wealth
on the part of an ecclesiastic was without parallel. Ferrer, however,
abused his power by the promotion of sanguinary deeds. He directed
his fanatical denunciations not only against Jews and heretics, but
even against friends who had helped to raise him from the dust. The
terrible demoralization of the church is illustrated in this monk. The
wrangling of three contemporary popes, each declaring himself to be
the vicegerent of God, one of whom, John XXIII (1410–1415), had
exhausted the catalogue of vices and deadly sins, a pirate, a
trafficker in indulgences, an assassin, and a debauchee—all this did
not so strikingly indicate the prevailing degeneracy as the fanatical
excesses of one really pure, moral nature like Vincent Ferrer. The
dove had become transformed into a venomous snake, the lamb into
a rapacious beast. So much viciousness cannot be spontaneous in
human character, in the adherents of Christianity; it must have been
derived from the Christian teaching itself.
Unlike Wycliffe and other reformers, Ferrer did not raise his voice
against the shortcomings of the church, but devoted himself to Jews
and heretics, whom he hated as adversaries of Christianity and
opponents of the infallibility of the pope. With pen and voice he
opened a crusade against Jews, which he sustained for several
years. His most vehement invective was aimed at the Spanish new-
Christians, who during the massacres of 1391 had gone over to the
church, but still largely conformed to Judaism. Partly from fear of
incurring the severe punishment attaching to apostasy, partly won
over by the fiery eloquence of the preacher, the Marranos made a
contrite confession of faith, which Ferrer regarded as a great victory
for the church, a triumph for the truths of Christianity, leading him to
hope that the conversion of the entire body of Jews might be
vouchsafed to him. By his influence with the people, who honored
him as a saint, he was very useful to the kings of Spain in putting
down popular risings during the civil wars without bloodshed.
Encouraged by the consideration of the Castilian royal family, Ferrer
craved permission not only to preach in the synagogues and
mosques, but to force Jews and Mahometans to listen to his
addresses. A crucifix in one arm, the Torah in the other, escorted by
flagellants and spearmen, he called upon the Jews, "with a terrible
voice," to enrol themselves under the cross.
Seraphic as he was, Vincent Ferrer was not averse to the
employment of force. He represented to the Spanish rulers that the
Jews should be strictly isolated, as their intercourse with the
Christian population was calculated to injure the true faith. His
suggestions met with too ready a response. Through him and the
other two conversionists, unspeakable sorrows were brought upon
the Spanish Jews; indeed, the years from 1412 to 1415 may be
reckoned among the saddest in the sorrowful history of the Jewish
people. Shortly after Ferrer's appearance at the most Christian court,
the regent Donna Catalina, the Infante Don Ferdinand, and the
apostate Paul Burgensis de Santa Maria, in the name of the child-
king, Juan II, issued an edict of twenty-four articles (January 12th,
1412), the aim of which was to impoverish and humiliate the Jews,
and reduce them to the lowest grade in the social scale. It ordered
that they should live in special Jew-quarters (Juderias), provided
with not more than one gate each, under pain of confiscation of
fortune and personal chastisement. No handicraft was to be
exercised by them; they were not to practice the healing art, nor
transact business with Christians. It goes without saying that they
were forbidden to hire Christian servants and fill public offices. Their
judicial autonomy was abolished, not only in criminal cases, in which
they had long ceased to exercise it, but also in civil disputes. The
edict prescribed a special costume for the Jews. Both men and
women were to wear long garments, in the case of males, of coarse
stuffs. Whoever dressed in the national costume, or in fine materials,
became liable to a heavy fine; on a repetition of the offense, to
corporal punishment and confiscation of property. The wearing of
the red Jew badge was, of course, insisted upon. Males were
prohibited from shaving the beard or cutting the hair under pain of
one hundred lashes. No Jew was to be addressed, either in
conversation or in writing, by the title "Don," to the infringement of
which a heavy fine was also attached. They were interdicted from
carrying weapons, and might no longer move from town to town,
but were to be fixed to one place of abode. The Jew detected in an
evasion of the latter restriction was to lose his entire property, and
be made a bondman of the king. Grandees and burghers were
sternly enjoined to afford not the slightest protection to Jews.
It is not unwarrantable to assume the influence of the apostate
Paul de Santa Maria in the details of these Jew-hating laws. They
singled out the most sensitive features of the Jewish character, pride
and sense of honor. Wealthy Jews, in the habit of appearing in
magnificent attire and with smoothly-shaven chins, were now to don
a disfiguring costume, and go about with stubbly, ragged beards.
The cultivated, who as physicians and advisers of the grandees had
enjoyed unrestricted intercourse with the highest ranks, were to
confine themselves to their Jew quarter, or be baptized, baptism
being the hoped-for result of all these cruel restrictions, enforced
with merciless vigor. A contemporary writer (Solomon Alami)
describes the misery caused by the edict: "Inmates of palaces were
driven into wretched nooks, and dark, low huts. Instead of rustling
apparel we were obliged to wear miserable clothes, which drew
contempt upon us. Prohibited from shaving the beard, we had to
appear like mourners. The rich tax-farmers sank into want, for they
knew no trade by which they could gain a livelihood, and the
handicraftsmen found no custom. Starvation stared everyone in the
face. Children died on their mothers' knees from hunger and
exposure."
Amid this tribulation the Dominican Ferrer invaded the
synagogues, crucifix in hand, preached Christianity in a voice of
thunder, offering his hearers enjoyment of life and opportunities of
preferment, or threatening damnation here and hereafter. The
Christian populace, inflamed by the passionate eloquence of the
preacher, emphasized his teaching by violent assaults on the Jews.
The trial was greater than the unhappy Castilian Jews could bear.
Flight was out of the question, for the law forbade it under a terrible
penalty. It is not surprising, then, that the weak and lukewarm
among them, the comfort-loving and worldly-minded, succumbed to
the temptation, and saved themselves by baptism. Many Jews in the
communities of Valladolid, Zamora, Salamanca, Toro, Segovia, Avila,
Benavente, Leon, Valencia, Burgos, Astorga, and other small towns,
in fact, wherever Vincent Ferrer preached, went over to Christianity.
Several synagogues were turned into churches by Ferrer. In the
course of his four months' sojourn (December, 1412-March, 1413) in
the kingdom of Castile, this proselyte-monger inflicted wounds upon
the Jews from which they bled to death.
When, however, he repaired to the kingdom of Aragon—
summoned thither to advise on the rival claims of several pretenders
to the throne—and when through his exertion the Castilian Infante,
Don Ferdinand, was awarded the Aragonese crown (June, 1414), a
trifling improvement took place in the condition of the Castilian
Jews. The regent, Donna Catalina, issued a new edict in the name of
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.
More than just a book-buying platform, we strive to be a bridge
connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.
Join us on a journey of knowledge exploration, passion nurturing, and
personal growth every day!
ebookbell.com

More Related Content

PDF
Sonar Project Report
PDF
Practical Arduino Engineering 1st Edition Harold Timmis
PDF
Download full ebook of Arduino In Easy Steps Stuart Yarnold instant download pdf
PPTX
Using arduino and raspberry pi for internet of things
PDF
Atmega tutorial
PPS
What is Arduino ?
PPTX
What are the different types of arduino boards
PDF
SKAD Electronics Training Manual.pdf
Sonar Project Report
Practical Arduino Engineering 1st Edition Harold Timmis
Download full ebook of Arduino In Easy Steps Stuart Yarnold instant download pdf
Using arduino and raspberry pi for internet of things
Atmega tutorial
What is Arduino ?
What are the different types of arduino boards
SKAD Electronics Training Manual.pdf

Similar to Arduino A Technical Reference A Handbook For Technicians Engineers And Makers 1st Edition J M Hughes (20)

PDF
Advanced View of Atmega Microcontroller Projects List - ATMega32 AVR.pdf
PDF
Advanced View of Atmega Microcontroller Projects List - ATMega32 AVR.pdf
PPTX
1.Arduino Ecosystem.pptx
PDF
Arduino Cookbook 3rd Edition Michael Margolis
PPTX
PEQUEÑO CURSO DE ARDUINO DESDE SEÑALES HASTA PROGRAMACIÓN
PPTX
Arduino Robotics workshop Day1
PDF
FinalThesisdraft
PDF
ARDUINO OVERVIEW HARDWARE SOFTWARE AND INSTALLATION.pdf
PDF
comenzando con MATLAB y Simulink para Arduino
PPTX
ARDUINO OVERVIEW HARDWARE SOFTWARE AND INSTALLATION.pptx
PPTX
Arduino-Workshop For beginners UG Students
PDF
Smart Projects With Arduino And Esp32 Integrating Artificial Intelligence Abd...
PDF
Practicas con arduino
PDF
Advanced View of Atmega Microcontroller Projects List - ATMega32 AVR.pdf
PPTX
Arduino uno details and Workshop contents
PDF
ATTiny85 ATTiny45 and ATTiny13 based projects list - ATMega32 AVR.pdf
PDF
Advanced View of Atmega Microcontroller Projects List - ATMega32 AVR.pdf
PDF
Arduino: Starter kit for arduino(manual de usuario)
PDF
Advanced View of Atmega Microcontroller Projects List - ATMega32 AVR.pdf
PDF
Introduction of Arduino Uno
Advanced View of Atmega Microcontroller Projects List - ATMega32 AVR.pdf
Advanced View of Atmega Microcontroller Projects List - ATMega32 AVR.pdf
1.Arduino Ecosystem.pptx
Arduino Cookbook 3rd Edition Michael Margolis
PEQUEÑO CURSO DE ARDUINO DESDE SEÑALES HASTA PROGRAMACIÓN
Arduino Robotics workshop Day1
FinalThesisdraft
ARDUINO OVERVIEW HARDWARE SOFTWARE AND INSTALLATION.pdf
comenzando con MATLAB y Simulink para Arduino
ARDUINO OVERVIEW HARDWARE SOFTWARE AND INSTALLATION.pptx
Arduino-Workshop For beginners UG Students
Smart Projects With Arduino And Esp32 Integrating Artificial Intelligence Abd...
Practicas con arduino
Advanced View of Atmega Microcontroller Projects List - ATMega32 AVR.pdf
Arduino uno details and Workshop contents
ATTiny85 ATTiny45 and ATTiny13 based projects list - ATMega32 AVR.pdf
Advanced View of Atmega Microcontroller Projects List - ATMega32 AVR.pdf
Arduino: Starter kit for arduino(manual de usuario)
Advanced View of Atmega Microcontroller Projects List - ATMega32 AVR.pdf
Introduction of Arduino Uno
Ad

Recently uploaded (20)

PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
Cell Structure & Organelles in detailed.
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PPTX
Institutional Correction lecture only . . .
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
01-Introduction-to-Information-Management.pdf
PPTX
Cell Types and Its function , kingdom of life
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Computing-Curriculum for Schools in Ghana
PDF
Insiders guide to clinical Medicine.pdf
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Sports Quiz easy sports quiz sports quiz
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Cell Structure & Organelles in detailed.
Renaissance Architecture: A Journey from Faith to Humanism
Institutional Correction lecture only . . .
FourierSeries-QuestionsWithAnswers(Part-A).pdf
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
01-Introduction-to-Information-Management.pdf
Cell Types and Its function , kingdom of life
Final Presentation General Medicine 03-08-2024.pptx
2.FourierTransform-ShortQuestionswithAnswers.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Computing-Curriculum for Schools in Ghana
Insiders guide to clinical Medicine.pdf
Abdominal Access Techniques with Prof. Dr. R K Mishra
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Sports Quiz easy sports quiz sports quiz
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Ad

Arduino A Technical Reference A Handbook For Technicians Engineers And Makers 1st Edition J M Hughes

  • 1. Arduino A Technical Reference A Handbook For Technicians Engineers And Makers 1st Edition J M Hughes download https://ebookbell.com/product/arduino-a-technical-reference-a- handbook-for-technicians-engineers-and-makers-1st-edition-j-m- hughes-9948270 Explore and download more ebooks at ebookbell.com
  • 2. Here are some recommended products that we believe you will be interested in. You can click the link to download. Arduino A Beginners Guide To Arduino Programming 1st Edition George Gibson https://ebookbell.com/product/arduino-a-beginners-guide-to-arduino- programming-1st-edition-george-gibson-48621802 Arduino A Quick Start Guide 1st Edition Maik Schmidt https://ebookbell.com/product/arduino-a-quick-start-guide-1st-edition- maik-schmidt-2284674 Arduinoa Quick Start Guide For Beginners To Getting Started With Electronics And Coding Schmidt Tech Guru https://ebookbell.com/product/arduinoa-quick-start-guide-for- beginners-to-getting-started-with-electronics-and-coding-schmidt-tech- guru-58532632 Mastering Arduino A Projectbased Approach To Electronics Circuits And Programming Jon Hoffman https://ebookbell.com/product/mastering-arduino-a-projectbased- approach-to-electronics-circuits-and-programming-jon-hoffman-7222508
  • 3. Introduction To Arduino A Piece Of Cake Alan G Smith https://ebookbell.com/product/introduction-to-arduino-a-piece-of-cake- alan-g-smith-5521690 An Essential Guidebook On Arduino A Handson Introduction With Guidance For Those Getting Started Arduino Projects Book Lowell Songster https://ebookbell.com/product/an-essential-guidebook-on-arduino-a- handson-introduction-with-guidance-for-those-getting-started-arduino- projects-book-lowell-songster-232322260 An Essential Guidebook On Arduino A Handson Introduction With Guidance For Those Getting Started Arduino Projects Book Songster https://ebookbell.com/product/an-essential-guidebook-on-arduino-a- handson-introduction-with-guidance-for-those-getting-started-arduino- projects-book-songster-232815978 Optimizing Pharmacotherapy In Older Patients An Interdisciplinary Approach Antonio Cherubini https://ebookbell.com/product/optimizing-pharmacotherapy-in-older- patients-an-interdisciplinary-approach-antonio-cherubini-50581092 Arduino Uno A Handson Guide For Beginner Agus Kurniawan https://ebookbell.com/product/arduino-uno-a-handson-guide-for- beginner-agus-kurniawan-44454870
  • 5. J. M. Hughes Arduino ATechnical Reference A HANDBOOK FOR TECHNICIANS, ENGINEERS, AND MAKERS
  • 7. J. M. Hughes Arduino: A Technical Reference A Handbook for Technicians, Engineers, and Makers Boston Farnham Sebastopol Tokyo Beijing Boston Farnham Sebastopol Tokyo Beijing
  • 8. 978-1-491-92176-0 [LSI] Arduino: A Technical Reference by J. M. Hughes Copyright © 2016 John Hughes. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://safaribooksonline.com). For more information, contact our corporate/ institutional sales department: 800-998-9938 or corporate@oreilly.com. Editor: Dawn Schanafelt Production Editor: Colleen Lobner Copyeditor: Rachel Head Proofreader: Kim Cofer Indexer: Ellen Troutman-Zaig Interior Designer: David Futato Cover Designer: Randy Comer Illustrator: John M. Hughes and Rebecca Demarest May 2016: First Edition Revision History for the First Edition 2016-05-05: First Release See http://oreilly.com/catalog/errata.csp?isbn=9781491921760 for release details. The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. Arduino: A Technical Reference, the cover image, and related trade dress are trademarks of O’Reilly Media, Inc. While the publisher and the author have used good faith efforts to ensure that the information and instructions contained in this work are accurate, the publisher and the author disclaim all responsibility for errors or omissions, including without limitation responsibility for damages resulting from the use of or reliance on this work. Use of the information and instructions contained in this work is at your own risk. If any code samples or other technology this work contains or describes is subject to open source licenses or the intellectual property rights of others, it is your responsibility to ensure that your use thereof complies with such licenses and/or rights.
  • 9. Table of Contents Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii 1. The Arduino Family. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 A Brief History 1 Types of Arduino Devices 2 Arduino Galleries 4 Arduino-Compatible Devices 7 Hardware-Compatible Devices 7 Software-Compatible Devices 8 The Arduino Naming Convention 9 What Can You Do with an Arduino? 10 For More Information 12 2. The AVR Microcontroller. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Background 14 Internal Architecture 14 Internal Memory 17 Peripheral Functions 17 Control Registers 18 Digital I/O Ports 18 8-Bit Timer/Counters 19 16-Bit Timer/Counters 21 Timer/Counter Prescaler 21 Analog Comparator 21 Analog-to-Digital Converter 22 Serial I/O 24 USART 24 SPI 25 iii
  • 10. TWI 25 Interrupts 26 Watchdog Timer 29 Electrical Characteristics 29 For More Information 29 3. Arduino-Specific AVR Microcontrollers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 ATmega168/328 32 Memory 32 Features 32 Packages 34 Ports 34 Pin Functions 34 Analog Comparator Inputs 34 Analog Inputs 34 Serial Interfaces 35 Timer/Clock I/O 36 External Interrupts 37 Arduino Pin Assignments 38 Basic Electrical Characteristics 38 ATmega1280/ATmega2560 39 Memory 39 Features 41 Packages 41 Ports 42 Pin Functions 42 Analog Comparator Inputs 42 Analog Inputs 43 Serial Interfaces 44 Timer/Clock I/O 45 External Interrupts 46 Arduino Pin Assignments 46 Electrical Characteristics 49 ATmega32U4 49 Memory 49 Features 51 Packages 51 Ports 51 Pin Functions 52 Analog Comparator Inputs 53 Analog Inputs 53 Serial Interfaces 54 iv | Table of Contents
  • 11. Timer/Clock I/O 55 External Interrupts 56 USB 2.0 Interface 57 Electrical Characteristics 58 Arduino Pin Assignments 59 Fuse Bits 60 For More Information 62 4. Arduino Technical Details. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 Arduino Features and Capabilities 63 Arduino USB Interfaces 64 Arduino Physical Dimensions 66 Full-Size Baseline Arduino PCB Types 67 Mega Form-Factor Arduino PCB Types 68 Small Form-Factor Arduino PCB Types 69 Special-Purpose PCB Types 73 Arduino Pinout Configurations 73 The Baseline Arduino Pin Layout 74 The Extended Baseline Pin Layout 76 The Mega Pin Layout 81 Nonstandard Layouts 83 For More Information 87 5. Programming the Arduino and AVR Microcontrollers. . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 Cross-Compiling for Microcontrollers 90 Bootloaders 92 The Arduino IDE Environment 94 Installing the Arduino IDE 95 Configuring the Arduino IDE 96 Cross-Compiling with the Arduino IDE 98 The Arduino Executable Image 101 The Arduino Software Build Process 101 Sketch Tabs 103 Arduino Software Architecture 104 Runtime Support: The main() Function 106 An Example Sketch 107 Constants 110 Global Variables 111 Libraries 112 Using Libraries in Sketches 112 Adding a Library to the Arduino IDE 116 Creating Custom Libraries 118 Table of Contents | v
  • 12. Arduino Source Code 119 6. Life Without the Arduino IDE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 IDE Alternatives 121 PlatformIO 122 Ino 124 The AVR Toolchain 125 Installing the Toolchain 127 make 130 avr-gcc 131 binutils 132 avr-libc 135 Building C or C++ Programs from Scratch 137 Compiling with avr-gcc or avr-g++ 137 Multiple Source Files and make 138 AVR Assembly Language 140 The AVR Programming Model 141 Creating AVR Assembly Language Programs 143 AVR Assembly Language Resources 146 Uploading AVR Executable Code 146 In-System Programming 147 Programming with the Bootloader 148 Uploading Without the Bootloader 149 JTAG 151 AVRDUDE 152 Using an Arduino as an ISP 154 Bootloader Operation 154 Replacing the Bootloader 156 Summary 156 7. Arduino Libraries. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 Library Components 158 Contributed Libraries 211 8. Shields. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 Electrical Characteristics of Shields 216 Physical Characteristics of Shields 217 Stacking Shields 219 Common Arduino Shields 220 Input/Output 221 I/O Extension Shields 222 I/O Expansion Shields 226 vi | Table of Contents
  • 13. Relay Shields 230 Signal Routing Shields 232 Memory 235 Communication 237 Serial I/O and MIDI 237 Ethernet 239 Bluetooth 241 USB 243 ZigBee 244 CAN 246 Prototyping 249 Creating a Custom Prototype Shield 253 Motion Control 253 DC and Stepper Motor Control 254 PWM and Servo Control 255 Displays 257 Instrumentation Shields 263 Adapter Shields 266 Miscellaneous Shields 268 Uncommon Arduino Shields 272 Sources 274 9. Modules and I/O Components. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 Modules 276 Physical Form Factors 277 Interfaces 277 Module Sources 280 Module Descriptions 282 Grove Modules 309 Sensor and Module Descriptions 310 Sensors 312 Temperature, Humidity, and Pressure Sensors 312 Tilt Sensors 318 Audio Sensors 319 Light Sensors 320 Magnetic Sensors 324 Vibration and Shock Sensors 324 Motion Sensors 325 Contact and Position Sensors 327 Range Sensors 331 Communications 332 APC220 Wireless Modules 332 Table of Contents | vii
  • 14. 315/433 MHz RF Modules 332 ESP8266 Transceiver 333 Output Devices and Components 334 Light Sources 335 Relays, Motors, and Servos 339 Analog Signal Outputs 342 User Input 343 Keypads 343 Joysticks 344 Potentiometers and Rotary Encoders 345 User Output 345 Text Displays 345 Graphical Displays 347 Support Functions 347 Clocks 348 Timers 350 Connections 351 Working with Naked Jumper Wires 351 Module Connection Systems 351 Building Custom Connectors 352 Choosing a Connection Method 354 Sources 355 Summary 355 10. Creating Custom Components. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357 Getting Started 360 Custom Shields 365 Physical Considerations 366 Stacking Shields 367 Electrical Considerations 369 The GreenShield Custom Shield 369 Objectives 370 Definition and Planning 370 Design 371 Prototype 379 Final Software 385 Fabrication 393 Final Acceptance Testing 397 Operation 399 Next Steps 400 Custom Arduino-Compatible Designs 400 Programming a Custom Design 401 viii | Table of Contents
  • 15. The Switchinator 401 Definition and Planning 402 Design 403 Prototype 416 Software 420 Fabrication 423 Acceptance Testing 427 Next Steps 428 Resources 428 11. Project: A Programmable Signal Generator. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431 Project Objectives 433 Definition and Planning 434 Design 435 Functionality 436 Enclosure 437 Schematic 438 Prototype 441 Control Inputs and Modes 441 Display Output 443 DDS Module 444 Software 446 Source Code Organization 447 Software Description 448 The DDS Library 456 Testing 457 Final Assembly 460 Pull-up Resistor Array 460 Input Protection 461 Chassis Components 462 DC Power 465 Final Testing and Closing 466 Reducing the Cost 466 Cost Breakdown 468 Resources 469 12. Project: Smart Thermostat. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471 Background 471 HVAC Overview 472 Temperature Control Basics 473 Smart Temperature Control 476 Project Objectives 477 Table of Contents | ix
  • 16. Definition and Planning 477 Design 478 Functionality 478 Enclosure 480 Schematic 482 Software 482 User Input/Output 485 Control Output 488 Prototype 489 DHT22 Sensor 491 Rotary Encoder 491 Real-Time Clock Module 493 LCD Shield 493 Software 493 Source Code Organization 494 Software Description 494 Testing 497 Final Version 498 Assembly 498 Testing and Operation 501 Cost Breakdown 502 Next Steps 503 Resources 503 13. Model Rocket Launcher: A Design Study. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505 Overview 505 The Design Cycle 506 Objectives 508 Selecting and Defining Functional Requirements 510 Creating the Preliminary Design 514 Design Feasibility 517 Preliminary Parts List 520 Prototype 521 Final Design 522 Electrical 522 Physical 527 Software 529 Testing and Operation 532 Cost Analysis 533 A. Tools and Accessories. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535 x | Table of Contents
  • 17. B. AVR ATmega Control Registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549 C. Arduino and Compatible Products Vendors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 575 D. Recommended Reading. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581 E. Arduino and AVR Software Development Tools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585 Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589 Table of Contents | xi
  • 19. Preface Since its introduction in 2005 the Arduino has become one of the most successful (some might argue the most successful) open source hardware projects in the world. Boards based on the open designs released by the Arduino team have been fabricated in countries around the world, including Italy, Brazil, China, the Netherlands, India, and the United States. One can purchase a fully functional Arduino-compatible board for around $15, and the Arduino development environment is readily available for download and is completely free. Originally based on the 8-bit AVR family of micro‐ controllers (the AVR is itself an interesting device with an equally interesting history), the Arduino has moved into the realm of 32-bit processing with the addition of the Due model with an ARM processor, the Yún with an on-board module running the OpenWrt version of Linux, and the upcoming Zero model. Arduinos have been used for everything from interactive art to robotics, and from environmental sensors to the smarts in small “CubeSat” satellites built by small teams and launched for a fraction of what a full-size satellite would cost. I bought my first Arduino (a Duemilanove) many years ago, more out of curiosity than anything else. I had worked with microprocessor and microcontroller develop‐ ment systems since the early 1980s, starting with the 6502, 6800, and 8051, and then moving on to the 8086, the Z80, the 80186, and the 68000 family. Early on I usually programmed these devices in assembly language or PL/M, since these were really the only rational choices at the time for embedded systems. Later it became feasible to use C or Ada, as the capabilities of the microprocessors improved and the software tools matured. In each case, however, I came to expect having loads of reference material available: datasheets, hefty manuals, handbooks, and reference design docu‐ mentation that would arrive along with the development circuit board and its acces‐ sories. It usually showed up in a large, heavy box. xiii
  • 20. When my new Arduino arrived and I opened the very small box I found that there was only a circuit board, a plug-in power pack, a few LEDs and resistors, some jumper wires, and a solderless breadboard block. No manuals, no handbooks, and no datasheets. Not even a CD with documents and software on it. Nothing more than a few sheets of paper with a manifest of what was in the box and a URL to a web page where I could read some “how to get started” material and find links to the software I needed. I was, to say the least, surprised. I was also ignorant. When I bought the Arduino I didn’t know its full backstory, nor was I aware of its intended audience. It turns out that it was originally meant primar‐ ily for people with little or no hardcore technical background who just wanted to experiment (in a playful sense) with something cool and make things go. In other words, artists and tinkerers, not engineers who have a penchant for technical details and an addiction to project plans, specifications, and, of course, manuals. Once I understood this, it all made a lot more sense. Reading Massimo Banzi’s book Getting Started with Arduino (O’Reilly) gave me a better understanding of the Ardu‐ ino philosophy, and it was a good starting place in my quest for additional details. Also, unlike semiconductor manufacturers with their development kits, the folks on the Arduino team aren’t in the business of selling chips—they’re working to inspire creativity. The AVR microcontroller was chosen because it was inexpensive and it could be easily integrated into their vision for a device that could be readily applied to a creative endeavor. The AVR has enough computational “horsepower” and sufficient built-in memory to do complex and interesting things, unlike earlier generations of microcontrollers that usually needed expensive development tools and provided only scant amounts of internal on-chip memory. Simplicity and low cost aside, the real secret to the success of the Arduino is the firm‐ ware bootloader on the AVR chip, coupled with a simple and easy-to-use integrated development environment (IDE) and the code libraries supplied with it—all provided free under open source and Creative Commons licensing. The Arduino philosophy is to make it as easy as possible to use an Arduino. By clearing away the bulk of the technical details and simplifying the development process, the Arduino invites the user to experiment, try new things, and yes, play. For the first time in a long time I found myself actually having a lot of fun just connecting things in different combina‐ tions to see what I could make it do. I wish that the Arduino had been around when I was teaching introductory embedded systems design—it would have helped reduce a lot of frustration for the people in the class trying to wade through assembly language listings, memory maps, and flowcharts. Since my first Arduino arrived I’ve found many sources for useful and interesting add-on components for the Arduino family, some of them quite amazing in terms of xiv | Preface
  • 21. 1 Entering “Arduino” into the search field on eBay will return a multitude of things like ultrasonic range sen‐ sors, temperature and humidity sensors, various Arduino clones, Bluetooth and ZigBee shields, and much more. But, unfortunately, some of the items come with little or no documentation, and even if there is some it may not be particularly up-to-date or accurate. That doesn’t mean you shouldn’t consider these sellers (the prices are usually excellent and the build quality is generally very good), but as always when buying things online, caveat emptor. both price and capabilities.1 In fact, I became something of an Arduino pack rat, buy‐ ing inexpensive shields and modules and building up a sizable collection of various bits. But, sadly, I have to say that many times I’ve opened a package with a nifty new gizmo in it, only to discover that there is no documentation of any kind. Not even a simple wiring diagram. As an engineer, it is particularly frustrating to me to purchase something interesting, only to have it show up with no documentation. I then have to embark on a quest to determine if any documentation actually does exist, and in a form that I can read (I can’t read Chinese). Sometimes that search is fruitless, and I’m forced to resort to component datasheets and reverse engineering the circuit board to figure out the wir‐ ing. Other times the information I’m seeking does exist, but it is scattered across mul‐ tiple websites in various bits and pieces. This situation is slowly improving, but it can still be a real pain. After years of collecting stacks of notes, web page links, and data‐ sheets, I finally decided to get organized and assemble it in one place. So, what does this book have that can’t be found somewhere on the Internet? Not that much, to be perfectly honest, but hopefully what it will do is reduce a lot of the poten‐ tial frustration and wasted time—and of course there are all the bits that I’ve discov‐ ered on my own. The official technical data comes from manufacturers such as Atmel, the Arduino team, and numerous other sources, both well known and obscure. Some overseas vendors do have at least rudimentary websites, whereas oth‐ ers have very nice web pages with links to other sites for the documentation. This book contains as much of the essential data as I could find or reverse engineer, all in one convenient place, with as many of the holes plugged as I could manage. I wanted to save others the frustration I’ve experienced trying to run down some mundane lit‐ tle technical detail about the USB interface, or figure out why a shield wasn’t working correctly, or why that really neat sensor I bought from someone through eBay didn’t seem to work at all. The result of my frustrations is this book, the one I’ve been wanting for working with the Arduino boards and shields. I really wanted something physical that I could keep near at hand on my workbench. It isn’t always practical to have to refer to a web page to look something up, and to make things even more interesting, sometimes access to the Internet just isn’t available (like when you’re trying to debug a remote data log‐ ging device on a mountaintop with just a little netbook for company and no wireless service for 60 miles in any direction). I wanted something that I could use to quickly Preface | xv
  • 22. 2 The books Environmental Monitoring with Arduino and Atmospheric Monitoring with Arduino (O’Reilly), both by Emily Gertz and Patrick Di Justo, offer some good ideas for doing just this with cheap and readily available sensors and an Arduino. look up the answer to a question when working with the Arduino and associated add- on components, no matter where I was. As far as I know, such a thing didn’t exist until now. I hope you find it as useful as I have as I assembled my notes for this book. Intended Audience This book is intended for those people who need or want to know the technical details. Perhaps you’ve gone as far as you can with the introductory material and the “99 amazing projects” type of books, and you now need to know how to do some‐ thing novel and unique. Or, you might be a working engineer or researcher who would like to incorporate an Arduino into your experimental setup in the lab. You might even be someone who wants to install an Arduino into an RC airplane, use one as part of a DIY weather station,2 or maybe do something even more ambitious (a CubeSat, perhaps?). Ideally you should have a basic knowledge of C or C++, some idea of how electrons move around in a circuit, and some experience building electronic devices. If I may be so bold, I would suggest that you have a copy of my book Practical Electronics: Components and Techniques (also from O’Reilly) on hand, along with some reference texts on programming and electronics (see Appendix D for some suggestions). What This Book Is This book is a reference and a handbook. I have attempted to organize it such that you can quickly and easily find what you are looking for. I have included the sources of my information whenever possible, and those insights that are the result of my own investigations are noted as such. What This Book Is Not This book is not a tutorial. That is not its primary purpose. I don’t cover basic elec‐ tronics, nor is there any discussion of the dialect of the C++ language that is used to create the so-called “sketches” for programming an Arduino. There are some excel‐ lent tutorial texts available that cover general electronics theory and programming, and I would refer the reader to those as a place to get started with those topics. This book is also not an Arduino-sanctioned guide to the products produced by the Arduino team. It is based on information gleaned from various sources, some more xvi | Preface
  • 23. obscure than others, along with my own notes and comments based on my experien‐ ces with the Arduino. As such, I am solely responsible for any errors or omissions. About Terminology The distinctions between processors, microprocessors, and microcontrollers arose sometime in the early 1980s as manufacturers were trying to distinguish their prod‐ ucts based on size and amount of external circuitry required for the devices to do something useful. Full-size mainframe processors and the smaller microprocessors like those found in desktop PCs both typically require some external components (sometimes a lot of them) in order to be useful. A microcontroller, on the other hand, has everything it needs to do its job already built in. Also, a microprocessor will typi‐ cally support external memory, whereas a microcontroller may have only limited sup‐ port (if any at all) for adding additional memory to what is already on the chip itself. Throughout this book I will use the terms “microcontroller” and “processor” inter‐ changeably. Although “microcontroller” might be considered to be technically more correct, in my mind it is still a processor of data, just a smaller version of the huge machines I once worked with in the distant past. They all do essentially the same thing, just at different scales and processing speeds. What’s in This Book Chapter 1 presents a brief history of the Arduino in its various forms. It also introdu‐ ces the AVR microcontrollers used in the Arduino boards, and discusses the differ‐ ences between software-compatible and hardware-compatible products based on the Arduino. The Atmel AVR microcontroller is the subject of Chapter 2. This is intended as an overview of what is actually a very sophisticated device, and so this chapter provides a quick tour of the highlights. This includes the timer logic, the analog comparator, the analog input, the SPI interface, and other primary subsystems on the chip. Chapter 3 takes a closer look at the AVR microcontrollers used in Arduino boards, namely the ATmega168/328, the ATmega1280/2560, and the ATmega32U4 devices. It builds on the overview presented in Chapter 2, and provides additional low-level details such as internal architecture, electrical characteristics, and chip pinouts. Chapter 4 covers the physical characteristics and interface functions of various Ardu‐ ino boards. This includes the USB interface types, printed circuit board (PCB) dimensions, and board pinout diagrams. What really makes the Arduino unique is its programming environment, and that is the subject of Chapter 5. This chapter defines the Arduino sketch concept and how it utilizes the C and C++ languages to create sketches. It introduces the Arduino boot‐ Preface | xvii
  • 24. loader and the Arduino main() function. This chapter also describes how you can download the Arduino source code and see for yourself what it looks like under the hood. Chapter 6 describes the AVR-GCC toolchain and presents techniques for program‐ ming an Arduino board without using the Arduino IDE. It also covers makefiles and includes a brief overview of assembly language programming. The chapter wraps up with a look at the tools available to upload code into an AVR. The focus of Chapter 7 is on the standard libraries supplied with the Arduino IDE. The Arduino IDE is supplied with numerous libraries, and more are being added all the time. If you want to know if a library module exists for a particular sensor or for a specific operation, then this is a good starting point. Chapter 8 presents the various types of shields available for the Arduino. It covers many of the commonly available types, such as flash memory, prototyping, input/ output, Ethernet, Bluetooth, ZigBee, servo control, stepper motor control, LED dis‐ plays, and LCD displays. It also covers using multiple shields, and presents some hints and tips for getting the most from a shield. Chapter 9 describes some of the various add-on components available that can be used with an Arduino. These include sensors, relay modules, keypads, and other items that aren’t specific to the Arduino, but work with it quite nicely. Electrical pin‐ out information and schematics are provided for many of the items discussed. Sometimes there just isn’t a readily available shield to do what needs to be done. Chapter 10 describes the steps involved in creating a custom shield. It also describes how to use an AVR microcontroller without an Arduino-type circuit board but still take advantage of the Arduino IDE. Chapters 11, 12, and 13 cover some projects that illustrate the capabilities of the AVR microcontrollers and the Arduino boards. They are intended to demonstrate how an Arduino can be applied in various situations, not as how-to guides for building a board or device. You can, however, build any of the items described yourself, if you feel so inclined, and they might serve as jumping-off points for your own projects. Each example project description includes theory of operation, schematics, a detailed parts list, PCB layouts (if required), and an overview of the software necessary to make it go. Because the main emphasis of this book is on the Arduino hardware and related modules, sensors, and components, the software shown is intended only to highlight key points; my aim was not to present complete, ready-to-run examples. The full software listings for the examples and projects can be found on GitHub. Chapter 11 describes a basic programmable signal generator, a handy thing to have around when working with electronic circuits. With this project you can generate xviii | Preface
  • 25. pulses at various duty cycles, output a sequence of pulses in response to a trigger input, generate sine waves, and also create programmable patterns of pulses. Chapter 12 covers the design and construction of a “smart” thermostat suitable for use with a home HVAC (heating, ventilation, and air conditioning) system. Instead of paying for something that is already built and sealed into a plastic case, you can build it yourself and program it to behave exactly the way you want it to. I’ll show you how to incorporate more than just a temperature sensor: features include multiple temper‐ ature and humidity sensors, and the use of your HVAC system’s fan to provide a comfortable environment without the cost of running the compressor or lighting up the heater. In Chapter 13 we will look at how to build an automatic model rocket launcher with a programmable sequencer and automatic system checks. Even if you don’t happen to have a model rocket handy, this project describes techniques that can be applied to many types of sequentially controlled processes, be it on a production line or a robotic material handling device in a laboratory. Appendix A is an overview of the basic tools and accessories you may need if you want to go beyond prefabricated circuit boards and modules. Appendix B is a compilation of the control registers for the ATmega168/328, the ATmega1280/2560, and the ATmega32U4 microcontrollers. Appendix C is a summary listing of the Arduino and compatible products distribu‐ tors and manufacturers listed in this book. It is by no means exhaustive, but hopefully it will be enough to get you started on your quest to find what you need. Appendix D lists some recommended books that cover not just the Arduino, but also C and C++ programming and general electronics. Finally, Appendix E is a summary of some of the readily available Arduino and AVR software development tools that are currently out there. Endorsements Other than references to the Arduino team and the folks at Arduino.cc, there aren’t any specific endorsements in this book—at least, not intentionally. I’ve made refer‐ ence to many different component manufacturers, suppliers, and other authors, but I’ve tried to be evenhanded about it, and I don’t specifically prefer any one over another. My only criteria in selecting those I do mention are that I own one or more of their products and that I’ve successfully managed to use a shield, module, sensor, or Arduino main PCB (or clone PCB in some cases) from the supplier in something, even if just in a demonstration of some type. Any trademarks mentioned are the property of their respective owners; they appear here solely for reference. As for the photography, I tried to use my own components, tools, circuit boards, modules, and Preface | xix
  • 26. other items as much as possible, and although an image may show a particular brand or model, that doesn’t mean it’s the only type available—it likely just happens to be the one that I own and use in my own shop. In some cases I’ve used images with per‐ mission from the vendor or creator, works in the public domain, or images with a liberal Creative Commons (CC) license, and these are noted and credited as appro‐ priate. I created all the diagrams, schematics, and other nonphotographic artwork, and I am solely responsible for any errors or omissions in these figures. Conventions Used in This Book The following typographical conventions are used in this book: Italic Indicates new terms, URLs, email addresses, filenames, and file extensions. Constant width Used for program listings, as well as within paragraphs to refer to program ele‐ ments such as variable or function names, databases, data types, environment variables, statements, and keywords. Constant width italic Shows text that should be replaced with user-supplied values or by values deter‐ mined by context. This element signifies a tip or suggestion. This element signifies a general note. This element indicates a warning or caution. xx | Preface
  • 27. Safari® Books Online Safari Books Online is an on-demand digital library that deliv‐ ers expert content in both book and video form from the world’s leading authors in technology and business. Technology professionals, software developers, web designers, and business and crea‐ tive professionals use Safari Books Online as their primary resource for research, problem solving, learning, and certification training. Safari Books Online offers a range of product mixes and pricing programs for organi‐ zations, government agencies, and individuals. Subscribers have access to thousands of books, training videos, and prepublication manuscripts in one fully searchable database from publishers like O’Reilly Media, Prentice Hall Professional, Addison- Wesley Professional, Microsoft Press, Sams, Que, Peachpit Press, Focal Press, Cisco Press, John Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FT Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, Course Technology, and dozens more. For more information about Safari Books Online, please visit us online. How to Contact Us Please address comments and questions concerning this book to the publisher: O’Reilly Media, Inc. 1005 Gravenstein Highway North Sebastopol, CA 95472 800-998-9938 (in the United States or Canada) 707-829-0515 (international or local) 707-829-0104 (fax) We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at http://bit.ly/arduino-a-technical-reference. To comment or ask technical questions about this book, send email to bookques‐ tions@oreilly.com. For more information about our books, courses, conferences, and news, see our web‐ site at http://www.oreilly.com. Find us on Facebook: http://facebook.com/oreilly Follow us on Twitter: http://twitter.com/oreillymedia Watch us on YouTube: http://www.youtube.com/oreillymedia Preface | xxi
  • 28. Acknowledgments This book would not have been possible without the enduring patience and support of my family. Writing appears to be habit-forming, but they’ve been very encouraging and supportive, and will even bring me things to eat and occasionally check to make sure I’m still alive and kicking in my office. It doesn’t get much better than that. I would particularly like to thank my daughter Seren for her photographic assistance and help in keeping my collection of various bits and pieces cataloged and organized. I would also like to thank the editorial staff at O’Reilly for the opportunity to work with them once again. As always, they have been helpful, patient, and willing to put up with me. Special thanks goes to Brian Sawyer and Dawn Schanafelt for their excel‐ lent editorial support and guidance, and to Mike Westerfield for his insightful techni‐ cal review of the material. xxii | Preface
  • 29. CHAPTER 1 The Arduino Family This chapter provides a brief history of the Arduino, along with a terse genealogy of the various board types created since 2007. It doesn’t cover boards produced before 2007, nor does it attempt to be comprehensive in its coverage of the various clones and derivatives that have been produced. The main focus here is on the differences between the various primary types of Arduino boards, with a specific focus on the types of processors used and the physical design of the boards. It also takes a quick look at the range of possible applications for Arduino circuit boards. Chapter 2 provides general information about the internal functions of the Atmel AVR processors, and Chapter 3 covers the specific processors used in Arduino boards. With the exception of the Yún, Chapter 4 describes the physical characteris‐ tics of different official Arduino boards introduced in this chapter. A Brief History In 2005, building upon the work of Hernando Barragán (creator of Wiring), Massimo Banzi and David Cuartielles created Arduino, an easy-to-use programmable device for interactive art design projects, at the Interaction Design Institute Ivrea in Ivrea, Italy. David Mellis developed the Arduino software, which was based on Wiring. Before long, Gianluca Martino and Tom Igoe joined the project, and the five are known as the original founders of Arduino. They wanted a device that was simple, easy to connect to various things (such as relays, motors, and sensors), and easy to program. It also needed to be inexpensive, as students and artists aren’t known for having lots of spare cash. They selected the AVR family of 8-bit microcontroller (MCU or µC) devices from Atmel and designed a self-contained circuit board with easy-to-use connections, wrote bootloader firmware for the microcontroller, and packaged it all into a simple integrated development environment (IDE) that used programs called “sketches.” The result was the Arduino. 1
  • 30. Since then the Arduino has grown in several different directions, with some versions getting smaller than the original, and some getting larger. Each has a specific intended niche to fill. The common element among all of them is the Arduino run‐ time AVR-GCC library that is supplied with the Arduino development environment, and the on-board bootloader firmware that comes preloaded on the microcontroller of every Arduino board. The Arduino family of boards use processors developed by the Atmel Corporation of San Jose, California. Most of the Arduino designs utilize the 8-bit AVR series of microcontrollers, with the Due being the primary exception with its ARM Cortex-M3 32-bit processor. We don’t cover the Due in this book, since it is radically different from the AVR devices in many fundamental ways and really deserves a separate discussion devoted to it and similar microcontrollers based on the ARM Cortex-M3 design. Although an Arduino board is, as the Arduino team states, just a basic Atmel AVR development board, it is the Arduino software environment that sets it apart. This is the common experience for all Arduino users, and the cornerstone of the Arduino concept. Chapter 5 covers the Arduino IDE, the libraries supplied with the IDE, and the bootloader. Chapter 6 describes the process of creating software for an AVR MCU without using the Arduino IDE. Types of Arduino Devices Over the years the designers at Arduino.cc have developed a number of board designs. The first widely distributed Arduino board, the Diecimila, was released in 2007, and since its initial release the Arduino family has evolved to take advantage of the various types of Atmel AVR MCU devices. The Due, released in 2012, is the first Arduino to utilize a 32-bit ARM Cortex-M3 processor, and it breaks from the rest of the family in terms of both processing power and board pinout configuration. Other boards, like the LilyPad and the Nano, also do not have the same pinout as the other members of the family, and are intended for a different range of applications—weara‐ bles in the case of the LilyPad; handheld devices for the Esplora; and compact size in the case of the Mini, Micro, and Nano. With each passing year new types of Arduino boards appear, so what is listed here may be out of date by the time you’re reading it. The newer versions have more advanced processors with more memory and enhanced input/output (I/O) features, but for the most part they use the same pinout arrangements and will work with existing add-on boards, called shields, and various add-on components such as sen‐ sors, relays, and actuators. Table 1-1 lists the Arduino types that have appeared since 2005. The newer versions of the Arduino will also run most of the sketches created for older models, perhaps with a few minor tweaks and newer libraries, but sketches written for the latest versions may or may not work with older models. 2 | Chapter 1: The Arduino Family
  • 31. Table 1-1 is not a buyer’s guide. It is provided to give a sense of historical context to the Arduino. As you can see, the years 2007 and 2008 saw the introduction of the LilyPad; the small form-factor boards like the Nano, Mini, and Mini Pro; and the introduction of the Duemilanove as a natural evolutionary step based on the Dieci‐ mila. While there are no significant physical differences between the Diecimila and the Duemilanove, the Duemilanove incorporates some refinements in the power sup‐ ply, most notably in its automatic switchover between USB power and an external DC (direct current) power supply. Later versions of the Duemilanove also utilize the ATmega328 MCU, which provides more memory for programs. Table 1-1 doesn’t include the Arduino Robot, which is a PCB with motors and wheels attached. One of the newest boards in the Arduino lineup is the Yún, an interesting beast that has both an ATmega32U4 microcontroller and a Linino module with an Atheros AR9331 MIPS-based processor capable of running a version of the Linux- based OpenWrt operating system. I won’t get into the OpenWrt end of the Yún, but the Arduino side is basically just a standard Arduino (a Leonardo, to be specific). If you want to learn more about the Yún, I would suggest checking it out on the Ardu‐ ino website. Table 1-1. Timeline of Arduino products Board name Year Microcontroller Board name Year Microcontroller Diecimila 2007 ATmega168V Mega 2560 2010 ATmega2560 LilyPad 2007 ATmega168V/ATmega328V Uno 2010 ATmega328P Nano 2008 ATmega328/ATmega168 Ethernet 2011 ATmega328 Mini 2008 ATmega168 Mega ADK 2011 ATmega2560 Mini Pro 2008 ATmega328 Leonardo 2012 ATmega32U4 Duemilanove 2008 ATmega168/ATmega328 Esplora 2012 ATmega32U4 Mega 2009 ATmega1280 Micro 2012 ATmega32U4 Fio 2010 ATmega328P Yún 2013 ATmega32U4 + Linino When more than one microcontroller type is shown in Table 1-1, it indicates that a particular version of an Arduino board was made initially with one microcontroller, and later with the other (usually more capable) device. For example, an older version of the Duemilanove will have an ATmega168, whereas newer models have the ATmega328. Functionally the ATmega168 and the ATmega328 are identical, but the ATmega328 has more internal memory. The latest additions to the Arduino family, the Leonardo, Esplora, Micro, and Yún, all use the ATmega32U4. While this part is similar to an ATmega328 it also incorporates an integrated USB-to-serial interface component, which eliminates one of the integra‐ ted circuit (IC) parts found on boards like the Uno and Duemilanove. Types of Arduino Devices | 3
  • 32. The programming interface also behaves slightly differently with the boards that use the ATmega32U4, but for most people this should be largely transparent. Chapter 2 describes the general functionality of AVR microcontrollers, Chapter 3 contains descriptions of the specific AVR MCU types found in Arduino devices, and Chapter 4 provides descriptions of the primary Arduino circuit boards and their pinout defini‐ tions. Arduino Galleries Tables 1-1 through 1-5 show some of the various types of Arduino boards, both past and present. It is not completely inclusive, since new types and updates to existing types occur periodically. The following images show the wide diversity in physical shapes and intended applications of the Arduino. Physically, an Arduino is not a large circuit board. The baseline boards, which have the physical pin arrangement commonly used for add-on boards (called shields, described in Chapter 8), are about 2.1 by 2.7 inches (53.3 by 68.6 mm) in size. Figure 1-1 shows a selection of Arduino boards with a ruler for scale, and Figure 1-2 shows a Nano mounted on a solderless breadboard. Figure 1-1. Relative sizes of Arduino boards Chapter 4 contains reference drawings with dimensions and pin definitions for most of the common Arduino boards. Note that while it is small, a board like the Nano has all of the same capabilities as a Duemilanove, except for the convenient pin sockets and regular (type B) USB connector. It is ideal for applications where it will not be disturbed once it is installed, and where small size is a requirement. Some applica‐ tions that come to mind are autonomous environmental data collection devices 4 | Chapter 1: The Arduino Family
  • 33. (automated solar-powered weather data stations or ocean data collection buoys, for example), timing and data collection for model rockets, security systems, and perhaps even a “smart” coffee maker. Figure 1-2. An Arduino Nano on a solderless breadboard Table 1-2. Baseline layout of Arduino boards Type Year introduced Diecimila 2007 Duemilanove 2008 Uno (R3 version) 2010 Arduino Galleries | 5
  • 34. Type Year introduced Ethernet 2011 Leonardo 2012 Table 1-3. Mega layout of Arduino boards Type Year introduced Mega 2009 Mega 2560 2009 Mega ADK 2011 Table 1-4. Small form factor Arduino boards Type Year introduced Nano 2008 Mini 2008 Fio 2010 Micro 2012 6 | Chapter 1: The Arduino Family
  • 35. Table 1-5. Special form factor Arduino boards Type Year introduced LilyPad 2007 Esplora 2012` Arduino-Compatible Devices In addition to the various board types designed or sanctioned by Arduino.cc, there are many devices that are either hardware compatible or software compatible. What makes these devices Arduino compatible is that they incorporate the Arduino boot‐ loader (or something that works like it), and they can be programmed with the Ardu‐ ino IDE by selecting the appropriate compatible Arduino board type from the IDE’s drop-down list. Hardware-Compatible Devices An Arduino hardware–compatible device is one where the various I/O pins on the board have been arranged to match one of the existing Arduino form factors. A hardware-compatible board can (usually) accept any of the shields and plug-in mod‐ ules created for an official Arduino board. The reasons behind this are covered in “The Arduino Naming Convention” on page 9. In most cases hardware-compatible boards look like any other Arduino board, except that the official Arduino logo and silkscreen graphics are missing. Other hardware- compatible products might not look anything like a typical Arduino board, but do provide the pin sockets in the correct arrangement for using a standard Arduino-type shield board. Some hardware-compatible products include additional connections, like the SainSmart version of the Uno with additional connectors for I/O functions. Table 1-6 lists a few Arduino clones and compatible boards that are available. There are many more than what is shown here, but this should give some idea of what is available. Arduino-Compatible Devices | 7
  • 36. Table 1-6. Arduino hardware–compatible devices Name Type Origin SainSmart UNO Uno clone China SainSmart Mega2560 Mega 2560 clone China Brasuino Similar to the Uno, with minor changes Brazil Diavolino An Arduino layout–compatible clone kit USA Note that Diavolino is a kit and requires assembly. Software-Compatible Devices There are many Arduino software–compatible boards available. These utilize the Arduino bootloader and development environment, but do not have a completely Arduino-compatible physical form factor. Software-compatible devices can be pro‐ grammed with the Arduino development tools, but may use a different arrangement of I/O pins, or perhaps use some other types of connectors in place of the pin sockets found on stock Arduino boards. Custom circuits based on an AVR microcontroller and built into some larger device or system would fall into the software-compatible category if the Arduino bootloader is installed in the microcontroller. The core of the Arduino is the processor and the preinstalled bootloader. Using that definition, one could have just a bare ATmega AVR IC with the Arduino firmware loaded into it. It could then be used with a solderless breadboard and the Arduino development environment. AVR MCU ICs with preloaded bootloader code are avail‐ able for purchase from multiple sources, or you could do it yourself. Chapter 5 describes the steps necessary to load an AVR MCU with the Arduino bootloader firmware. 8 | Chapter 1: The Arduino Family
  • 37. It is interesting to note that some of the boards from Arduino, such as the Mini, Micro, Nano, LilyPad, and Esplora, are not hardware compatible in terms of using the “standard” I/O connector layout. They can’t be used directly with a conventional shield, but they are still Arduino boards, and they are supported by the Arduino IDE. The Boarduino from Adafruit Industries is one example of an Arduino software– compatible device. This board is designed to mount on a standard solderless bread‐ board much like a full-size 40-pin IC. It is available in two styles: DC and USB. The DC version does not have an on-board USB chip, so an external USB adapter is needed to program it. Another example of a software-compatible board is the Drag‐ onfly from Circuit Monkey, which uses standard Molex-type connectors instead of the pins and sockets used on a conventional Arduino. It is intended for high- vibration environments, such as unmanned aerial vehicles (UAVs) and robotics. The Raspduino is designed to mount onto a Raspberry Pi board, and it is functionally equivalent to an Arduino Leonardo. This results in a combination that is roughly equivalent to the Yún, but not exactly the same. Each setup has its own strengths and weaknesses. Table 1-7 lists a few Arduino software–compatible boards. Table 1-7. Arduino software–compatible devices Name Description Origin Boarduino DC Designed to fit on a solderless breadboard USA Boarduino USB Designed to fit on a solderless breadboard USA Dragonfly Uses Molex-type connectors for I/O USA Raspduino Designed to fit on a Raspberry Pi board Netherlands This is just a small selection of the various boards that are available. Because the AVR microcontroller is easy to integrate into a design, it has found its way into numerous applications. With the Arduino bootloader firmware, programming a device is greatly simplified and the design possibilities are vast. The Arduino Naming Convention While the circuit design and software for the Arduino are open source, the Arduino team has reserved the use of the term “Arduino” for its own designs, and the Arduino The Arduino Naming Convention | 9
  • 38. logo is trademarked. For this reason you will sometimes find things that behave and look like official Arduino devices, but which are not branded Arduino and have not been produced by the Arduino team. Some of them use “-duino” or “-ino” as part of the product name, such as Freeduino, Funduino, Diavolino, Youduino, and so on. Some, like the boards made by SainSmart, use just the model name (Uno and Mega2560, for example). At the time of this writing, there was an ongoing dispute between the company created by the original founders (Arduino LLC) and a different company started by one of the original founders (Arduino SRL). As a result, Arduino LLC uses the trademark Arduino within the United States and Genuino elsewhere. Occasionally someone will produce a board that claims to be an Arduino, but is in fact just a copy that uses the Arduino trademark without permission. The silkscreen mask used to put the logo and other information on an official Arduino is also copy‐ righted, and the Arduino folks don’t release the silkscreen with the PCB layout files. Massimo Banzi has a section of his blog devoted specifically to these unauthorized boards, and his examination of blatant and shameless copies is interesting, to say the least. Just search for the “hall of shame” tag. The bottom line here is that you are welcome to copy the schematics, the bootloader code, and the Arduino IDE, and use these to create your own version of an Arduino. It is, after all, open source. Just don’t call it an Arduino or use the artwork from Ardu‐ ino.cc without permission. What Can You Do with an Arduino? In addition to the ease of programming made possible by the Arduino IDE, the other big feature of the Arduino is the power and capability of the AVR microcontroller it is based on. With a handful of readily available add-on shields (described in Chapter 8) and a wide selection of low-cost sensor and actuator modules (these are described in detail in Chapter 9), there really isn’t a whole lot you can’t do with an Arduino pro‐ vided that you keep a few basic constraints in mind. The first constraint is memory. The AVR MCU just doesn’t have a whole lot of mem‐ ory available for program storage and variables, and many of the AVR parts don’t have any way to add more. That being said, the ATmega32 and ATmega128 types can use external memory, but then the I/O functions for those pins are no longer readily available. Arduino boards were not designed to accommodate external memory, since one of the basic design assumptions was that the AVR chip itself would have the nec‐ essary I/O and that the user would be running a relatively short program. The Ardu‐ ino was not intended to be a replacement for a full-on computer system with 10 | Chapter 1: The Arduino Family
  • 39. gigabytes of RAM and a hard disk drive (HDD). There are inexpensive Intel-based single-board computers that fit that description, but they won’t fit into an old mint tin, a section of PVC tubing strapped to a pole or a tree, a small robot, or the payload section of a model rocket. An Arduino will. The second constraint is speed. The Arduino CPU clock rate is typically between 8 and 20 MHz (see Chapter 4 for a detailed comparison of Arduino AVR device types). While this may sound slow, you should bear in mind two key facts: first, the AVR is a very efficient RISC (reduced instruction set computer) design, and second, things in the real world generally don’t happen very quickly from a microcontroller’s perspec‐ tive. For example, how often does a so-called smart thermostat need to sample the temperature in a home or office? Once a second is probably overkill, and once every 5 or even 10 seconds will work just fine. How often does a robot need to emit an ultra‐ sonic pulse to determine if there is an obstacle ahead? A pulse every 100 ms is proba‐ bly more than enough (unless the robot is moving very, very fast). So, for an Arduino running at 16 MHz (like the Leonardo, for example), there will be on the order of 1,000,000 or more CPU clock ticks between sensor pulses, depending on whatever else the CPU is doing with the pulses. Given that an AVR can execute many instruc‐ tions in one or two clock cycles, that’s a lot of available CPU activity in between each pulse of the ultrasonic sensor. The third main constraint is electrical power. Since the Arduino hardware is actually nothing more than a PCB for an AVR IC to sit on, there is no buffering between the microcontroller and the external world. You can perform a fast “charcoal conversion” of an AVR (in other words, overheat the IC and destroy it) if some care isn’t taken to make sure that you aren’t sourcing or sinking more current than the device can han‐ dle. Voltage is also something to consider, since some of the AVR types have 3.3V I/O, whereas others are 5V tolerant. Connecting 5V transistor-transistor logic (TTL) to a 3.3V device usually results in unhappy hardware, and the potential for some smoke. With the preceding constraints in mind, here are just a few possible applications for an Arduino: • Real-world monitoring — Automated weather station — Lightning detector — Sun tracking for solar panels — Background radiation monitor — Automatic wildlife detector — Home or business security system • Small-scale control — Small robots What Can You Do with an Arduino? | 11
  • 40. — Model rockets — Model aircraft — Quadrotor UAVs — Simple CNC for small machine tools • Small-scale automation — Automated greenhouse — Automated aquarium — Laboratory sample shuttle robot — Precision thermal chamber — Automated electronic test system • Performance art — Dynamic lighting control — Dynamic sound control — Kinematic structures — Audience-responsive artwork In Chapters 11, 12, and 13 we will look at applications such as a smart thermostat, a programmable signal generator, and an automated rocket launch control system to help fulfill your suborbital yearnings. These are just the tip of the iceberg. The possi‐ bilities are vast, and are limited only by your imagination. So long as you don’t try to make an Arduino do the job of a full-on computer system, you can integrate one into all sorts of interesting applications—which is exactly what the folks at Arduino.cc want you to do with it. For More Information The boards listed in this chapter are just a small selection of what is available, and there is much more to the story of the Arduino. Entering “Arduino” into Google’s search bar will produce thousands of references to explore. The official Arduino website can be found at http://www.arduino.cc. Massimo Banzi’s blog is located at http://www.massimobanzi.com. Also, check the appendixes for more website links and book recommendations. 12 | Chapter 1: The Arduino Family
  • 41. CHAPTER 2 The AVR Microcontroller Because an AVR-based Arduino is really just a physical platform for an AVR micro‐ controller (i.e., a breakout board), the electrical characteristics of an Arduino are essentially those of the AVR device on the PCB. Understanding the low-level details of an Arduino is really a matter of understanding the AVR device that powers it. To that end, this chapter presents broadly applicable material consisting of high-level descriptions of the main functions utilized in the AVR family. This includes the AVR CPU and the so-called peripheral functions such as timers, counters, serial interface logic, analog-to-digital (A/D) converters, analog comparators, and discrete digital I/O ports. AVR microcontrollers are available in a wide variety of configurations and package types, which makes writing a chapter like this something of a challenge. Fortunately, the various types of 8-bit AVR devices use a common central processing unit (CPU) and a modular internal architecture built around an internal data bus. This allows for each variant to incorporate different combinations and quantities of functional mod‐ ules into the AVR’s internal circuitry to meet specific design requirements and sup‐ port different intended applications. Due to practical limitations of space, the descriptions in this chapter are necessarily terse and focused on the essential characteristics, and don’t provide may of the low- level details that can be found in the reference documentation available from Atmel. If you need or want to know the logic circuit and register-level details of what’s inside a particular AVR microcontroller, datasheets, user’s guides, and application notes are available from Atmel free of charge. 13
  • 42. Background The AVR microcontroller began life in the early 1990s as a student project at the Nor‐ wegian Institute of Technology. Two students, Alf-Egil Bogen and Vegard Wollan, devised an 8-bit device with a RISC-type internal architecture while working at a local semiconductor facility in Trondheim, Norway. The design was later sold to Atmel, where Bogen and Wollan continued to work on it and refine it. The AVR microcontrollers are highly configurable and very versatile, and they embody several unique features that set them apart from other 8-bit microcontrollers like the 8051 or 68HC05 components. The AVR is a modified Harvard architecture 8- bit RISC microcontroller. In a Harvard architecture read-only program, code and modifiable data (variables) are stored in separate memory spaces. By way of compari‐ son, a microprocessor like the 68040 uses the Von Neumann architecture, in which programs and data share the same memory space. The AVR family of devices was one of the first to incorporate on-board flash memory for program storage, instead of the one-time programmable ROM (read-only mem‐ ory), EPROM (erasable programmable read-only memory), or EEPROM (electrically erasable programmable read-only memory) found on other microcontrollers. This makes reprogramming an AVR microcontroller simply a matter of loading new pro‐ gram code into the device’s internal flash memory. Most AVR parts do have a small amount of EEPROM for storing things like operating parameters that must persist between changes in the flash memory. Internal Architecture Internally, an AVR ATmega microcontroller consists of an AVR CPU and various input/output, timing, analog-to-digital conversion, counter/timer, and serial interface functions, along with other functions depending on the part number. These are referred to by Atmel as peripheral functions. Besides the I/O functions, the main differences between the AVR microcontroller types lie in the amount of on-board flash memory and available I/O functions. The 8-bit parts all use essentially the same AVR CPU core. The following list shows just some of the basic features of AVR microcontrollers: • RISC architecture — 131 instructions — 32 8-bit general-purpose registers — Up to 20 MHz clock rate (20 MIPS operation) • On-board memory — Flash program memory (up to 256K) 14 | Chapter 2: The AVR Microcontroller
  • 43. — On-board EEPROM (up to 4K) — Internal SRAM (up to 32K) • Operating voltage — VCC = 1.8 to 5.5V DC Figure 2-1 shows a simplified block diagram of the AVR CPU core found on 8-bit AVR devices. Figure 2-2 shows a generic high-level block diagram of an AVR device. This is not intended to represent any specific AVR device, just an AVR in general. Figure 2-1. AVR CPU block diagram Internal Architecture | 15
  • 44. The peripheral functions are controlled by the CPU via an internal high-speed data bus. Control registers (separate from the CPU registers) are used to configure the operation of the peripherals. All peripheral functions share port pins with the discrete digital I/O capabilities. Figure 2-2. Generic AVR microcontroller block diagram 16 | Chapter 2: The AVR Microcontroller
  • 45. Atmel makes many different types of AVR microcontrollers, which allows hardware designers to pick the part that meets their specific needs and reduce the number of unused pins and wasted space on a printed circuit board. Some, like the tinyAVR parts, come in small surface-mount packages with as few as six pins. Each has one or more discrete digital I/O ports, which can be programmed to perform multiple func‐ tions (see “Peripheral Functions” on page 17). For example, the ATTINY13-20SQ comes in an eight-pin DIP (dual in-line pin) or SOIC (small-outline IC) surface-mount package. Six of the device’s pins are connec‐ ted to an internal 8-bit I/O port (port B). The other two are VCC (power) and ground. The six port B pins can be configured as analog inputs, oscillator outputs, interrupt inputs, SPI signals, or discrete digital inputs or outputs. Internally, the device—even one this small—is still an AVR microcontroller, and it has 1K of built-in flash memory for programs, and 64 bytes of RAM for variables. On the other end of the spectrum there are AVR parts like the ATmega649, with nine 8-bit ports (A through J, but no I, since I can be confused for the numeral 1), 64K of flash memory, 4K of RAM, 2K of EEPROM, 54 general-purpose I/O pins, and an integrated LCD interface. The AVR32 series of parts are 32-bit AVR processors with up to 256K of flash memory, 32K of RAM, an integrated DSP (digital signal process‐ ing) unit, protected memory, and 36 general-purpose I/O pins. No Arduino boards use an AVR part as small as a tinyAVR (it would be a real chal‐ lenge to squeeze the Arduino bootloader into something with only 1K of flash and still have room left for a useful program), or anything like the ATmega649 or an AVR32, but the point here is that the AVR family offers many choices, and the parts that have been selected for use in Arduino devices aren’t the only AVR parts that could be used. Internal Memory AVR devices all contain various amounts of three types of memory: flash, SRAM (static random-access memory), and EEPROM. The flash memory is used to store program code, the SRAM is used to hold transient data such as program variables and the stack, and the EEPROM can hold data that needs to persist between software changes and power cycles. The flash and EEPROM can be loaded externally, and both will retain their contents when the AVR is powered off. The SRAM is volatile, and its contents will be lost when the AVR loses power. Peripheral Functions The heart of an AVR microcontroller is the 8-bit CPU, but what makes it a truly use‐ ful microcontroller is the built-in peripheral functions integrated into the IC with the CPU logic. The peripheral functions of an AVR device vary from one type to another. Internal Memory | 17
  • 46. Some have one timer, some have two or more (up to six for some types). Other parts may have a 10-bit A/D converter (ADC), whereas others feature a 12-bit converter. All AVR parts provide bidirectional I/O pins for discrete digital signals. Some ver‐ sions also support a touchscreen and other types of interactive interfaces. This section contains general descriptions of the peripheral functions that are used with the various types of AVR devices found in Arduino products, with the ATmega168 serving as a baseline example. This section does not attempt to provide an exhaustive reference for each type of AVR microcontroller, but instead covers the general functionality of each type of peripheral function. Refer to Chapter 3 for spe‐ cific information regarding the processors used in the Arduino boards described in this book, and also see the Atmel technical documentation for low-level details not provided here. Control Registers In addition to 32 general-purpose registers in the CPU, AVR devices also have a num‐ ber of control registers that determine how the I/O ports, timers, communications interfaces, and other features will behave. The control register set will vary from one type of device to another, since different types may have more or less ports than others, and different peripheral function configurations. The control registers for the AVR parts used in the Arduino boards covered in this book can be found in Appendix B. They are also described in detail in the documentation available directly from Atmel. Even a modest AVR part like the ATmega168 has far more internal functionality than it has pins available to dedicate to each function. For this reason, most of the pins on an AVR microcontroller can be configured to perform specific functions based on the settings contained in the control registers. Because the pin functions are dynamically configurable, it is possible to have a pin perform one type of function at one point in time, and then perform a different function once the control register value has been modified. For example, pin 12 of an ATmega168 in a 28-pin DIP package is connected to PD6 (Port D, bit 6), but it can also be configured to act as an interrupt source (PCINT22), as the positive input for the AVR’s internal analog comparator (AIN0), or as the out‐ put of a timer comparison logic circuit (the Timer/Counter0 output compare match A), which can be used to generate a PWM (pulse width modulation) signal. Digital I/O Ports AVR microcontrollers use bidirectional I/O ports to communicate with the external world. A port is an 8-bit register wherein some or all of the bits are connected to physical pins on the AVR device package. Different types of AVR devices have differ‐ 18 | Chapter 2: The AVR Microcontroller
  • 47. ent numbers of ports, ranging from one for the ATTINY13-20SQ up to nine for the ATmega649. Ports are labeled as A, B, C, and so on. Each pin of a port is controlled by internal logic that manages the signal direction, the state of an internal pull-up resistor, timing, and other functions. A simplified sche‐ matic is shown in Figure 2-3. The Px in Figure 2-3 refers to port bit/pin x (0 through 7). For a detailed description of the AVR port logic, see the AVR technical references. Figure 2-3. AVR I/O port block diagram Because of the sophisticated logic used to control functionality, an AVR port can per‐ form many different functions—some of them simultaneously. When a port is config‐ ured as an output it is still possible to read data from it, and an output can be used to trigger an interrupt (discussed in “Interrupts” on page 26). 8-Bit Timer/Counters There are two forms of 8-bit timer/counter available in AVR microcontrollers. In the first type the clock input is derived from the primary system clock, and hence the timer/counter is synchronous. The second form has the ability to operate in an asyn‐ chronous mode using an external clock source. Figure 2-4 shows a simplified sche‐ Peripheral Functions | 19
  • 48. matic of an AVR timer. The control registers for the timer/counter are defined in Appendix B and described in detail in the Atmel technical documentation. Figure 2-4. AVR timer/counter block diagram The Timer/Counter0 module in an AVR 8-bit timer/counter peripheral function is a general-purpose timer and/or counter that features two independent output compari‐ son circuits with four modes of operation. The timer/counter modes of operation are as follows: Normal mode This is the simplest mode of timer/counter operation. The count always incre‐ ments and no counter clear is performed when the counter reaches its maximum 8-bit value. When this occurs, the counter overflows and returns to zero. When the counter wraps back to zero, the Timer/Counter Overflow Flag (TOV0) is set. The TOV0 flag can be viewed as a ninth bit, but it is only set, not cleared, by a timer overflow. The timer overflow interrupt will automatically clear the over‐ flow flag bit, and the interrupt can be used to increment a second software-based counter in memory. A new counter value can be written to the TCNT0 register at any time. Clear Timer on Compare (CTC) mode In the Clear Timer on Compare mode, the OCR0A register is used to manipulate the counter resolution by defining the maximum value of the counter. This results in greater control of the compare match output frequency and helps to simplify external event counting. 20 | Chapter 2: The AVR Microcontroller
  • 49. Fast PWM mode The fast pulse width modulation mode supports high-frequency PWM waveform generation. Phase correct PWM mode The phase correct PWM mode provides a high-resolution phase correct PWM waveform generation option. In addition, some AVR devices contain an 8-bit timer/counter with the ability to operate asynchronously using external clock inputs (the TOSC1 and TOSC2 clock input pins). It is functionally equivalent to the synchronous 8-bit timer/counter cir‐ cuit described previously. 16-Bit Timer/Counters The 16-bit timer/counter is similar to the 8-bit version, but with an extended count range. It is true 16-bit logic, which allows for 16-bit variable period PWM generation. The module also features two independent output comparison circuits, double- buffered output comparison registers, and an input capture circuit with noise cancel‐ ing. In addition to PWM generation the 16-bit timer/counter can be used for high- resolution external event capture, frequency generation, and signal timing measurement. It has the ability to generate four different interrupts (TOV1, OCF1A, OCF1B, and ICF1). Timer/Counter Prescaler In an AVR device one or more counters may share the same prescaler logic, but with different settings. The prescaler is essentially a divider circuit that generates a deriva‐ tive of the system I/O clock at f/8, f/64, f/256, or f/1024, which are referred to as taps. One timer/counter might use the f/64 tap, whereas another might use the f/1024 tap. The use of a prescaler allows the range of a timer/counter to be extended to more closely match the rate at which an external event occurs, and also increases the time in between timer/counter overflows and resets. Analog Comparator The analog comparator section of an AVR microcontroller is used to compare the input voltages on the AIN0 and AIN1 pins. Although AIN0 is defined as the positive input and AIN1 as the negative, this refers to the relationship between them, not the actual polarity of the input voltages. Figure 2-5 shows a simplified schematic of the analog comparator circuit of an AVR. Analog Comparator | 21
  • 50. Figure 2-5. AVR analog comparator block diagram When AIN0 is greater than AIN1, the comparator logic sets the comparator flag ACO. The output of the comparator can be configured to trigger the input capture function of one of the timer/counter modules, and it can also generate an interrupt specific to the comparator. The interrupt event can be configured to trigger on com‐ parator output rise, fall, or toggle. The analog comparator circuit can do more than just compare the voltages on the AIN0 and AIN1 inputs. The input of the analog comparator may also be configured such that the AIN1 input can be compared to the internal bandgap reference voltage, or AIN0 can be compared to the output of the ADC multiplexer (and this voltage is still available to the input of the ADC). The unusual symbols with four arrows are analog gates. How a gate will respond to a control input is indicated by the inversion circle—when the inverting control input is used it will pass an analog signal when the control is low, and otherwise it will pass a signal when it is high. Analog-to-Digital Converter Most AVR microcontrollers contain an 8-bit, 10-bit, or 12-bit analog-to-digital con‐ verter. The 8-bit converters are found in the ATtiny6 and ATtiny10 parts. Some of the automotive versions of AVR microcontrollers have no ADC. When an ADC is part of the AVR design, it will have anywhere from 4 to 28 inputs. The actual number of available inputs depends largely on the physical package. Each input is selected one at a time via an internal multiplexer—they are not all active 22 | Chapter 2: The AVR Microcontroller
  • 51. simultaneously. In addition, some of the I/O pins used by the ADC input multiplexer may also be assigned to other functions. ATmega168 devices have either six or eight ADC input channels, depending on the package type. The PDIP (plastic DIP) package has a 10-bit ADC with six input chan‐ nels. The TQFP and QFN/MFL surface-mount packages have a 10-bit ADC with eight input channels. Figure 2-6 shows a block diagram of the AVR ADC peripheral function. Figure 2-6. AVR analog-to-digital converter block diagram Analog-to-Digital Converter | 23
  • 52. Notice in Figure 2-6 that the AVR employs what is called a “successive approxima‐ tion” converter. This type of converter isn’t particularly fast, but it is simple to imple‐ ment, requiring only a DAC (digital-to-analog converter) and a comparator. The typical conversion time for a 10-bit AVR ADC in free-running mode, while still maintaining full resolution, is around 65 microseconds (µs) per sample. Serial I/O The ATmega168 provides three primary forms of serial interface: synchronous/asyn‐ chronous serial, SPI master/slave synchronous, and a byte-oriented two-wire inter‐ face similar to the Philips I2C (Inter-Integrated Circuit) standard. USART A common component of many AVR parts is a built-in USART (universal synchro‐ nous/asynchronous receiver-transmitter), also referred to as a UART (universal asyn‐ chronous receiver-transmitter). This function can be used to implement an RS-232 or RS-485 interface, or used without external interface logic for chip-to-chip communi‐ cations. The baud rate is determined by the frequency of the clock used with the microcontroller, with 9,600 being a typical speed. Higher rates are possible with a fast external crystal. The USART can also be used in SPI (serial peripheral interface) mode, in addition to the dedicated SPI logic found in AVR devices. Figure 2-7 shows the basic internal components of the AVR USART peripheral function. Figure 2-7. AVR USART block diagram 24 | Chapter 2: The AVR Microcontroller
  • 53. 1 Master out, slave in; master in, slave out; and serial clock. SPI The SPI peripheral logic of the AVR supports all four standard SPI modes of opera‐ tion. I/O pins on the AVR device may be configured to act as the MOSI, MISO, and SCK1 signals used by SPI. These pins are different from the RxD and TxD (recieve data and transmit data) pins used by the USART. Figure 2-8 shows a high-level view of the SPI logic. Figure 2-8. AVR SPI block diagram TWI The third form of serial I/O supported by many AVR devices is the two-wire interface (TWI). This interface is compatible with the Philips I2C protocol. It supports both master and slave modes of operation, and a 7-bit device address. The TWI interface can achieve transfer speeds of up to 400 kHz with multimaster bus arbitration and has the ability to generate a wakeup condition when the AVR is in sleep mode. Inter‐ Serial I/O | 25
  • 54. nally, the TWI peripheral is rather complex—much more so than either the USART or SPI peripherals. Figure 2-9 shows an overview of the TWI interface. Figure 2-9. AVR TWI (I2C) block diagram Interrupts Interrupts are an essential function of a modern processor. They allow the processor to respond to events, either internal or external, by switching to a special block of interrupt handler code to deal with the interrupt. Once the block of code has been executed, control returns to the program that was interrupted at the place where the interrupt occurred. In the AVR an interrupt response may be enabled or disabled via 26 | Chapter 2: The AVR Microcontroller
  • 55. Exploring the Variety of Random Documents with Different Content
  • 56. CHAPTER VI. JEWISH APOSTATES AND THE DISPUTATION AT TORTOSA. The Marranos—The Satirists—Pero Ferrus of Alcala, Diego de Valencia, and Villasandino—Astruc Raimuch and Solomon Bonfed—Paul de Santa Maria and his Zealous Campaign against the Jews—Joshua Ibn-Vives—Profiat Duran (Efodi)—Meïr Alguades—The Philosophy of Crescas— Death of Henry III of Castile and Unfavorable Change in the Position of the Jews—Messianic Dreams of the Kabbalists—Jews seek an Asylum in Northern Africa— Simon Duran—Geronimo de Santa Fé, Vincent Ferrer and Benedict XIII—Anti-Jewish Edict of Juan II—Special Jewish Costume—Conversion of Jews owing to Ferrer's Violent Efforts—Disputation at Tortosa—The Jewish Spokesmen at the Conference—Incidents of the Meeting —Geronimo instigates the Publication of a Bull for the Burning of the Talmud—Pope Martin V befriends the Jews. 1391–1420 C.E. The baptized Jews who had abandoned their faith during the terrible persecution of 1391 became a source of considerable trouble to their Spanish brethren. They had embraced the cross only to save their lives, or the lives of those dear to them; for, surely, they had found no convincing demonstration of the truth of the Christian religion in the violence of its missionaries, or in the death agonies of
  • 57. their brethren in race who had perished rather than apostatize. Dazed and broken-hearted, these forced converts (Anusim) to Christianity felt more intense antipathy to their new religion than when they had been openly opposed to it. It was natural for them to resolve to take the first opportunity of casting away their disguise, and returning to Judaism with increased zeal. Many of these new Christians emigrated to the neighboring Moorish countries; to Granada or across the straits to Morocco, Tunis, or Fez, where the people, wiser and more tolerant than Christian Europe, gladly opened their doors to a wealthy and industrious race. The majority, unable to leave Spanish territory, yet averse to wholly discarding their ancient faith, joined in Jewish ceremonies and celebrations whilst outwardly appearing Christians. The kings of Castile, Aragon and Majorca, who had disapproved of conversions by mob violence, allowed the Jews to do as they pleased. The authorities either did not or would not see their relapse into Judaism, and the Inquisition had not yet been established in Spain. These forced converts gradually formed themselves into a peculiar class, outwardly Christians, at heart Jews. By the populace, who nicknamed them Marranos, or "The Damned," they were regarded with more distrust and hatred than the openly observant Jews, not because of their secret fidelity to Judaism, but on account of their descent and inborn intelligence, energy, and skill. Baptized Jews, who had been glad to disencumber themselves of their Judaism, shared in these feelings of aversion. They were the worldlings who valued wealth, rank, and luxury above religion, or the over-educated whose philosophy had led them to skepticism, and whose selfishness induced them to welcome a change which brought them out of the narrow confines of a small community, and opened up a wider world to them. Their hearts had never been with Judaism, and they had adhered to it only out of respect or a certain compunction. To them, forced baptism was a relief from chafing fetters, a welcome coercion to overcome scruples which had always sat lightly upon them. For their own advantage they simulated devotion to Christianity, but were on that account neither better nor more religious men. The unscrupulous among them found special pleasure in the persecution
  • 58. of their former religion and its followers. To gratify their malice, they brought charges against rabbis and other representative Jews, or any member of the community, thus endangering the existence of the whole body of Jews in the country. It was bad enough that the latter had been robbed of so many able and learned men— physicians, authors, poets—and that the church had been enriched by their wealth and intelligence; but these very forces were used to inflict further mischief on the Jews that had remained steadfast. Knowing the faults of their former brethren, the converts could easily attack them. Don Pero Ferrus, a baptized Jew, made the community and rabbis of Alcala the target for his ridicule. In a poem he represents himself exhausted from want of sleep finding repose at last in the synagogue of this town, when suddenly he is disturbed, and scared away without mercy by "Jews with long beards and slovenly garments come thither for early morning prayer." A sharp rejoinder to this effort of Ferrus' "buffoon tongue" was put forth by a Jewish poet in the name of the Alcala community. Spanish poetry reaped considerable advantage from these passages at arms. Verse, up to that period starched, solemn, and stately as the punctilious ceremonial of the Madrid court, in the hands of Judæo-Christian satirists acquired the flexibility, wit and merriment of neo-Hebraic poetry at its best. This tone and style were gradually adopted by Christian poets, who borrowed expressions from Jewish writers to give point to their epigrams. Not only the apostate, the monk, Diego de Valencia, used Hebrew words in lampoons on the Jews, but the same practice was adopted with surprising dexterity by the Christian satirist, Alfonso Alvarez de Villasandino, the "poet prince" of his day. A malicious critic might have been inclined to say that Spanish poetry was in process of being Judaized. A few of the new-Christians showed as active a zeal in the propagation of Christianity as if they had been born Dominicans, or as if they felt isolated in their new faith among the old Christians, and yearned for the companionship of their former friends. A newly- baptized physician, Astruc Raimuch, of Fraga, who, as a Jew, had been a pillar of orthodoxy, exerted himself to make converts, taking
  • 59. to himself the name of Francisco God-flesh (Dios-Carne). He spread his snares particularly with a view to entrapping one of his young friends. A fluent writer of Hebrew, Astruc-Francisco drew up a letter in that language, dwelling on the decline of Judaism and enthusiastically propounding the dogmas of Christianity. His applications of Biblical texts to the doctrines of the Trinity, Original Sin, Redemption, and the Lord's Supper, appear almost droll in Hebrew. His friend's answer was meek and evasive, every word carefully weighed to avoid offending the delicate sensibilities of the church and its zealous servants. More spirited was the reply of the satirical poet, Solomon ben Reuben Bonfed, who in rhymed prose set himself to confute Astruc-Francisco's arguments with unsparing incisiveness. Apologizing in his introduction for interfering between two friends, he proceeded to point out that as a Jew the questions discussed concerned him nearly, whilst the misstatements made rendered it impossible for him to remain silent. Solomon Bonfed examined somewhat minutely the dogmas of the Incarnation, Original Sin, and Transubstantiation, showing them to be irrational and untenable. He justly said: "You twist and distort the Bible text to establish the Trinity. Had you a Quaternity, you would demonstrate it quite as strikingly and convincingly from the books of the Old Testament." Of all the Jews baptized in 1391, however, none inflicted so much injury on his former brethren as Rabbi Solomon Levi of Burgos (born 1351–1352, died 1435), who as a Christian rose to very important ecclesiastical and political dignities under the name of Paul Burgensis, or de Santa Maria. Previous to his change of creed he had been a rabbi, and he was well versed in Biblical, Talmudical, and Rabbinical literature. As a Jew he was extremely orthodox and punctilious, passing in his own circle for a pillar of the faith. His nature was, however, shrewd and calculating. Ambitious and vain to the last degree, he soon began to regard as too narrow his sphere of action within the walls of the college, which during a long period counted him amongst its students and teachers. He longed for a life of bustling activity. To obtain a state appointment, he sought access
  • 60. to court, and began to live like a grandee, with equipage and horses and numerous retinue. It was his ambition to become a Jewish Almoxarif or even to obtain a higher appointment. His occupations bringing him into daily contact with Christians, and frequently involving him in religious controversies, he devoted some attention to church literature, in order to be able to make a display of learning. The massacres of 1391 dissipated his last hope of obtaining high preferment as a Jew, and he consequently resolved, in his fortieth year, to be baptized. To derive the best advantage from his conversion, the new Christian, Paul de Santa Maria, caused it to be understood that he had embraced Christianity willingly, as a result of the convincing arguments put forth in the theological writings of the schoolman Thomas Aquinas. The Jews received such protestations with distrust. Knowing him well, they did not scruple to ascribe his conversion to a craving for rank and power. After his change of creed, his family, wife and sons, renounced him. For a commoner, the only road to high office lay through the church. Solomon-Paul knew this well, and at once proceeded to Paris and attended the University, where he pursued theology. His knowledge of Hebrew gave him a great advantage, and helped him to distinguish himself. It was not long before the quondam rabbi became a duly ordained Catholic priest. Then he betook himself to the papal court at Avignon, where the haughty, obstinate, and proselytizing cardinal, Pedro de Luna, reigned as anti-pope under the title of Benedict XIII. Here, during the stormy church schism, favorable opportunities for intrigue and personal advancement presented themselves. Paul won the pope's favor by his shrewdness, zeal, and eloquence. He was appointed archdeacon of Trevinjo and canon of Seville, his first steps on the ladder of the Catholic hierarchy. He abandoned himself to the most ambitious dreams: he might become a bishop, a cardinal, and why not the pope? The times were propitious. He boasted that he was descended from the most ancient and the noblest branch of the Hebrew race, the tribe of Levi, the same that had given birth to Mary, the mother of Jesus. He was not an ordinary priest sprung from the people, but had
  • 61. ancestors bound to be acknowledged and distinguished by the church. On the recommendation of the pope, he was later on overwhelmed with honors and favors by the king of Castile, Don Henry III, and his ambition was satisfied. The apostasy of so respected a rabbi as Solomon Burgensis not only created the greatest astonishment among Jews, but filled them with anxiety. Would this example not find imitators in a time of so much trouble and temptation? Would it not bias waverers, or at least encourage pretending Christians to persevere in the course begun? The prevailing disquietude was increased when it was found that after his own conversion Paul considered it his duty to convert his former co-religionists. To this end he left no stone unturned. With voice and pen he assailed Judaism, seeking his weapons in Jewish literature itself. Not long after his conversion he addressed a letter to his former acquaintance, Joseph (José) Orabuena, physician in ordinary to King Charles III of Navarre, and chief rabbi of the Navarrese communities, in which he stated that he acknowledged and honored Jesus as the Messiah whose advent had been foretold by the prophets, and invited Orabuena to follow his example. To another chief rabbi, Don Meïr Alguades, physician in ordinary to the Castilian king, Don Henry III, Paul de Santa Maria addressed a Hebrew satire in prose and verse, in which he ridiculed the innocent celebration of the Jewish feast of Purim. As if grudging the Jews the moderate pleasures in which they indulged during this festival, he exaggerated their love of drink, and boasted of his own sobriety. Paul evinces in this satire considerable skill in handling the new- Hebrew language, but, notwithstanding his opportunities, he exhibits little wit. As soon as he had acquired a position at the papal court at Avignon, he devoted himself to calumniating the Jews with a view to bringing about new persecutions. His purpose became so obvious that the cardinal of Pampeluna himself, and other ecclesiastics, ordered him to desist. It is true the Jews had to pay dearly for his silence. He also intrigued against Chasdaï Crescas. So far did this apostate carry his enmity to Judaism that he advised the king, Don
  • 62. Henry III, to abstain from employing both Jews and new-Christians in state offices. Did he wish to render impossible the rivalry of some fellow-Hebrew, his superior in adroitness? In his writings Paul de Santa Maria exhibited as much hatred of Judaism as of Jews. While the Franciscan monk, Nicholas de Lyra, a born Christian, held up the works of Jewish commentators like Rashi as models of simple exegesis, the former rabbi found every observation of a Rabbinical writer insipid, nonsensical, and scandalous. On the other hand, the most ridiculous commentary of a church writer was to him a lofty, unsurpassable work. Thoughtful Jews were not slow to recognize their bitterest foe in this new-Christian, and they prepared for a severe struggle with him, notwithstanding that their choice of weapons was limited. Christians were not only free to say what they pleased in demonstration and defense of their doctrines, but could appeal to the summary authority of the sword and the dungeon. Jews were forced to all kinds of circumlocution and ambiguity to avoid provoking the violence of their adversaries. The gallant stand of a mere handful of Jews against power and arrogance should excite the admiration of all whose sympathies are not with victorious tyranny, but with struggling right. The campaign against Paul de Santa Maria was opened by a young man, Joshua ben Joseph Ibn-Vives of Lorca (Allorqui), a physician and an Arabic scholar, who had formerly sat at the feet of the renegade rabbi. In an humble epistle, as though a docile pupil were addressing an illustrious master, Joshua Allorqui administered many a delicate reproof to his apostate teacher, and at the same time, by his naïve doubts, dealt destructive blows at the fundamental doctrines of Christianity. He observes in his introduction that the conversion of his beloved teacher had to him more than to others been a source of astonishment and reflection, as his example had been a main support of his own religious belief. He was at a loss to conceive the motives of the sudden change. He could not think that he had been led away by desire for worldly distinction, "for I well remember," he says, "how, surrounded by riches and
  • 63. attendants, thou didst yearn for thy former humble state with its life of retirement and study, and how it was thy wont to speak of thy high position as empty mockery of happiness." Nor could he suppose that Paul's Jewish convictions had been disturbed by philosophic doubt, as up to the moment of his baptism he had conscientiously observed all the ceremonial laws, and had known how to discriminate between the kernel of philosophic truth which harmonizes with religion and the pernicious shell which so often passes for the real teaching. Could it be that the sanguinary persecution of the Jews had led him to doubt the possibility of the enduring power of Judaism? But even this theory was untenable, for Paul could not be unaware of the fact that only a minority of Jews live under Christian rule, that the larger numbers sojourn in Asia, and enjoy a certain degree of independence; so that if it pleased God to allow the communities in Christian lands to be extirpated, the Jewish race would not by any means disappear from the face of the earth. There remained, continued Joshua Vives of Lorca, the assumption that Paul had carefully studied Christianity, and had come to the conclusion that its dogmas were well founded. He begged him, therefore, to impart to him the convictions at which he had arrived, and thus dissipate the doubts which he (Joshua) still entertained as to the truth of Christianity. Allorqui then detailed the nature of his doubts, covertly but forcibly attacking the Christian system. Every sentence in this epistle was calculated to cut the Jew- hating new-Christian to the quick. The evasive and embarrassed reply, which Paul indited later on, clearly indicated how he had winced under this attack. The philosopher, Chasdaï Crescas, also came forward in gallant defense of the religion of his fathers. He composed (1396) a polemical treatise (Tratado), in which he tested philosophically the Christian articles of faith, and demonstrated their untenableness. This work was addressed to Christians more than to Jews, and was particularly intended for the perusal of Spaniards of high rank whose friendship Chasdaï Crescas enjoyed. Hence it was written not in Hebrew but in Spanish, which the author employed with ease, and
  • 64. its tone was calm and moderate. Chasdaï Crescas set forth the unintelligibility of the doctrines of the Fall, the Redemption, the Trinity, the Incarnation, the Immaculate Conception, and Transubstantiation, and examined the value of baptism, the coming of Jesus, and the relation of the New Testament to the Old, with dispassionate deliberation, as if he did not know that he was dealing with questions which might at any moment light the fires of an auto- da-fé. At about the same time an accomplished Marrano, who had relapsed into Judaism, published a pungent attack on Christianity and the new-Christians. In the entire history of Judæo-Christian controversy no such stinging satire had been produced on the Jewish side as that now issued by the physician, astronomer, historical student, and grammarian Profiat Duran. During the bloody persecution of 1391 in Catalonia, Profiat Duran, otherwise Isaac ben Moses, or, as he called himself in his works, Efodi (Ephodæus), had been forced to simulate conversion to Christianity. He was joined by his friend David Bonet Buen-Giorno. Both resolved at a convenient opportunity to abandon their hated mask and emigrate to Palestine, where they could freely acknowledge Judaism. Their affairs being arranged, Profiat Duran traveled to a seaport town in the south of France, and there awaited his friend. The latter, in the meantime, was sought out by or came across the Jew-hating apostate, Solomon Paul de Santa Maria, and was prevailed upon to remain a Christian. What was Profiat Duran's astonishment when he received a letter announcing, with much exultant vaporing, the definite acknowledgment of Christianity by En Bonet, who exhorted him also to remain in the pale of his adopted faith. The letter contained an enthusiastic panegyric of Paul de Santa Maria, who had been taken into the favor of the king of Castile. Profiat Duran could not remain silent. In reply, he inflicted punishment on his friend, and more particularly on the proselytizing Paul, in an epistle characterized by the keenest irony, which has not yet lost its sting. It pretends to assent to everything advanced by Bonet, and to confirm him in his resolve to remain a Christian. "Be not ye like your fathers" (Altehi
  • 65. ka-Abothecha) is the refrain throughout, and so artfully is this admonition employed that Christians used it (under the title Alteca Boteca) as an apology for Christianity. Whilst thus pretending to criticise the errors of the older faith, Profiat Duran dwells on the Christian dogmas, naïvely describing them in their most reprehensible form. He concentrates on the weaknesses of Christianity the full light of reason, Scriptural teaching and philosophic deduction, apparently with no desire to change his friend's intention. A portion of the satire is directed against the Jew- hater Paul de Santa Maria, upon whom Bonet had bestowed unstinted praise. "Thou art of opinion that he may succeed in becoming pope, but thou dost not inform me whether he will go to Rome, or remain at Avignon"—a cutting reference to the papal schism distracting the church. "Thou extollest him for having made efforts to free Jewish women and children from the obligation of wearing the Jew badge. Take the glad tidings to the women and children. For myself, I have been told that he preached mischief against the Jews, and that the cardinal of Pampeluna was compelled to order him to be silent. Thou art of opinion that he, thy teacher, will soon receive the miter or a cardinal's hat. Rejoice, for then thou also must acquire honors, and wilt become a priest or a Levite." Towards the end Profiat Duran changes irony into a tone of seriousness: he prays his former friend not to bear as a Christian the name of his respected father who, had he been alive, would sooner have had no son than one faithless to his religion. As it is, his soul in Paradise will bewail the faithlessness of his son. This satirical epistle was circulated as a pamphlet. Its author sent copies not only to his former friend, but also to the physician of the king of Castile, the chief rabbi, Don Meïr Alguades. So telling was the effect produced, that the clergy, as soon as they discovered its satirical character, made it the subject of judicial inquiry, and committed it to the flames. At the request of Chasdaï Crescas, Profiat Duran wrote another anti-Christian work, not, however, a satire, but in the grave language of historical investigation. In this essay he showed, from his intimate acquaintance with the New Testament and the literature of the church, how in course of time Christianity had degenerated.
  • 66. Favored and promoted by the anti-pope, Benedict XIII, of Avignon, Paul of Burgos rose higher and higher; he became bishop of Carthagena, chancellor of Castile and privy counselor to the king, Don Henry III. His malice did not succeed in prejudicing the king against the Jews, or inducing him to bar them from state employment. Don Henry had two Jewish physicians, in whom he reposed especial confidence. One, Don Meïr Alguades, an astronomer and philosopher, he appointed, perhaps in imitation of Portugal, to the chief rabbinate of the various Castilian communities. He was always in the king's train, and it is probable that to some extent he influenced him favorably towards his co-religionists. The other was Don Moses Zarzel (Çarçal), who celebrated in rich Spanish verse the long wished for birth of an heir to the Castilian throne, borrowing the beauties of the neo-Hebraic poetry to do honor to the newly-born prince, in whose hands, he prophesied, the various states of the Pyrenean Peninsula would be united. The calm, as between two storms, which the Spanish Jews enjoyed during the reign of Don Henry was favorable to the production of a few literary fruits, almost the last of any importance brought forth in Spain. None of these works was epoch-making; they were useful, however, in keeping alive the spirit of better times, and in preventing the treasures of Jewish literature from being forgotten. Profiat Duran managed to make people forget his baptism and to settle down quietly in Spain or Perpignan, where he commentated Maimuni's philosophy, and some of Ibn-Ezra's works. He also composed a mathematical and calendarial essay (Chesheb-Efod) and an historical account of the persecutions to which his race had been subjected since the dispersion. His best work is a Hebrew grammar ("Maasé Efod," written about 1403), in which he summarizes the results of older writers, rectifies their errors, and even attempts to formulate the principles of Hebrew syntax. A production of more than common merit was written by Chasdaï Crescas, now on the brink of the grave, his spirits shattered by persecution. He was a profound, comprehensive thinker, whose mind never lost itself in details, but was forever striving to
  • 67. comprehend the totality of things. His scheme for a work treating, in the manner of Maimuni, of all phases and aspects of Judaism, investigating the ideas and laws out of which Jewish teaching had gradually developed, and reharmonizing the details with the whole where the connection had ceased to be apparent, bears witness to the extraordinary range of his learning and the perspicacity of his mind. The work was to be at once a guide to Talmudical study and a practical handbook. Death appears to have prevented the accomplishment of this gigantic enterprise, only the philosophic portion, or introduction, being completed. In this introduction Chasdaï Crescas deals, on the one hand, with the principles of universal religion, the existence of God, His omniscience and providence, human free-will, the design of the universe, and, on the other, with the fundamental truths of Judaism, the doctrines of the creation, immortality, and the Messiah. Crescas was less dominated by the Aristotelian bias of mediæval philosophy than his predecessors. It had lost its halo for him; he perceived its weaknesses more clearly than others, and probed them more deeply. With bold hands he tore down the supports of the vast edifice of theory constructed by Maimuni on Aristotelian grounds to demonstrate the existence of God and His relation to the universe, and, conversant with the whole method of scholastic philosophy, he combated it with destructive force. While the philosophy of his day appeared to him thus vague and illusory, he considered the foundations of Judaism unassailable, and set himself to show the futility of the criticisms of the former. The acknowledgment of Divine omniscience led him to the daring statement that man in his actions is not quite free, that everything is the necessary result of a preceding occurrence, and that every cause, back to the very first, is bound to determine the character of the final action. The human will does not follow blind choice, but is controlled by a chain of antecedent circumstances and causes. To what extent can the doctrine of reward and punishment be admitted, if the will is not free? Chasdaï Crescas' answer to this is that reward and punishment wait on intentions, not on actions. He
  • 68. who, in purity of heart, wishes to accomplish good—which must, of course, necessarily follow—deserves to be rewarded, as the man who willingly promotes evil, deserves punishment. The highest good to which man can aspire, and the end of all creation, is spiritual perfection, or bliss everlasting, not to be obtained, as the philosophers imagine, by filling the mind with metaphysical theories, but only through the active love of God. This is the substance of all religion and particularly of Judaism. From this point of view it may with justice be said that "the world was created for the sake of the Torah," for the aim of the Law is to lead to immortality by means of ideas and commandments and the guidance of thoughts and actions. Chasdaï Crescas, the first to distinguish between universal religion and specific forms, such as Judaism and Christianity, propounded, deviating from Maimuni's system, only eight peculiarly Jewish tenets. His just objection to Maimuni's thirteen articles of faith was that they were either too many or too few, inasmuch as they blended indiscriminately fundamental truths common to all religions, and teachings peculiar to Judaism. Together with Profiat Duran and Chasdaï Crescas, Don Meïr Alguades, the Castilian chief rabbi, appeared, in the brief interval between two bloody persecutions in Spain, as a writer of philosophic works. He was not an independent inquirer; he merely translated the ethics of Aristotle (1405, in collaboration with Benveniste Ibn-Labi) into Hebrew, making the work accessible to Jews, who, in practical life, lived up to its principles better than the Greeks, who produced them, or the Christians, who, in the pride of faith and church doctrine, considered themselves above the necessity of conforming to the requirements of morality. Throughout the reign of Don Henry III of Castile the life of the Jews was tolerable. The young but vigorous monarch severely punished Fernan Martinez, the prime mover in the massacres of 1391, as a warning against further excesses. He permitted the Jews to acquire land, renewed the law of his ancestor, Alfonso XI, and
  • 69. relieved his Jewish tax-farmers and finance administrators from restrictions. As soon as he died (the end of 1406) the affairs of the Jews again took an unfavorable turn, foreshadowing unhappy times. The heir to the crown, Juan II, was a child, barely two years old. The regency devolved on the queen-mother, Catalina (Catherine) of Lancaster, a capricious, arrogant and bigoted young woman, who imagined that she ruled, while she was herself ruled by her various favorites. The co-regent, Don Ferdinand, later king of Aragon, who was intelligent and kind, allowed himself to be guided by the clergy. By his side in the council of state sat the apostate rabbi, Solomon alias Paul de Santa Maria, another and more mischievous Elisha- Acher, in whose eyes Judaism was an abomination, and every Jew a stumbling-block. The deceased king, Don Henry III, had appointed him executor of his will and tutor to his heir; he consequently had an influential voice in the council of the regency. What a prospect for the Jews of Castile! It was not long before they were made to feel the hostile spirit of the court. First it exhibited itself in attempts to humiliate the more notable Jews who had intercourse with the court circle and the grandees of the kingdom, and occupied positions of distinction. The intention was to dismiss them from these positions with the reminder that they belonged to a despised caste. An edict was issued (October 25th, 1408), in the name of the infant king, reviving the anti-Jewish statutes of the code of Alfonso the Wise. "Whereas the exercise of authority by Jews may conduce to the prejudice of the Christian faith," their occupation of posts in which they might possess such authority was forbidden for all future time. Every Jew permitting himself to be invested with official functions, either by a nobleman or a municipality, was to be fined twice the amount of the revenue of such post, and, if his fortune did not suffice to make up the required amount, it would be confiscated, and the delinquent become liable to a punishment of fifty lashes. A Christian appointing a Jew to a post of influence would also be punished with a fine. To insure the working of the edict, it was enacted that the informer and the court of law concerned in a case should secure each one-third of the confiscated estates. Officials
  • 70. were charged to make the edict known everywhere, and carefully to watch that its injunctions were carried out. It is impossible not to suspect the hand of Paul de Santa Maria in this decree. No one knew better than he the strong and the weak points in the character of the Spanish Jews, and he doubtless calculated that Jewish notables, in danger of losing their official employment and high social position, would go over to Christianity, while the faithful, excluded from intercourse with Christian society and from participation in the public life of the country, would suffer a decline similar to that of the German Jews. At the same time he vented his hate on Meïr Alguades, the physician of the dead king. The queen-regent had no cause to injure this Jewish notable; only Paul could desire his ruin, because he was the mainstay of his opponents and the leader of those who held him up to contempt. With the object of procuring his downfall, a vindictive accusation was trumped up against him. While the queen- mother, with the infant king, was staying at Segovia, some priests charged a Jew of the town with having bought a consecrated host from the sacristan, in order to blaspheme it. They further stated that the holy wafer had worked such terrible wonders while in the possession of the Jew, that in fear and trembling he had delivered it up to the prior of a monastery. Whether this story was fabricated, or whether there was a grain of truth in a bushel of fiction, it is impossible to say; it sufficed, however, to attract the serious attention of the bishop, Velasquez de Tordesillas, who caused a number of Jews to be arrested as accomplices in the crime, among them Don Meïr Alguades. Criminal proceedings were formally commenced by order of the queen-regent, and Alguades and his fellow-prisoners were subjected to torture, and confessed their guilt. It is stated that in his agony Meïr Alguades made a confession of another kind—that the king, Henry III, had come by his death at his hands. Although everybody knew that the king had been ailing from his youth, Don Mëir—who must have been specially interrogated while under torture as to whether he had poisoned the king—was put to death in the most inhuman manner. He was torn limb from
  • 71. limb. The same fate befell the other prisoners. Still not satisfied, the bishop of Segovia accused some Jews of having bribed his cook to poison his food, and they also were put to death. At about this time one of the synagogues in Segovia was transformed into a church. The troubled times, projecting shadows of a still more unhappy future, produced the melancholy phenomenon of another Messianic frenzy. Again it arose in the minds of mystics. The Zohar having adroitly been raised to the dignity of an approved authority, the Kabbala daily acquired more influence, although it was not studied in proportion to the zeal with which its authority was advocated. Three Kabbalists were particularly active in exciting the emotions and turning the heads of the people—Abraham of Granada, Shem Tob ben Joseph, and Moses Botarel. The first composed (between 1391 and 1409) a Kabbalistic work, a farrago of strange names of the Deity and the angels, of transposed letters, and jugglery with vowels and accents. Abraham of Granada had the hardihood to teach that those who could not apprehend God by Kabbalistic methods belonged to the weak in faith, were ignorant sinners, and like the depraved and the apostate were overlooked by God, and not found worthy of His special providence. He thought that the relinquishment of their religion by cultured Jews was explained by their fatal application to scientific study, and their contempt for the Kabbala. On the other hand, he professed to see in the persecutions of 1391, and in the conversion of so many prominent Jews to Christianity, the tokens of the Messianic age, the suffering that must precede it, and the approach of the redemption. Shem Tob ben Joseph Ibn-Shem Tob (died 1430) accused the Jewish philosophers, Maimuni, Gersonides, and others, of seducing the people to heresy and infidelity, and with being the real cause of apostasy in troubled times. In a work entitled "Emunoth" he made violent attacks on Jewish thinkers and philosophic studies generally, and taught that the salvation of Israel lies in the Kabbala, the oldest Jewish tradition, and the genuine, pure truth. The entire book is composed of grave charges against the more enlightened school of Jewish thinkers, and panegyrics of Kabbalistic nonsense.
  • 72. These two men, Abraham of Granada and Shem Tob, though narrow-minded, were sincere, differing in this respect from Moses Botarel (or Botarelo), also a Spaniard, from Cisneros, in Castile, who pursued his course with fraudulent intent. He gave out that he was a thaumaturge and prophet; he announced himself even as the Messiah. He prophesied that in the spring month of 1393 the Messianic age would be ushered in by extraordinary marvels. Later on he wrote a work full of lies and delusions. In his pride and boastfulness, he addressed a circular letter to all the rabbis of Israel, declaring that he was in a position to solve all doubts, and throw light on all mysteries, that he was the chief of the great Synhedrin, and a great deal more in the same charlatanic strain. As in the days of the oppression by the Visigothic kings, an asylum for persecuted Jews was formed on that portion of the African coast facing Spain. Many of the north African towns, such as Algiers, Miliana, Constantine, Buja, Oran, Tenes, and Tlemçen, were filled with Jews fleeing from the massacres of 1391, and with new- Christians anxious to get rid of the Christianity which they had been forced to embrace, but which they hated cordially. Almost daily there came fresh troops of refugees from all parts of Spain and Majorca. They transplanted to their new fatherland their intelligence, wealth, industry, and commercial enterprise. The Mahometan Berber princes, then more tolerant and humane than the Christians, received them without imposing a poll tax. At first the Mahometan population grumbled a little at so sudden and considerable an increase in the number of inhabitants, fearing that the price of provisions would be raised. When, however, the narrow-mindedness and selfishness of their complaints were pointed out to them by an intelligent kadi they were satisfied, and the Jews were allowed to settle in their midst in peace. The small Berber communities formed since the cessation of the Almohade persecution a century before, acquired greater importance through this immigration. The new-comers preponderated in numbers over the native Jews, so that the latter, to a certain extent, were forced to adopt the Spanish communal
  • 73. organization and the Sephardic ritual. The Spaniards, in fact, became the leading element in the old African communities. The distinguished rabbi, Isaac ben Sheshet-Barfat, who had escaped from Spain and settled in Algiers, was recognized by the king of Tlemçen as chief rabbi and judge of all the communities. This he owed to the influence of one of his admirers, Saul Astruc Cohen, a popular physician and an accomplished man, who not only practiced his art gratuitously, but spent his fortune in relieving both Mahometan and Jewish poor. In the name of the king the local rabbis were forbidden to assume clerical or judicial functions without the authority of the chief rabbi, Isaac ben Sheshet. This in no way detracted from the esteem in which Ben Sheshet was held, and applications for the decision of difficult questions continued to pour in upon him. In Algiers he continued to oppose wrong-doing with the conscientiousness and impartiality that had always characterized him. Among the members of his community was a mischievous personage (Isaac Bonastruc?), who had considerable influence with the Algerian authorities. Actuated by self-interest he was desirous of stopping the daily increasing immigration of Marranos, and to this end persuaded the kadi to impose a tax of one doubloon on every immigrant. Finding that troops of fugitives continued to arrive, he set himself to work upon the selfishness of the community, so that they might oppose any further influx of their brethren. Fifty-five new- Christians, who had recanted, from Valencia, Barcelona, and Majorca, were waiting to land in the harbor of Algiers, but were refused permission by Jews. This was tantamount to throwing them on the mercy of Christian executioners. Such selfishness and injustice the chief rabbi, Isaac ben Sheshet, could not tolerate, and he laid the ban on the heartless Jews, who tried to escape the punishment. So determined was his attitude that, with the assistance of Astruc Cohen and his brother, the Marranos were ultimately brought safe to land. In Africa Ben Sheshet-Barfat worked for nearly twenty years, promoting the welfare of his co-religionists and the interests of religion and morality. His declining years were
  • 74. embittered by the persistent attacks of a young rabbi, Simon ben Zemach Duran, an able Talmudist, who had emigrated from Majorca. Ben Sheshet was succeeded on his death by Simon Duran (born 1361, died 1444). The community of Algiers elected him on condition that he did not seek a ratification of his appointment from the king, probably because the authority derived by his predecessor from the royal confirmation had been too uncontrolled. Simon Duran, an accomplished mathematician and physician, was the first Spanish-Jewish rabbi to take pay. He publicly excused himself for doing so, on the ground of his necessitous circumstances. During the persecutions in Majorca a portion of his large fortune had been lost, and the remainder had been sacrificed in bribing the informers who threatened to deliver him as a Judaizing Christian to the Dominican Moloch. He had arrived in Algiers almost a beggar, and the healing art, by which he had hoped to earn a subsistence, had brought him nothing, physicians enjoying but little consideration among the Berbers. Subsequently Simon Duran justified the payment of rabbis from the Talmud. Were the abbots, bishops, and princes of the church equally conscientious? As if the Jews of Spain had not had enough enemies in the poor, indolent burghers and nobles, who regarded their opulence with so much jealousy, in the clergy, who cloaked their immorality with zeal for the propaganda of the faith, or in the upstart converts, who sought to disguise their Jewish origin by a show of hatred of their former brethren, there arose at about the beginning of the fifteenth century three new Jew-haters of the bitterest, most implacable type. One was a baptized Jew, another a Dominican friar, and the third an abandoned anti-pope. On these three men, Joshua Lorqui, Fra Vincent Ferrer, and Pedro de Luna, or Benedict XIII, the responsibility must rest for the events which directly conduced to the most terrible tragedy in the history of the Jews of Spain. Joshua Lorqui of Lorca assumed on his baptism the name Geronimo de Santa Fé, became physician in ordinary to the Avignon pope, Benedict, and, like his teacher, Solomon-Paul de Santa Maria, considered it his mission in life to draw his former brethren over to
  • 75. Christianity by every possible means. Vincent Ferrer, afterwards canonized, was one of those gloomy natures to whom the world appears a vale of tears, and who would wish to make it one. In saint-like virtue, indeed, he stood alone among the clergy and monks of his day. The pleasures of life had no charm for him; for gold and worldly distinction he thirsted not; he was penetrated with true humility, and entered on his work with earnestness. Unfortunately, the degeneracy and foulness of society had impressed him with the fantastic idea that the end of the world was at hand, and that mankind could be saved only by adopting the Christian faith and a monastic mode of life. Vincent Ferrer consequently revived flagellation. He marched through the land with a troop of fanatics who scourged their naked bodies with knotted cords, and incited the masses to adopt the same form of penance, believing that it would bring about the salvation of the world. Gifted with a sympathetic voice, an agreeable manner, and considerable eloquence, this Dominican friar soon obtained ascendancy over the public mind. When amid sobs he recalled the sufferings of Jesus, and depicted the approaching end of the world, the emotions of his auditors became violently agitated, and he could lead them to good or to evil. He had given up a high position at the papal court to lead the life of a flagellant and barefooted friar. This helped to increase the number of his admirers and disciples, for renunciation of position and wealth on the part of an ecclesiastic was without parallel. Ferrer, however, abused his power by the promotion of sanguinary deeds. He directed his fanatical denunciations not only against Jews and heretics, but even against friends who had helped to raise him from the dust. The terrible demoralization of the church is illustrated in this monk. The wrangling of three contemporary popes, each declaring himself to be the vicegerent of God, one of whom, John XXIII (1410–1415), had exhausted the catalogue of vices and deadly sins, a pirate, a trafficker in indulgences, an assassin, and a debauchee—all this did not so strikingly indicate the prevailing degeneracy as the fanatical excesses of one really pure, moral nature like Vincent Ferrer. The dove had become transformed into a venomous snake, the lamb into a rapacious beast. So much viciousness cannot be spontaneous in
  • 76. human character, in the adherents of Christianity; it must have been derived from the Christian teaching itself. Unlike Wycliffe and other reformers, Ferrer did not raise his voice against the shortcomings of the church, but devoted himself to Jews and heretics, whom he hated as adversaries of Christianity and opponents of the infallibility of the pope. With pen and voice he opened a crusade against Jews, which he sustained for several years. His most vehement invective was aimed at the Spanish new- Christians, who during the massacres of 1391 had gone over to the church, but still largely conformed to Judaism. Partly from fear of incurring the severe punishment attaching to apostasy, partly won over by the fiery eloquence of the preacher, the Marranos made a contrite confession of faith, which Ferrer regarded as a great victory for the church, a triumph for the truths of Christianity, leading him to hope that the conversion of the entire body of Jews might be vouchsafed to him. By his influence with the people, who honored him as a saint, he was very useful to the kings of Spain in putting down popular risings during the civil wars without bloodshed. Encouraged by the consideration of the Castilian royal family, Ferrer craved permission not only to preach in the synagogues and mosques, but to force Jews and Mahometans to listen to his addresses. A crucifix in one arm, the Torah in the other, escorted by flagellants and spearmen, he called upon the Jews, "with a terrible voice," to enrol themselves under the cross. Seraphic as he was, Vincent Ferrer was not averse to the employment of force. He represented to the Spanish rulers that the Jews should be strictly isolated, as their intercourse with the Christian population was calculated to injure the true faith. His suggestions met with too ready a response. Through him and the other two conversionists, unspeakable sorrows were brought upon the Spanish Jews; indeed, the years from 1412 to 1415 may be reckoned among the saddest in the sorrowful history of the Jewish people. Shortly after Ferrer's appearance at the most Christian court, the regent Donna Catalina, the Infante Don Ferdinand, and the apostate Paul Burgensis de Santa Maria, in the name of the child-
  • 77. king, Juan II, issued an edict of twenty-four articles (January 12th, 1412), the aim of which was to impoverish and humiliate the Jews, and reduce them to the lowest grade in the social scale. It ordered that they should live in special Jew-quarters (Juderias), provided with not more than one gate each, under pain of confiscation of fortune and personal chastisement. No handicraft was to be exercised by them; they were not to practice the healing art, nor transact business with Christians. It goes without saying that they were forbidden to hire Christian servants and fill public offices. Their judicial autonomy was abolished, not only in criminal cases, in which they had long ceased to exercise it, but also in civil disputes. The edict prescribed a special costume for the Jews. Both men and women were to wear long garments, in the case of males, of coarse stuffs. Whoever dressed in the national costume, or in fine materials, became liable to a heavy fine; on a repetition of the offense, to corporal punishment and confiscation of property. The wearing of the red Jew badge was, of course, insisted upon. Males were prohibited from shaving the beard or cutting the hair under pain of one hundred lashes. No Jew was to be addressed, either in conversation or in writing, by the title "Don," to the infringement of which a heavy fine was also attached. They were interdicted from carrying weapons, and might no longer move from town to town, but were to be fixed to one place of abode. The Jew detected in an evasion of the latter restriction was to lose his entire property, and be made a bondman of the king. Grandees and burghers were sternly enjoined to afford not the slightest protection to Jews. It is not unwarrantable to assume the influence of the apostate Paul de Santa Maria in the details of these Jew-hating laws. They singled out the most sensitive features of the Jewish character, pride and sense of honor. Wealthy Jews, in the habit of appearing in magnificent attire and with smoothly-shaven chins, were now to don a disfiguring costume, and go about with stubbly, ragged beards. The cultivated, who as physicians and advisers of the grandees had enjoyed unrestricted intercourse with the highest ranks, were to confine themselves to their Jew quarter, or be baptized, baptism
  • 78. being the hoped-for result of all these cruel restrictions, enforced with merciless vigor. A contemporary writer (Solomon Alami) describes the misery caused by the edict: "Inmates of palaces were driven into wretched nooks, and dark, low huts. Instead of rustling apparel we were obliged to wear miserable clothes, which drew contempt upon us. Prohibited from shaving the beard, we had to appear like mourners. The rich tax-farmers sank into want, for they knew no trade by which they could gain a livelihood, and the handicraftsmen found no custom. Starvation stared everyone in the face. Children died on their mothers' knees from hunger and exposure." Amid this tribulation the Dominican Ferrer invaded the synagogues, crucifix in hand, preached Christianity in a voice of thunder, offering his hearers enjoyment of life and opportunities of preferment, or threatening damnation here and hereafter. The Christian populace, inflamed by the passionate eloquence of the preacher, emphasized his teaching by violent assaults on the Jews. The trial was greater than the unhappy Castilian Jews could bear. Flight was out of the question, for the law forbade it under a terrible penalty. It is not surprising, then, that the weak and lukewarm among them, the comfort-loving and worldly-minded, succumbed to the temptation, and saved themselves by baptism. Many Jews in the communities of Valladolid, Zamora, Salamanca, Toro, Segovia, Avila, Benavente, Leon, Valencia, Burgos, Astorga, and other small towns, in fact, wherever Vincent Ferrer preached, went over to Christianity. Several synagogues were turned into churches by Ferrer. In the course of his four months' sojourn (December, 1412-March, 1413) in the kingdom of Castile, this proselyte-monger inflicted wounds upon the Jews from which they bled to death. When, however, he repaired to the kingdom of Aragon— summoned thither to advise on the rival claims of several pretenders to the throne—and when through his exertion the Castilian Infante, Don Ferdinand, was awarded the Aragonese crown (June, 1414), a trifling improvement took place in the condition of the Castilian Jews. The regent, Donna Catalina, issued a new edict in the name of
  • 79. Welcome to our website – the perfect destination for book lovers and knowledge seekers. We believe that every book holds a new world, offering opportunities for learning, discovery, and personal growth. That’s why we are dedicated to bringing you a diverse collection of books, ranging from classic literature and specialized publications to self-development guides and children's books. More than just a book-buying platform, we strive to be a bridge connecting you with timeless cultural and intellectual values. With an elegant, user-friendly interface and a smart search system, you can quickly find the books that best suit your interests. Additionally, our special promotions and home delivery services help you save time and fully enjoy the joy of reading. Join us on a journey of knowledge exploration, passion nurturing, and personal growth every day! ebookbell.com