A Hands On Course in Sensors Using the Arduino and Raspberry Pi Series in Sensors 1st Edition Ziemann - Get the ebook in PDF format for a complete experience
A Hands On Course in Sensors Using the Arduino and Raspberry Pi Series in Sensors 1st Edition Ziemann - Get the ebook in PDF format for a complete experience
com
https://ebookmeta.com/product/a-hands-on-course-in-sensors-
using-the-arduino-and-raspberry-pi-series-in-sensors-1st-
edition-ziemann/
OR CLICK HERE
DOWLOAD EBOOK
https://ebookmeta.com/product/a-hands-on-course-in-sensors-using-the-
arduino-and-raspberry-pi-2nd-edition-volker-ziemann/
ebookmeta.com
https://ebookmeta.com/product/a-hands-on-course-in-sensors-using-the-
arduino-and-raspberry-pi-2nd-edition-volker-ziemann-2/
ebookmeta.com
https://ebookmeta.com/product/polyphenols-based-nanotherapeutics-for-
cancer-management/
ebookmeta.com
Beekeeping For Dummies Blackiston
https://ebookmeta.com/product/beekeeping-for-dummies-blackiston/
ebookmeta.com
https://ebookmeta.com/product/a-family-for-garrett-forever-safe-the-
twelve-days-of-christmas-1st-edition-haven-rose-3/
ebookmeta.com
https://ebookmeta.com/product/a-necklace-of-springbok-ears-xam-
orality-and-south-african-literature-1st-edition-helize-van-vuuren/
ebookmeta.com
https://ebookmeta.com/product/high-school-math-2015-common-core-
algebra-2-student-edition-grade-10-11-prentice-hall/
ebookmeta.com
https://ebookmeta.com/product/dirty-kingdom-covington-high-1-1st-
edition-amelia-winters/
ebookmeta.com
Comparative and Diachronic Perspectives on Romance Syntax
1st Edition Gabriela Pan■ Dindelegan
https://ebookmeta.com/product/comparative-and-diachronic-perspectives-
on-romance-syntax-1st-edition-gabriela-pana-dindelegan/
ebookmeta.com
A Hands-On Course in
Sensors Using the Arduino
and Raspberry Pi
Series in Sensors
Series Editors: Barry Jones and Haiying Huang
Volker Ziemann
CRC Press
Taylor & Francis Group
6000 Broken Sound Parkway NW, Suite 300
Boca Raton, FL 33487-2742
This book contains information obtained from authentic and highly regarded sources. Reasonable efforts have been
made to publish reliable data and information, but the author and publisher cannot assume responsibility for the validity
of all materials or the consequences of their use. The authors and publishers have attempted to trace the copyright
holders of all material reproduced in this publication and apologize to copyright holders if permission to publish in this
form has not been obtained. If any copyright material has not been acknowledged please write and let us know so we may
rectify in any future reprint.
Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced, transmitted, or utilized
in any form by any electronic, mechanical, or other means, now known or hereafter invented, including photocopying,
microfilming, and recording, or in any information storage or retrieval system, without written permission from the
publishers.
For permission to photocopy or use material electronically from this work, please access www.copyright.com (http://
www.copyright.com/) or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA 01923,
978-750-8400. CCC is a not-for-profit organization that provides licenses and registration for a variety of users. For
organizations that have been granted a photocopy license by the CCC, a separate system of payment has been arranged.
Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are used only for
identification and explanation without intent to infringe.
Preface xv
Acknowledgments xvii
Chapter 1 Introduction 1
Chapter 2 Sensors 5
2.1 ANALOG SENSORS 5
2.1.1 Resistance-based sensors 5
2.1.2 Voltage-based sensors 10
2.1.3 Current-based sensors 14
2.2 SIGNAL CONDITIONING 16
2.2.1 Voltage divider 16
2.2.2 Amplifiers 17
2.2.3 Filters 21
2.2.4 Analog-to-digital conversion 23
2.2.5 Supply voltage 26
2.3 DIGITAL SENSORS 28
2.3.1 Buttons and switches 29
2.3.2 On/off devices 30
2.3.3 I2C devices 32
2.3.4 SPI devices 35
2.3.5 RS-232 devices 36
2.3.6 Other sensors 36
Chapter 3 Actuators 39
3.1 SWITCHES 39
3.1.1 Light-emitting diodes and optocouplers 39
3.1.2 Large currents 41
3.2 MOTORS 43
3.2.1 DC motors 44
3.2.2 Servomotors and model-servos 46
3.2.3 Stepper motors 47
v
vi Contents
Bibliography 235
Index 237
List of Figures
2.1 Image of a light-dependent resistor (LDR) on the left and how to connect it
in a plain voltage-divider configuration (center) and in a Wheatstone bridge
(right). 5
2.2 The band-level scheme and the schematics for the circuit with the LDR in a
voltage divider. The upper graph illustrates dark conditions and the lower
graph shows conditions where the LDR is exposed to light. Note that the
vertical axis by convention shows the energy of electrons. This causes the
positive pole of the battery to have the most negative energy. See the text
for a discussion. 6
2.3 NTC resistors are doped semiconductors that have donor levels just below
the conduction band. Increasing the temperature increases the kinetic energy
of the electrons that allows them to occasionally jump into the conduction
band, where they contribute to the conductivity of the material. 8
2.4 A linear potentiometer (left) and a circuit illustrating the electric connec-
tions (right). 9
2.5 A joystick is shown on the left and a fluid-level resistive sensor on the right. 10
2.6 A strain gauge. 10
2.7 Schematic of an MQ-x gas detector (left) and a sensor mounted on a small
breakout board (right). 11
2.8 Image of an LM35 temperature sensor (left) and how to connect it (right). 11
2.9 On the left we show a schematic of a thermocouple on the top and a ther-
mopile on the bottom. On the right we show an image of an MLX90614
contact-free thermometer. 12
2.10 Schematic of a Hall sensor (left) and the A1324 sensor (right). 12
2.11 The operational principle of an ADXL accelerometer. 13
2.12 An SM-24 geophone with a diameter of about 30 mm. 14
2.13 Energy-band diagram (left) and circuit (right) of a reverse-biased pin diode
in photoconductive mode. 14
2.14 Image of a BPW34 pin diode on the left and two phototransistors on the
right; an IR-sensitive BPX38 and an SFH3310, sensitive in the visible part
of the spectrum. 15
2.15 On the left we have a voltage divider to reduce the input voltage of 0-5 V
to 0-3.3 V. The right circuit shows the use of clamping diodes to protect the
input of the microcontroller to lie between ground and 5 V. 16
ix
x LIST OF FIGURES
2.16 A bare operational amplifier shown on the left and shown wired as a line
buffer on the right. We omitted the supply wires on the latter schematic. 17
2.17 A non-inverting (left) and inverting (right) amplifier. 18
2.18 A difference amplifier (left) and the same circuit with adjustable V1 (right)
that is used to subtract the baseline. 19
2.19 Instrumentation amplifier (left) and logarithmic amplifier (right). 19
2.20 Amplifying a weak signal and shifting it to mid-range between the power
rails. 20
2.21 A simple low-pass (left) and high-pass (right) filter. 21
2.22 A simple band-pass (left) and band-stop (right) filter. 22
2.23 An active non-inverting (left) and inverting (right) low-pass filter. 22
2.24 The operating principle of a 3-bit flash ADC. 23
2.25 The operating principle of a successive approximation ADC. 24
2.26 The operating principle of a delta-sigma ADC. 24
2.27 Sampling a signal in different Nyquist zones. The dashed line displays a
frequency of 0.15fs and the solid lines show signals with frequency (1 −
0.15)fs on the left and (1+0.15)fs on the right. Note that at the times when
the signal is sampled (indicated by boxes), the signals are indistinguishable. 25
2.28 The dashed signals s1 and s2 are the images aliased into the base band of
the original signals S1 and S2 in higher Nyquist zones. 26
2.29 Schematics of very simple power supply circuits. 27
2.30 Variable-voltage (left) and fixed-voltage (right) regulator circuits. 28
2.31 Connecting a switch or button with a pull-up resistor. 29
2.32 Level shifter circuitry using a n-type MOSFET. The source of the MOSFET
is connected to the 3.3 V logic and the drain to the 5 V logic. 30
2.33 Schematic view of a PIR sensor (left) and the hardware (right). 31
2.34 HR-SR04 distance sensor. 31
2.35 Illustration of the operational principle of a barometric pressure sensor. 32
2.36 A BMP180 barometric pressure sensor and an HYT-221 humidity sensor. 33
2.37 The operational principle of one gyroscope in the MPU-6050. 34
2.38 An MPU-6050 accelerometer on a breadboard. 35
2.39 A GPS receiver on the left and a DHT11 humidity sensor on a breadboard
on the right. 36
2.40 A Shinyei PPD42NS particle sensor (left) and a GP2Y1010AU0F dust sensor
(right). 37
3.1 A close-up of a light-emitting diode is shown on the left. In the center is the
schematic of connecting an LED and the same circuit on a breadboard. 40
3.2 The physics of an LED. 41
3.3 The terminals of an NPN transistor (left), and using an NPN transistor as
switch (right). 42
3.4 Two NPN transistors connected to form a Darlington pair (left) and a
ULN2003 Darlington array (right). 42
LIST OF FIGURES xi
4.18 Connecting a unipolar stepper motor to the UNO with a ULN2003 Darling-
ton driver. 93
4.19 Connecting a bipolar stepper motor to the UNO with an L293D H-bridge
driver. 94
4.20 Connecting a bipolar stepper motor to the UNO with a DRV8825 stepper
motor driver with microstep capability. 98
4.21 Adjusting the maximum current on the DRV8825 breadboard. 99
4.22 Connecting an MCP4921 12-bit DAC to the Arduino UNO. 101
4.23 Connecting a speaker and a piezo buzzer to the Arduino. 103
4.24 Front and back side of the HC-06 Bluetooth dongle and the connection to
the Arduino. 104
4.25 The NodeMCU with an LM35 temperature sensor. 106
4.26 The communication with a web server showing the HTTP header. 108
8.1 The weather-node circuit with the NodeMCU on the right and the LM35,
HYT221, and BMP180 sensors towards the left. 168
8.2 The weather station web page served by the Raspi. 173
10.1 The setup to measure the color-dependent absorption (left) and the reflec-
tion from a surface (right). 185
10.2 The setup to measure the water color with an Arduino UNO. 186
LIST OF FIGURES xiii
10.3 The color sensor with the RGB-LED on the left and the phototransistor on
the right. 188
12.1 The schematic setup to measure the beam size of a laser pointer. 197
12.2 The chassis from the CD-ROM drive with the laser mounted on the top right
and the photoresistor on the bottom right. The black obstacle is mounted
on the carriage that can be moved via the spindle on the top by a small
stepper motor that is located below the laser. 198
12.3 The schematics of the circuit. The stepper motor of the frame is connected
to points labelled PA,. . . ,PD. 199
12.4 The raw sensor value as a function of the position of the obstacle and the
derived laser beam profile, which shows a moderate asymmetry. 203
13.1 The chassis of the robot with two breadboards. The smaller one can be
turned by operating a model-servo. Mounted on the larger breadboard are
a NodeMCU on the right and a second chip on the left, a bare ATmega328
that was initially tested and later replaced by an Arduino NANO. 206
13.2 Simplified setup of the remote controller on a breadboard. 207
13.3 The schematic of the remote controller. 207
13.4 The electronics circuit of the robot (color version available online). 212
13.5 The schematic of the robot electronics. 213
13.6 The operational robot from the back (left) and from the front (right). 221
A.1 Two impedances connected in series (left) and in parallel (right). 230
Preface
Some years ago three young students inquired about a moderately complex project to earn
some credits. I happily agreed to supervise them and assigned moderately difficult tasks,
namely, to build from scratch a data acquisition system for slow signals. I suggested to
connect some sensors to an Arduino microcontroller and then write a program for the
Arduino to interface the measurement values to the control system we use in our lab.
The students were very dedicated and a real joy to work with. They had the Arduino
under control within a few hours and had the first sensors reporting their measurement
values after the first day. Then they worked out a protocol that is compatible with our
EPICS-based control system, and after discussions with our control systems experts and
even more debugging, eventually the students had a prototype system working. After clean-
ing up their project, they had to give a presentation and write a report to earn their
well-deserved credits.
I soon realized that there is a clear progression of the information generated by a sensor.
The information bubbles upwards through a sequence of microcontrollers and computers
that provide data-handling, storage, and online presentation to a seminar presentation, and
eventually ends up in a report. Understanding the path the measurement data take ap-
peared like a useful concept to communicate to students. Moreover, I wanted the students
to understand the details of the signal chain and how it really works. Therefore, I used
the hands-on approach with programming the Arduino that serves as communication glue
between the sensor and the control system. This proved beneficial for the students’ under-
standing and was appreciated by them. The abstract concepts thus led to a very concrete
realization. In the final stages of the project I coached the students on how to prepare a
presentation for a seminar according to some simple guidelines, and eventually put the oral
presentation into writing for a report to hand in and receive their credits.
This book is inspired by these students and their projects, but goes a step further and
adds a number of additional topics such as signal conditioning, controlling actuators such as
switches and motors, as well as control system setup, data storage, and networking. Please
note that I cover only basic examples that are boiled down to the bare essentials in order
to illustrate the main concepts and to get started quickly. Anyway, the concepts covered
should come in handy when working with real-world data-acquisition tasks. I basically follow
Mrs. Robinson’s guideline of “help you learn to help yourself” (remember the Simon and
Garfunkel song?) and try to fill the toolbox with practical know how. This know how should
enable the reader to help herself and pick up datasheets and manuals to adapt the basics
from this book to realize far more advanced projects.
User Guide
The main theme of the book is From Sensor to Report, and that should be the guiding
principle of using it in the classroom, either in a student laboratory or as the basis for
individual projects.
For a student laboratory I suggest installing the software with some of the more arcane
instructions before starting the lab. This comprises turning the Raspi into a router (Sec-
xv
xvi Preface
tion 5.4), installing the MySQL database (Section 5.6.2), and installing EPICS (Section 6.1).
The students should focus on the sensors and use the above systems as a background infras-
tructure. They should, on the other hand, understand the basic operation of the sensors,
learn how to interface them to a microcontroller, and move the information to the next level
on a different computer. This requires them to write network code, fill an SQL database,
prepare the protocol files for EPICS, or present data on a web server. In the lab a knowledge-
able supervisor, a “tutor”, should be available to answer questions and guide the students.
Using solderless breadboards in the lab enables the students to quickly arrive at a working
system on which to base further experiments and try out new ideas.
A suitable scope for student projects, suitable for a single or a group of two students,
is to connect a small number of sensors to an Arduino. Then they should be given a target
system where they can publish the data. This can be a database, EPICS, MQTT, or a web
page. After a prototype system is working, the students should present their system in a
seminar and prepare a report.
All code and the corresponding images of the circuits on a breadboard, prepared
with Fritzing [1], are available on this book’s web site at https://www.crcpress.com/
9780815393603.
Acknowledgments
This book only materialized because my students, Adam, Måns, and Frida, asked about
“some project” and then completed it with such enthusiasm. I gratefully acknowledge their
contributions and input.
I gratefully thank my colleagues Roger Ruber and Mattias Klintenberg. They read and
commented on parts of the manuscript and provided essential feedback. All remaining errors
are of course my responsibility.
I thank Camilla Thulin, Uppsala University, for her help with the photography.
This book is only possible thanks to the open source community that created the Arduino
and Raspberry Pi ecosystems and the large number of people who answer questions on
Internet forums.
I acknowledge the creators and maintainers of the Fritzing software. I relied on it to
prepare many drawings to illustrate the wiring of circuits.
I am indebted to my editor Francesca McGowan and to Rebecca Davies at Taylor &
Francis for competently guiding me through the intricacies of writing and publishing a book.
Last, but not least, I acknowledge my family for putting up with me during the writing
and editing period, when I was more often than not absent minded and showed a distinct
lack of response to other matters.
xvii
CHAPTER 1
Introduction
What is the path that the electrical signal from a sensor takes to end up in a report? We
address this question because collecting sensor data, processing them, and deriving some
understanding from the data plays an important role in many circumstances. One example
is a utility company that gathers information about electricity, heating, and water in order
to prepare statements for their customers and to estimate demand for their product in the
future. Smart homes are another example; they measure temperatures or detect the presence
of beverages in the refrigerator to adjust the thermostat in the first case, or to prepare
a report for us to pick up some milk or beer on the way home in the second case. Quite
generally, many Internet of Things (IoT) technologies share a common base with the topic of
the book, but even large experimental collaborations such as the ATLAS [2] or CMS [3] that
operate the huge detectors at the Large Hadron Collider (LHC) [4] at CERN [5] get their
data from sensors that are buried deep inside the detectors. They sense currents from drift
chambers where charged particles cause a discharge between wires at different potentials, or
they cause electrical signals from semiconductor detectors, where they create electron–hole
pairs that induce a current. Other examples are Hall sensors, to measure magnetic fields, and
humidity sensors or barometric pressure sensors to detect variations of ambient conditions.
All these sensors produce electrical signals that often need to be amplified or otherwise
conditioned. This stage involves operational amplifiers and various filters to improve the
signal-to-noise ratio. Once properly processed, the analog signals are passed on to analog-
to-digital converters (ADC), where they are converted to a digital representation that is
subsequently handled by computers. Often some of the computing power is located close
to the sensor and is provided by microcontrollers that collect signals from nearby sensors
and convert them to the underlying physical quantities, formatted to have a standardized
output format. Thus they act as “communication glue” between the specific interface to
the sensor and a more generic interface to a host computer that is usually located further
away. The latter is the other end of the communication channel from the microcontroller
and provides data storage and presentation, and sometimes also shows recent data for on-
line monitoring. The host computer may run generic control-system software to provide a
further abstraction layer towards higher-level software. Examples we discuss are MQTT [6],
which is popular with IoT projects, and the EPICS control system [7], commonly found in
scientific laboratories.
In this book we will build a system that contains all the ingredients also found in
large scientific or industrial installations. In a sense it is a simplified model of a large
installation, yet containing all the hardware and logical building blocks. In particular, we
use the Arduino microcontroller [8] as the local intelligence to control switches and motors
to move the sensors around and enable reading them out and translating the signals to
a format that allows communication with a host computer using a standardized protocol.
1
2 A Hands-On Course in Sensors Using the Arduino and Raspberry Pi
Analog Digital
sensors sensors
Actuators
I2C switches, motors
Signal SPI
conditioning
Digitization Reading
RS-232, WIFI
Protocol
Data presentation
Publish with web server
EPICS control system
MQTT messaging system
Presenting at seminar
This comprises the hardware channels, which can be USB, RS-232, Bluetooth, or WiFi as
well as the logical protocol, such as a simple query-response protocol. As host computer
we use a Raspberry Pi [9] which, in its most recent incarnation, features four processing
cores and runs a standard Linux system with a huge base of available software, including
web servers, the MATLABTM -clone Octave, and even MathematicaTM , all without license
charges.
The remainder of the book is organized as laid out in Figure 1.1. We first discuss a
number of analog sensors and signal-conditioning methods, followed by a number of sensors
that already provide their measurements in digital form, and the buses and protocols used.
Next we discuss actuators. They switch things on and off, even those requiring large currents,
and we learn how to control different types of motors that are sometimes needed as part of
the measurement process. We then describe how to interface the actuators and the sensors
with the Arduino, either by digitizing the signals or by using the appropriate bus-interface.
We go on to describe a program structure that permits the Arduino to support a simple
query-response protocol in order to serve as a slave to a host computer. Next, we configure
a Raspberry Pi as a standardized host computer. It will provide data storage in databases,
and present the data in graphical form either using Octave running locally on the Raspi
or by publishing our measurement data with a web server, also running on the Raspi. We
continue the discussion by installing the EPICS control system software and turn the Raspi
into a full-blown control-system server that can join any other EPICS installation in a
transparent way. We go on to discuss the MQTT message-passing system, which plays an
important role in IoT applications. Having assembled all the parts, we consider examples
in which we build a weather station with distributed sensors, and systems to record ground
vibrations, monitor the color of water, and measure the capacitance of a capacitor. In two
more advanced examples, we build a system to measure the width of the beam of a laser
pointer, and a remote-controlled robot that also senses flames autonomously, moves to the
fire, and sounds an alarm. We conclude with presenting guidelines about how to prepare
a seminar presentation based on the examples and how to write a readable publication
describing our data acquisition system using sensors, actuators, Arduino, and Raspberry
Pi.
CHAPTER 2
Sensors
A sensor is a device that converts a physical quantity to an electrical signal [10, 11, 12, 13],
and therefore either provides a voltage or a current, or causes a change of its resistance.
More generally, the impedance of the sensor, which also comprises capacitive and inductive
sensors, may change. We are thus faced with the task to measure either of these electrical
quantities.
Below we discuss examples of the different types of sensors. The examples only show
a selection of those available on the market, and searching the Internet for the physical
quantity one wants to measure jointly with the keyword “sensor” will give an idea of what
is available. Once the sensor is identified, careful reading of the datasheet to learn about
how to interface the sensor is mandatory.
5
6 A Hands-On Course in Sensors Using the Arduino and Raspberry Pi
Highest energy
for electrons
Vcc
LDR
Vcc Signal
More electrons
in conduction
Measured band
voltage
Band gap
2.4 eV
Conduction band
lower boundary
Vcc Photon
LDR
Vcc Signal
Figure 2.2The band-level scheme and the schematics for the circuit with the LDR in
a voltage divider. The upper graph illustrates dark conditions and the lower graph
shows conditions where the LDR is exposed to light. Note that the vertical axis
by convention shows the energy of electrons. This causes the positive pole of the
battery to have the most negative energy. See the text for a discussion.
Sensors 7
operating principle of this and many other sensors is based on the availability of electrons in
the conduction band of a material. In good (wires) or bad (resistors) conductors, electrons
partially fill the available states in the conduction band up to some energy, the Fermi level,
whereas in insulators the Fermi level is located in between the completely filled valence band
and the conduction band [14]. Therefore, no electrons are available in the conduction band.
Furthermore, the energy-difference between the upper boundary of the valence band and
the lower boundary of the conduction band, the bandgap, is large, while for semiconductors
it is on the order of electron-volt (eV).
In photoresistors the base material is often CdS, a semiconductor with a bandgap of
about 2.4 eV. This energy equals that of photons of green light with a wavelength of about
500 nm. Therefore, green photons can elevate electrons from the valence to the conduction
band and thus create electron–hole pairs. These now freely moving charge carriers conduct
electric current and therefore increase the conductivity of the material. Figure 2.2 illustrates
this in more detail. The upper figure shows a simplified band level scheme under dark
conditions. The bold lines show the lower boundary of the conduction band and the upper
boundary of the valence band. The dashed line shows the highest energy-states that electrons
occupy. For metals and resistors, this is close to the Fermi level, but in a semiconductor, like
CdS, the Fermi level lies between valence and conduction band. Yet, at room temperature,
there are a few thermally excited electrons in the conduction band of CdS. We visualize this
by the close proximity of the dashed line to the lower conduction-band boundary. In metals
there are plenty of electrons in the conduction band, and the conductivity is high. In the
resistor there are fewer electrons in the conduction band, or their mobility is impeded in
other ways such that there is a shift in the Fermi level across the resistor. In dark conditions
there are only very few thermally excited electrons in the conduction band of the LDR, and
the conductivity is very low. Consequently, there is a large voltage-drop across the LDR
and the measured voltage, which is the difference of Fermi levels between the measurement
points. The measured voltage is therefore close to the full voltage delivered by the battery.
If, on the other hand, the LDR is illuminated, the photons lift electrons from the valence
band into the conduction band. This increases the conductivity and only a small voltage is
dropped across the LDR. This consequently reduces the measured voltage, as shown in the
lower graph of Figure 2.2. Note that we do not discuss the details of the interfaces between
the different parts because it is beyond the scope of this book.
In the middle of Figure 2.1 we show how to connect a photoresistor in series with a
resistor R0 (here 10 kΩ) to create a voltage divider between the supply voltage Vcc and
ground. From the discussion of voltage dividers and a short refresher of basic circuit theory
in appendix A or [15, 16], the voltage Vs on the signal terminal is then given by Vs =
Vcc RLDR /(R0 + RLDR ). Thus, the illumination of the LDR changes its resistance RLDR
and the signal voltage varies correspondingly. Note that we have to select the resistor R0
in the middle of the range of RLDR . This causes the voltage we measure to be around one
half of the supply voltage. Therefore, we also need to use a volt meter in that voltage range.
Very small variations of the light intensity are then difficult to resolve and may need to
be amplified. Using a Wheatstone bridge, where we compare the voltages in two resistor
dividers, as shown on the right of Figure 2.1, helps to alleviate this problem. We expand on
the use of Wheatstone bridges in Section 2.2.
Other resistance-based sensors are resistance-based temperature detectors (RTD) such as
the PT100 temperature sensor. It is a calibrated platinum-based sensor with a resistance
of exactly 100 Ω at 0 o C. It is based on the fact that the resistance of a very pure metal
is determined only by scattering of electrons in the conduction band with phonons, which
are vibrations of the ions that make up the crystal lattice of the metal. Moreover, higher
8 A Hands-On Course in Sensors Using the Arduino and Raspberry Pi
Band
Occupied donor levels Partially occupied gap
donor levels
Valence band
at low upper boundary at higher
temperature temperature
Figure 2.3NTC resistors are doped semiconductors that have donor levels just below
the conduction band. Increasing the temperature increases the kinetic energy of the
electrons that allows them to occasionally jump into the conduction band, where
they contribute to the conductivity of the material.
temperatures cause stronger vibrations of the lattice, with correspondingly higher resistance.
Intuitively one might think of the crystal ions at higher temperature to oscillate with larger
amplitudes, creating a larger target for the electrons to scatter, thus impeding their motion.
Since this is an intrinsic property of the material, calibration measurements of resistance as
a function of temperature are universally valid for all sensors of the same metal, provided
the metal is very pure and free of imperfections. Commercial sensors are often made of
platinum wire wound on a ceramic support body. The PT100 sensors are connected to a
calibrated current source and the voltage drop across the sensor is measured with a volt
meter, just as any other resistance measurement.
Thermistors are resistors that have their temperature dependence deliberately made
large. In positive temperature calibration (PTC) devices, the resistance increases with tem-
perature, and in negative temperature calibration (NTC) devices, it decreases. PTCs are
mostly used as protection devices that switch the resistance from a low- to a high-resistance
state if a certain temperature is exceeded. They are based on polycrystalline materials that
change their dielectric constant at a certain temperature, the Curie temperature, by a large
amount. Above the Curie temperature, the state of the magnetic dipoles is disordered and
the dielectric constant is small. This causes the formation of large potential barriers be-
tween the crystal grains, which leads to a high resistance. Below the Curie temperature the
molecular dipoles are aligned, the dielectric constant is large, and the resistance is low. A
typical application of the PTC thermistor is a self-regulating heater, in which the heater
also warms up the thermistor, which increases the resistance and limits the current to the
heater until an equilibrium is found. PTCs can also be used to detect whether a threshold
temperature is exceeded.
The converse thermistors are NTCs, which decrease their resistance with increasing
temperature. They are often used for temperature sensing and are based on a doped semi-
conducting material that has occupied impurity donor levels below the conduction band, as
shown in Figure 2.3. Increasing the temperature thermally excites these electrons to jump
into the conduction band, thus increasing the conductivity. This effect is much larger than
the reduction of the resistance due to the ions oscillating and impeding the motion of the
electrons, which was responsible for the temperature dependence in the PT100 sensor. Both
NTC and PTC thermistors are sensed by connecting them to a constant-current source and
measuring the voltage drop across the thermistor.
Sensors 9
Figure 2.4A linear potentiometer (left) and a circuit illustrating the electric connec-
tions (right).
10 A Hands-On Course in Sensors Using the Arduino and Raspberry Pi
Figure 2.5 A joystick is shown on the left and a fluid-level resistive sensor on the
right.
that is affected by the adsorbed gases. On the left of Figure 2.7 we illustrate the working
principle. The heater is located under the SnO2 active layer and powered by passing a
current through it. The resistance, which depends on the concentration of the specific gas,
can be measured between the terminals labeled 1 and 2. A device mounted on a small
breakout board is shown on the right of Figure 2.7. The sensing area is located under the
metallic hat that protects against the heated area, and potential explosive reactions on the
hot surface should a “wrong” gas ignite.
After this short selection of resistance-based sensors we progress to discuss sensors that
report a voltage directly.
where Eg = 1.2 V is the bandgap energy of silicon, k is the Boltzmann constant, and
T the absolute temperature in Kelvin. A(T ) is a device-specific constant with moderate
temperature dependence. Assuming that both transistors are located on the same substrate
and have the same temperature, we solve for two current densities j1 and j2 and obtain
for the voltage difference ∆VBE = VBE,1 − VBE,2 = kT /e ln(j1 /j2 ). In the LM35, the base-
Uh
Sn2O
1 2
Heater
emitter diodes of the two transistors have different areas such that the ratio of the areas
determines the current densities, provided that the same macroscopic current passes through
the two transistors. There are operational amplifiers on the same substrate to provide signal
conditioning such that the LM35 produces an output voltage Vs that is related to the
temperature T by Vs = T /100. Here Vs is measured in volts and the temperature in degrees
Celsius, such that a temperature of 23 o C results in a voltage of 0.23 V. The LM35 has three
pins; one is connected to ground, one to the supply voltage, and the third one carries the
voltage Vs that is proportional to the temperature. Note the polarity for connecting the
LM35 in Figure 2.8. The flat surface is pointing to the wires on the left-hand side.
Thermocouples are temperature sensors that are based on the effects of temperature and
temperature gradient on conductors made of different materials. Directly at the junction of
the conductors, the Peltier effect causes a current that depends on the temperature. This
happens at the points labeled by their respective temperatures T1 and T2 on the top left
in Figure 2.9. On the wire segments a temperature gradient causes an additional current
to flow, the Thomson effect. And finally, joining the two junctions and the wires causes a
current to circulate, provided the loop is closed. This is called the Seebeck effect. If the loop
is open, as shown at the top left of Figure 2.9, a voltage U develops at the end terminals
as a consequence of the Peltier, Thomson, and Seebeck effects. In practice, one junction,
say at T1 , is held at known and constant temperature, for example, by immersing the
Figure 2.8 Image of an LM35 temperature sensor (left) and how to connect it (right).
12 A Hands-On Course in Sensors Using the Arduino and Raspberry Pi
material A
T1 T2
material B U material B
T1
A A A A A A
B B B B B B
T2
U
Figure 2.9On the left we show a schematic of a thermocouple on the top and a
thermopile on the bottom. On the right we show an image of an MLX90614 contact-
free thermometer.
junction in ice water. Then the voltage U is related to the temperature difference T2 − T1
of the sensing end at T2 and the reference temperature T1 . The magnitude of the voltage
generated depends on the combination of metals and is typically on the order of 50 µV/o C.
In a thermopile a number of wire segments of materials A and B are connected in series,
as shown on the bottom left in Figure 2.9. This increases the sensitivity of the device to
temperature differences. Thermopiles are often found in devices sensing heat and infrared
radiation, such as thermal imaging devices or contact-free thermometers. The sensor used
in the latter is shown on the right of Figure 2.9.
Some crystals and ceramics react to external stresses by producing a piezoelectric voltage
between opposite sides of the material, as a consequence of rearranging charges within their
crystal structure. The resulting voltages reach several kV and can be used to produce
sparks in ignition circuits or in old-fashioned vinyl record players. There, a “crystal”-stylus
is squeezed in the grooves of the record and the generated voltages are amplified and made
audible as sound. In scientific applications, piezoelectric sensors are used to measure pressure
or forces.
The speed of angular motion is easily sensed by a DC electrical motor that is operated
backwards as a generator. Instead of applying a voltage to turn the axis of the motor,
turning the axis induces an induction voltage in the motor coils that is proportional to the
angular velocity. Attached to a propeller that is turned by either a flowing liquid or a gas,
such a device can measure flow rates.
+Uh/2
I I
E
B
-Uh/2
Figure 2.10 Schematic of a Hall sensor (left) and the A1324 sensor (right).
Sensors 13
Hall sensors produce a voltage that is proportional to the magnetic induction B. Their
mode of operation is explained in Figure 2.10 and is based on passing a known current
I through a semiconductor. In the presence of a magnetic field, the Lorentz force de-
flects the charge carriers—electrons and holes—towards perpendicularly mounted electrodes
(shaded). This creates a potential difference (a voltage) between the electrodes, which causes
a transverse electric field that counteracts the deflection from the Lorentz force such that the
following charge carriers can move towards the exit electrode undeflected. In equilibrium,
the voltage difference between the upper and lower electrodes is proportional to the mag-
netic induction B and can be measured with a voltmeter. The A1324 Hall sensor, shown on
the right in Figure 2.10, has signal-conditioning circuitry on board and only needs three pins
for ground, supply voltage, and output voltage. The latter is proportional to the magnetic
field, with a sensitivity of 50 mV/mT centered at 2.5 V when no field is present.
The ADXL335 is a three-axis integrated acceleration sensor based on micromachined
structures on a silicon substrate where an inertial mass is suspended by springs [12]. The
inertial mass is part of an assembly of capacitors driven by an AC voltage that is used to
measure the imbalance of a capacitive voltage divider. As opposed to our simplified model
with only one capacitor doublet, the real device uses a large number of interleaved capacitor
doublets in order to increase the sensitivity. Figure 2.11 illustrates the principle of operation
for a single direction. On the left in Figure 2.11 there is an AC-voltage generator that drives
the light-grey capacitor plates. The dark-grey inertial mass is placed halfway between the
driven plates, and in the absence of acceleration, the capacitances between the two light
grey plates and the inertial mass are equal. An acceleration introduces an imbalance in the
capacitances that affects the voltage level on the inertial mass. Comparing the phase and
amplitude of that signal with that of the driving AC signal yields direction and magnitude
of the acceleration. After some signal processing, it is then made available as Uacc on one
of the output pins of the ADXL335 in the range from 0 to 3 V, such that the voltage is
proportional to the acceleration in the range from -3 g to +3 g and is updated at a rate of
about 100 times per second.
The SM-24 is another type of accelerometer called a geophone, and is shown in Fig-
ure 2.12. It is based on a coil connected to the housing by springs embedded in a magnetic
field generated by permanent magnets that are attached to the housing. If the housing
moves, the coil remains stationary due to its inertia, and a voltage is induced in the coil,
which is proportional to the velocity and can be measured. The sensitivity is 28.8 V/(m/s)
and the device operates in the range of 10-240 Hz.
acc
Microphones convert sound to electrical signals and can be classified as sensors. Two
major classes are on the market. Dynamic microphones operate similarly to the geophones.
A coil, attached to a membrane, is excited by sound, moves in a magnetic field, and induces
an induction voltage in the coil that is amplified and measured. In electret microphones, the
membrane constitutes one electrode of a capacitor. If it moves, the capacitance changes,
and the amount of charge stored on the capacitor is pushed on and off the capacitor and
creates a current that is amplified and measured.
The electret microphone serves as a nice example with which to turn to current-based
sensors.
E +Vb
n i p
electron raised
to cond band acceptor
levels R
Rf
nip
photon Vb _
conduction
band Ip Ip
OpAmp
donor Vo
levels
+
valence
band
Figure 2.14Image of a BPW34 pin diode on the left and two phototransistors on the
right; an IR-sensitive BPX38 and an SFH3310, sensitive in the visible part of the
spectrum.
have an additional layer of un-doped, intrinsically (‘i’) conducting silicon in order to increase
the target area for the photons and provide a chance to produce additional charge carriers.
One operational mode of the pin diode, called photoconductive, is illustrated on the left-
hand side of Figure 2.13, which shows a simplified energy-band diagram of a reverse-biased
diode. Note that by convention, the upwards energy axis corresponds to the potential energy
of electrons that is lowest at the most positive voltage and that is found on the left-hand
side. In the figure the cathode (n side) is therefore at higher voltage than the anode (p
side) and results in all charge carriers being pulled out of the intermediate zone; electrons
to the left and holes to the right. This results in the diode blocking any current flow. The
extra layer of un-doped silicon provides extra potential charge carriers that act as targets
for photons, having energy higher than the band-gap. These photons create electron–hole
pairs by lifting electrons from the valence band into the conduction band, as indicated in
Figure 2.13. The applied voltage, which is more positive on the left-hand side, causes the
electrons to move to the left and the holes move to the right. Combined, this constitutes
a current Ip . We mention in passing that ionizing radiation, such as high-energy photons
and gamma rays as well as charged particles with high energies, create electron–hole pairs.
This makes pin-diodes suitable as radiation detectors. The circuit on the right-hand side of
Figure 2.13 shows an operational amplifier that converts the current Ip flowing towards its
negative input port into a voltage Vo = −Rf Ip on its output port. We will cover operational
amplifiers in more detail in the coming sections. A BPW34 pin diode is shown on the left
of Figure 2.14.
Phototransistors such as the BPX38 or SFH3310, both shown on the right of Figure 2.14,
are similar to normal transistors, but their base-collector diode is a reverse-biased photo-
diode, similar to the one described in the previous paragraph. It causes a current to flow
as a consequence of impinging photons. The base-emitter diode is already forward biased
and will ensure that the collector–emitter connection becomes conducting. Moreover, often
there is a lens to increase the number of photons impinging onto the base terminal with the
photosensitive area. Phototransistors sensitive to special spectral ranges such as infrared
radiation, by suitably choosing their band gap, can be used as flame detectors.
The sensors in imaging applications such as cameras are charge-coupled devices, or CCDs,
which are similar to a pin diode that is attached to a small capacitor, one for each pixel
of the camera. Exposure to light transfers a small charge to the capacitor. The often large
number of pixels are read out sequentially by transferring the charge from on capacitor to
the one closer to the external readout port. A bucket chain to transfer water that is emptied
16 A Hands-On Course in Sensors Using the Arduino and Raspberry Pi
Figure 2.15On the left we have a voltage divider to reduce the input voltage of 0-5 V
to 0-3.3 V. The right circuit shows the use of clamping diodes to protect the input
of the microcontroller to lie between ground and 5 V.
at the end point comes to mind. In a CCD, once the charge reaches the output port, it is
passed through a resistor, where it creates a voltage drop that can be measured.
Solar cells operate in a similar fashion to photodiodes in photovoltaic mode where they
provide a voltage to a load. They are, however, optimized to absorb as large a part of the
spectrum as possible, and also to have a large absorbing area, in order to maximize the
electric power available to the load.
After this brief overview of different analog sensors, we need to address how to prepare
the signals such that they can be easily interfaced. This preparatory stage is referred to as
signal conditioning.
Figure 2.16A bare operational amplifier shown on the left and shown wired as a line
buffer on the right. We omitted the supply wires on the latter schematic.
at its center tap (the lower-signal wire) because the two resistors are equal. The voltage
divider on the right-hand side is the same one, we encountered previously, with the upper-
signal wire connected to the point between the upper resistor and the LDR. Normally one
would choose the resistance of the right resistor to be in the middle of the range of interest
of the LDR, such that voltage-difference between the signal wires is close to zero, indicating
mid-range. In this way, depending on the light exposure, the voltage difference between the
wires varies around zero and the sign will tell us whether the exposure is lower or higher
than the expected mid-range value. Since we now deal with voltages that vary around zero,
it is easier to amplify that voltage in order to increase the sensitivity. For example, when
using a plain voltmeter, we can use a smaller voltage range.
In case we use a piezo-based sensor, the generated voltages can be much higher than is
acceptable in the following circuit such as a microcontroller. In such a situation, clamping
diodes, as shown on the right of Figure 2.15, are used. If the input voltage is between 0 and
5 V, the diodes are blocking, and the signal is passed on to the microcontroller. If, on the
other hand, the input voltage exceeds 5 V plus the forward voltage drop, the diode starts
conducting and shorts the input to the upper power rail of 5 V. If the input voltage is below
0 V, the lower diode starts conducting and shorts the input to ground. In either case, the
voltage delivered to the microcontroller is limited to 0-5 V plus or minus the forward diode
voltage drop. Many integrated circuits including microcontrollers have built-in clamping
diodes. The Raspberry Pi, however, is a notable exception.
2.2.2 Amplifiers
Very small electrical signals usually need to be amplified to reach levels adequate for further
processing. The standard device to achieve this is an operational amplifier or op-amp, shown
on the left of Figure 2.16. There are two input ports on the left, one labeled “plus”, one
labeled “minus”, and one output port. The latter delivers a voltage that depends on the
difference between the two input ports. In an ideal op-amp, the amplification factor is
infinite and we usually use some feedback mechanism to obtain a deterministic behavior,
as discussed below. Normally, op-amps require both positive and negative supply voltage,
even though sometimes it is possible to tie the negative supply rail to ground, in which case
only unipolar signals can be amplified.
Before discussing different circuits, we need to describe three basic principles that char-
acterize op-amps.
18 A Hands-On Course in Sensors Using the Arduino and Raspberry Pi
The input impedance of the input ports is “infinite”, which means that no current
flows into the op-amp and it will not load the upstream circuitry.
The op-amp tries to reduce the difference between the input ports V+ − V− to zero.
The amplification without feedback is quasi-infinite, and the output has a very low
impedance and can provide high output currents.
These simple rules will help us to design and understand the following circuits, but consult
[15] and [16] for a more extensive discussion.
We start by considering a line buffer, which is typically used as an impedance converter
that transforms the output of a sensor with a high impedance to a low-impedance signal
that is less susceptible to noise. We show the circuit on the right of Figure 2.16, where the
output of the op-amp is fed back onto the negative input port. By using the second op-amp
rule, we see that the op-amp tries to make the positive and negative input ports equal,
but negative is tied to the output, which forces the output to follow the positive input.
Moreover, by the first rule, the input impedance is high and no current (or at least very
small current) is drawn from the sensor, while the output is low impedance and can provide
a high current. Note that we omitted the connections to the supply rails on the right of
Figure 2.16, and will do so henceforth in order not to clutter the schematics.
The line buffer is essentially an amplifier with unit amplification, but if we require a
higher degree of amplification, we need to add two additional resistors to the circuit, and
arrive at the left of Figure 2.17. The two resistors R1 and R2 constitute a voltage divider
that forces the negative input voltage to be V− = Vout R2 /(R1 + R2 ). But, at the same time,
the op-amp forces V− = V+ , which, after solving for Vout , leads to Vout = V+ (R1 + R2 )/R2 ,
where (R1 + R2 )/R2 = 1 + R1 /R2 is the amplification factor. Since the output voltage Vout
has the same sign as the input voltage V+ on the positive input port, this configuration is
called a non-inverting amplifier...
...which hints at the existence of an inverting amplifier, for which we show the schemat-
ics on the right of Figure 2.17. To calculate the amplification factor, we note that the
input current Iin only flows through the input resistor R4 and the feedback resistor R5
because the input impedance of the op-amp is essentially infinite and no current flows into
the input ports. But the equality of the current in the input and the feedback resistor
implies I = (Vin − V− )/R4 = (V− − Vout )/R5 . Moreover, we observe that the positive in-
put port is grounded, which forces the negative input port to be on ground potential as
well. This implies V− = 0, and the relation between input and output voltage becomes
Sensors 19
Figure 2.18A difference amplifier (left) and the same circuit with adjustable V1
(right) that is used to subtract the baseline.
Vout = −Vin R5 /R4 , where the negative sign indicates that the amplifier is inverting. Note
that we can add several input resistors R4 in parallel with one end connected to the negative
input port. This allows us to add the currents passing through the parallel copies of R4 , and
we obtain a summing amplifier. The resistor values were simply chosen to be in a reasonable
range. They need to be determined adequately for each application.
Sometimes the signal one wants to measure changes around a non-zero baseline. Exam-
ples are the Hall sensor A1324 from the previous section, where zero magnetic field produces
2.5 V and the magnetic field added or subtracted from that value depending on its polarity.
In order to increase the resolution, we want to amplify not the signal, but the difference of
the signal to the baseline. In other words, we need a circuit to subtract the baseline and
amplify the difference. A differential amplifier as shown in Figure 2.18 accomplishes this
feat, provided that R2 = R4 and R1 = R2 . The output voltage Vout in that case is given by
Vout = (V2 − V1 )R2 /R1 . Adding a potentiometer that adjusts V1 between the positive and
negative supply rail subtracts it as baseline voltage.
20 A Hands-On Course in Sensors Using the Arduino and Raspberry Pi
Figure 2.20 Amplifying a weak signal and shifting it to mid-range between the power
rails.
A circuit similar to the one in Figure 2.18 but with line buffers on the inputs is called
an instrumentation amplifier, and an example is shown on the left of Figure 2.19. Normally
it is not necessary to build instrumentation amplifiers from discrete components. There are
ready-made circuits available such as the AD620 or INA131.
Often, sensors produce small voltages that vary around zero, but the analog-to-digital
converter (ADC) requires an input range of 0 to 5 V. We thus face the problem of amplifying
a bipolar signal and changing the baseline level to mid range of the ADC. We show a circuit
that amplifies by approximately a factor of 10 in Figure 2.20. The amplification is mainly
determined by the ratio of the feedback resistor R3 to the input resistors R1 and R2 . The
voltage divider of R6 and R8 provides the mid-range offset voltage. The average level of the
output voltage crucially depends on the tolerances of the resistors, and in order to place
the level safely in mid range, we use the capacitor C1 to first remove the DC level of the
output signal before adjusting it properly to mid-range, with the voltage divider consisting
of R4 and R5 .
In case we need to amplify input signals that vary over a huge range of values, a loga-
rithmic amplifier such as the one on the right of Figure 2.19 is a useful circuit. It can be
shown that the relation between input and output voltage is Vout = −Vt ln(V1 /Is R), where
Vt is the thermal voltage and Is the saturation current of the diode. Swapping the diode
and the resistor results in an exponential amplifier.
A close relative to the operational amplifier is the comparator. It can be visualized as
an op-amp with very large, even infinite, amplification, whose output port saturates at the
power rails. If the voltage at the positive input terminal of a comparator is larger than
that on the negative input terminal, the output voltage is very close to the positive supply
voltage. On the other hand, if the voltage on the positive input terminal is lower than that
on the negative, the output is close to ground potential. In this way it translates the input
voltages to a binary digital state. A comparator may therefore be considered as a 1-bit
analog-to-digital converter, and we will see in a later section how it is used to extend the
number of bits of the conversion. Some comparators have the threshold when switching
from low to high output configured to be slightly higher than the threshold switching from
the high output state back to the low one. This small hysteresis prevents the output from
Sensors 21
switching back and forth uncontrollably, should the voltages on the two input terminal be
very close.
After the basics of signal amplification, we will now address the question of how to reduce
noise in the circuits and decrease the sensitivity of a circuit in an undesired frequency range.
This is the realm of filters.
2.2.3 Filters
The task of filters is to remove certain frequencies from an electrical signal such as all high
frequencies, in which case the filter is called a low-pass filter. An example is a low-pass filter
that removes “hissing” in audio-signals. The converse filter is a high-pass filter that removes
low frequencies. An example is a anti-rumble filter found in old vinyl record players. If we
know that the desired signal contains only a certain range of frequencies and we wish to
remove all others, we use a band-pass filter. An example is the IF filter found in radios that
are based on the super-heterodyne principle. And finally there are filters that remove only
frequencies in a narrow band. They are called band-stop or notch filters. An example is a
filter that removes the omnipresent 50 Hz or 60 Hz hum coming from the power grid.
We first consider a low-pass filter, which in the simplest incarnation is a frequency-
dependent voltage divider made of a resistor with resistance R and a capacitor with ca-
pacitance C, as shown on the left of Figure 2.21. For a refresher of basic concepts circuit
theory, such as impedance, please consult appendix A. In our circuit, the capacitor has an
impedance 1/iωC, which gets smaller with increasing frequency ω = 2πf. Intuitively, the
higher frequencies are shorted to ground. If we build a voltage divider as shown on the
left of Figure 2.21, the output voltage Vout is given by Vout = (Vin /iωC)/(R + 1/iωC) =
Vin /(1+iωRC) and we see that it is attenuated with increasing frequency ω and, conversely,
the low frequencies are unaffected, hence the√name low-pass filter. The frequency where the
signal amplitude is attenuated by a factor 2 is given by ωc = 1/RC, and the imaginary
unit indicates that there is a phase shift between input and output voltage that depends
on the frequency. Equivalently, a low-pass filter can be constructed with an inductor with
impedance iωL and resistor R, but in many operational situations the inductances have
values that are difficult to find; therefore filters are usually constructed from resistors and
capacitors. The frequency dependence of the filter asymptotically behaves as the first inverse
power of ω, and the filter is called a single-pole filter. Cascading two such filters results in
two-pole low-pass filters that exhibit a steeper frequency-dependence of 1/ω 2 .
Swapping the resistor and capacitor in the low-pass filter results in the high-pass filter
shown on the right of Figure 2.21, which has a frequency dependence of iωRC/(1 + iωRC)
Exploring the Variety of Random
Documents with Different Content
"Herra kuningas", hän sanoi, "taivas on synkkä raskaista
lumipilvistä, enkä minä enää näe tuota pikkuista valoa." Kuningas
sanoi: "mene vielä takaisin vuoren kukkulalle."
Mutta tuskin tämä oli lausuttu, ennenkuin koko vuori alkoi väristä
ja vavista ja luhistua kokoon, ja raju tuuli puhalsi suuren salin lävitse
ja kukisti kuninkaan istuimen, ja tähti paistaa heloitti sisään
pimeinten rotkojen ylitse, ja kaikki peikot hajosivat kuin varjot ja
savu, kunnes ei muuta ollut jäljillä, kuin jäinen joulupuu, ja tämä
alkoi kiiltää ja sulaa, ja korkealta ilmasta rupesivat enkelien äänet
soimaan kuin kanteleet. Mutta lapset peittivät kasvonsa käsillään
eivätkä rohjenneet katsahtaa ylös, ja heihin tuli ikäänkuin uni, kun
jotakuta kovin väsyttää, eivätkä he enää tietäneet, mitä vuoressa
tapahtui.
Kun nyt Kaarle Kustaa ja Sohvi olivat juosseet väsyksiin asti, sanoi
veli sisarelle: "tule, niin menemme maantien varrelle muijan luo ja
ostamme vohvelia rahallani!" — "Niin, tehdäänpä niin", Sohvi sanoi.
Mutta maantien varrella istui viisi tai kuusi poikaa ja tyttöä, jotka
par'aikaa ajoivat hottiinsa ja latoivat sokeria vohveleille niin paksusti,
että kärpäset olisivat voineet ajaa lumiauraa niiden päällä, jos vaan
olisivat saaneet lupaa.
Mutta tällä kertaa seisoi tien varrella pieni poika melkein ilman
vaatteita, sillä hänen päällänsä oli ainoastaan repaleinen paita.
Ja kun hän seisoi valkean ääressä, oli hänen lämmin, mutta kun
hän tahtoi auttaa muita kantamaan polttopuita, oli hänen kylmä, että
hampaat tärisivät, sillä yö-ilmassa oli vilponen, niin kuin useinkin on
juhannuksen aikana. — "Miksi et pue enemmän päällesi?" kysyi
Kaarle Kustaa häneltä.
Niin paloi valkea koko yön, eikä se yö ollut pimeä. Sillä hetken
kuluttua puna taivaanrannalla koillisessa rupesi hohtamaan yhä
heleämmin ja lopullisesti tuli se kirkkaaksi kuin keltaisin kulta. "Heti
aurinko nousee", sanoi Kaarle Kustaa. "Tulkaa, nouskaamme vuorelle
paremmin nähdäksemme!" "Missä on takkini? Tahdon takkini", huusi
Tuure, joka oli ottanut maksun siitä, kun oli tehnyt hyvän työn. "Oi,
minkälainen narri minä olinkaan!" huusi hän. "Nyt olen kadottanut
hopearahan, jonka vuokraksi sain!"
1. Kultakärpänen
2. Punainen lippu.
(Aallotar kertoo.)
3. Jalopeura.
(Kukkain haltia.)
4. Meren syvyydessä.
(Aallotar.)
5. Lähde.
(Kukkain haltia.)
6. Sumusaaret.
(Aallotar.)
Henkilöt:
Kuningas.
Kuningatar.
Kuninkaan julistaja.
Tulpaani, kuninkaan puutarhuri
Bumburrifex, rosvo, velho ja ihmissyöjä.
Bumburra, hänen vaimonsa.
Tähkö, poika, | Tulpaanin lapset.
Palko, tyttö, |
Nopsajalka, köyhä poika.
Varma, hänen sisarensa.
Hunttu Honkasalmelta, mylläri poika.
Kalle Kukkanen, |
Matti Laukka, | Tähkön ja Palon
Riikka Kukkanen | leikkikumppaneja.
Kasi Aituri, tyttö. |
Musti, koira.
Ukkoja, akkoja ja lapsia kuninkaan kaupungista.
Ensimmäinen tapaus.
Lapset laulavat.
Lapset (laulavat).
Tähkö. Niin, pojat, älkää sanoko sitä isälle. (Hän menee taas
piiloon.)
Kasi. Vaiti, sinä siinä. Oli niin hirveätä kivikkoa siellä metsässä.
Minulta hävisi sinne toinen kenkä.
Kasi (sulkee kädellään häneltä suun). Jos et ole vaiti, niin minä
varastan sinulta jalkasi!
Palko. Mitä te, isä, puhutte, onko kuka tehnyt pahaa puutarhassa?
Kasi. Miten viaton tuo tyttö on olevinaan! Ikään kuin eivät kaikki
tietäisi, että hän juuri taittoi tulpaanin.
Tähkö. Ja ettekö näe, isä, että pojan jalat ovat mullassa puutarhan
penkeistä?
Kasi. Te, Matti ja Riikka, älkää luulkokaan, että teillä muka on niin
ylevät omattunnot! Ken on vaiti ja siten yhtyy kujeesen, kun toiset
selvittäytyvät pienellä hätävalheella, hän ei ole yhtään parempi
toisia.
Hunttu. Niin se juuri on. Hyi häpeätä, hyi meitä kaikkia! (Lähtee
menemään pois.)
Toinen tapaus.
Bumburra.
Bumburra. Vai niin, joko mieheni nyt tulee kotiin. Ja minulla kun
on vain kukko iltaseksi! Onhan minulla porsaskin, mutta se on
jouluporsas, se. (Hän avaa oven, Nopsajalka ja Varma astuvat
sisään.) Mitä ihmettä? Kaksi lasta!