Opportunities for Human-Interfaced Capacitive Sensing in Building Environments Brian Sennett

Opportunities for Human-Interfaced Capacitive Sensing
in Building Environments
by
Brian Sennett
S.B., Massachusetts Institute of Technology (2013)
Submitted to the Department of Electrical Engineering and Computer Science
in partial fulfillment of the requirements for the degree of
Master of Engineering in Electrical Engineering and Computer Science
at the
MASSACHUSETTS INSTITUTE OF TECHNOLOGY
February 2015
c Massachusetts Institute of Technology 2015. All rights reserved.
○
Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Department of Electrical Engineering and Computer Science
January 15, 2015
Certified by . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Dr. Peter Lindahl
Postdoctoral Associate
Thesis Supervisor
Certified by . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Dr. Steven B. Leeb
Professor of E.E.C.S. & M.E., MacVicar Faculty Fellow
Thesis Supervisor
Accepted by . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Prof. Albert R. Meyer
Chairman, Master of Engineering Thesis Committee
Opportunities for Human-Interfaced Capacitive Sensing
in Building Environments
by
Brian Sennett
Submitted to the Department of Electrical Engineering and Computer Science
on January 15, 2015, in partial fulfillment of the
requirements for the degree of
Master of Engineering in Electrical Engineering and Computer Science
Abstract
This work presents several types of novel long-range capacitive sensors that enable better detection
of how people move through buildings, presenting ample opportunity for smart lighting and utility
control. Various arrangements of sensors on walls, ceilings, and floors turn building surfaces into
sensor systems. These systems offer presence and motion detection, and each sensor can also act as
a short-range imaging and material detection device. The ability to detect materials in occupants
enables this sensor system to act as a non-intrusive security scanning device, improving the confidence
of security personnel and easing concerns of travelers and building occupants. Each component of
the sensor is modeled physically for electrostatic simulations, and electrically in circuit form. These
accurate simulations validate experimental data and confirm a lumped-capacitance system model,
as well as provide a tool for designing sensor systems prior to installation.
Thesis Supervisor: Dr. Peter Lindahl
Title: Postdoctoral Associate
Thesis Supervisor: Dr. Steven B. Leeb
Title: Professor of E.E.C.S. & M.E., MacVicar Faculty Fellow
2
Acknowledgments
I am indebted to my thesis supervisors, Steve Leeb and Pete Lindahl, for their endless support and
motivation, and for their tireless dedication to exploring the thrill and power of engineering. I would
also like to thank my mentors at the Laboratory for Electromagnetic and Electronic Systems who
have shaped my knowledge immensely throughout my MIT career, including Chris Schantz, John
Donnal, Arthur Chang, Lizi George, and Al-Thaddeus Avestruz. I especially thank John Donnal for
his help in building the scanning-grid setup. Finally, I am grateful to my parents, Marty Sennett
and Chris Ferrero, for always believing in me and pushing me to be the best I can be.
3
4
Contents
1 Introduction
13
1.1
Motivation
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13
1.2
Previous Developments in Capacitive Sensing . . . . . . . . . . . . . . . . . . . . . .
14
1.3
Capacitive Sensing Opportunities . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15
1.3.1
Energy Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15
1.3.2
Security Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16
1.3.3
Configuration Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17
1.3.4
Hybrid Long-Range and Short-Range System . . . . . . . . . . . . . . . . . .
18
Thesis Overview and Contributions . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18
1.4
2 Capacitive Sensing Methods
19
2.1
Basics of Capacitance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19
2.2
Human-Interfaced Capacitive Coupling . . . . . . . . . . . . . . . . . . . . . . . . . .
22
2.3
Short-Range Capacitive Tomography . . . . . . . . . . . . . . . . . . . . . . . . . . .
23
2.3.1
Capacitive Scanning Grid . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24
2.3.2
Receiving Front-End Circuitry . . . . . . . . . . . . . . . . . . . . . . . . . .
26
Long-Range Room Occupancy Sensing . . . . . . . . . . . . . . . . . . . . . . . . . .
27
2.4.1
High-Voltage Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28
2.4.2
Active Electrodes and Common-Mode Feedback
. . . . . . . . . . . . . . . .
30
2.4.3
Synchronous Demodulation . . . . . . . . . . . . . . . . . . . . . . . . . . . .
33
2.4
3 Simulation
3.1
3.2
3.3
35
Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Physical Modeling in Comsol
R
○
35
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
35
3.2.1
Scanning Grid Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
38
3.2.2
Room-Based Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
41
Lumped-Capacitance System Models . . . . . . . . . . . . . . . . . . . . . . . . . . .
44
3.3.1
44
Scanning Grid Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5
3.3.2
3.4
Room-Based Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
45
Circuit Modeling in LTspice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
46
3.4.1
Scanning Grid Model
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
46
3.4.2
Room-Based Circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
48
4 Short-Range Capacitive Tomography
51
4.1
Sensor Circuitry and Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
51
4.2
Material Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
52
4.3
Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
54
4.3.1
Imaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
55
4.3.2
Material Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
56
5 Long-Range Room Occupancy Sensing
5.1
5.2
5.3
63
Configuration Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
63
5.1.1
Wall-Mounting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
63
5.1.2
Ceiling-Mounting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
64
5.1.3
Floor-Mounting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
64
Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
65
5.2.1
Wall-Mounted Electrodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
67
5.2.2
Ceiling-Mounted Electrodes . . . . . . . . . . . . . . . . . . . . . . . . . . . .
70
5.2.3
Floor-Mounted Electrodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
75
Indigenous Sources: Photodetection . . . . . . . . . . . . . . . . . . . . . . . . . . .
80
6 Conclusion and Future Work
83
6.1
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
83
6.2
Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
84
6.2.1
Further Exploration of Materials . . . . . . . . . . . . . . . . . . . . . . . . .
84
6.2.2
Installation Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
85
A Code
87
R
A.1 Matlab○
Data-Processing Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
87
A.1.1 Scanning Grid Graphing: SeriesOfHands.m . . . . . . . . . . . . . . . . . . .
87
A.1.2 Room Sensor Graphing: ProcessOutputs.m . . . . . . . . . . . . . . . . . . .
88
A.1.3 High-Voltage Source Signal Parametrization: source_signal_fit.m . . . . .
90
R
A.2 Matlab○
Acquisition Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
91
A.2.1 Room Sensor ADC Communications: readADC.m . . . . . . . . . . . . . . . .
91
A.2.2 Room Sensor ADC Communications: open_ser.m . . . . . . . . . . . . . . .
93
A.2.3 Room Sensor Tests: verticalSetupTest.m . . . . . . . . . . . . . . . . . . .
94
6
A.3 Python Acquisition Code: cap_sweepGrid2.py . . . . . . . . . . . . . . . . . . . . .
95
A.4 Onboard Microcontroller Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
97
A.4.1 Scanning-Grid Microcontroller Code . . . . . . . . . . . . . . . . . . . . . . .
97
A.4.2 Room-Sensor Microcontroller Code: fullyDiff.c . . . . . . . . . . . . . . . 105
B Long-Range Sensor Schematics
123
B.1 Active Electrode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
B.1.1 Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
B.1.2 PCB Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
B.2 Sensor Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
B.2.1 Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
B.2.2 PCB Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
B.3 High-Voltage Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
B.3.1 Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
B.3.2 PCB Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
7
8
List of Figures
2-1 Two charged conductors at a large distance away from each other . . . . . . . . . . .
19
2-2 Two charged floating conductors with electric fields shown . . . . . . . . . . . . . . .
20
2-3 The forced-voltage method
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
21
2-4 Three conductors including ground plane with capacitances . . . . . . . . . . . . . .
21
2-5 Cartoon of capacitive coupling modes . . . . . . . . . . . . . . . . . . . . . . . . . .
23
2-6 High-level overview of scanning-grid circuit . . . . . . . . . . . . . . . . . . . . . . .
25
2-7 Generalized block diagram for grid receive circuitry and control. . . . . . . . . . . .
26
2-8 Block diagram of the synchronous detector in the scanning-grid system. . . . . . . .
27
2-9 The circuit model for the PI controller and plant. . . . . . . . . . . . . . . . . . . . .
29
2-10 Generalized block diagram for the signal conditioning circuitry . . . . . . . . . . . .
31
2-11 Common mode feedback circuit for the front end amplifier . . . . . . . . . . . . . . .
32
2-12 Block diagram of the synchronous detector and low pass filters . . . . . . . . . . . .
33
2-13 Circuit implementation of the synchronous detector and low pass filters . . . . . . .
34
R
3-1 Mesh of a section of a room simulation in Comsol○
.
. . . . . . . . . . . . . . . . .
36
3-2 Scanning-grid experimental setup in shielding enclosure. . . . . . . . . . . . . . . . .
39
3-3 The scanning grid printed circuit with row and column electrodes, on plastic backing.
40
R
. . . . . . . . . . . . . . . . . .
3-4 Model of a section of the scanning grid in Comsol○
41
R
○
3-5 Cross-sections of Comsol model of scanning grid. . . . . . . . . . . . . . . . . . . .
42
R
3-6 Model of the scanning grid section in Comsol○
with composite fat-plastic object. . .
43
R
3-7 Model of an example room setup, with boundary, in Comsol○
.. . . . . . . . . . . .
44
3-8 Lumped-capacitance model of the scanning-grid sensor . . . . . . . . . . . . . . . . .
45
3-9 Lumped-capacitance model of the room-based sensor. . . . . . . . . . . . . . . . . .
46
3-10 Example of LTspice model of scanning-grid capacitance network. . . . . . . . . . .
47
3-11 LTspice model of active receive electrode. . . . . . . . . . . . . . . . . . . . . . . . .
48
3-12 LTspice model of front-end amplifier on sensor board. . . . . . . . . . . . . . . . . .
49
3-13 LTspice model of common-mode feedback circuit on sensor board. . . . . . . . . . .
49
3-14 LTspice model of source circuitry. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
50
9
4-1 The scanning-grid setup, scanning a foot. . . . . . . . . . . . . . . . . . . . . . . . .
52
4-2 Dielectric permittivity and conductivity of non-infiltrated human fat . . . . . . . . .
53
4-3 Dielectric permittivity and conductivity of dry human skin . . . . . . . . . . . . . .
54
4-4 Image of human foot, placed on scanning grid, diagonally across grid. . . . . . . . .
56
4-5 Two sample objects for material detection on the grid setup. . . . . . . . . . . . . . .
57
4-6 Frequency response of moist sponge on scanning grid. . . . . . . . . . . . . . . . . .
58
4-7 Frequency response of moist sponge versus steel disc on scanning grid. . . . . . . . .
59
R
○
4-8 Cross-sections of Comsol model of scanning grid. . . . . . . . . . . . . . . . . . . .
60
4-9 Simulated data for various grid objects across frequencies. . . . . . . . . . . . . . . .
61
5-1 Wall-mounting configuration in large room. . . . . . . . . . . . . . . . . . . . . . . .
64
5-2 Opposing configuration with ceiling-mounted source . . . . . . . . . . . . . . . . . .
65
5-3 Floor-mounting configuration to raise floor variously above ground. . . . . . . . . . .
66
5-4 Cartoon of a wall-mounted coplanar sensor configuration. . . . . . . . . . . . . . . .
67
5-5 Comparison of receive electrode displacements in wall-mounted setup. . . . . . . . .
68
5-6 Matching between experimental and simulated data for “long” wall-mounted setup. .
68
5-7 Opposing wall-mounted setup at far-field distances, with simulation results. . . . . .
69
5-8 Opposing wall-mounted setup at near-field distance, with three sensor displacements.
70
5-9 Comparison of receive electrode displacements in ceiling-mounted setup. . . . . . . .
71
5-10 Matching between experimental and simulated data for “long” ceiling-mounted setup.
71
5-11 Range tests for “long” ceiling setup. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
72
5-12 Range tests for “long” ceiling setup, with only 126" plotted and zoomed in for visibility. 72
5-13 Range tests for ceiling setups, with three electrode displacements. . . . . . . . . . . .
73
5-14 Opposing-setup tests with source at floor level . . . . . . . . . . . . . . . . . . . . . .
74
5-15 Opposing-setup tests with source at ceiling level and receive electrodes at floor level.
74
5-16 Cartoon of a coplanar sensor configuration at floor level. . . . . . . . . . . . . . . . .
75
5-17 Floor setup tests with electrodes and artificial floor at various heights . . . . . . . .
76
5-18 Comparison of experimental and simulated data for the 5.75” artificial-floor setup. .
77
5-19 Comparison of experimental and simulated data for the 1”, on-floor setup. . . . . . .
78
5-20 Floor setup results with foot placed directly on electrode. . . . . . . . . . . . . . . .
78
5-21 Floor setup range tests with subject walking 66” and 86” away from the electrodes. .
79
5-22 Floor setup for range tests, with artificial-floor platform and electrode mounting. . .
80
5-23 Photosensor circuit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
81
5-24 Output waveform of photosensor circuit, with compact fluorescent lamp. . . . . . . .
82
10
List of Tables
3.1
R
Materials in Comsol○
model for scanning grid. . . . . . . . . . . . . . . . . . . . . .
39
4.1
Comparison of grounded and ungrounded objects on grid. . . . . . . . . . . . . . . .
55
11
12
Chapter 1
Introduction
1.1
Motivation
Capacitive sensors have become ubiquitous in consumer electronics. Sensors from the size of a small
coin to a large sheet of paper offer a human-machine interface that drives the fast growth of tabletbased computing. In this type of short-range sensor, the size of the sensor surface is larger than the
distance between the sensor and the object being sensed. However, the availability of long-range—
rather than short-range—capacitive sensors is relatively low. A short-range environment, with its
known material makeup and short sensing range, is much more controllable than an environment
with various objects and prevailing environmental noise. Research for capacitive sensing on a room
scale, at long-range and with uncontrolled variables, is less commonplace than for typical short-range
sensors.
This work presents several types of novel long-range capacitive sensors that enable better detection of how people move through buildings, presenting ample opportunity for smart lighting and
utility control. Various arrangements of sensors on walls, ceilings, and floors offer presence and
motion detection, and each sensor can potentially also act as a short-range imaging and material
detection device. Furthermore, the sensors are designed to be entirely non-intrusive. They can take
the form of a tile in a typical commercial tiled floor, or be hidden behind wall-covering material, or
be implemented as a tile in a standard commercial ceiling grid.
Previous work with this type of sensor has been motivated by energy optimization: more knowledge about a building’s occupancy levels means better control of energy use. This thesis builds on
sensors designed to retrofit into a typical fluorescent lamp to automatically dim the lamp based on
sensed room occupancy, as well as room-imaging technology that uses an array of sensors to produce
a “map” of a room, indicating where lighting should be turned on and off. The contribution of this
thesis is to introduce ways to incorporate both short-range and long-range capacitive sensors that
13
better enable their widespread use.
1.2
Previous Developments in Capacitive Sensing
Two types of sensors are prevalent in consumer electronics: touch-sensitive buttons, which are a
binary (finger present or not present) sensor; and trackpads or touch-sensitive grids, which are gridbased extrapolations of binary sensors with a given resolution that can detect where a finger lies on
the pad. The former replaces mechanical switches, helping to extend lifetime and improve ingress
protection. A commonplace example is on a microwave or stove, where dirty fingers can introduce
dirt into a mechanical switch and cause it to fail. Capacitive sensors, on the other hand, can be
wiped clean easily and avoid all ingress of harmful particles.
Capacitive touch pads and grids are most often used to replace mice and trackballs. In laptops,
a trackpad is now the most commonly used pointing device, replacing its pointing-stick ancestor
gradually since a patent for such a capacitive sensor was granted in 1994 [1]. In the mid-1990s, the
pointing stick was standard on notebook computers whereas a trackpad was an added, and expensive,
feature [2]. In tablets and smartphones, a touch screen eliminates pointing devices altogether. These
applications have arisen rather recently—within the past fifteen years—and uses of capacitive sensing
in consumer electronics will likely continue to change and improve.
For many years, capacitive sensing has been in use for industrial controls, where non-contact
sensing is helpful, or even a requirement [3]. In process measurement, systems often encounter
multiphase flow, a phenomenon where there are multiple regimes of fluid flow present in a pipe,
e.g. slug, laminar, and turbulent. Electrical capacitance tomography (ECT, a method of capacitive
imaging) can aid in measuring multiphase flow; surrounding a pipe with electrodes and measuring the
change in capacitive coupling between these electrodes can produce an indication of the permittivity
of the material within the pipe and even a longitudinal image of bubbles [4]. Similarly, velocity
measurements on flows of solids through air in ducts can be made by ECT, greatly improving
control for industrial conveying applications [3].
Recently, advances in computational ability have allowed the use of finite element modeling
(FEM) techniques to simulate various capacitive sensing technologies. Results from modeling can
be used both to verify experimental data and also to predict how a sensing system will operate, in the
lab and in the field. In [5], a prototype ECT system with a similar pipe-based layout was assembled,
tested, and compared against finite-element models. That particular work used FEMLAB software
R
for modeling, but a similar process is carried out in this work with Comsol○
.
Measuring the change in capacitance brought about by the varying dielectric properties of materials is called dielectrometry. In this thesis, dielectrometry is used to detect the presence of objects
with differing material makeups. This technique is useful in its own right for the purpose of obtain14
ing many physical material variables, such as moisture, porosity, density, and age. Two-dimensional
interdigital capacitive sensors have been developed to scan across a range of frequencies and explore
this type of measurement [6].
Capacitive sensors in consumer electronics can be in more subtle applications as well. A wall stud
sensor [7] detects the change in dielectric constant of a wall when the sensor passes over a stud. It
uses a transmitter electrode (no receiver electrode) and a simple logic circuit and oscillator to detect
the absorption of electric field by varying wall materials. The capacitor formed by the transmitter
electrode and building ground determines the time constant of an oscillator circuit, which the sensor
measures. A similar technology is used in automotive distance sensors, widely installed in modern
cars. Here, capacitive sensing is combined with ultrasonic sensing, greatly enhancing sensitivity in
the nearfield (one foot or less) [8].
Capacitive sensing has also been used in seat-occupancy sensors in vehicles, to aid in air-bag
deployment accuracy and increasing passenger safety. A system proposed in [9] uses several transmitting electrodes and a single receiving electrode to measure the shielding or coupling effects of a
human body between the electrodes. In this way, the system can measure not only the presence,
but also the shape, of a human occupant. Furthermore, the capacitive system avoids the ambiguity
of rapidly changing forces during a crash, unlike conventional weight-sensing systems.
A more advanced inductive-capacitive sensor uses both electric and magnetic field measurement
to establish whether an object is metallic or human [10]. Two electrodes, which double as coils,
transmit and receive fields. In its inductive state, the sensor detects conductive objects, such as
laptops. In its capacitive state, humans and grounded objects can be detected. By comparing
results between the two sensing modes, the sensor can precisely determine human occupancy.
1.3
Capacitive Sensing Opportunities
The body of previous work in short-range capacitive sensing, in both consumer and industrial applications, is ample and provides a good foundation for work in long-range sensing. Research at the
Laboratory for Electromagnetic and Electronic Systems (LEES) at the Massachusetts Institute of
Technology (MIT) has begun to explore how long-range capacitive sensing can use features present
in buildings to improve the energy use of such a building. This thesis, in particular, focuses on the
idea that many common building surfaces can become sensors to improve knowledge of energy use
patterns.
1.3.1
Energy Optimization
A main goal of previous work by Cooley et al. [11] is intelligent dimming and control of modularly
deployed commercial lighting for more efficient energy use. The retrofit sensor (and subsequent
15
standalone versions) expand the amount and accuracy of information that can be obtained about
occupants. The conventional pyroelectric infrared (PIR) sensor allows only very limited information:
motion of infrared-emitting objects. Conversely, capacitive sensors, and particularly the variety of
implementations presented in this work, produce information that is dependent on the size and
material makeup of an object, as well as position in the room and direction of motion.
More high-accuracy information generally leads to better estimation, so the framework for providing accurate occupant data leads to diverse opportunities in energy management. For example,
in a building with a single main entrance, where the flux of workers represents a flow of mass,
heating and cooling systems can adapt based on the estimated human occupant mass in the building. Knowledge of this sort prior to measuring the actual temperature enhances the ability of the
temperature control system to easily maintain comfortable working conditions in the building.
1.3.2
Security Management
With the rise of the threat of terrorism, especially since attacks in 2001, security checkpoints have
been good examples of improved technology in contraband and weapons detection. Airports have
used several technologies to try to detect passengers with harmful materials, many of which are
quite intrusive and have caused protest from those fearing for their privacy. Full-body scanners, in
particular, have been likened to a “virtual strip search.” The Transportation Security Administration
(TSA) has revised policies based on new legislation [12] designed to ease these security procedures.
Given that the goal of full-body scanning is to find harmful objects on a person, capacitive
sensing is well-suited to this application without unnecessarily revealing details about the subject
themselves. By using conventional electrodes but scanning across several frequencies, the frequencydependent dielectric and conductive properties of materials can be detected. Human flesh, bone,
and skin present different dielectric and conductive properties than metallic objects, such as guns
and knives.
Conventional security scanners must be bulky and obvious in order to gather the required data
about a subject. Capacitive electrodes can be implanted in floors, walls, and ceilings, and made
invisible to the public, while still allowing modular array-based sensor systems for flexibility in
installation. Whether regarded as a benefit or detriment, the entire scanner can be used without
the subject knowing. In this way, a relatively non-intrusive security solution can be implemented
with capacitive sensing.
The movement of a human through the proposed sensor’s detection field interrupts electric fields
in a way that produces a predictable “characteristic curve” if the occupant walks a straight line
through the sensor field. Given knowledge about the configuration and a baseline reading, this curve
can be used to make accurate measurements on the velocity, or position, of an occupant as they
move through the field. This type of capacitive sensor can obtain this information more accurately
16
than optical sensors (for example, cameras) since optical sensors gather too much information, which
can also vary drastically depending on ambient light level and other factors out of the control of the
system designer. The proposed capacitive sensor avoids these issues to provide more reliable data
on occupant motion and presence.
1.3.3
Configuration Design
Electric field sensing liberates the user from many conventional drawbacks, as electric fields are
radiated and sensed independent of line-of-sight limitations, and a variety of shapes, sizes, and
orientations of the electrodes are acceptable. The installer must keep in mind the effect of conductive
and dielectric materials on the field strength, but in general, once a capacitive sensor is presented
with an environment and calibrated properly, it is very robust to different installation schemes.
The two main domains we consider are large rooms and relatively narrow hallways. The large
room might be an array of cubicles, a laboratory space, or a museum gallery. The hallway might be
a back corridor, an entryway, or an airport security checkpoint.
Large Rooms
The most favorable location in a large room is in an array on the ceiling or embedded in a floor. If
installed at a wall, the sensor may be useful for detecting occupants on one side of the room, but
the range of the sensor is insufficient to measure an entire room from just one wall.
The experimental electrodes are roughly eight by ten inches across, by a tench of an inch thick,
which makes them very convenient for embedding in the center of a standard commercial drop ceiling
tile. Likewise, standard vinyl floor tiles can be replaced with retrofit electrodes; since the electrode
itself is a thin layer of copper, the circuit-board substrate can be swapped for the tile itself. Carpet
is even more flexible for electrode installation, as the electrode can be installed flat beneath the
carpet padding and not be felt through the carpet.
In any installation, the user should be aware of the presence of large grounded objects, which
may detract from sensor performance. A floor or ceiling filled with metal piping and conduit, for
example, may dominate the capacitive coupling in the room and may not be a good choice for
installation of electrodes. Rather, another surface further away from such objects may work much
better from a sensing standpoint.
Hallways
Hallways are ideal for ECT, more so than large rooms, because the distance from any surface is
limited. A hallway through which occupants pass can be likened to a pipe through which materials
flow, and using capacitive sensors to non-intrusively detect in that setup has been researched [4], [3].
17
Each single array of sensor electrodes can detect the size, material makeup, and velocity of occupants
passing through, but multiple arrays can also be set up to provide more information.
1.3.4
Hybrid Long-Range and Short-Range System
To accomplish the goals of energy optimization and security management, the long-range room
sensor system can be combined with the short-range scanning grid to sense the material makeup
and position of occupants in a room. The short-range scanning grid, when embedded as a tile in a
floor, can detect a plurality of materials, possibly contraband, on the person of a room occupant.
This detection is accomplished by varying the frequency of the localized AC waveform transmitted by
the grid, and taking advantage of the frequency-dependent dielectric properties of common materials.
In addition, the rows and columns of this grid can be joined to form a single receiving electrode as
part of the long-range system, and these electrodes can sense the position of an occupant. Switching
between modes at the electrode level would be necessary to distinguish between the short-range
and long-range detection schemes, but the same hardware can be used for both schemes. Though
untested, the integration of these two systems builds naturally upon the research in this thesis.
1.4
Thesis Overview and Contributions
This thesis draws on existing technology, both widespread and newly developed, in capacitive sensing.
It tests opportunities in building environments and proposes several topologies and techniques for
localized and large-scale detection, imaging, and material recognition.
First, a localized sensor is introduced that can produce a two-dimensional image of a nearfield object; this sensor uses a scanning grid like many capacitive sensors and has relatively little
complexity or system cost. Furthermore, existing long-range capacitive sensor systems are explored
in various configurations, with the aim of providing a simple-to-install sensor system versatile in the
field. Combining the two systems creates a hybrid long-range sensor network with short-range floor
tile sensors that can detect dangerous materials on the person of occupants in the room.
Both the near-field and long-range sensors have been thoroughly modeled at the physical, electrostatic, and circuit (electrodynamic) levels to better understand the interactions that make them
work. Each long-range configuration is well-matched between its model and actual experimental
data, validating the model. Based on experimental data and models of the system that drives that
data, recommendations can be made about the choice of setup that is most appropriate for a given
environment. Short-range models are used to qualitatively compare simulated and experimental
behavior, and the near-field sensor is shown to successfully distinguish between objects of varying
material makeup.
18
Chapter 2
Capacitive Sensing Methods
2.1
Basics of Capacitance
Capacitance is the ability of a body to store energy. In order to measure changes in the capacitance
of a system, the changes in stored energy must therefore be measured. This chapter introduces the
concept of capacitance, along with ways in which electric fields cause objects to capacitively couple
to one another, and how these interactions can be measured.
A discussion on basic capacitive coupling is presented here, adapted from [13]. The definition of
capacitance between two conducting bodies is
𝐶≡
𝑄
𝑉
(2.1)
where 𝐶 is the capacitance in farads, 𝑄 is the total charge on either conductor in coulombs, and 𝑉
is the potential difference in volts between the two conductors. In the case where the conductors
are far enough apart that there is a negligible electric field between them, each conductor may be
charged with its own voltage source, as in Figure 2-1. The resultant charge on each conductor is
calculated using (2.1) as 𝑄1 = 𝐶𝑥 𝑉𝑥 and 𝑄2 = 𝐶𝑦 𝑉𝑦 . These quantities represent the capacitance
between the conductor and ground.
𝑄2
++++
+++
−
+
𝑉𝑥
− − −
+
+
Large distance
𝑉𝑦
Ground plane
−
+
𝑄1
−−−−−−
Figure 2-1: Two charged conductors at a large distance away from each other, adapted from [13].
19
If the voltage sources are removed, each conductor’s charge 𝑄1 and 𝑄2 ideally remains on the
conductor. Bringing the conductors much closer together, so that the electric field created between them is significant, the charge on one conductor will induce an opposite charge on the other
conductor, as shown in Figure 2-2.
𝑄2
𝑄1
⃗
𝐸
+
+++
+
+
-
++
Ground plane
Figure 2-2: Two charged floating conductors with electric fields shown, adapted from [13].
Based on the potential between each conductor and ground, the charge on each conductor can
be obtained as follows:
𝑄1 = 𝑐11 𝑉1 + 𝑐12 𝑉2
(2.2)
𝑄2 = 𝑐21 𝑉1 + 𝑐22 𝑉2
The numbers 𝑐11 , 𝑐12 , 𝑐21 , 𝑐22 are termed coefficients of capacitance, and are typically presented
in a capacitance matrix, as would be returned by finite-element software. Here, the coefficients 𝑐11
and 𝑐22 are known as coefficients of self-capacitance of conductor 1 and 2 respectively, and 𝑐12 and
𝑐21 are coefficients of mutual capacitance. These coefficients, and a 2 × 2 matrix, represent this
simple two-conductor system; in more complex systems with more conductors, the matrix becomes
size 𝑁 × 𝑁 . As a whole, the capacitance matrix is a matrix representation of the basic 𝑄 = 𝐶𝑉
equation, adapted to [𝑄] = [𝐶][𝑉 ].
Determining these coefficients is done by the forced-voltage method, discussed further in Chapter
3. One object is connected to a known voltage source while the others are held at ground reference.
Then, the charge transferred to each of the objects is measured, and the process is repeated for each
conductor. In Figure 2-3, a one-volt source is applied to object 1, and object 2 is tied to ground
(𝑉2 = 0). Using (2.1) again will determine two of the coefficients of capacitance (half of the matrix
20
for this system).
𝑄1 = 𝑐11 (1) + 𝑐12 (0) → 𝑐11 = 𝑄1
(2.3)
𝑄2 = 𝑐21 (1) + 𝑐22 (0) → 𝑐21 = 𝑄2
Likewise, to find the other two coefficients, a one-volt source is applied to the other conductor.
𝑄2
𝑄1
⃗
𝐸
++
−
+
1V
+
+
+
-
- - Ground plane
Figure 2-3: The forced-voltage method: determining two coefficients of capacitance by applying a
known voltage to one conductor and holding the other at ground. Adapted from [13].
Since the charge induced on an object is the opposite of the charge present on the source,
coefficients of mutual capacitance are always negative or zero. Note that in Figure 2-3, the charge
induced on object 2 is negative, and so 𝑄2 and therefore 𝑐21 is negative.
Adapting the coefficients of capacitance found in a capacitance matrix to an actual circuit is
important, since modeling the sensor system’s capacitive circuit is part of the simulation process.
This relationship is governed by the capacitance and potential difference between the objects, as
well as between each object and ground. For this simple two-conductor system, these relationships
are shown schematically in Figure 2-4.
𝐶12
𝑄2
𝑄1
+
+
𝐶1𝐺
𝐶2𝐺
𝑉1
𝑉2
−
−
Ground plane
Figure 2-4: Three conductors including ground plane with capacitances, adapted from [13].
With object 1 at voltage 𝑉1 with respect to ground, and object 2 at voltage 𝑉2 with respect to
21
ground, each object’s charge is determined as
𝑄1 = 𝐶1𝐺 𝑉1 + 𝐶12 (𝑉1 − 𝑉2 ) = (𝐶1𝐺 + 𝐶12 )𝑉1 − 𝐶12 𝑉2
(2.4)
𝑄2 = 𝐶2𝐺 𝑉2 + 𝐶12 (𝑉2 − 𝑉1 ) = −𝐶12 𝑉1 + (𝐶2𝐺 + 𝐶12 )𝑉2
To find the relationship between the circuit capacitances (shown in uppercase) and coefficients
(shown in lowercase), Equations (2.5) and (2.3) can be compared. For the two-conductor system,
the result is:
𝑐11 = 𝐶1𝐺 + 𝐶12
(2.5)
𝑐12 = −𝐶12
𝑐22 = 𝐶2𝐺 + 𝐶12
𝑐21 = −𝐶12
𝐶1𝐺 = 𝑐11 + 𝑐12
𝐶2𝐺 = 𝑐22 + 𝑐21
It should be noted that, by reciprocity, 𝐶𝑥𝑦 should always equal 𝐶𝑦𝑥 , and likewise 𝑐𝑥𝑦 = 𝑐𝑦𝑥 .
When the ground reference conductor is explicitly defined, the 𝐺 notation becomes another terminal.
For instance, defining the ground as conductor 3 in this example would turn 𝐶1𝐺 into 𝐶13 . In this
R
may be adapted to circuit
way, the output matrix of finite-element software such as Comsol○
simulations, as was done in this thesis, and the circuit simulation represents the entire capacitive
system that is being measured, whether it is the short-range capacitance affected by a human foot
or the long-range capacitance affected by an entire person.
2.2
Human-Interfaced Capacitive Coupling
A 1996 work [14] proposes a three-dimensional capacitive gesture sensor, an electric field sensing
input device, or “field mouse.” It lays out many capacitive sensing fundamentals, such as a lumpedcapacitance model and various modes of capacitive coupling, termed loading mode, transmit mode,
and shunt mode. These coupling modes are introduced in Figure 2-5. In the top portion of that
figure, two electrodes are present, a transmitter and a receiver. Some object or body is interrupting
the electric fields created between those two electrodes, and the primary capacitances in the system
are shown. These capacitances can be measured by measuring the currents 𝑖𝑡 , 𝑖𝑔 , and 𝑖𝑟 in the
system.
22
Figure 2-5: Cartoon of capacitive coupling modes, from [15].
Loading mode was the first type of coupling to be investigated, and is used in devices such as the
wall stud sensor discussed previously [7]. This mode uses only one electrode, a transmitter, which
sends electric fields that are absorbed by an object of interest. Measuring changes in current into the
transmitter gives an indication of changes in capacitance between the transmitter and the object.
Most relevant to this research are the shunt and transmit modes. In shunt mode, the resting
electric field between the transmit and receive electrodes is “shunted” away from the receive electrodes
by an object of interest, be it a human finger, body, foot, metallic object, or any object that disturbs
the field and has a capacitive coupling to ground. The object’s coupling to ground—some global
reference, usually earth ground—is important. In the case of a finger-scale capacitive scanning grid,
the object (a finger) shunts some electric field away from the receive electrode and through the
human body and feet toward earth ground through a capacitive path, shown in Figure 2-5 as 𝑖𝑔 .
In shunt mode, this ground path dominates the path to either the transmitter or receiver. In other
words, 𝐶𝑔 >> 𝐶𝑡 and 𝐶𝑔 >> 𝐶𝑟 . Shunt mode is almost always the mode of operation in this work’s
experimental and simulated setups.
In transmit mode, the object-electrode capacitances 𝐶𝑡 and 𝐶𝑟 are on the same order of magnitude as 𝐶𝑔 : 𝒪(𝐶𝑔 ) = 𝒪(𝐶𝑡 ) = 𝒪(𝐶𝑟 ). Here, the object increases the transmit-receive electrode
capacitance rather than shunting the field to ground and reducing that capacitance.
2.3
Short-Range Capacitive Tomography
Recent work in the Laboratory for Electromagnetic and Electronic Systems (LEES) at MIT has
expanded upon the lamp-sensor contributions of [11] to explore hyperspectral imaging, i.e. the
ability to detect both the position and the material makeup of an occupant in a given room. A
standalone system presented in [16] with a dedicated source and transmitter electrode, along with
23
differential receiving circuitry, allows more flexibility in sensor use and more precision in detection.
This expansion of sensing freedom motivated room-scale imaging with a capacitive sensor array
in [17]. By performing scans across a range of frequencies, the capacitive sensor system introduces
the possibility of detecting between human and metallic occupants, and also of locating their position
in two dimensions in a roughly 9-by-12-foot room. The system was able to differentiate between
materials in a 2-by-2 grid in a small enclosure. Hyperspectral imaging relies upon the frequencydependent dielectric permittivity of various commonplace materials, including the materials that
make up humans, to influence changes in the detected capacitance of a sensor system.
The hybrid short-range and long-range system discussed earlier relies on the hyperspectral imaging abilities of the short-range sensor. As a platform for short-range hyperspectral imaging, a
capacitive scanning grid is used, much like contemporary grid-based capacitive trackpads and touch
screens. Since an AC signal creates the electric fields that are used for sensing in this type of grid, the
AC drive signal can be varied to explore the frequency response of detected materials. A discussion
of the typical contemporary capacitive grid concept, along with its implications for hyperspectral
imaging, is below. An experimental platform was used to realize this concept, discussed further
in Chapter 4, based on a product that uses the scanning-grid technology. The product is quite
similar to that discussed in a patent application [18], and allowed the relatively easy creation of an
experimental setup.
2.3.1
Capacitive Scanning Grid
The basic principle behind a frequency-driven capacitive scanning grid is as follows: a drive signal,
which is a relatively high-frequency AC waveform, is selectively sent to one transmitting electrode at
a time. The transmitting electrodes are either rows or columns in the grid, and are printed circuit
traces on each side of a substrate (the rows and columns are not electrically connected). See Figure
2-6 for an overview of the grid and attached circuitry. Each time a transmitting electrode is driven,
all the receiving electrodes (the other of either rows or columns in the grid) are “read” one at a time
by the front-end circuitry, a set of transimpedance amplifiers. By multiplexing between transmitting
electrodes, and sub-multiplexing between receiving electrodes, the system controller can obtain data
(received current) for each point in the grid.
Normally, electric fields of varying strength are formed from the transmitting electrodes to the
receiving electrodes. The presence of an object, such as a human finger, causes the electric field to
be partially absorbed by the object, which stands at a virtual ground. The reduction in electric field
at the receiving electrode results in a reduced transmit-receive capacitance, which is sensed by the
system controller as a lower received current. This type of field disturbance represents shunt-mode
coupling, since the object-ground capacitance dominates object-electrode capacitances.
Typically the transmitting electrodes’ drive signal is on the order of 100 kHz ( [15], [18]); the drive
24
Receive front-end circuitry
Receive electrodes (rows)
Transmit electrodes (columns)
Timing
Demodulation
ADC
Drive circuitry
Figure 2-6: High-level overview of scanning-grid circuit, adapted from [19]. Rows in the grid are on
one side of the printed circuit substrate and columns are on the other.
signal in the product used for these tests is 250 kHz. However, the frequency at which the receiving
electrodes are sub-multiplexed is much lower, between 1 kHz and 10 kHz, to allow for a steady-state
reading, and perhaps for multiple averaged data acquisitions. Furthermore, the frequency at which
the transmitting electrodes are multiplexed is limited by the receive sub-multiplex frequency:
𝑓trans <
𝑓rcv
𝑁
(2.6)
where 𝑁 is the number of receiving electrodes. Thus, three clocks drive the signals in the scanninggrid system: the drive signal, the receive multiplex clock, and the transmit multiplex clock.
The substrate for the electrodes is a thin plastic flexible printed circuit with copper traces.
The thin substrate allows relatively high baseline capacitance (that is, when no object is present)
between send and receive electrodes, such that an object’s presence is more detectable. More baseline
capacitance implies greater resting electric field strength, which improves specificity of the grid (more
immunity to false readings from nearby grid points) as well as better external noise immunity, both
25
from surrounding fields and noise floor in the sensor electronics.
2.3.2
Receiving Front-End Circuitry
A conceptual diagram of the receive portion of the typical scanning-grid circuitry is depicted in Figure
2-7, showing details of the blocks in Figure 2-6. Driving the transmit electrodes is straightforward:
a standard logic-level demultiplexer, in conjunction with a drive clock (at, for instance, 250 kHz),
can directly send a square wave to one particular transmit electrode and hold the others at DC while
they are not being driven. The system controller has knowledge of which line is driven at a given
time, and this determines the position in the resultant output matrix.
ctl1
𝑛 receive electrodes
rcv1
Q1
ctl2
rcv2
Q2
Synchronous
Detector
& LPF
𝑣𝐷𝐶
ADC
Microcontroller
𝑣𝑜𝑢𝑡
ctl𝑛
rcv𝑛
Q𝑛
𝑛 transistor buffers
Figure 2-7: Generalized block diagram for grid receive circuitry and control.
Reading the receive electrodes is slightly more complex. In multiplexed systems, to improve
cost and simplicity, a single analog-to-digital converter (ADC) line can be used, with switches (e.g.
transistors) controlling which receive electrode is connected to that line. The same type of logic
demultiplexer used in the drive circuitry can control bias points of input transistors via control lines
ctl𝑛 , as shown in Figure 2-7. Driving all of the input transistors except one into the cutoff region
effectively turns them off; meanwhile, the remaining active read line is in its active region and buffers
the capacitively-coupled signal from that particular receive electrode onto the synchronous detector,
and from there to the ADC input. Like the drive-side multiplexers, the control logic inputs for
26
the read-side multiplexers determine the current ADC value’s position in the output matrix of grid
values.
Since the drive signal to the transmit electrodes should be AC—and if logic-level drivers are used,
it will be a square wave—the received signal that is coupled from transmit to receive electrodes will
be an AC signal at the drive frequency. A synchronous detector converts the AC signal to a DC
value by multiplying the incoming signal by an in-phase clock signal at the original drive frequency,
as depicted in Figure 2-8. With the incoming signal 𝑤(𝑡) = cos 𝜔𝑡, the output of the multiplier is
𝑣𝑆𝐷 = 𝑣𝐷𝐶 + cos(2𝜔𝑡 + 𝜙)
(2.7)
The second term in (2.7) can be filtered out by a low-pass filter to recover 𝑣𝐷𝐶 , which is proportional to the magnitude of the AC received signal.
cos 𝜔𝑡 + 𝜙
𝑤(𝑡)
𝑣𝑆𝐷
LPF
𝑣𝐷𝐶
Figure 2-8: Block diagram of the synchronous detector and low pass filter in the scanning-grid
system.
This DC value is sent to the ADC, sampled, and placed in the appropriate index in a matrix that
represents values for each location on the physical grid. Since a human finger disturbs the transmitreceive electric field and shunts some of the field to ground, the transmit-receive capacitance at that
grid location decreases; this creates a lower-amplitude square wave at the detection circuit, and a
DC value less in magnitude than the rest of the grid. Plotting the output matrix with a single finger
touch on the grid reveals similar values across the grid, with the exception of a small “dot” of lower
values where the finger is located. Extending this simple case to a variety of objects allows use of the
grid as an imaging device, in addition to its original intended purpose of single-touch recognition.
Furthermore, sweeping the frequency of the drive signal, and in turn the synchronous detector, leads
to detection of the dielectric properties of objects on the grid.
2.4
Long-Range Room Occupancy Sensing
Room occupancy detection is advantageous in many commercial and residential environments. The
ever-present “green building” goal drives building system designers to conserve energy. In 2014,
occupant-oriented utility loads such as lighting, as well as heating, ventilation, and air conditioning
(HVAC), accounted for 47% of the total consumed electricity in the U.S. for the residential and
commercial sectors [20]. Thus, occupancy detection can directly link utility loads to their use statistics and thereby offer significant energy savings. However, in typical, low-cost occupancy detection
27
systems, pyroelectric infrared (PIR) sensors are limited by drift in background infrared radiation.
To solve this, the signals from the sensors are high-pass filtered, which ultimately motivates motion,
rather than presence, sensing [21].
Motion sensing often causes lights to remain on longer than necessary, or fails to detect occupants
sitting still. Capacitive detection, on the other hand, can be used for true presence sensing. Solutions
previously proposed in LEES take advantage of existing commercial lighting [11]. This type of
fluorescent lamp sensor encourages modular, widespread deployment since it features self-contained
sensor and ballast circuitry. An auto-dimming ballast allows precise control of power consumption,
offering benefits for energy savings.
An adaptation of this sensor was created with an active, synchronous source, to remove the
fluorescent lamp from the setup [16]. By doing so, the sensor system could be implemented in a
much wider variety of scenarios. Furthermore, obtaining more control over environmental parameters
expands the options for types of sensing (for instance, sensor excitation frequency can now be
arbitrarily chosen and varied). A high-voltage signal source and front-end sensing amplifier allow
high sensitivity to changes in capacitance when an occupant is present.
The standalone system used in the long-range experiments was originally developed by Thompson
[16] and improved upon by George [17]. The system consists of a high-voltage source amplifier and
electrode; two differential receive electrodes, which detect and amplify the sensed signal; a commonmode feedback system to reject common-mode signals; synchronous demodulation of the detected
signals; and control and analog-to-digital conversion with a microcontroller, which communicates
the detected signal levels to a computer.
2.4.1
High-Voltage Source
The transmitter portion of the sensor system is comprised of a high-voltage amplifier and source
electrode. The source electrode is identical to the active receive electrodes, but the front-end amplifier
circuitry is not populated; rather, the plate is simply driven via a single coaxial cable from the
amplifier, which produces a roughly 500VPP version of a modulated, dual-frequency signal. Two
frequencies in the source signal, when demodulated, provide more information about changes in the
lumped-capacitance network in the room, and also enable material detection. Here, the frequencies
were chosen to be 84 kHz and 10 kHz.
The signal itself is synthesized by two direct digital synthesis (DDS) integrated circuits, which
communicate with the onboard microcontroller via Serial Peripheral Interface (SPI). A summing
amplifier mixes the two signals and removes undesirable DC offset produced by the DDS chips.
Since they have a unipolar supply, these chips output a signal with DC offset (about 300 mV), and
in order to achieve maximum gain in the summing amplifier, as little 𝑣𝑜𝑠 as possible is required.
28
(︂
𝑣𝑠𝑟𝑐 = −𝑅𝑓
𝑣𝑑𝑑𝑠1 + 𝑣𝑜𝑠
𝑣𝑑𝑑𝑠2 + 𝑣𝑜𝑠
+
𝑅𝑑𝑑𝑠
𝑅𝑑𝑑𝑠
)︂
=
𝑣𝑑𝑐
𝑅𝑑𝑐
(2.8)
Here, the three resistor values are the input scaling resistors in the summing amplifier. 𝑣𝑑𝑐 is an
input voltage to negate the 𝑣𝑜𝑠 from the DDS.
The synthesis circuitry described above is located on the main sensor board along with the
front-end amplifier, synchronous detection, and analog-digital conversion. A coaxial cable brings
the low-voltage signal to a separate circuit board, with its own power supply and enclosure, that
amplifies the composite source signal to high voltage.
Within the high voltage amplifier, a divided version of the output is measured and fed back
in closed loop. The first stage is implemented with a pre-gain stage (non-inverting amplifier) and
proportional-integral controller, built from two AD8620 op-amps. The high-voltage amplifier gain
can be adjusted with a trim potentiometer, which has a low temperature coefficient to minimize
drift in source signal amplitude.
After these gain stages, an OPA452 power op-amp forms the power amplifier stage (also in a
non-inverting configuration), after which an autotransformer produces the required output voltage
(roughly 500 VPP).
𝑣𝑠𝑟𝑐
+
P(s)
Power Amp
Transformer
𝑣𝑝
AD8620
−
𝐶𝑐
𝑣𝑝,𝑜𝑢𝑡
Turns
Ratio
(×10)
𝑣𝐻𝑉
𝑅𝑑1
𝑅𝑐
𝑅𝑑2
𝐶𝑓 𝑏
Figure 2-9: The circuit model for the PI controller and plant.
The slew rate of the OPA452 dictates the maximum and minimum voltages it can produce at its
output given the source signal frequency:
𝑣HV =
SR
7.2 V/𝜇s
=
2𝜋𝑓
2𝜋𝑓
(2.9)
With 𝑓 = 84 kHz, 𝑣HV is limited to ±13.64 V. For this reason, the power supply rails for the power
stage are limited to ±25V [16].
29
For this single-ended source design, a single-winding autotransformer is sufficient, with one center tap. An autotransformer is more efficient, physically and electrically, than a two-winding transformer, as it requires less core material and fewer windings, and presents lower leakage.
2.4.2
Active Electrodes and Common-Mode Feedback
The role of the receive electrodes draws on the upcoming discussion of Maxwell’s equations in 3.2.
⃗ 𝑛 is the time-derivative of the
The current produced on a surface 𝐴 by an impinging electric field 𝐸
total charge on that area. Using (3.4), the current is
𝐼(𝑡) =
𝜕Φ𝑒 (𝑡)
𝜕𝑄(𝑡)
=𝜖
𝜕𝑡
𝜕𝑡
(2.10)
where 𝑄 is the total charge on the surface area, 𝜖 is the dielectric permittivity of the surface, and Φ𝑒
is the electric flux normal to the surface. In order for current to flow on the receive electrode—and
thus, for a change in capacitance to be detected—the time-derivative of the flux must be nonzero.
This implies a time-varying or AC source signal, which is used in both the scanning-grid and roomscale sensors. Furthermore, the receive electrode can be thought of as a transducer between the
sensed electric field and the produced current in the electrode itself [22], and therefore the receive
electrodes feature a transimpedance amplifier as the front-end, to convert the current in the electrode
plate to voltage at the amplifier’s output.
Each differential receive electrode contains a single front-end amplifier on the electrode itself,
which serves to reduce the effective node length, reducing the effect of cable capacitance (which can
be tens of times the sensed capacitance). The two front-end amplifiers are followed by a differential
amplifier, and a circuit which feeds the common-mode sensed signal (the average of the two signals)
back to the inverting node of the front-end amplifiers. This is based on the following:
(︂
𝑣𝑜𝑢𝑡 = 𝐴𝑑 (𝑣𝑖𝑛1 − 𝑣𝑖𝑛2 ) + 𝐴𝑐𝑚
𝑣𝑖𝑛1 + 𝑣𝑖𝑛2
2
)︂
(2.11)
There are a variety of electromagnetic signals in the testing environment which necessitate
common-mode feedback: 60-Hz “hum” from AC wiring throughout the laboratory environment,
at the ceiling and floor as well as across walls and columns; and fluorescent lamp ballasts and tubes
at ceiling level, which typically operate at around 50 kHz. The former can easily be filtered out of
the received signal as 60 Hz is well below the frequencies of interest used in the sensor, but the latter
is right in the middle of the two transmitted and measured frequencies (10 kHz and 84 kHz). Thus,
these signals, which are common to both the positive and negative differential receive electrodes,
can be eliminated early on by common-mode feedback.
The on-board amplifier and common-mode feedback system require some additional support for
the receive electrodes. First, they must receive ±5V from an external supply. In addition, the
30
𝑣𝑖𝑛1
G1
G2
𝑣𝑖𝑛2
Synch. Det.
&
LPF
G3
G1
Instr. Amp.
&
ADC
𝑣𝑜𝑢𝑡
×4
Figure 2-10: Generalized block diagram for the signal conditioning circuitry, adapted from [16].
common-mode signal is fed back to the electrodes via coaxial cable. Figure 2-11 is a schematic of
the front-end amplifier with common-mode feedback. The electrode circuitry is to the left of the
coaxial cable and circuitry on the main sensor board is to the right.
Figure 2-11 also shows how the electrodes, and the sensor system in general, interact with the
lumped-capacitance network in the room. The network and the source can be broken into two
half Thevenin equivalent circuits, each referenced to ground and providing an output port to each
differential receive electrode. Given a source and some lumped-capacitance network, a Thevenin
equivalent voltage can be found by measuring the voltage with respect to ground at each receive
electrode, and a Thevenin equivalent capacitance (impedance) can be found by short-circuiting
the respective receive electrode to ground. The voltages are shown as 𝑉Thev1 and 𝑉Thev2 , and the
capacitances are shown as 𝐶𝑠𝑒𝑛1 and 𝐶𝑠𝑒𝑛2 .
The electrodes also feature a capacitive compensation network to maintain stability of the system.
In Figure 2-11, 𝐶𝑐 is chosen with the feedback network 𝑅𝑓 and 𝐶𝑓 to create a stable system where
the system pole (determined by the 𝑅𝑓 𝐶𝑓 product) is away from the operating frequencies of the
system. Depending on the choice of 𝑅𝑓 and 𝐶𝑓 , the feedback may be capacitively- or resistivelydominated [16]. When 𝑍𝐶𝑓 ≪ 𝑍𝑅𝑓 , the feedback is capacitively-dominated and the transfer function
of the front-end amplifier becomes
𝑣𝑜′
𝑠𝑅𝑓 𝐶𝑠𝑒𝑛
′ = 1 + 𝑠𝑅 𝐶
𝑣𝑖𝑛
𝑓 𝑓
⃒
𝑣𝑜′ ⃒⃒
𝐶𝑠𝑒𝑛
=−
′
⃒
𝑣𝑖𝑛 𝑠→∞
𝐶𝑓
(2.12)
(2.13)
where 𝐶𝑠𝑒𝑛 is the sensed Thevenin-equivalent capacitance from the environment. (2.13) holds if the
source frequency 𝜔 is much greater than 1/(𝑅𝑓 𝐶𝑓 ). Thus, the feedback network is not frequencydependent because changes in source frequency affect the sensed and feedback capacitances equally
31
Thevenin equivalent circuit
𝑣𝑐𝑚
𝐶𝑠𝑒𝑛1
Electrodes
Sensor board
+
×10
ADA4817
′
𝑣𝑜1
𝐶𝑐
−
𝑅𝑓
𝑅
−
+
𝑉Thev1
𝑅𝑐
′
𝑣𝑖𝑛
LT1806
𝐶𝑓
+
𝑅
−
+
𝑉Thev2
−
𝑣𝑐𝑚
+
×10
ADA4817
−
𝐶𝑠𝑒𝑛2
′
𝑣𝑜2
𝑅𝑓
𝐶𝑓
Figure 2-11: Common mode feedback circuit for the front end amplifier, adapted from [16].
32
𝑣𝑐𝑚
and the changes cancel. For this reason, capacitively (rather than resistively) dominated feedback
was chosen.
Following the front-end amplifier, the signal is buffered and sent to a series of demodulation
blocks. In general, the first gain stage is on the receive electrodes’ active circuitry (𝐺1 ); the second
is at the front-end differential amplifier on the main sensor board (𝐺2 ), and the third is at the input
to each demodulation block (𝐺3 ). Each gain stage is shown in Figure 2-10. The section in the
dotted lines is replicated four times, for the in-phase and quadrature components of the two sensed
frequencies in the received signal.
2.4.3
Synchronous Demodulation
This sensor system uses a similar synchronous detection scheme to the scanning-grid sensor. Here,
the system uses a higher-frequency carrier signal modulated by a lower-frequency signal, in this case
roughly 84 kHz and 10 kHz. The source signal is driven by a clock that is also used to demodulate
the received signal. Filtering this demodulated signal recovers the signal of interest. In addition, to
minimize the impact of phase offset between the source and demodulating signals, the received signal
is demodulated by both in-phase and quadrature (90 degrees out of phase) clocks. This produces
both magnitude and phase information:
|𝑣10𝑘 | =
√︁
2
2
𝑣10𝑘
+ 𝑣10𝑘
𝐼
𝑄
(2.14)
(︀
)︀
∠𝑣10𝑘 = ∠ 𝑣10𝑘𝐼 + 𝑗𝑣10𝑘𝑄
(2.15)
Similarly to the synchronous detection scheme for one frequency as shown in Figure 2-8, the
dual-frequency scheme shown in Figure 2-12 uses both the in-phase and quadrature clocks.
cos 𝜔𝑐 𝑡 + 𝜙
𝑤(𝑡)
𝑞𝐼 (𝑡)
LPF𝐼
sin 𝜔𝑐 𝑡 + 𝜙
𝑞𝑄 (𝑡)
LPQ𝑄
Figure 2-12: Block diagram of the synchronous detector and low pass filters, adapted from [16].
The synchronous demodulation is accomplished with sets of analog switches, in this case the
MAX4523, which are arranged in a full-bridge topology, depicted in Figure 2-12. This switching
circuit forms a square-wave multiplier, and so there are higher-order harmonics of the clock signals
in the output, in addition to the single harmonic term in (2.7). The harmonics must be filtered by
33
an anti-aliasing low-pass filter, after which an instrumentation amplifier sends the output signal to
an analog-to-digital converter.
𝑅1
𝑠
𝑣𝑖𝑛+
𝑅3
𝑠
MAX4523
𝐶1
𝑅5
𝑅7
𝐶3
𝐶5
𝐶4
𝐶6
𝑣𝑜𝑢𝑡,+
𝐶2
𝑣𝑖𝑛−
𝑠
𝑠
𝑅2
𝑅4
𝑅6
𝑅8
𝑣𝑜𝑢𝑡,−
Figure 2-13: Circuit implementation of the synchronous detector and low pass filters, from [16].
34
Chapter 3
Simulation
3.1
Methods
For each component of this sensing system, the entire configuration was modeled from top to bottom
in order to ensure that theory matches practice, and that the sensor can perform adequately in a
variety of configurations. Furthermore, accurate simulation techniques can lead to simplified tools
for experimenting with installation configurations before installing the sensor system itself.
The physical environment, whether the capacitive “sandwich” of the short-range scanning grid or
the entire room with long-range sensing electrodes, was modeled as a three-dimensional electrostatics
R
Multiphysics finite element modeling software. This software was used to extract
model in Comsol○
a capacitance matrix, which provided values for a lumped-capacitance model of the environment.
The lumped-capacitance model was joined by ideal models of the actual sensor circuitry in
LTspice, which provided analog output values to be compared to the values acquired by the actual
sensor setup.
3.2
R
Physical Modeling in Comsol○
R
Comsol○
multiphysics software uses three-dimensional models of the experimental setup, with pre-
cise dimensions and accurate representation of the dielectric permittivity of materials in the model.
Each object was designated as a terminal, and applying voltage to these terminals one at a time led
to a calculation of the capacitance between each. Capacitance was calculated using the [𝐶] = [𝑄][𝑉 ]
matrix model discussed in Section 2.1. This provided a simple translation to the lumped-capacitance
circuit model of the experimental setup, which could be modeled in LTspice.
The finite-element software first creates a mesh of a finite number of nodes, based on the input
geometry of the model, then performs calculations on this mesh. Figure 3-1 depicts a section of a
35
mesh of an example room simulation.
− Receive
Source
+ Receive
R
. The mesh contains 221,203 eleFigure 3-1: Mesh of a section of a room simulation in Comsol○
ments, seen as tetrahedrals; the three electrodes appear black because their small thickness requires
a much finer mesh.
For all experiments, and the lumped-capacitance models that are used to simulate the experimental setups, an electroquasistatic (EQS) environment can be assumed. The EQS approximation
is valid for a system if an electromagnetic wave can propagate a characteristic length of the system
in a time that is much less than a period of interest, 𝜏 [23]. This holds true within the range of
frequencies used in these experiments: 10 − 250 kHz. If 𝜏 = 1/𝑓 , then 4 × 10−6 s < 𝜏 < 1 × 10−4 s.
Assuming the bulk of material in each experimental setup is air, then an electromagnetic wave can
travel at roughly 3 × 108 m/s; with a room 5 meters across, the wave can propagate in 1.5 × 10−7
R
s, much less than 𝜏 . Comsol○
’s electrostatics module serves well to model the interactions present
in these experiments. The following constraints were made on the model: charge conservation, zero
charge, and conductor constitutive relationships, all of which follow Maxwell’s equations or variants
thereof. A more in-depth derivation of these equations can be found in [24] and [22].
Charge is conserved through the electric Gauss’ Law, which states that the gradient of the electric
⃗ is equal to the volumetric charge density 𝜌𝑣 :
flux density 𝐷
⃗ = ∇ · 𝜖0 𝜖𝑟 𝐸
⃗ = 𝜌𝑣
∇·𝐷
36
(3.1)
This takes into account the relative permittivity, 𝜖𝑟 , of the material in which the electric field is
present. 𝜖0 is the permittivity of a vacuum. In the case of air, 𝜖0 ≈ 𝜖, so 𝜖𝑟 ≈ 1.
The zero charge constraint applies at the exterior boundaries of the domain in the model. This
domain was set between two edge conditions: first, without a terminating boundary, electric fields
would continue outwards forever and a mesh would be impossible to generate; second, the boundary
must be far enough away to have a negligible edge effect on the components of interest within the
model. One can obtain the zero charge constraint by shrinking a volume of charge as in (3.1) to zero
thickness. This yields a charged planar boundary, where the charge density is a surface charge 𝜌𝑠
rather than a volumetric charge 𝜌𝑣 . For two sides of some arbitrary planar boundary, the relation is
(︁
)︁
⃗1 −𝐷
⃗ 2 = 𝜌𝑠 = 0
𝑛
ˆ· 𝐷
(3.2)
in the case of the model’s boundaries, where the zero-charge condition applies. Here, 𝑛
ˆ is a unit
vector normal to the boundary’s surface. This implies that there is a discontinuity in electric flux
normal to the boundary due to the surface charge on that boundary.
Finally, each conductor (terminal) has its own constitutive relationship: the total charge 𝑄 in
an area 𝐴 on the surface of a conductor is
∫︁ ∫︁
𝑄=
𝜌𝑠 d𝐴
(3.3)
𝐴
and from (3.1), we find that the charge is equal to the permittivity times the total electric flux
normal to the surface of the conductor,
∫︁ ∫︁
⃗ 𝑛 · d𝐴
⃗
𝐸
𝑄 = 𝜖0 𝜖𝑟
(3.4)
𝐴
= 𝜖 0 𝜖 𝑟 Φ𝑒
(3.5)
Since electric fields are produced by potential differences, the potential between two points on
any two conductors is
∫︁
𝑣𝑐 =
⃗ · d⃗𝑠
𝐸
(3.6)
𝑠
where 𝑠 is some path between those two points. Furthermore, conductors are equipotential surfaces,
and so this voltage relation holds for any points on those two conductors. To find the capacitance
between the conductors (the last step in the electrostatic model), divide the total charge on either
conductor by the potential difference between them:
∫︀∫︀
⃗ 𝑛 · d𝐴
⃗
𝜖0 𝜖𝑟 𝐴 𝐸
𝑄
Φ𝑒
𝐶≡
= 𝜖0 𝜖𝑟
=
∫︀
⃗
𝑉
𝑣𝑐
𝐸 · d⃗𝑠
𝑠
37
(3.7)
Derivation of the capacitance matrix was done through the forced-voltage method, as described
in [25] and earlier in this work at Section 2.1. The entries in a given column of this matrix are
computed from the charge that forms on that respective conductor, or terminal, when a potential is
applied to that terminal (𝑉𝑥 = 1, 𝑥 = 𝑛) and the other terminals are held at ground (𝑉𝑥 = 0, 𝑥 ̸= 𝑛).
The matrix is defined as follows:
⎡
𝑄1
⎢
⎢
⎢ 𝑄2
⎢
⎢ ..
⎢ .
⎣
𝑄𝑁
⎡
𝐶11 𝑉1 + 𝐶12 𝑉2 + · · · + 𝐶1𝑁 𝑉𝑁
⎤
⎥ ⎢
⎥ ⎢
⎥ ⎢
⎥=⎢
⎥ ⎢
⎥ ⎢
⎦ ⎣
𝐶21 𝑉1 + 𝐶22 𝑉2 + · · · + 𝐶2𝑁 𝑉𝑁
..
.
⎥
⎥
⎥
⎥
⎥
⎥
⎦
⎤
𝐶𝑁 1 𝑉𝑁 + 𝐶𝑁 2 𝑉2 + · · · + 𝐶𝑁 𝑁 𝑉𝑁
(3.8)
The diagonal entries in the capacitance matrix are self-capacitances, and are always positive
numbers. These are the sum of the other entries in that column. All the off-diagonal entries
are negative, and are mutual capacitances: for instance, the capacitance between a finger and a
transmitting electrode. If the finger were designated terminal 1, and the transmitting electrode
terminal 2, then the mutual capacitance between the two is labeled 𝐶12 . These are the capacitances
of interest for this work.
Different model structures were used for the two-dimensional scanning grid sensor and the roombased multi-electrode sensor. Within each structure, basic parameters were varied to adapt to
changing experimental setups.
3.2.1
Scanning Grid Sensor
The experimental setup for the scanning grid sensor was a roughly 8-inch by 11-inch module with
associated electronics. The module, based on the experimental setup, is a stack-up of the following
materials: on the top is a plastic housing, and inside is a thin plastic flexible printed circuit consisting
of two layers, on top of a metal ground plane. The flexible printed circuit has rows of narrow
electrodes on top, and columns on the bottom. The experimental module is shown in an aluminum
Faraday-cage enclosure in Figure 3-2; Figure 3-3 is a photo of the actual flexible circuit with rows
and columns, mounted on the plastic overlay that forms part of the housing. This setup is discussed
more in Chapter 4.
R
In Comsol○
, this stack-up was modeled over a reduced area within a much larger, grounded
boundary. Each layer of the stack-up was represented with accurate dimensions, and each material
was assigned an appropriate set of characteristics, most importantly dielectric permittivity. The
R
output matrix of capacitances from Comsol○
is square and symmetric, since the capacitance be-
tween two terminals 𝐶𝑥𝑦 is equal to 𝐶𝑦𝑥 . Each row and column in the model, made up of copper
traces, were considered a terminal, as well as the ground plane.
A sample model image is shown in Figure 3-4. As in the actual printed circuit, the space between
38
Figure 3-2: Scanning-grid experimental setup in shielding enclosure. A reference paper is placed
over the plastic grid overlay.
Layer
Upper plastic shell
Column electrodes
Flexible circuit substrate
Row electrodes
Ground plane spacing
Ground plane
Thickness [mil]
100
3
10
3
240
10
Thickness [mm]
2.54
0.0762
0.254
0.0762
6.096
0.254
Material
PVC
Copper
Polyethylene Terephthalate (PET)
Copper
Air
Aluminum
R
model for scanning grid.
Table 3.1: Materials in Comsol○
each row and column intersection is filled with a diamond-shaped trace expansion. Note that the
actual grid is much larger (contains more rows and columns) than in the simulation. In order to
speed up simulation time, the model was kept relatively localized around the object, shown here as
a disc atop the grid.
Cross-sections of this model showing the various layers are shown in Figure 3-5. This is a
“baseline” setup, that is, no object is present on the grid. When the first column in the simulation
is forced to 1 volt, the resulting electric field distribution is shown in Figure 3-5b.
In the experimental setup, an aluminum Faraday cage (see Figure 3-2) was built around the
scanning grid device to minimize interference from external electromagnetic radiation sources, as
well as constrain the way in which the row and column electrodes coupled to ground. By simulating
R
this cage in Comsol○
, we achieve better similarity between the simulation and the experiment with
regard to grounded objects around the setup.
39
Figure 3-3: The scanning grid printed circuit with row and column electrodes, on plastic backing.
R
as an electrostatic ground in the model,
Therefore, a rectangular prism was created in Comsol○
which encloses the grid sensor and is otherwise filled with air. This box represents the entire
workspace for the simulation. In Figure 3-4, the walls in the background are part of this bounding
box, most of which has been hidden for visibility.
To gain more insight into the desired role of the scanning-grid sensor—detecting hidden objects
R
on the person of an occupant—the Comsol○
simulations tested the grid model described above alone
(as a baseline), with an object representing a human foot, with an object representing some hidden
piece of plastic, and finally with the hidden plastic object beneath the “foot”. Eight frequencies were
R
modeled, and this involved sweeping the dielectric constant of materials in Comsol○
as well as the
actual drive frequency in LTspice. For each simulation, the circuit drive frequency was swept, but
the dielectric permittivity of the modeled object was only changed in the case of the human flesh
alone as well as when it was combined with the plastic object.
The modeled setup for the combined configuration is shown in Figure 3-6. The scanning-grid
model has three distinct, but joined, blocks on top. To simulate a purely plastic object, all three
blocks were set to a dielectric permittivity of 5, such that there was a large plastic block simulated
on the grid. For the object composed entirely of fat (the simulated version of a human foot), all
three blocks were set to the same permittivity value. The permittivity for the human “foot” was
40
Object
Plastic overlay
Column electrodes
Ground plane
R
Figure 3-4: Model of a section of the scanning grid in Comsol○
.
based on data for fat (not infiltrated) in [26], and since the frequencies were swept from 100 kHz to
1 MHz, the permittivity varied from 80 to 25, respectively.
For the composite object, simulating a human foot with a plastic object hidden beneath, one
lower block was set to a permittivity of 5, representing a small plastic object; the other lower block
and the upper block had the permittivity of fat. In this way, a rough simulation of a foot (the
resulting L-shape of two blocks) covering a plastic block was achieved.
In each simulation, the blocks on the grid were not treated as individual terminals, but rather
a dielectric mass; only the very top surface of the mass was designated a terminal. In this way,
the model could simulate a human foot where the foot itself is not at ground potential, but rather
capacitively couples through the human body to ground.
Combining sweeps in permittivity where appropriate and a swept electrode drive frequency allowed producing output magnitude graphs similar to those from experimental data, which could be
compared qualitatively. This experimental data is discussed in Chapter 4.
3.2.2
Room-Based Sensor
R
As with the scanning grid sensor, the simulation for the room-based sensor was a Comsol○
model
representing the physical and dielectric properties of the experimental setup, followed by an LTspice
model to simulate the lumped capacitances and the sensor circuitry. Here, however, the size of the
41
Plastic overlay
PET printed circuit
Air gap
Ground plane
(a) Cross-section with no object, showing layers. Row electrodes are below the PET layer; column electrodes
are above it.
(b) The same cross-section showing electric field distribution with a column forced to 1 volt.
R
Figure 3-5: Cross-sections of Comsol○
model of scanning grid.
experimental setup did not allow quite as tightly constrained of an outer domain, and it was much
more difficult to match the simulation to the experiment.
When deciding the complexity of the model, the lower bound is a system with only electrodes
and a human occupant represented by a rectangular prism. The upper bound includes object
in the experimental “room”, as well as anything within several yards of the setup. In order to
obtain reasonably accurate results while keeping simulation time short—and minimize the amount
R
of measuring required to set up a complex model—the final Comsol○
simulation used models of the
electrodes; a human with prismatic torso, head, arms, and legs; and a modeled floor and ceiling.
The floor and ceiling were especially important to model, since the principle of the occupant
coupling the electrodes to ground is central to the idea of capacitive sensing. The floor takes the
same role in the room simulation that the aluminum ground plane does in the two-dimensional
scanning grid. Because all of the experiments were performed in a basement laboratory, the ceiling
42
R
Figure 3-6: Model of the scanning grid section in Comsol○
with composite fat-plastic object.
and its host of suspended piping and ductwork functioned as a ground plane as well. Instead
of modeling each grounded object above the room, the simulations combined these into a single,
grounded plane.
In [22], Cooley et al. found that in simulation, modeling the floor as a grounded plane roughly
one inch below the floor-tile level caused the best match between simulation and experimental data.
R
The Fastcap software package was used for these simulations, rather than Comsol○
. They also
modeled each object in the ceiling zone above the experimental setup; the current research replaces
that with a single ceiling ground plane 8 34 feet above floor level and a single floor ground plane 5
inches below floor level. An example of this setup is shown in Figure 3-7. The human occupant
moves along a path parallel to the electrodes; the three electrodes (source, flanked by a positive
and negative differential receive) are arranged as they are in one of the experimental setups (a wallmounted configuration). The boundary of the room is the large rectangular box, with dimensions
8 34 feet high by 20 feet wide. The concrete floor is modeled beneath the boundary box, and is 5
inches thick, below which sits the floor ground plane. The top surface of the room’s boundary (the
“ceiling”) is also grounded.
43
+ Receive
Human
Source
Pa
th
− Receive
of
m
ot
io
n
R
Figure 3-7: Model of an example room setup, with boundary, in Comsol○
.
3.3
Lumped-Capacitance System Models
Both the scanning grid and room-scale sensor embody systems that contain infinitely many networks
of electrical nodes. It would be difficult to create an electrical model of either system, with all their
node-to-node capacitances, without simplifying or lumping the capacitances together into a lumpedcapacitance model. The ability to interpret the system is greatly improved with such a model.
3.3.1
Scanning Grid Sensor
The nodes of interest in the scanning grid are as follows: each of the source (transmit) electrodes,
which are several rows or column traces on the printed-circuit-based grid; likewise, each of the receive
electrodes; the ground plane beneath the grid; and any object of interest disturbing the electric fields
at the sensor. These nodes are shown in a lumped-capacitance network in Figure 3-8. Note that
𝐶𝑥𝑦 = 𝐶𝑦𝑥 .
The topic of grounding is non-trivial: not only is a link (of some sort) to a global ground critical
for most capacitive sensing, but this link to ground can take many forms. We assume any purelyresistive link through wires is a direct short, and so the metal ground plane intentionally added
beneath the sensor is simulated at ground potential; likewise, any object that is experimentally
placed on the grid and grounded through a wire is also modeled as a short to the global ground
node. On the other hand, an object of interest that is not directly grounded is modeled as a capacitive
44
link to ground, and so stands as its own node, with a separate capacitor to the global ground. To
model a human hand or foot, an object was simulated on the grid but not designated a conductive
terminal. Rather, the top surface of that object was designated the object terminal, to represent the
fact that a hand or foot is not at ground potential but couples through the human body to ground.
Transmit
𝐶15
𝐶12
𝐶14
𝐶24
Object
Receive
𝐶25
𝐶45
Figure 3-8: Lumped-capacitance model of the scanning-grid sensor, with ungrounded object.
3.3.2
Room-Based Sensor
The experimental long-range sensor system measures the lumped-capacitance network in the room,
which is influenced by the presence of an occupant. In shunt-mode coupling, which is typically
present in this long-range system, the human-to-ground capacitance is large compared to humancoupled capacitances and thus acts primarily as a short relative to the other current paths in the
system. Referring to Figure 3-9, the receive electrode to ground capacitances (𝐶24 and 𝐶25 , as well
as 𝐶34 and 𝐶35 , in parallel) form the bottom legs of current dividers, while the top legs are formed by
the source-to-receive electrode capacitances (𝐶12 and 𝐶13 ). Any asymmetry of the human occupant
relative to the receive electrode geometry creates an asymmetry in this divider, and therefore a
differential current at the receive electrodes, which is sensed as a differential amplitude at the sensor
electronics.
The same basic nodes as the scanning-grid sensor are used for the room sensor: source, receiver,
ground, and occupant. Unlike the scanning grid sensor, the room-based sensor has a fully-differential
receiver, so the positive and negative receive electrodes are separate nodes. The human occupant
is characterized as a single conducting body, and thus is one node; the ceiling and floor ground
planes are also assumed to be electrically connected and so comprise a single fifth node. The typical
lumped-capacitance network is shown in Figure 3-9.
Each lumped capacitance is labeled with indices into a capacitance matrix that is produced
R
by Comsol○
. Here, the five terminals, in order, are Source, Receive −, Receive +, Human, and
45
Source
𝐶15
𝐶12
𝐶14
𝐶13
𝐶24
𝐶34
𝐶25
𝐶45
𝐶35
Human
𝐶23
Receive −
Receive +
Figure 3-9: Lumped-capacitance model of the room-based sensor.
R
Ground. In this case, Ground is not a terminal but instead a global ground in Comsol○
, and
incorporates the floor and ceiling ground planes. The output matrix is in fact 4 × 4, but the fifth
row and column (capacitances from other terminals to ground) are found by summing across the
existing rows and columns. In other words,
𝐶𝑥5 =
4
∑︁
𝐶𝑥𝑛
(3.9)
𝐶𝑚𝑦
(3.10)
𝑛=1
𝐶5𝑦 =
4
∑︁
𝑚=1
3.4
Circuit Modeling in LTspice
The last step of the modeling process involves the sensor circuits themselves. The goal for all
steps in simulation was to match experimental results with a thoroughly modeled system, in order
to demonstrate that the lumped-capacitance models are valid, but to avoid excess in peripheral
components (e.g. pipes in the room simulation). This carried through for circuit modeling in
LTspice. If a simplified circuit could accurately match results, it was used.
3.4.1
Scanning Grid Model
Instead of using an LTspice model with each circuit component from the grid sensor, an expanded
R
matrix could be
version of Figure 3-8 was used so that output capacitances from the Comsol○
R
simulation contains three columns (transmit
directly applied to the circuit model. The Comsol○
46
Row 1
𝐶14
0
Row 2
𝐶25
Col 1
𝐶12
Col 3
𝐶13
Col 1
Row 1
𝐶34
𝐶15
Col 1
Row 2
𝐶35
Col 3
Row 4
𝐶67
Row 3
Col 1
Plane
Col 1
Object
𝐶47
𝐶26
Col 2
Row 3
𝐶56
Row 1
Col 3
Row 1
Plane
Col 3
Col 2
Row 4
𝐶57
Row 2
Row 2
𝐶58
Plane
Row 1
𝐶49
Object
Row 3
Row 2
Object
𝐶89
𝐶48
𝐶39
Object
𝐶24
𝐶37
𝐶38
𝐶29
𝐶19
Row 1
Col 2
Row 4
Row 1
Row 4
Col 2
Col 3
Plane
Col 2
Groundings
Col 3
Col 1
Row 3
Row 1
Row 4
Col 1
Col 2
Col 3
𝐶23
𝐶46
𝐶27
𝐶28
Row 3
Col 1
Row 2
Col 3
Row 4
𝐶36
Col 2
𝐶16
𝐶45
𝐶17
𝐶18
Row 2
Object
Plane
Main intersections
Transmit sources
Col 2
Row 3
Plane
Row 2
𝐶59
Object
𝐶78
Plane
Row 3
𝐶69
Object
Plane
Row 4
Row 3
𝐶68
Plane
Row 4
𝐶79
Object
Object
Figure 3-10: Example of LTspice model of scanning-grid capacitance network.
47
Other intersections
1
Col 3
Ground plane couplings
0
Col 2
Object couplings
Col 1
electrodes) and four rows (receive electrodes) to allow enough space to surround a multi-material
object. In addition, capacitances are formed to the ground plane beneath and the object itself.
The capacitance matrix is treated as a network with an input and output: the input is one of
the transmit electrodes, and the output is one of the receive electrodes, depending on which is being
“driven” and “read” at a given time. In simulation, small-signal analysis is used, such that a one-volt
sine wave is applied at the input and the network’s gain is read at the system output. A typical
simulated schematic is shown in Figure 3-10.
3.4.2
Room-Based Circuitry
For the room-scale sensor, the LTspice simulation includes the lumped-capacitance model as in
3-9, along with the front-end amplifier, synchronous demodulator, and filters. Excluding the deR
modulators would have meant performing equivalent calculations in Matlab○
to obtain simulated
output values, and including these components in the circuit simulation was little slower than, or
more complex than, the other solution.
Thus, simplified models of nearly all real circuit components were included (using more complex
models specific to the actual components used would have meant much slower simulation with
little better results). Op-amps were modeled with an open-loop gain 𝐴𝑜 = 105 and gain-bandwidth
product GBW=107 Hz, and had ideal power supplies with no rails. Capacitors (in circuitry and in the
lumped-capacitance model) included no series inductance or resistance; the system temperature was
fixed and the effects of temperature were not included. Voltage sources had zero output resistance.
10 Ω
CMFB1
51 Ω
+
+
Receive1
−
Sig1
−
180 pF
500 Ω
51 Ω
10 MΩ
Figure 3-11: LTspice model of active receive electrode. The other receive electrode is identical but
with signals CMFB2 , Receive2 , Sig2 .
48
To create the entire LTspice schematic, the following components were combined: source (Figure
3-14), lumped-capacitance model (Figure 3-9), two active receive electrodes (Figure 3-11), and the
sensor board circuits, which consisted of a front end differential amplifier (Figure 3-12) and commonmode feedback circuit (Figure 3-13). Finally, the synchronous demodulators and filters were modeled
exactly as shown in Figure 2-13, and simulated analog output values for plotting were taken from
the node that is the ADC input in the actual circuit.
51Ω
Sense+
Sig1
51Ω
10kΩ
−
VCM
+
10kΩ
51Ω
51Ω
Sense−
Sig2
Figure 3-12: LTspice model of front-end amplifier on sensor board.
−
51Ω
CMFB1
+
VCM
−
+
−
51Ω
CMFB2
1MΩ
+
64pF
Figure 3-13: LTspice model of common-mode feedback circuit on sensor board.
To model the source circuitry, Spice waveforms were summed (as in the DDS summing circuit in
the experimental setup) and sent to the Source node in the lumped-capacitance network. Voltages,
and frequencies, of each of the two frequency components were chosen based on captured data from
the high-voltage source output, since even with a low-drift source amplifier design, the amplitudes
and phase shifts of each frequency component in the source signal vary slightly over time. This
49
variation significantly affects the circuit model of the system.
Thus, before each experiment, the source waveform was recorded by a high-voltage differential
R
probe, and the signal was analyzed in Matlab○
. A fast Fourier transform (FFT) of the data gave
initial guesses for the two frequency components, and these guesses were used as initial parameters
for a least-squares sinusoidal fit to the actual source signal (see A.1.3). The fit produced amplitude,
frequency, and phase information for both source frequencies. This allowed the simulation to match
even as small variations in the environment changed the source signal slightly.
The two in-phase source components were used as trigger or clock inputs to the in-phase demodulator blocks; duplicated, phase-shifted sources were used to trigger the quadrature demodulators.
The source section of the circuit model is shown in Figure 3-14, where amplitude (𝐴𝑖 ) and frequency
(𝑓𝑖 ) information from the source parametrization is included in the simulated voltage sources. Phase
information from the parametrization was not important in simulation, as long as the in-phase and
quadrature signals were 90∘ apart.
𝑆1𝑄
−
+
𝐴1 sin(2𝜋𝑓1 + 90∘ )
𝑆1
−
+
𝐴1 sin(2𝜋𝑓1 + 0∘ )
10 kΩ
10 kΩ
𝑆2𝑄
−
𝐴2 sin(2𝜋𝑓2 + 90 )
−
+
∘
Source
𝑆2
10 kΩ
−
+
𝐴2 sin(2𝜋𝑓2 + 0∘ )
+
Figure 3-14: LTspice model of source circuitry.
50
Chapter 4
Short-Range Capacitive Tomography
4.1
Sensor Circuitry and Setup
Developing a functional capacitive sensor is non-trivial, yet for years the technology has been so
commonplace that it is easy to obtain samples of many types of sensing grids. For this reason, the
scanning grid research built upon a product that is on the market that would also function as a
straightforward experimental platform. One such grid is presented in [18] as a reading assistant
for children; it follows the same general scanning method described here. Details on the circuit
components used in this type of setup can be found in that patent.
R
A Fisher-Price○
reading assistant uses two large (letter-paper-sized) scanning grids in a “book”
format, and the sensing circuitry is relatively simple and robust. The capacitive grid itself, with
most front-end circuitry, was used from this product, while custom control hardware and software
enabled deeper insight into its performance.
TM
R
The custom control hardware consists of an Atmel○
AVR
microcontroller, which performs
both control and data acquisition tasks. The AVR communicates via RS232 to a host computer,
which can issue scanning and testing commands and record the acquired data. A Python script
R
aggregates the received data stream from the AVR, and a Matlab○
script analyzes and plots the
data. These scripts can be found in Appendix A.
Of the two scanning grids in the “book” format, only the right-hand grid was used. A photo of
this grid with the plastic covering is shown in Figure 3-3, with the ground plane removed. The grid,
plastic covering surface, and ground plane were untouched. The analog output line was connected
to the microcontroller’s ADC, and four “drive” and four “read” control lines were connected from
input/output pins on the microcontroller to the respective lines in the device. The setup was
powered on a common 3.3-volt rail, which was converted through a linear regulator from 5 volts,
which powered the microcontroller and was produced by USB power. Thus, the power source was
51
entirely bus-powered, though ground connections were brought out to be shared with an oscilloscope
and to ground the shielding enclosure as well as any objects used for testing, if need be.
The “book” device was set up on legs to safeguard the added electronics while allowing easy
access, and in this orientation it was also simple to test by putting one’s foot or objects on the
grid. The standing device was placed inside a cardboard box covered with aluminum foil to act as
a shield, with a lid that could be closed to offer additional EMI immunity. Of course, when doing
human hand or foot tests the lid had to be open.
Figure 4-1: The scanning-grid setup, scanning a foot.
4.2
Material Detection
Capacitive sensing offers benefits beyond detection and imaging: hyperspectral detection relies on
the varying dielectric permittivity of materials across a frequency spectrum. The drive frequency of
50-300 kHz of the typical scanning-grid sensor is optimized for detection, and for a human finger,
but varying this drive frequency over several orders of magnitude opens up new opportunities.
The dielectric permittivity of any material can generally be given as a complex number:
𝜖𝑟 = 𝜖′ − 𝑗𝜖′′
(4.1)
where the real part is permittivity and the complex part is conductivity, or the “lossy” component
52
of the complex permittivity. With an AC voltage applied to two capacitive “plates”, the current
through the resulting capacitor represents a charging current and a loss current [13]:
𝐼 = 𝐼𝑐ℎ𝑎𝑟𝑔𝑖𝑛𝑔 + 𝐼𝑙𝑜𝑠𝑠 = 𝑉 (𝑗𝜔𝐶 + 𝐺) = 𝑉 (𝑗𝜔𝐶0 𝜖′ + 𝐺)
(4.2)
and if 𝐺 = 𝜔𝐶0 𝜖′′ , then
𝐼 = 𝑉 (𝑗𝜔𝐶0 𝜖′ + 𝜔𝐶0 𝜖′′ ) = 𝑉 (𝑗𝜔𝐶0 )(𝜖′ − 𝑗𝜖′′ )
(4.3)
In this way, it is apparent that the measured current at the receive electrode is related not only
to the dielectric constant of the material, but also to the frequency at which it is driven:
𝐼 ∝ 𝑉 𝑗𝜔𝜖𝑟
(4.4)
Most materials have complex permittivity components that are frequency-dependent, at least
over some range. Plots in Figure 4-2 and 4-3 from [26] show two exemplary human tissues (fat and
dry skin, respectively) where dielectric permittivity is shown in the top graph and conductivity in
the bottom for each plot. Over the frequency range 10 Hz to 1 MHz, the permittivity of skin changes
S Gabriel et al
Permittivity 𝜖𝑟
Conductivity 𝜎
Dielectric
FigureFigure
1. (g) Fat 4-2:
(not infiltrated).
2280
very little, whereas there is drastic change in the permittivity of fat.
permittivity and conductivity of non-infiltrated human fat, from [26].
53
Dielectric properties of biological tissues: III
Permittivity 𝜖𝑟
Conductivity 𝜎
2287
Figure 1. (n) Skin
(dry). 4-3:
Figure
Dielectric permittivity and conductivity of dry human skin, from [26].
As discussed previously, the basic parallel-plate capacitor has capacitance
𝐶=
𝜖𝑟 𝜖0 𝐴
𝑑
(4.5)
and varying the relative permittivity of the dielectric material between the two electrodes, 𝜖𝑟 , changes
the resulting capacitance proportionally. In general, this allows the capacitive sensor to detect a
change in capacitance based on a change in material. Detection of this sort always requires a
baseline reading, that is, an output matrix of control values when no materials are present in the
detection field; to differentiate between materials, both objects will need to be present as well
(determination of capacitance differences resulting from varying permittivities is a relative, not
absolute, measurement). Despite these requirements, hyperspectral imaging makes capacitive sensors
a very powerful tool.
4.3
Results
The experimental setup—the product with custom hardware modifications—was used to verify that
a scanning-grid sensor of its type could produce images of objects placed on the grid, and also give
information that would lead to identifying the material makeup of those objects.
54
4.3.1
Imaging
As a first goal of the scanning-grid sensor, images of objects placed directly on the grid were obtained.
A crucial element of the theory of capacitive sensing involves the transfer of charge through the
detected object to some reference ground. To test this on the grid, an experiment was performed
with a large (3/8”) steel bolt, which was tested alone on the grid and with a length of 22-gauge
insulated copper wire coiled around it. The end of the wire was either left standing (as an “antenna”)
or connected to the experiment’s reference ground; likewise, the bolt was removed and the resulting
coil of wire was also tested.
Object
Bolt
Bolt
Bolt
No bolt
No bolt
Wire orientation
No wire
Antenna
Grounded
Antenna
Grounded
Response value [mV]
0.6
2.7
4.7
2.4
3.3
Table 4.1: Comparison of grounded and ungrounded objects on grid.
The results showed that grounding an object dramatically increased its response value. The
antenna tests were to act as a control, so that capacitive coupling between the wire and ground
could be distinguished from a purely resistive (wired) connection to ground; furthermore, the wirealone test suggested that a ground itself was very similar to the object (the bolt) when it was
grounded. The shape of objects is easily recognizable by the grid, but is much harder to obtain
when the object has little or no link to the reference ground of the scanning circuit.
The typical proposed use case of the scanning-grid sensor is as an embedded floor tile, and thus
a demonstrative image of a foot, as in Figure 4-4, was obtained.
The grid’s 16 column electrodes and 16 row electrodes form a 16 × 16 grid, acquired by the
R
onboard microcontroller and sent to Matlab○
, and then displayed as an image. Each point in the
256-point grid image represents the deviation from the baseline reading, taken immediately before
the image reading, which is the same grid scan but with no object present. Recall that the read
analog value is the amplitude of the capacitively-coupled square wave, produced by the synchronous
detection circuit before being read by the ADC.
The disadvantage of the images is that they require close contact on the plastic cover surface
of the grid device to produce a recognizable reading. The highest-pressure zones of the foot—the
heel and ball—showed most clearly in Figure 4-4. Further separation between the grid itself and the
object reduces the signal-to-noise ratio of each point and hinders detection.
55
Scan at 250 kHz
16
0.5
0.45
14
0.4
12
0.35
10
0.3
0.25
8
0.2
6
0.15
4
0.1
0.05
2
0
2
4
6
8
10
12
14
16
Figure 4-4: Image of human foot, placed on scanning grid, diagonally across grid.
4.3.2
Material Detection
Using a range of drive frequencies, various objects were scanned to evaluate the performance of
the grid for material detection. Two major results arose: the importance of grounding, or groundcoupling, the object (as above); and the varying frequency responses of different materials.
First, a single object was placed in an identical location on the grid, and four scans of twelve
frequencies each were performed for the entire grid space. The first scan was a baseline scan, so no
object was on the grid at that point; the second scan was the object alone, with no forced connections
to ground; the third scan used an alligator-clip lead to connect the object to the experimental
reference ground; the fourth scan removed the lead and used a human finger touching the object
(but not pressing down) to capacitively couple it to earth ground.
The object studied here is a circular sponge moistened with water to simulate a slightly conductive, but non-metallic, object, much like a human hand or foot. The sponge was placed in a plastic
bag to avoid wetting the experimental setup, and connected to ground by clipping the lead to the
sponge itself. The sponge is shown in Figure 4-5a.
Results of this test are shown in Figure 4-6. Note that the plot depicts the analog readings
56
(a) Sponge with finger touching
(b) Steel disc with direct ground connection
Figure 4-5: Two sample objects for material detection on the grid setup.
across frequencies at a single grid location, in this case (9,9). The test could be repeated for every
grid location to obtain a frequency-dependent image. The frequency response of the system itself
(shown in the baseline reading) can clearly be seen dominating the frequency response overall, yet
the response when an object is present differs enough to be recognizable. Note also that the response
when the sponge is placed alone on the grid is very similar to baseline—emphasizing that a groundcoupling of some sort is essential for detection. Finally, note that the object-alone response is in
fact greater than the baseline reading. This implies that the usual mode of detection, using ground
coupling, creates shunt-mode sensing, and thereby decreases the response from baseline. On the
other hand, an ungrounded object creates transmit-mode coupling, and strengthens the electric field
from transmit to receive electrodes, and thus increases the response from baseline.
Next, a difference in frequency response between materials was shown with the addition of a
steel disc, roughly the same thickness and diameter as the sponge. This disc is pictured in Figure
4-5b. Figure 4-7 shows a comparison between the baseline reading, the sponge when touched by
a finger, and the disc when touched by a finger. A significant difference in frequency response
begins at around 1 MHz. The hardware in the experimental setup cannot produce reliable results
much beyond this frequency, but projecting the visible curve to several orders of magnitude further
predicts much greater variation.
R
In order to qualitatively verify these experimental results, a Comsol○
simulation was run for
four different scenarios. First, a baseline simulation with no object was run. Next, a simulation was
run with a rectangular block of material representing a human foot atop the grid. This material had
a variable dielectric permittivity according to Figure 4-2, representing the permittivity of human
fat at 100 kHz, 250 kHz, and 1 MHz. Third, an identical rectangular block was used, except that
this material represented some unknown plastic, with a constant dielectric permittivity of 5. As [27]
suggests, most plastics have a constant permittivity across the 100 kHz to 1 MHz range. Finally,
the two materials were combined such that the fat-based material covered the plastic material, as a
human foot might conceal a weapon or explosive.
57
Frequency sweep at 9, 9
1.1
1
Response value [V]
0.9
0.8
0.7
0.6
0.5
0.4
Baseline
Object floating
Object grounded
Object with finger touch
0.3
0.2
105
106
Frequency [Hz]
Figure 4-6: Frequency response of moist sponge on scanning grid.
The rectangular block was distributed over two grid locations so that the effect of differing
materials could be compared between the two points. The top surface of this composite block was
treated as a terminal, and held at ground in the LTspice simulation, so as to approximate the
ground-coupling of a human. Figure 4-8a shows a side view of the simulation, while Figure 4-8b
shows the electric field distribution when the middle column (column 2) is held at 1 volt. There
are three blocks visible above the grid itself: the top and left-bottom blocks represent the human
material, while the bottom-right one represents the plastic material being concealed. Thus, by
observing the response at grid locations (3,2) and (2,2), the difference between the fat-only sample
and the concealed-material sample, respectively, may be noted.
The responses of the baseline and plastic object simulations are flat across frequency since the
dielectric constant of the plastic object is frequency-independent. This statement assumes several conditions in the simulation that are not present in the experimental setup: namely, that the
receiving front-end circuit is frequency-independent; that the materials in the sensor itself have
frequency-independent dielectric permittivities; and that the plastic’s permittivity has a perfectly
flat frequency response. Still, idealizing the setup allows the main objective of the scanning-grid
sensor to be tested: the ability to recognize different materials by their frequency response given
their location on the grid.
58
Frequency sweep at 9, 9
1
0.9
Response value [V]
0.8
0.7
0.6
0.5
0.4
Baseline
Sponge with finger touch
Disc with finger touch
0.3
0.2
105
106
Frequency [Hz]
Figure 4-7: Frequency response of moist sponge versus steel disc on scanning grid.
At the second coordinate (3,2), on the lower graph in Figure 4-9, the composite response almost
exactly overlays the response for fat, since the object at that location is indeed modeled as fat. On
the other hand, the composite response for (2,2), in the upper graph, deviates significantly away
from the fat’s response and toward the plastic’s response, showing that the object at that coordinate
is composed of a combination of the two materials, and the material closer to the sensor is the
unknown plastic. Given proper training data in an installation, this principle allows the scanning
floor tile to distinguish between ordinary and potentially dangerous materials.
59
Covering object (fat)
Lower part of covering object
Concealed object (plastic)
(a) Showing parts of composite object atop grid, simulating foot with concealed plastic object
(b) Showing electric field distribution with middle column forced to 1 volt; scale is in volts
R
Figure 4-8: Cross-sections of Comsol○
model of scanning grid.
60
Response at grid coordinate (2,2)
Output voltage [V]
0.24
0.22
0.2
0.18
Baseline
Fat
Plastic
Composite
0.16
0.14
105
106
Drive frequency [Hz]
Response at grid coordinate (3,2)
Output voltage [V]
0.24
0.22
0.2
0.18
Baseline
Fat
Plastic
Composite
0.16
0.14
105
106
Drive frequency [Hz]
Figure 4-9: Simulated data for various grid objects across frequencies.
61
62
Chapter 5
Long-Range Room Occupancy
Sensing
5.1
Configuration Methods
There are numerous options for sensor configurations in room occupancy detection. Several criteria
brought about the various options for this research. The source can be located on the ceiling, floor,
or wall; the receive electrodes can be planar with source (all electrodes on the same surface) or
opposing it (receive electrodes are on a parallel but opposite surface from the source). Finally, there
can be a short (18 inches), long (36 inches), or extra long (72 inches) spacing between the source and
either receive electrode. These criteria were dictated by the different installation options available,
as well as to relate how sensor performance changes based on the influence of the various capacitive
coupling modes, proximity to grounded objects, and other considerations. The goal is to experiment
with design choices so as to establish tradeoffs and opportunities dependent on fixed environmental
conditions and design constraints.
5.1.1
Wall-Mounting
To create this setup, a similar technique to previous experiments (especially [17] and [16]) was
used. Plastic shelves acted as artificial walls and allowed electrodes to be placed in a variety of
configurations, as shown in Figure 5-1. Electrodes were held by small plastic stands.
Electrodes were held at constant height, and the source was placed halfway along the path taken
by the test subject. Taped lines on the floor in the photo run parallel to this walking path; the path
itself was spaced 46” away from the plane of the electrodes, with the exception of range tests, where
the path was spaced further away. The spacing of the electrodes kept the source position constant
relative to the length of the path, while the positive and negative receive electrodes moved further
63
− Receive
+ Receive
Source
Figure 5-1: Wall-mounting configuration in large room.
away from the source.
5.1.2
Ceiling-Mounting
To best approximate electrodes embedded in a typical commercial drop ceiling, the source and receive
electrodes were hung at a height of 8 feet above the floor. In order to accommodate various spacings,
a wooden rod was suspended from ceiling hardware and in turn held each electrode with custom,
3D-printed plastic holders. Wiring was suspended above the 8-foot level while in the experimental
room space so as to not interfere with the electric fields. (The coaxial cable feeding the source
electrode, in particular, can act like an antenna.) A photo of a setup with the source electrode
mounted at ceiling level in this way, and the receive electrodes mounted at floor level, is shown in
Figure 5-2.
5.1.3
Floor-Mounting
Wall and ceiling configurations lend themselves well to retrofit applications. However, floor-mounted
electrodes would almost always require new floor installations, since space beneath a floor in which
to mount electronics is typically limited. Furthermore, the sensor is very sensitive to the distance
between the electrodes and underlying ground “plane” represented by the grounded objects beneath.
64
Source
+ Receive
− Receive
Figure 5-2: Opposing configuration with ceiling-mounted source and floor-mounted receive electrodes, in large room.
Thus, four tests were carried out on floor-mount configurations: one with the electrodes an inch
above the actual floor, and three with varying heights of “artificial floor,” to explore the effects of
the grounded objects beneath the actual floor, e.g. reinforcing rods and pipes. The artificial floor
was made using a large wooden plank that acted as a walking path and electrode support; this
configuration can be seen in Figure 5-3. Concrete blocks were used to adjust the height, so that the
electrodes were either 5 34 , 9 34 , or 18 inches above the actual floor.
5.2
Results
The variety of installation options allows the exploration of several approaches to occupancy sensing
using electric field measurements, and each can suit a particular use case given its sensor configuR
ration. For each, a Comsol○
simulation replicates a configuration of sensors in a simulated room
environment. The simulation outputs a matrix of capacitances, based on which sensing mode is
dominant, and can show the variation in these capacitances as a “human” subject walks through
the sensors. Given a lumped-capacitance model of the room, subject, and sensors, an LTspice
65
+ Receive
− Receive
Source
Figure 5-3: Floor-mounting configuration to raise floor variously above ground.
model produces a simulated output voltage. Experiments using actual sensor hardware validate
these results.
The occupant’s path along the electrode array disturbs the sensed electric field and creates a
“characteristic curve" of output voltages. With the type of linear path used in these experiments
(that is, parallel to the plane of the sensor electrodes), the characteristic curve starts and ends
with control points (human is very near the edge of the sensing field, with nearly zero differential
voltage) and also contains a control point near the center, where the human’s influence on the field is
equal between the positive and negative electrodes. These control points sit at zero volts once offset
has been removed from the characteristic curve, since the occupant-free sensor response should be
zero. There are two peaks in the curve—one positive, one negative—as the occupant passes by each
electrode in turn and creates a large differential field disturbance.
Results for both the 10 kHz and 100 kHz (nominal) components of the received signal are shown;
sometimes the two components differ by a scale factor, and sometimes they present a more complex
difference. Analyzing both components gives more resilience to variety in configuration, as well as
more information for distinguishing between materials. The performance of each configuration is
judged upon the magnitude of the peaks (how recognizable the curve would be in the presence of
electrical, environmental, and miscellaneous occupant noise) as well as the distinguishability between
peaks. Since any installed operation of this sensor system would rely on a detection algorithm to
66
function, the analog output values must be easy to recognize not only by humans, but also by
algorithms.
5.2.1
Wall-Mounted Electrodes
Mounting electrodes to the side, in a planar manner (for example, source and both receive electrodes
in a single wall) creates shunt-mode capacitive coupling, since the presence of a human standing on
the floor shunts the transmitted electric field away from the receive electrodes and to the ground.
With the experimental setup used in this work, the range of a co-planar wall-mounted sensor system
is roughly 7 feet away from the wall, so the wall-mounted setup is best suited for localized detection,
or for use in a hallway. The configuration is illustrated in Figure 5-4. This configuration was tested
with three receive electrode displacements, at 1.5 feet, 3 feet, and 6 feet away from the source,
labeled Short, Long, and Extra Long, respectively. The displacement is shown as dimension 𝑥 in
Figure 5-4. The path taken by the subject, noted as dimension 𝑦 in Figure 5-4, was fixed at 46”
away from the receive electrodes; then, for further range tests, this distance was increased.
− Receive
+ Receive
Source
𝑥
𝑦
𝑥
Figure 5-4: Cartoon of a wall-mounted coplanar sensor configuration. Dimension 𝑥 varies between
1.5, 3, and 6 feet. Dimension 𝑦 varies between 46”, 86”, and 126”.
Results of this comparison are in Figure 5-5, and show that the setup is robust to multiple
displacements. Best results are achieved with receive electrodes 3 feet away (the “long” setup) since
peaks are most distinguishable and greatest in magnitude. The perpendicular termination of electric
fields to the source and receive electrodes brings about field displacement further from the electrodes’
plane as the spacing increases; this leads to greater interruption of the fields (stronger peaks) and
greater sensor range. The factor that limits this spacing is the strength of the fields, which will
decrease so much as to be overcome by surrounding EMI and electrical noise if the receive electrodes
are too far away from the source. Thus, the bounds are approached by the “short” and “extra long”
setups, respectively, and the “long” setup avoids both problems.
The model and simulation created for these setups matched reasonably well with experimental
data. For example, the “long” displacement experimental results for the wall-mounted setup are
compared against simulated results for the same setup in Figure 5-6.
Since the characteristic curve—and thereby detection quality—arise from field interruption near
the receive electrodes, the best performance will always come from an occupant moving close to the
67
0.06
Short 10 kHz
Long 10 kHz
Extra Long 10 kHz
Short 84 kHz
Long 84 kHz
Extra Long 84 kHz
Output voltage [V]
0.04
0.02
0
−0.02
−0.04
−0.06
0
2
4
6
8
10
12
Distance along path [steps]
14
16
18
Figure 5-5: Comparison of receive electrode displacements in wall-mounted setup. Each step is a
floor tile roughly 9 inches long.
0.06
10
10
84
84
Output voltage [V]
0.04
kHz
kHz
kHz
kHz
Experimental
Simulated
Experimental
Simulated
0.02
0
−0.02
−0.04
−0.06
−0.08
0
2
4
6
8
10
12
Distance along path [steps]
14
16
18
Figure 5-6: Matching between experimental and simulated data for “long” wall-mounted setup.
receive electrodes. However, the sensor can detect presence even with an occupant further away, and
to improve sensor range, the source electrode can be moved to an opposite surface from the receive
electrodes, for an opposing setup.
Figure 5-7 documents far-field presence and the effect of an opposing source. Here, the source
was mounted 145” away from the receive electrodes—just over 12 feet. The occupant walked at two
distances away from the source: 86”, or 40” beyond the usual walking path, and 126”, or 80” beyond
the usual path. Both paths show good recognition of the occupant’s movement.
Results of simulations are also included for comparison. The most likely source of the large
68
deviation from experimental data for the 126” test is the close proximity of the occupant to the
source. The way in which fields are absorbed by the occupant in this position, and how the remaining
fringe fields reach the receive electrodes, is largely influenced by the body shape and ground-coupling
of the human, more so than in the other experiments. Therefore, when the occupant approaches the
middle of the walking path (just next to the source), the sensor output can be unpredictable. With
the subject directly by the source electrode, the capacitance between the source and the human
likely becomes greater than the capacitance between the human and ground, and thus the occupant
acts briefly in transmit mode, before switching back to shunt mode. The same reason may explain
the shift in peaks between simulated and experimental data here. Note how the peaks become closer
together as the human moves further from the receive electrodes, since the line between source
and receive runs at a diagonal compared to the walking path. This implies that the occupant will
interrupt the fields along that line earlier if they are closer to the receive electrodes. In simulation,
the exact parameters of the human’s shoulders, for example, may have differed from those in the
experiment.
x 10
10 kHz Component Magnitude
−3
Output voltage [V]
4
Simulated 86”
Simulated 126”
Experimental 86”
Experimental 126”
2
0
−2
−4
0
x 10
2
4
6
8
10
12
Distance along path [steps]
14
16
18
84 kHz Component Magnitude
−3
Output voltage [V]
2
Simulated 86”
Simulated 126”
Experimental 86”
Experimental 126”
1
0
−1
−2
0
2
4
6
8
10
12
Distance along path [steps]
14
16
18
Figure 5-7: Opposing wall-mounted setup at far-field distances, with simulation results.
69
The path used in most tests (46" away from the receive electrodes) functions quite well for the
opposing wall-mounted setup. Figure 5-8 offers a comparison between three sensor displacements,
and performance here is comparable to performance for other mounting configurations.
x 10
−3
4
Short 10 kHz
Long 10 kHz
Extra Long 10 kHz
Short 84 kHz
Long 84 kHz
Extra Long 84 kHz
Output voltage [V]
3
2
1
0
−1
−2
−3
−4
0
2
4
6
8
10
12
Distance along path [steps]
14
16
18
Figure 5-8: Opposing wall-mounted setup at near-field distance, with three sensor displacements.
5.2.2
Ceiling-Mounted Electrodes
Mounting electrodes above occupants, as in ceiling tiles, also exhibits shunt-mode coupling if the
source and receive electrodes are in the same plane. The electric fields normally fringe from the
source to either receive electrode, and an occupant passing through the fields shunts these fields to
the ground plane on or near where the occupant stands. As with the wall setup, the ceiling-mounted
configuration was tested with the same three electrode displacements. Results are shown in Figure
5-9, and similar behavior was observed. Good distinguishability came from the “long” 3-foot spacing,
while the “short” and “extra long” setups are functional, but signal strength is reduced and so peak
magnitude is sub-optimal. Experimental data is compared with data from a simulation of the “long”
displacement version of the ceiling-mounted setup in Figure 5-10.
The opportunities for ceiling-mounted sensors drastically decrease if there is a requirement that
the occupant be directly beneath the sensors. Fortunately, the ceiling-mounted configuration works
well even if the occupant walks along a path several feet away from the line formed by the electrodes.
Figure 5-11 shows that at the 86” and 126” distances away from the line directly beneath the sensor,
signal magnitudes decrease significantly compared to when an occupant walks directly below the
sensor, but Figure 5-12 shows that the characteristic curves can still be detected.
Since these range tests were performed using the setup where receive electrodes are mounted 3
70
Output voltage [V]
0.1
0.05
0
Short 10 kHz
Long 10 kHz
Extra Long 10 kHz
Short 84 kHz
Long 84 kHz
Extra Long 84 kHz
−0.05
−0.1
0
2
4
6
8
10
12
Distance along path [steps]
14
16
18
Figure 5-9: Comparison of receive electrode displacements in ceiling-mounted setup.
0.15
Output voltage [V]
0.1
0.05
0
−0.05
−0.1
10
10
84
84
−0.15
kHz
kHz
kHz
kHz
Experimental
Simulated
Experimental
Simulated
−0.2
0
2
4
6
8
10
12
Distance along path [steps]
14
16
18
Figure 5-10: Matching between experimental and simulated data for “long” ceiling-mounted setup.
feet away from the source, it is valuable to explore the far-field performance of a setup where the
receive electrodes are closer or further away from the source—the “short” or “extra long” setups,
respectively. In applications where there is limited mounting space, or a requirement that electrodes
be mounted at a constrained distance from each other, these setups may be useful. In Figure 5-13,
the test with an occupant walking 86” away from the sensors shows good recognition with each
of the electrode displacements, but at 126” away only the 3-foot (“long”) and 6-foot (“extra long”)
displacements give meaningful results. Thus, it is apparent that far-field performance relies on the
receive electrodes being spaced far enough away from the source. This allows the source to generate
fringing fields sufficiently far away from the sensors to capture the presence of an occupant in the
71
Output voltage [V]
0.1
0.05
0
In-line, 10 kHz
86” away, 10 kHz
126” away, 10 kHz
In-line, 84 kHz
86” away, 84 kHz
126” away, 84 kHz
−0.05
−0.1
0
2
4
6
8
10
12
Distance along path [steps]
14
16
18
Figure 5-11: Range tests for “long” ceiling setup.
−3
x 10
1.5
Output voltage [V]
1
0.5
0
−0.5
126” away, 10 kHz
126” away, 84 kHz
−1
0
2
4
6
8
10
12
Distance along path [steps]
14
16
18
Figure 5-12: Range tests for “long” ceiling setup, with only 126" plotted and zoomed in for visibility.
far-field.
Ceiling-mount setups where the ceiling is reasonably close to the occupant, that is, within 12
or so feet of the floor, have been shown to function well with planar source and receive electrodes.
However, for higher ceiling surfaces, more range may be achieved with an opposing method. For
instance, wall-mount setups using opposing source and receive electrodes, rather than planar, have
been discussed for large rooms that necessitate detection across the horizontal span of the room.
The same technique may be used with a ceiling mount. Mounting a source electrode at floor level,
and the differential receive electrodes at ceiling level, is likely to offer a greater range. The results of
72
10 kHz Component Magnitude
Output voltage [V]
0.02
0.01
0
−0.01
Short, 86”
Short, 126”
Long, 86”
Long, 126”
Extra long, 86”
Extra long, 126”
−0.02
−0.03
0
2
4
6
8
10
12
Distance along path [steps]
14
16
18
14
16
18
84 kHz Component Magnitude
Output voltage [V]
0.01
0.005
0
Short, 86”
Short, 126”
Long, 86”
Long, 126”
Extra long, 86”
Extra long, 126”
−0.005
−0.01
0
2
4
6
8
10
12
Distance along path [steps]
Figure 5-13: Range tests for ceiling setups, with three electrode displacements.
a test with this setup, with the ceiling-level electrodes at the standard 8-foot height, are in Figure
5-14. The peaks in the characteristic curve are clearly defined, and so even with reduced magnitude
(resulting from greater source-receive distance), the output will offer good detection characteristics.
Note the similarities between Figure 5-14 and the simulated results in Figure 5-7, in that there
is an overall smooth curve interrupted sharply in the middle by two narrow peaks. The two narrow
peaks may indicate a brief switch from shunt-mode coupling to transmit-mode coupling, when the
occupant passes over the source and extends the “source electrode” upwards. This behavior manifested itself in the experimental results for the opposing floor setup, but not for the opposing wall
setup earlier, showing that small differences in details of the occupant can have a significant effect
on the accuracy of a simulation in some cases. A similar, reversed setup where the source electrode
is at ceiling height and the receive electrodes are at floor height (Figure 5-15) is also workable, but
73
0.03
Output voltage [V]
0.02
0.01
0
−0.01
−0.02
Short 10 kHz
Long 10 kHz
Extra Long 10 kHz
Short 84 kHz
Long 84 kHz
Extra Long 84 kHz
−0.03
−0.04
−0.05
0
2
4
6
8
10
12
Distance along path [steps]
14
16
18
Figure 5-14: Opposing-setup tests with source at floor level and receive electrodes at 8-foot ceiling
level.
demonstrates the problems of mounting receive electrodes near the large floor ground plane. Here,
the receive electrodes were 1 inch away from the tile floor.
0.4
Output voltage [V]
0.2
0
−0.2
Short 10 kHz
Long 10 kHz
Extra Long 10 kHz
Short 84 kHz
Long 84 kHz
Extra Long 84 kHz
−0.4
−0.6
0
2
4
6
8
10
12
Distance along path [steps]
14
16
18
Figure 5-15: Opposing-setup tests with source at ceiling level and receive electrodes at floor level.
Peaks in the characteristic curve are of greater magnitude but are far less clearly defined, possibly
due to significant absorption of field by the floor’s embedded ground in the experimental setup. Caution must be taken when mounting any electrodes at floor level to raise them above any constructed
plane that may be connected to earth ground, as discussed in the next section.
74
5.2.3
Floor-Mounted Electrodes
The behavior of electric fields in a floor-mounted setup is conceptually illustrated in Figure 5-16.
Placing the source and receive electrodes at floor level, that is, embedded within a floor, has the
advantage of placing the occupant very close to the electrodes. However, the ground plane created
by the floor and any grounded objects within is also close to the electrodes and therefore absorbs
much of the transmitted electric field from the source. The experimental setup used here absorbed
more of the transmitted field than many installations might, and so experiments were performed
with an artificial floor to vary the distance between floor and ground plane (see 5-3). A test was also
performed with the electrodes held 1” above the floor itself, without the use of the artificial floor.
Instead, small 3D-printed plastic stands stood the electrodes off from the floor.
𝑥
− Receive
𝑥
Source
+ Receive
𝑦
Figure 5-16: Cartoon of a coplanar sensor configuration at floor level. Dimension 𝑥 varies between
1.5, 3, and 6 feet. Dimension 𝑦 varies between 1”, 5.75”, 9.75”, and 18”.
The results are plotted in 5-17 for these four heights. The most significant qualitative result is
that there are four peaks, rather than two, in the characteristic curve. The outermost two peaks
compare to the peaks in the other setups’ result graphs: they are the largest, and created by shuntmode coupling. As the occupant approaches and steps over the receive electrodes, the occupant’s
body shunts fields away from the electrodes. However, as the occupant comes between the receive
electrodes and the source plate, they act in transmit mode, increasing the coupling between the
source plate and the receive electrode, and creating the two smaller peaks in the middle of each
graph.
Results for the three artificial-floor heights (5.75” through 18”) are nearly identical, showing that
the floor’s ground plane has dramatically less effect when removed by several inches from the plane of
the electrodes. However, when the electrode plane is much nearer to the ground plane, 1” above the
actual floor, the absorption of electric field by the ground is enough that the transmit-mode coupling
is nearly insignificant. Furthermore, the shunt-mode coupling creating the outermost peaks is also
quite small compared to the large shunt coupling by the ground plane, and so the outermost peaks
75
10 kHz Component Magnitude
Output voltage [V]
0.5
0
1”
5.75”
9.75”
18”
−0.5
0
2
4
6
8
10
12
Distance along path [steps]
14
16
18
84 kHz Component Magnitude
Output voltage [V]
0.2
0.1
0
1”
5.75”
9.75”
18”
−0.1
−0.2
0
2
4
6
8
10
12
Distance along path [steps]
14
16
18
Figure 5-17: Floor setup tests with electrodes and artificial floor at various heights above the actual
floor. Electrode displacement is the “long” setup, 3 feet away, for each test.
are small compared to those of the artificially raised floor.
In sum, a closely-spaced ground plane, or collection of grounded objects, can severely impact
the coupling present if the sensor plane is too close. Installing the sensors in a floor that is well
away from any virtual ground plane, or even creating an artificially raised floor, can help avoid this
issue. Even still, detection is possible when the ground plane is quite close, but the results may be
overcome by noise. The two additional peaks created here can increase the amount of information
available for detection and position recognition, providing more resolution in a given space than the
other sensor installations.
Matching between simulated and experimental data, shown in Figure 5-18, was good on the two
outermost peaks, but deviated significantly on the inner peaks. The transmit-mode coupling created
when the occupant stands between the source and each receive electrode—this creates the two inner
peaks—is heavily influenced by the space between the occupant’s legs and feet and the electrodes.
Differences in magnitudes in these regions can be attributed to slight movements of the subject’s feet
around the electrode, the shape of their legs, the size of their feet and shoes, and so on. Modeling
76
10 kHz Component Magnitude
Output voltage [V]
0.4
Experimental
Simulated
0.2
0
−0.2
−0.4
0
2
4
6
8
10
12
Distance along path [steps]
14
16
18
84 kHz Component Magnitude
Output voltage [V]
0.2
Experimental
Simulated
0.1
0
−0.1
−0.2
0
2
4
6
8
10
12
Distance along path [steps]
14
16
18
Figure 5-18: Comparison of experimental and simulated data for the 5.75” artificial-floor setup.
these details accurately enough to match the inner peaks in the graph is beyond the scope of this
thesis, but does present a rich opportunity for further exploration, as well as the ability to detect
such details. Given a set of calibration measurements, this sensor configuration might be used to
detect the shoe size of occupants, for instance. However, this detection is dependent on the exact
position of the occupant as they pass over the sensor array.
In a similar fashion, a simulation for the floor-mounted setup with electrodes 1” above the actual
floor deviated significantly from experimental data, shown in Figure 5-19. Because of the close
proximity of all (source and receive) electrodes to the floor, very few fringing fields reach the receive
electrodes even in a resting state, and any disturbance (such as the human’s legs and feet passing
by the electrodes) creates a strong effect. Thus, the exact parameters of the human are far more
influential here than in the other simulations, creating the magnitude differences visible at the peaks.
It should be noted that to perform these floor-based tests, the subject’s legs and feet straddled
the sensor electrodes as they passed over, rather than stepping atop the electrode itself. To test the
effect of this behavior, tests were performed where the subject placed one foot on the (artificial or
77
0.4
10
10
84
84
Output voltage [V]
0.3
0.2
kHz
kHz
kHz
kHz
Experimental
Simulated
Experimental
Simulated
0.1
0
−0.1
−0.2
−0.3
−0.4
0
2
4
6
8
10
12
Distance along path [steps]
14
16
18
Figure 5-19: Comparison of experimental and simulated data for the 1”, on-floor setup.
real) floor beside the electrode and one foot (with shoe) on the electrode plate, whenever the foot
position along the subject’s walking path happened to cover all or part of the electrode.
1
Output voltage [V]
0.5
0
−0.5
−1
10
10
84
84
kHz
kHz
kHz
kHz
at
at
at
at
1”
5.75”
1”
5.75”
−1.5
0
2
4
6
8
10
12
Distance along path [steps]
14
16
18
Figure 5-20: Floor setup results with heights of 1” (on floor) and 5.75” (raised) with foot placed
directly on electrode.
Results are shown in Figure 5-20. The magnitudes of the two outermost peaks are much greater
due to the close capacitive coupling between the occupant’s foot and the electrode, an example
of transmit-mode coupling (human-to-electrode capacitance is on the order of human-to-ground
capacitance). Furthermore, the peaks are much easier to recognize since they dominate any other
behavior along the path. Thus, as expected, stepping directly on the electrodes does not dramatically
78
change the characteristic curve produced, except to very clearly indicate when the occupant’s foot
is passing by the electrodes.
In the same way that the range of the wall-mounted and ceiling-mounted setups were tested, the
far-field performance of a setup with the electrodes mounted in the floor was also evaluated. The
subject walked along a line parallel to the line formed by the three electrodes, at both 66” and 86”
away from the electrodes. In addition, two heights of artificial floor were explored, as well as a height
of 1” above the ground. For the 1” test, the electrodes were mounted on plastic stands to raise them
1” above the actual floor, and the subject walked on the floor itself. For the artificial-floor tests,
the subject walked on a platform raised above the actual floor, and the electrodes were mounted on
plastic stands to raise them to the same height.
10 kHz Component Magnitude
Output voltage [V]
0.04
1” high, 66” away
1” high, 86” away
5.75” high, 66” away
5.75” high, 86” away
9.75” high, 66” away
9.75” high, 86” away
0.02
0
−0.02
−0.04
0
2
4
6
8
10
12
Distance along path [steps]
14
16
18
84 kHz Component Magnitude
Output voltage [V]
0.02
1” high, 66” away
1” high, 86” away
5.75” high, 66” away
5.75” high, 86” away
9.75” high, 66” away
9.75” high, 86” away
0.01
0
−0.01
−0.02
0
2
4
6
8
10
12
Distance along path [steps]
14
16
18
Figure 5-21: Floor setup range tests with subject walking 66” and 86” away from the electrodes.
When electrodes are mounted in the floor and close to large grounded objects, as in the 1” test,
the sensor can still recognize an occupant at 86” away. When the grounded objects are moved
further away from the electrodes and the occupant, the far-field performance increases with the
artificial floor height (that is, the distance away from the grounded objects). For the 5.75” and
79
9.75” tests, the sudden jumps in the characteristic curve are notable as the ends of the platform on
which the subject walked. Figure 5-22 shows this platform, which is shorter than the full length
of the walking path. These results indicate clearly that electrodes mounted in a surface that is
parallel to the plane of the floor, but above the height of the occupant’s feet (as these were when the
subject was off the platform), return much greater magnitude than when the plane of the electrodes
is the same plane upon which the occupant walks. This may perhaps be taken as an indication that
placing electrodes well below the floor will result in decreased signal magnitude, but it also shows
that horizontal surfaces at mid-occupant height (e.g. a bench) are suitable locations for electrode
placement, especially for the purpose of detecting far-field movement (in this case, around 7 feet).
Figure 5-22: Floor setup for range tests, with artificial-floor platform and electrode mounting.
5.3
Indigenous Sources: Photodetection
The task of integrating sensor electrodes into building surfaces may be made easier by eliminating
the source, at least the particular source that is explicitly part of the sensor system. With just two
differential receive electrodes, placement and integration can be simpler, and indigenous sources, for
example fluorescent lights, can be used instead.
Previous versions of this sensor as in [11] were built-in to fluorescent lights because they used
the indigenous source of the lamp’s electromagnetic emissions, but detection and tomography is
more difficult without the standalone sensor system used in these experiments. Since the latest
system requires a synchronous detector, the source’s frequency and phase must be known. If the
source is a lamp of some sort, a photodetector can be used to synchronize the source signal. This
80
photodetector circuit, and its integration with the hybrid short-range and long-range sensor system,
is an opportunity for further exploration. However, a prototype circuit is presented here that may
serve as a good foundation for a photodetector-synchronized sensor.
Most fluorescent lamp ballasts operate around 50 kHz, and thus the lamp itself switches at that
frequency. This causes fluctuations in light at the frequency and phase of the lamp’s electromagnetic
emissions. A phototransistor positioned near the light source and a simple circuit produce a square
wave at the fluctuation frequency. Placing the phototransistor in a common-collector amplifier
configuration, followed by an active band-pass filter, produces a sine wave at the ballast frequency,
and with very small harmonic amplitude.
The filter was designed with reference to [28], having a center frequency of 55 kHz and bandwidth
of 30 kHz. Following the filter is a DC blocking capacitor, biasing resistors to center the waveform
about 2.5 volts, and a comparator circuit to compare the waveform to this 2.5V threshold. The
output is a 0 to 5 volt square wave.
+5V
168.2kΩ
1𝜇F
−
1𝜇F
6.2kΩ
330pF
330pF
470Ω
8.2kΩ
𝑉𝑠𝑖𝑛𝑒
TL072
+
+5V
2kΩ
+5V
2kΩ
2kΩ
+5V
+
LM311
6.2kΩ
2kΩ
−
𝑉𝑠𝑞
+5V
2kΩ
2kΩ
Figure 5-23: Photosensor circuit. The NPN transistor is a phototransistor, followed by a band-pass
filter and comparator.
This clock signal can then be input to the synchronous detection circuit on the room sensor
board, which will demodulate the incoming sensed electric field signal. A test was performed using
this circuit and two types of common fluorescent lamps: a compact fluorescent lamp (CFL) in a
hand-held utility fixture, and a standard T8 tube lamp in a ceiling fixture with standard plastic
diffuser attached. Both tests were performed with the phototransistor held roughly two inches away
81
from the fixture. A clean clock signal was produced in both tests, with slightly different clock
frequencies, based on the varying ballast frequencies of different manufactured fixtures. The CFL
example’s output is in Figure 5-24.
Figure 5-24: Output waveform of photosensor circuit, with compact fluorescent lamp.
82
Chapter 6
Conclusion and Future Work
6.1
Summary
In this work, electric field sensing was introduced as a commonplace technology as well as a field
that presents ample opportunities for expansion. Two dominant modes of capacitive coupling—shunt
mode and transmit mode—describe how electric fields deviate in the presence of a sensed object or
occupant, namely, shunt mode involves the object shunting the field to ground and transmit mode
allows the object to transmit the field from the source to the receiver. The current at the receive
electrode from the source electrode decreases or increases, respectively, and can be sensed by frontend amplifiers and conversion electronics.
Two hardware methods were presented to accurately perform capacitive sensing: the scanning
grid (a short-range sensor) and the standalone room occupancy sensor (a long-range device). The
basic concepts are the same, but the overall scale and detection goals are much different. Furthermore, the scanning grid is a single-ended device that is built on a two-dimensional plane of crossed
electrodes, whereas the room sensor is fully differential, with active differential receive electrodes
and a source electrode, all of which are independently mounted pieces of hardware.
R
A thorough simulation method was also presented, using the Comsol○
Multiphysics software
package. Simulation in this manner, coupled with a lumped-capacitance environment model and
circuit simulation, confirms the theoretical background of this type of electric-field sensing, and is
a way to verify designs before installation in the end-use environment. Since the environment is an
important factor in the performance of this sensor system, verification may be a useful tool.
The scanning-grid sensor was found to be readily useful for two-dimensional imaging of objects
placed on the sensor plane, and sweeping the frequency of the drive signal leads to the discovery
of the material’s dielectric permittivity relative to other materials placed on the sensor plane. This
concept was confirmed in simulation using a prototype compound model representing a human foot
83
with a concealed metal object.
Finally, the long-range room sensor was examined in an experimental setup, and found robust
to various configurations and ranges. Best typical performance arose from placing receive electrodes
3 feet from the source electrode, in plane with the source; arranging the source on an opposite but
parallel plane extended the sensing range. Placing electrodes close to the experimental floor, which
was well-represented by a conductive ground plane, reduced the range as the fields were absorbed
into the floor. However, spacing the electrodes further from this virtual ground plane improved the
results. The room-based simulations modeled the electrodes and humans fairly accurately, along
with the room and virtual ground plane, but ignored many large grounded objects in the vicinity.
Even still, simulation results matched very well with experimental results, demonstrating that many
sources of external interference can be successfully ignored.
6.2
6.2.1
Future Work
Further Exploration of Materials
The scope of this thesis did not allow the same level of simulation accuracy with the scanning-grid
sensor as with the room-scale sensor. To achieve this, the scanning grid’s front-end and synchronous
detection circuitry should be modeled in LTspice and iteratively adjusted so that simulated outputs match experimental ones. Many influential physical constraints may come into play, most
importantly the ground planes (actual or lumped) near the scanning grid.
The sensor hardware features a manufactured ground plane slightly below the grid, which may
influence output levels and range greatly. Furthermore, enclosing the hardware in an aluminum
R
Faraday cage, as these experiments did, should be accurately modeled in Comsol○
as a bounding
ground. Once a simulation has been established that can match experimental data, it can be used
to determine whether the hardware in use is capable of ECT, that is, if the frequency range across
which common materials can be differentiated is possible.
In the likely case that this is not true, new hardware may be developed to accommodate those
frequencies, which may be several MHz. Inexpensive consumer-grade components may not suffice
for this purpose. Special care should be taken to ensure that the grid layout functions properly
(see the discussion of grid thickness previously). Alternatively, new hardware may be used with the
existing grid, to take advantage of the already-developed sensing surface with circuitry better suited
to multi-material detection.
With a scanning grid capable of the required frequencies, the integration of this grid into the
room-sensor setup is simple. The grid can be used as a single receive electrode—two can be a
differential pair as in these experiments—by disconnecting some or all of the rows or columns from
their respective front-end amplifiers and drive circuits and instead connecting them together and
84
tying this connection to a single front-end amplifier as on the existing active receive electrodes.
The system can alternate between both grid and single-electrode behavior with proper switching
components, and thus the entire integrated system can be used both as a macro-detector (presence,
motion, and rough position detection) and a micro-detector (imaging and material/object detection).
6.2.2
Installation Methods
Experimenting with various arrangements of sensor electrodes in this work, as well as achieving
relatively accurate simulation through modeling, demonstrated that a functional sensor system can
arise from a non-ideal installation. The experimental environment used here contains many large
metallic objects and sources of interference that can negatively impact sensor readings, yet the
system’s common-mode rejection and fully-differential operation obviate most of these issues.
Even still, to prove conclusively that this system is useful in a typical commercial environment,
further testing will be helpful. Installing the experimental electrodes above drop ceiling tiles, as
suggested, as well as building an actual floor with embedded electrodes, can reveal more nuances
for suggested and avoided practices during installation. Furthermore, experimentation in a nonbasement environment may show to be more typical of a commercial installation, where large ground
planes have less of an effect. A demonstrable, modular “tile” system is a possible outcome of this
research, and would involve more effort in mechanical, electrical, and software engineering.
85
86
Appendix A
Code
A.1
R
Matlab○
Data-Processing Code
A.1.1
Scanning Grid Graphing: SeriesOfHands.m
This script can generate either a single grid image from a single-frequency scan, or a frequency plot
from a single point scan across a frequency range, or both.
% Imports baseline and sample CSV’s from Python script on grid
% Plots a figure for each frequency scanned, representing 16*16 grid
% Brian Sennett, MIT RLE/LEES, August 20 2014
5
close all ;
cd(’ ../ csv/StaticTest1218_Foot5’)
10
% Read in CSV files − these are typically stored as pairs in their own dir
baselineIn = csvread(’baseline.csv’);
sample1In = csvread(’sample.csv’);
sample2In = csvread(’sample$.csv’);
sample3In = csvread(’sample$$.csv’);
15
cd(’ ../../ MATLAB␣code’)
% Grab vectors from data
hz = baselineIn(1,:);
20 numFreqs = length(hz)/256;
baseline_volts = reshape(baselineIn(2,:), numFreqs, 16, 16);
sample1_volts = reshape(sample1In(2,:), numFreqs, 16, 16);
sample2_volts = reshape(sample2In(2,:), numFreqs, 16, 16);
25 sample3_volts = reshape(sample3In(2,:), numFreqs, 16, 16);
87
% Take difference between sample and baseline
diff_volts = abs(sample1_volts − baseline_volts)./baseline_volts;
30
% Take slices at each frequency from the diff vector
for n = 1:numFreqs
frame = squeeze(diff_volts(n,:,:));
q = ceil (sqrt(numFreqs));
subplot(q,q,n);
35
figure ;
v = 0:0.01:0.6;
% Number of contours in plot
colormap(bone(128)) % Regulates contourf
contourf(flipud(rot90(frame)), v), shading flat % Get right orientation
title ( sprintf ( ’Scan␣at␣%d␣kHz’, round(hz(n)/1e3)))
40
caxis ([0 0.5]) ;
colorbar ;
end
poi = [9,9]; % Point of interest to generate frequency sweep plot
45
% Get slice at given point over frequency range
pointFrameBase = baseline_volts(:,poi(1),poi(2));
pointFrameSamp1 = sample1_volts(:,poi(1),poi(2));
pointFrameSamp2 = sample2_volts(:,poi(1),poi(2));
50 pointFrameSamp3 = sample3_volts(:,poi(1),poi(2));
% Plot frequency response at POI
figure ;
semilogx(hz(1:numFreqs),pointFrameBase, hz(1:numFreqs), pointFrameSamp1)
55 title ( sprintf ( ’Frequency␣sweep␣at␣%d,␣%d’, poi(1), poi(2)))
xlabel( ’Frequency␣[Hz]’)
ylabel( ’Response␣value␣[V]’)
legend(’Baseline’ , ’Alone’, ’Grounded’, ’Finger’)
A.1.2
Room Sensor Graphing: ProcessOutputs.m
Various modifications can be made to accommodate plotting of different scenarios: all experimental
data, or experiment/simulation comparison; two to four datasets; number of horizontal axis data
points.
% This script produces one plot from a given dataset
% Load in data files ; experimental data in output and sim data in Soutput
% Warning: it will overwrite the eps file in this directory
5
% Brian Sennett, MIT RLE/LEES, Oct−Dec 2014
output1 = output;
88
output2 = Soutput;
10
close all
a10ki = output1(1,:) − mean(output1(1,[1,end]));
a10kq = output1(2,:) − mean(output1(2,[1,end]));
a100ki = output1(3,:) − mean(output1(3,[1,end]));
15 a100kq = output1(4,:) − mean(output1(4,[1,end]));
amag10k = abs(a10ki + 1i*a10kq);
amag100k = abs(a100ki + 1i*a100kq);
20 aphase10k = phase(a10ki+1i*a10kq);
aphase100k = phase(a100ki+1i*a100kq);
b10ki = output2(1,:) − mean(output2(1,[1,end]));
b10kq = output2(2,:) − mean(output2(2,[1,end]));
25 b100ki = output2(3,:) − mean(output2(3,[1,end]));
b100kq = output2(4,:) − mean(output2(4,[1,end]));
bmag10k = abs(b10ki + 1i*b10kq);
bmag100k = abs(b100ki + 1i*b100kq);
30
bphase10k = phase(b10ki+1i*b10kq);
bphase100k = phase(b100ki+1i*b100kq);
% For spacing in number of sample points
35 a = linspace(1, 17, 17);
b = linspace(1, 17, 17);
aout10 = −amag10k.*sign(a10ki);
aout100 = −amag100k.*sign(a100ki);
40 bout10 = bmag10k.*sign(b10ki);
bout100 = bmag100k.*sign(b100ki);
set (0, ’ defaultTextInterpreter ’ , ’ latex ’ ) ;
45
figure ( ’Units’ , ’ inches ’ , ’ Position ’ ,[1 1 6.5 6], ’PaperPositionMode’,’auto’);
subplot(2, 1, 1);
plot(a, aout10, ’ro’ , b, bout10, ’b*’)
set(gca, ’FontName’,’Times’, ’FontSize’,11)
legend(’Experimental’, ’Simulated’, ’Location’, ’SouthEast’)
50 xlabel( ’Distance␣along␣path␣[steps]’)
ylabel( ’Output␣voltage␣[V]’)
title ( ’10␣kHz␣Component␣Magnitude’)
55
subplot(2, 1, 2);
plot(a, aout100, ’ro’ , b, bout100, ’b*’)
89
set(gca, ’FontName’,’Times’, ’FontSize’,11)
legend(’Experimental’, ’Simulated’, ’Location’, ’SouthEast’)
xlabel( ’Distance␣along␣path␣[steps]’)
ylabel( ’Output␣voltage␣[V]’)
60 title ( ’100␣kHz␣Component␣Magnitude’)
print( ’−depsc2’,mfilename)
A.1.3
High-Voltage Source Signal Parametrization: source_signal_fit.m
This script analyzes captured oscilloscope data of the high-voltage source output. A fast Fourier
transform (FFT) of the data gives initial guesses for amplitude, frequency, and phase of the two
frequency components. These guesses are used as initial parameters for a least-squares sinusoidal fit
to the actual source signal. The script produces a final plot for verification. Adapted from code by
Peter Lindahl.
% Peter Lindahl, MIT RLE/LEES, December 2014
% load data csv
data = csvread(’../Room␣Tests␣(Output␣matrices)/Source␣capture␣data/source74.csv’,2,0);
5
% get source signal and create time vector
t = data(:,1);
source = data(:,2);
Fs = (t(2)−t(1))^(−1);
10
% run FFT on source signal to get initial guesses at amp, freq, and phase
L = length(source);
NFFT = 2^(nextpow2(L)+2); % Next power of 2 from length of source
Y = fft (source,NFFT)/L;
15 f = Fs/2*linspace(0,1,NFFT/2+1);
% Plot single−sided amplitude spectrum.
figure (1) ;
plot(f,2*abs(Y(1:NFFT/2+1)))
20 title ( ’ Single−Sided␣Amplitude␣Spectrum␣of␣y(t)’)
xlabel( ’Frequency␣(Hz)’)
ylabel( ’ |Y(f)| ’ )
% from plot, picked indices 8 and 56 as
25 %10k and 84k contributions, respectively
% initial guess for nonlinear least squares fit
% assume 10k component larger
30 [A1,A1ind] = max(2*abs(Y));
90
w1 = f(A1ind)*2*pi;
phi1 = phase(Y(A1ind));
% find 84k component by finding max outside of window around A1
[A2,A2ind] = max(2*abs(Y((A1ind+20):(NFFT/2+1))));
A2ind = A2ind+A1ind+20−1; % fix A2ind
w2 = f(A2ind)*2*pi;
phi2 = phase(Y(A2ind));
DC = 0;
40 param_init = [A1,w1,phi1,A2,w2,phi2,DC];
35
% view if desired (otherwise comment out)
figure (1)
clf ;
45 plot(t,source,t,cap_source(param_init,t));
% fit curve
param_fit = lsqcurvefit(@cap_source,param_init,t,source);
50
figure (1)
plot(t,source,t,cap_source(param_fit,t))
% outputs of this method are
% param_fit:
55 A1 = param_fit(1);
w1 = param_fit(2);
f1 = w1/(2*pi);
phi1 = param_fit(3);
60 A2 = param_fit(4);
w2 = param_fit(5);
f2 = w2/(2*pi);
phi2 = param_fit(6);
65 DC = param_fit(7);
A.2
A.2.1
R
Matlab○
Acquisition Code
Room Sensor ADC Communications: readADC.m
The Atmel microcontroller on the room sensor board sends a stream of data via RS232 serial to the
host computer. This script decodes the stream, as well as commanding the ADC to sample data. It
is called as a subroutine of verticalSetupTest.m. Adapted by Peter Lindahl from code written by
Elizabeth George [17] and William Thompson [16].
function val = readADC(s, chan)
91
% Updated 12−2−2014 by Peter Lindahl
% Function Description:
5
% Inputs:
%
s − serial object of active USB serial port
%
chan − ADC channel
10
% Outputs:
%
val − value returned scaled to represent the differential analog
%
voltage input to the ADC
%% Send the command to the sensor if necessary
15 % s is the text file , looking for character string (%s)
fprintf (s, ’%s’,strcat(’A’,chan));
%% Read from the board
20
% scan what?
raw = fscanf(s, ’%02x’);
matrix = rot90(raw);
%% Interpret data received from the board and print and return read value
25
% format of string read from ADC:
% matrix = [m1 m2 m3 m4] with each m an 8−bit value; matrix is 32−bit
% total value
%
m1:
30 %
bit 7 − end of conversion bit . should be 0.
%
bit 6 − dummy bit−should be 0
%
bit 6 − sign bit (1 −> result >= 0, 0 −> result < 0)
%
bit 5 − most sig bit. an over or under−voltage bit
%
bits 4−0 − value bits
35
%
m2: all value bits
%
m3: all value bits
%
m4: bits 7−6 value bits
%
bit 5 − least sig bit
40 %
bits 4−0 sub−least sig bit values .
V_ref = 2.5; % reference voltage applied to the ADCs on board
% put matrix into decimal number:
45 result = matrix(1)*2^24+matrix(2)*2^16+matrix(3)*2^8+matrix(4);
result = bitshift(result,−5); % shift to get rid of sub−LSBs
result = bitand(result,16777215); % ensure only the value bits are retained
if bitget(matrix(1),6) % then positive number.
92
50
val = result*V_ref/(2^24−1);
elseif bitget(matrix(1),6) == 0 % negative number.
val = −(16777215−result)*V_ref/(2^24−1);
end
55
end
A.2.2
Room Sensor ADC Communications: open_ser.m
Opens serial communications with the sensor board’s microcontroller via RS232. Written by Elizabeth George [17].
function s = open_ser(port)
5
%% COM Port Handling
portstr = int2str(port);
ports=instrfind;
%Convert COM Port arg to string
% Close all open serial ports
if size (ports,1) > 0
disp( ’Closing␣ serial ␣port␣open␣from␣previous␣run.’);
10
stopasync(instrfind);
fclose (instrfind);
delete (instrfind);
end
15
20
25
% Determine Serial Port Path (Platform−Specific):
if ismac == 1
serial_path = ’/dev/tty.usbserial’;
elseif isunix == 1
serial_path = ’/dev/TTYUSB0’;
elseif ispc == 1
serial_path = strcat(’COM’,portstr); %Create proper serial path with port arg
else
disp( ’Cannot␣figure␣out␣serial␣port␣path.␣␣Plese␣edit␣the␣.m␣file␣manually.’);
return;
end
% Define the serial port
s=serial(serial_path, ’BaudRate’, 9600, ’DataBits’, 8, ’Parity’, ’none’, ’StopBits’, 1, ’
terminator’, ’LF’,’timeout’,2) ; % create a serial port object
set(s, ’Timeout’,1);
30 %Open serial port defined above
fopen(s);
end
93
A.2.3
Room Sensor Tests: verticalSetupTest.m
% Simple routine to automate various configuration tests
% Calls open_ser.m and readADC.m
%
% Brian Sennett, MIT RLE/LEES, October 2014
5
%% User values
ser_port = 6;
ADC = [’0’ , ’1’ , ’2’ , ’3’ ];
10 numPts = 34;
avgpts = 10;
%
%
%
%
Whichever Windows specifies
Use all 4 ADC’s (10KI, 10KQ, 100KI, 100KQ)
Number of steps along scan line
Number of averages
%% Initialize
15
close all
s = open_ser(ser_port); % Open connection to FullyDiff controller
fprintf (s, ’%s’, ’p3’) ; % PWM chop
fprintf (s, ’%s’, ’d3’) ; % DDS
20
% Setup beep on completion of each point
fs = 8000;
T = 0.25; % seconds duration
t = 0:(1/fs):T;
25
fpt = 1500; % frequency in Hz
fbk = 4500;
a = 0.25; % volume
point_beep = a*sin(2*pi*fpt*t);
30 back_beep = a*sin(2*pi*fbk*t);
%% Start scans
output = zeros(length(ADC),numPts);
35
pause(4); % Give me time to run over there
for k = 1:numPts
sound(back_beep, fs); % Alert subject that next point is pending
40
vals = zeros(length(ADC),avgpts);
45
% Flush ADCs before each point
for m = 1:length(ADC)
readADC(s,ADC(m));
end
94
pause(1/6.7)
% Sample each ADC at each point
for n = 1:avgpts
for m = 1:length(ADC)
vals(m,n) = readADC(s,ADC(m));
end
pause(1/6.7);
end
50
55
for m = 1:length(ADC)
output(m,k) = mean(vals(m,:));
end
60
sound(point_beep, fs); % Call subject to move to next point
pause(2)
% Wait for subject to move to next point
end
65
%% Plot results
a10ki = output(1,:);
a10kq = output(2,:);
a100ki = output(3,:);
70 a100kq = output(4,:);
mag10k = sqrt(a10ki.^2+a10kq.^2);
mag100k = sqrt(a100ki.^2+a100kq.^2);
75 phase10k = angle(a10ki+1i*a10kq).*(180/pi);
phase100k = angle(a100ki+1i*a100kq).*(180/pi);
scale = −(numPts−1)/2:(numPts−1)/2;
80
plot(scale, mag10k.*sign(phase10k), scale, mag100k.*sign(phase100k))
title ( ’Response␣Values␣on␣Linear␣Walk’)
legend(’10kHz␣magnitude’, ’100kHz␣magnitude’)
ylabel( ’Magnitude␣[V]’)
xlabel( ’Distance␣from␣centerline,␣source␣plate␣[ tiles ] ’ )
A.3
Python Acquisition Code: cap_sweepGrid2.py
This code is a full-featured script to request, and read, data from the onboard microcontroller in
the scanning-grid experimental setup. The user can sweep across a range of frequencies or select
just one frequency for a grid image. A few different commands are sent via the RS232 serial stream
to the C-code (see A.4.1) running on the embedded microcontroller; each function is defined in its
95
own file, and the probe function, which sweeps across given frequencies at a given grid coordinate,
is used in the below Python code. Adapted from code by John Donnal.
#!/usr/bin/python
5
import numpy as np
import sys
from matplotlib import pyplot as p
import os.path
import time
import serial
import ipdb
10
doBaseline = True
ser = serial.Serial(’/dev/ttyUSB0’, 115200, timeout=1)
ser.flush()
15 p.ion()
data = []
last = 0
run = True
20 bad_frame=True
startCount = 48
stopCount = 64
step = 8
25
# 100 kHz −> 1.7 MHz
# sweepRange = [9, 12, 16, 21, 27, 34, 45, 58, 74, 96, 124, 160]
30
# 10 kHz −> 1.3 MHz
# sweepRange = [12, 16, 22, 31, 42, 60, 83, 115, 160, 222, 309, 430, 596, 829, 1152, 1600]
sweepRange = [64]
35
40
45
if doBaseline:
print "Starting␣baseline␣scan.␣Please␣keep␣hands␣off!"
for row in range(16):
for col in range(16):
statStr = "\n({},{})".format(row,col)
sys.stdout.write(statStr)
for count in sweepRange:
writeStr = "probe␣{}␣{}␣{}\n".format(row, col, count)
ser.write(writeStr);
line = ser.readline()
sample = [int(x) for x in line.split()]
data.append(sample)
96
sys.stdout.write(’.’)
sys.stdout.flush()
# form baseline NP array
data = np.array(data)
baseline = [[16.0e6/x for x in data [:,0]], [y/4096.0+0.05 for y in data [:,1]]]
# convert x series to hz and y series to volts
50
raw_input("place␣item␣to␣scan,␣then␣press␣Enter")
data = []
55 for row in range(16):
for col in range(16):
statStr = "\n({},{})".format(row,col)
sys.stdout.write(statStr)
for count in sweepRange:
60
writeStr = "probe␣{}␣{}␣{}\n".format(row, col, count)
ser.write(writeStr);
line = ser.readline()
sample = [int(x) for x in line.split()]
data.append(sample)
65
sys.stdout.write(’.’)
sys.stdout.flush()
ser.close()
# form sample NP array
70 data = np.array(data)
sample = [[16.0e6/x for x in data [:,0]], [y/4096.0+0.05 for y in data [:,1]]]
# convert x series to hz and y series to volts
# save both baseline and sample arrays to files
75 if doBaseline:
np.savetxt("baseline.csv", baseline, delimiter=",")
filename = "sample.csv"
filenameShort = "sample"
80 while os.path.isfile(filename):
filenameShort += "$"
filename = filenameShort + ".csv"
np.savetxt(filename, sample, delimiter=",")
A.4
A.4.1
Onboard Microcontroller Code
Scanning-Grid Microcontroller Code
main.c
Written by John Donnal.
97
/*
* Include header files for all drivers that have been imported from
* Atmel Software Framework (ASF).
*/
5 #include <asf.h>
#include <string.h>
#include <uart.h>
#include <led.h>
#include "sweep.h"
10 #include <stdio.h>
#include "probe.h"
#include "calib.h"
#include "decoders.h"
15
#define MY_ADC ADCA
#define MY_ADC_CH ADC_CH0
20
#define
#define
#define
#define
WAIT 0
SWEEP 1
CALIB 2
IMAGE 3
void init(void);
25
void process_input(void);
char input_buffer[40];
int input_index =0;
30 int state = WAIT;
void init(void){
board_init();
//setup UART
35
sysclk_init();
pmic_init();
uart_init();
memset(input_buffer,0,sizeof(char)*40);
40
45
//////////////////////////
//250kHz clock setup PWM OCB on TCC0
//////////////////////////
//turn on timer module for port C
sysclk_enable_module(SYSCLK_PORT_C,SYSCLK_TC0);
//output on OCB
TCC0.CTRLB = 1<<5;
98
50
PORTC.DIRSET = 1<<1;
//Waveform mode: freq
TCC0.CTRLB |= 1<<0;
//set frequency
TCC0.CCA = 32;
//start pwm clk/1
TCC0.CTRLA = 1;
55
60
/////////////////////
//setup ADC
//////////////////
PORTA.DIRCLR=1<<2;
struct adc_config adc_conf;
struct adc_channel_config adcch_conf;
adc_read_configuration(&MY_ADC, &adc_conf);
adcch_read_configuration(&MY_ADC, MY_ADC_CH, &adcch_conf);
65
70
75
80
adc_set_conversion_parameters(&adc_conf, ADC_SIGN_OFF, ADC_RES_12,
ADC_REF_BANDGAP);
adc_set_conversion_trigger(&adc_conf, ADC_TRIG_MANUAL, 1, 0);
adc_set_clock_rate(&adc_conf, 200000UL);
adcch_set_input(&adcch_conf, ADCCH_POS_PIN2, ADCCH_NEG_NONE, 1);
adc_write_configuration(&MY_ADC, &adc_conf);
adcch_write_configuration(&MY_ADC, MY_ADC_CH, &adcch_conf);
adc_enable(&MY_ADC);
//////////////////
//setup decoder ports
/////////////////
PORTD.DIR = 0xE7;
PORTE.DIRSET = (1<<2)|(1<<3);
led_init();
cpu_irq_enable();
}
int main (void)
{
85
init();
int drive=0;
int sense=0;
char buffer[20];
uint16_t result;
90
while(1) ;
while(1){
PORTB.OUTTGL=1<<2;
sprintf(buffer,"frame␣clock:%d\n",64);
for (sense=0;sense<16;sense++){
95
for (drive=0;drive<16;drive++){
99
write_decoders(drive,sense);
delay_us(20);
adc_start_conversion(&MY_ADC, MY_ADC_CH);
adc_wait_for_interrupt_flag(&MY_ADC, MY_ADC_CH);
result = adc_get_result(&MY_ADC, MY_ADC_CH);
sprintf(buffer,"%d␣",result);
PORTB.OUTTGL=1<<1;
100
}
}
write_decoders(0,0);
delay_ms(10);
105
};
}
110
115
120
125
130
135
ISR(USARTC0_RXC_vect){
uint8_t data = USARTC0.DATA;
switch(state){
case WAIT:
//USARTC0.DATA = data; //echo the input optionally
input_buffer[input_index++]=data;
if (data==’\n’){
process_input();
input_index=0;
}
if (input_index>=40){
input_index=0;
uart_print("input␣overflow␣error\n");
}
break;
case CALIB:
if (calib_step()){
state=WAIT;
uart_print("calibration␣done\n");
}
break;
default :
uart_print("state␣error\n");
}
}
/*input is formatted as command: arg1,arg2,arg3,arg4
* even if a command doesn’t need all 4 args, some numbers
* must be present
140 */
void process_input(void){
char cmd[40];
int arg [4];
100
int res = sscanf(input_buffer,"%s␣%d␣%d␣%d␣%d\n",
cmd,&arg[0],&arg[1],&arg[2],&arg[3]);
char output_buffer[40];
sprintf(output_buffer,"res:␣%d\n",res);
sprintf(output_buffer,"cmd:␣%s,␣[%d,%d,%d,%d]\n",
cmd,arg[0],arg [1], arg [2], arg[3]) ;
if (strcmp("scan",cmd)==0)
uart_print("scanning...\n");
else if (strcmp("sweep",cmd)==0){
state=SWEEP;
sweep_start(arg[0],arg[1],arg[2],arg[3]) ;
state=WAIT;
}
else if (strcmp("calib",cmd)==0){
state=CALIB;
calib_start();
} else if (strcmp("probe",cmd)==0){
probe(arg[0],arg[1],arg[2]) ;
}
else
uart_print("unknown␣command\n");
145
150
155
160
165
}
calib.c
Written by John Donnal.
5
#include <asf.h>
#include "calib.h"
#include "uart.h"
#include "decoders.h"
int row,col;
void calib_start(void){
row=0;
col=0;
10
write_decoders(row,col);
uart_print("#");
}
15
20
int calib_step(void){
if (++col>=16){
col=0;
uart_print("\n");
if (++row>=16){
return 1;
}
}
101
uart_print("#");
write_decoders(col,row);
return 0;
25
}
decoders.c
Written by John Donnal.
#include <asf.h>
#include "decoders.h"
5
10
15
20
25
30
35
void write_decoders(int drive, int sense){
if ((drive&(1<<3))==(1<<3)){
PORTD.OUTSET=1<<5;
} else {
PORTD.OUTCLR=1<<5;
}
if ((drive&(1<<2))==(1<<2)){
PORTD.OUTSET=1<<6;
} else {
PORTD.OUTCLR=1<<6;
}
if ((drive&(1<<1))==(1<<1)){
PORTD.OUTSET=1<<7;
} else {
PORTD.OUTCLR=1<<7;
}
if ((drive&(1<<0))==((1<<0))){
PORTD.OUTSET=1<<2;
} else {
PORTD.OUTCLR=1<<2;
}
/////////////////////////
if ((sense&(1<<3))==(1<<3)){
PORTE.OUTSET=1<<2;
} else {
PORTE.OUTCLR=1<<2;
}
if ((sense&(1<<2))==(1<<2)){
PORTE.OUTSET=1<<3;
} else {
PORTE.OUTCLR=1<<3;
}
if ((sense&(1<<1))==(1<<1)){
PORTD.OUTSET=1<<0;
} else {
PORTD.OUTCLR=1<<0;
102
40
}
if ((sense&(1<<0))==((1<<0))){
PORTD.OUTSET=1<<1;
} else {
PORTD.OUTCLR=1<<1;
}
45
}
probe.c
Written by John Donnal.
5
#include
#include
#include
#include
#include
<asf.h>
<stdio.h>
"probe.h"
"decoders.h"
"uart.h"
void probe(int row, int col, int pwm_count){
char buf[40];
uint32_t result=0;
10
sprintf(buf,"probing␣(%d,␣%d)␣@␣%d\n",row,col,pwm_count);
write_decoders(col,row);
//uart_print(buf);
TCC0.CCA=pwm_count;
delay_ms(100);
15
result=0;
for ( int j=0;j<8;j++){
adc_start_conversion(&ADCA, ADC_CH0);
adc_wait_for_interrupt_flag(&ADCA, ADC_CH0);
result += adc_get_result(&ADCA, ADC_CH0);
20
}
result=result/8;
sprintf(buf,"%d␣%d\n",pwm_count,result);
uart_print(buf);
}
sweep.c
Written by John Donnal.
5
#include
#include
#include
#include
#include
"uart.h"
"decoders.h"
"sweep.h"
<stdio.h>
<asf.h>
103
10
15
20
25
void sweep_start(int row, int col, int start, int stop){
char buf[40];
uint32_t result=0;
sprintf(buf,"sweeping␣(%d,␣%d)",row,col);
write_decoders(col,row);
//uart_print(buf);
for ( int i=start;i<stop;i++){
TCC0.CCA=i;
delay_ms(100);
result=0;
for ( int j=0;j<8;j++){
adc_start_conversion(&ADCA, ADC_CH0);
adc_wait_for_interrupt_flag(&ADCA, ADC_CH0);
result += adc_get_result(&ADCA, ADC_CH0);
}
result=result/8;
sprintf(buf,"%d␣%d\n",i,result);
uart_print(buf);
}
uart_print("done\n");
}
uart.c
Written by John Donnal.
#include
#include
#include
#include
<asf.h>
<string.h>
"uart.h"
"led.h"
5
void uart_init(void){
//using UARTC0
//0. Enable the submodule clock
sysclk_enable_module(SYSCLK_PORT_C, PR_USART0_bm);
10
//1. Set the Tx pin high
PORTC.OUT |= (1<<3);
//2. Set the TxD as output and RxD as input
PORTC.DIR |= (1<<3);
PORTC.DIR &= ~(1<<2);
15
//3. Set the baud rate and frame format.
//clk_per=32MHz
//115200: BSCALE = 1079, BSEL = −5
//http://www.avrcalc.elektronik−projekt.de/xmega/baud_rate_calculator
//
20
USARTC0.BAUDCTRLA = 0x37;
104
USARTC0.BAUDCTRLB = 0xB4;
//4. Set the mode of operation (enables XCK pin output in synchronous mode).
USARTC0.CTRLC = 0x3; //8N1
//5. enable receiver interrupts
USARTC0.CTRLA = 0x30;
//6. Enable the transmitter and receiver using 2x clock
USARTC0.CTRLB = (1<<4)|(1<<3)|(1<<2);
25
}
30 uint8_t uart_print(const char* data){
int len = strlen(data);
for ( int i=0;i<len;i++){
USARTC0.DATA = data[i];
while((USARTC0.STATUS&(1<<6))!=(1<<6));
35
USARTC0.STATUS|=(1<<6);
}
return len;
}
uint8_t uart_read(uint8_t* data, uint8_t maxlen){
40
//check if there is any data
uint8_t len=0;
while(USARTC0.STATUS&(1<<7) && len<maxlen){
USARTC0.STATUS|=(1<<7);
data[len++]=USARTC0.DATA;
45
}
return len;
}
A.4.2
Room-Sensor Microcontroller Code: fullyDiff.c
Written by William Thompson [16].
5
10
/*
Fully Differential Standalone Sensor Code
MIT 04/2012
BJ Thompson
Rev. 1
*/
/*
Adapted from:
LUFA Library
Copyright (C) Dean Camera, 2012.
15
dean [at] fourwalledcubicle [dot] com
www.lufa−lib.org
105
*/
20
25
/*
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute , and sell this
software and its documentation for any purpose is hereby granted
without fee , provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific , written prior permission.
30
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness . In no event shall the author be liable for any
special , indirect or consequential damages or any damages
35
whatsoever resulting from loss of use, data or profits , whether
in an action of contract, negligence or other tortious action ,
arising out of or in connection with the use or performance of
this software.
*/
40
/** \ file
*
* Main source file for the Fully Differential Standalone Sensor board.
* This file contains the main resources for using the board:
45 * − hardware configuration and initialization
* − USB and virtual serial communication
*
*/
50
#include "FullyDiff.h"
#include <stdlib.h>
/** LUFA CDC Class driver interface configuration and state information. This structure is
* passed to all CDC Class driver functions, so that multiple instances of the same class
55 * within a device can be differentiated from one another.
*/
USB_ClassInfo_CDC_Device_t FullyDiff_CDC_Interface =
{
.Config =
60
{
.ControlInterfaceNumber
= 0,
.DataINEndpointNumber
.DataINEndpointSize
106
= CDC_TX_EPNUM,
= CDC_TXRX_EPSIZE,
65
.DataINEndpointDoubleBank
= false,
.DataOUTEndpointNumber
= CDC_RX_EPNUM,
.DataOUTEndpointSize
= CDC_TXRX_EPSIZE,
.DataOUTEndpointDoubleBank = false,
70
.NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM,
.NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
.NotificationEndpointDoubleBank = false,
},
75
};
/** Standard file stream for the CDC interface when set up, so that the virtual CDC COM port
can be
* used like any regular character stream in the C APIs
*/
80 static FILE USBSerialStream;
/* Global Variables */
char ADC_buf[5]; //Array to consolidate ADC conversions
85
char lastPress = 0;
bool debugFlag = true;
90
// Generic bad input message
char *ErrStr = "Bad␣Input.\r\n";
/** Main program entry point. This routine contains the overall program flow, including initial
* setup of all components and the main program loop.
**/
95 int main(void)
{
SetupHardware();
100
/* Create a regular character stream for the interface so that it can be used with the
stdio .h functions */
CDC_Device_CreateStream(&FullyDiff_CDC_Interface, &USBSerialStream);
//LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
105
for (;;)
{
CheckPE2();
110
/* Must throw away unused bytes from the host, or it will lock up while waiting for
107
the device */
uint16_t BytesReceived = CDC_Device_BytesReceived(&FullyDiff_CDC_Interface
);
if (BytesReceived)
{
115
120
125
130
135
140
145
150
155
int16_t recByte = CDC_Device_ReceiveByte(&FullyDiff_CDC_Interface);
switch (recByte)
{
case ’A’: // ADC Command
{
int16_t ADC_rec = 0;
if (debugFlag)
{
// Echo received command byte
CDC_Device_SendByte(&FullyDiff_CDC_Interface,recByte);
CDC_Device_SendString(&FullyDiff_CDC_Interface,":␣\r\n");
}
// Receive channel byte and check if valid
ADC_rec = waitforByte();
// Select a single ADC
if (ADC_rec >= ’0’ && ADC_rec <= ’6’)
{
uint8_t chan = ADC_rec−’0’;
ADC_flush();
ADC_read(chan);
ADC_response(); // Responds with 4 bytes
}
// Select all ADCs
else if (ADC_rec == ’a’ || ADC_rec == ’A’)
{
for ( int i = 0; i < 6; i++)
{
ADC_flush();
ADC_read(i);
ADC_response(); // Responds with 4*6=24 bytes
}
}
// (Re)Configure ADCn
else if (ADC_rec == ’w’)
{
// placeholder for writing to ADC
108
}
// Invalid input
else
reportError();
160
}
break;
165
case ’d’ :
{
int16_t DDS_rec = 0;
DDS_rec = waitforByte();
if (checkHex(DDS_rec))
{
170
if (DDS_rec == ’1’)
{
DDS_Config(6,0x00100000);
DDS_Config(7,0x00100000);
}
else if (DDS_rec == ’2’)
{
DDS_Config(6,0x00800000);
DDS_Config(7,0x00800000);
}
else if (DDS_rec == ’3’)
{
DDS_Config(6,0x00100000);
DDS_Config(7,0x00800000);
}
else if (DDS_rec == ’0’)
{
DDS_Config(6,0);
DDS_Config(7,0);
}
175
180
185
190
}
else
{
195
reportError();
break;
}
200
/*
CDC_Device_SendByte(&FullyDiff_CDC_Interface,DDS_rec);
CDC_Device_SendString(&FullyDiff_CDC_Interface,"\r\n");
*/
}
109
205
210
break;
case ’D’: // DDS Command
{
// Initialize DDS byte buffer
// 1 Byte channel, 4 Byte data = 5 bytes + NULL
char DDS_bytes[6];
int16_t DDS_rec = 0;
uint8_t DDS_chan = 0;
uint16_t DDS_com = 0;
215
220
225
230
// Wait for 4 incoming bytes and check if input is valid
for ( int i = 0; i < 5; i++)
{
DDS_rec = waitforByte();
if (checkHex(DDS_rec))
{
// Save input if valid
DDS_bytes[i] = DDS_rec;
}
else
{
// Terminate buffer and exit if not valid
DDS_bytes[i] = ’\0’;
reportError();
break;
}
}
235
// Terminate buffer
DDS_bytes[5]= ’\0’;
240
// Extract, convert, and write DDS channel and command from input
DDS_chan = (uint8_t) (DDS_bytes[0] & 0x0F);
DDS_com = (uint16_t) strtoul(&DDS_bytes[1],NULL,16);
DDS_Set(DDS_chan,DDS_com);
245
250
// Echo received DDS instruction
if (debugFlag)
{
fprintf(&USBSerialStream,"DDS:␣Chan:%X␣Command:%X\r\n",
DDS_chan,DDS_com);
}
}
break;
case ’p’ :
{
int16_t pwm_rec = 0;
110
255
260
265
270
275
280
285
290
295
pwm_rec = waitforByte();
if (checkHex(pwm_rec))
{
if (pwm_rec == ’1’) // Set PWM chans to 41.6kHz
{
OCR0A = 0x17;
OCR1A = 0x0060;
OCR4C = 0xC0;
OCR4B = OCR4C/2;
}
else if (pwm_rec == ’2’) // Set PWM chans to 333kHz
{
OCR0A = 0x02;
OCR1A = 0x000C;
OCR4C = 0x18;
OCR4B = OCR4C/2;
}
else if (pwm_rec == ’3’) // PWM1: 41.6kHz, PWM2: 333kHz
{
OCR0A = 0x02;
OCR1A = 0x0060;
OCR4C = 0x18;
OCR4B = OCR4C/2;
}
}
else
{
reportError();
break;
}
}
break;
case ’P’: // PWM Command
{
CDC_Device_SendByte(&FullyDiff_CDC_Interface,recByte);
CDC_Device_SendString(&FullyDiff_CDC_Interface,"\r\n");
char PWM_bytes[4];
int16_t PWM_rec = 0;
for ( int i = 0; i < 3; i++)
{
PWM_rec = waitforByte();
if (checkHex(PWM_rec))
{
PWM_bytes[i] = PWM_rec;
}
111
300
else
{
reportError();
break;
}
305
}
PWM_bytes[3] = ’\0’;
if (PWM_bytes[0] == ’1’)
{
OCR0A = (uint8_t) strtoul(&PWM_bytes[1],NULL,16);
fprintf(&USBSerialStream,"%d\r\n",(uint8_t) strtoul(&PWM_bytes
[1],NULL,16));
}
else if (PWM_bytes[0] == ’2’)
{
OCR1A = (uint8_t) strtoul(&PWM_bytes[1],NULL,16);
fprintf(&USBSerialStream,"%d\r\n",(uint8_t) strtoul(&PWM_bytes
[1],NULL,16));
}
else if (PWM_bytes[0] == ’3’)
{
OCR4C = (uint8_t) strtoul(&PWM_bytes[1],NULL,16);
OCR4B = OCR4C/2;
fprintf(&USBSerialStream,"%d\r\n",(uint8_t) strtoul(&PWM_bytes
[1],NULL,16));
}
else
{
reportError();
break;
}
310
315
320
325
}
break;
330
}
335
340
}
else if (BytesReceived > 1)
{
char recBytes[BytesReceived+1];
for ( int i = 0; i < BytesReceived; i++)
{
recBytes[i] = CDC_Device_ReceiveByte(&FullyDiff_CDC_Interface);
}
CDC_Device_SendString(&FullyDiff_CDC_Interface,recBytes);
}
CDC_Device_USBTask(&FullyDiff_CDC_Interface);
112
345
USB_USBTask();
}
}
void delay_ms(uint8_t count)
350 {
while (count−−)
{
_delay_ms(1);
}
355 }
bool checkHex(int16_t data)
{
if (data >= ’0’ && data <= ’9’)
360
{
return true;
}
else if (data >= ’a’ && data <= ’f’)
{
365
return true;
}
else if (data >= ’A’ && data <= ’F’)
{
return true;
370
}
else
return false;
}
375
void reportError(void)
{
debugCheck();
//Clear CDC buffer and exit if input not valid
CDC_Device_Flush(&FullyDiff_CDC_Interface);
CDC_Device_SendString(&FullyDiff_CDC_Interface,ErrStr);
380
}
385 int16_t waitforByte(void)
{
// Wait for an incoming byte
while (!( CDC_Device_BytesReceived(&FullyDiff_CDC_Interface))) {continue;}
390
// Receive incoming byte
return CDC_Device_ReceiveByte(&FullyDiff_CDC_Interface);
}
113
/* Configures the board hardware and chip peripherals */
395 void SetupHardware(void)
{
/* Disable watchdog if enabled by bootloader/fuses */
MCUSR &= ~(1 << WDRF);
wdt_disable();
400
MCUCR = (1 << JTD);
MCUCR = (1 << JTD);
/* Disable clock division */
clock_prescale_set(clock_div_1);
405
/* Hardware Initialization */
//LEDs_Init();
USB_Init();
SPI_Init();
410
/* Set up pin direction for button */
DDRE &= ~(1 << PE2);
PORTE |= (1 << PE2);
/* Set up pin directions for CS and disable all chips */
DDRD = 0xFF;
PORTD = 0xFF;
415
/* Set up PWM for chopper channels */
PWM_Init();
420
/* Set up PWM on Status LEDs */
LEDs_PWMInit();
425
/* Set up Debug Mode */
DDRF &= ~(1 << PF7);
PORTF |= (1 << PF7);
debugCheck();
430
DDS_Init();
}
435
/* Set up PWM pins on board */
void PWM_Init(void)
{
/* Set up directions for PWM pins */
DDRB |= (1 << PB5)|(1 << PB6)|(1 << PB7);
DDRC |= (1 << PC6);
440
114
445
450
455
460
465
470
475
480
485
/* Set up PWM for 8−bit TC0
OC0A on PB7 connected, toggle on compare match
WGM = 1 (0b010), TOP=OCRA0
Prescaler : CLK/8
TCCR0A = 0b01000010;
TCCR0B = 0b00000010; */
/* No prescaler: 0x00 = 8MHz, 0xFF = 31.2kHz
* CLK/8:
0x00 = 1MHz, 0xFF = 3.94kHz
* CLK/8:
0x02 = 333kHz, 0x18 = 40kHz
* CLK/8:
0x17 = 41.6kHz
*/
TCCR0A = 0;
TCCR0A |= (1<<WGM01);
TCCR0B |= (1<<CS01);
OCR0A = 0x02;
TCCR0A |= (1<<COM0A0);
/* Set up PWM for 16−bit TC1, OC1A on PB5
Use frequency and phase correct mode:
− Mode: Toggle OC1A on compare match (OC1x disconnected)
− WGM: Mode 9 (1001)
− Prescaler: CLK/1 (none)
− TCCR1A = 0b01000001;
− TCCR1B = 0b00010001; */
/* OCR1A: 400kHz = 0x0A, 333.33kHz = 0x0C, 40kHz = 0x64, 41.6kHz = 0x60 */
// Chan: 40kHz
TCCR1A = 0;
TCCR1A = (1<<WGM10);
TCCR1B = (1<<WGM13)|(1<<CS10);
OCR1A = 0x0060;
TCCR1A |= (1<<COM1A0);
/* Set up PWM for 10−bit TC4, OC4B on PB6
Use frequency and phase correct mode:
− Mode:
− WGM:
− Prescaler: CLK/1 (none)
− TCCR4A = 0b00100000
− TCCR4B = 0b00000001
− TCCR4C = 0b00100000
− TCCR4D = 0b00000001 */
/* OCR4C (TOP): 400kHz = 0x14, 40kHz = 0xC8,
0CR4C (TOP): 333.33kHz = 0x18, 41.6kHz = 0xC0,
OCR4B (MATCH): 50% Duty Cycle = OCR4C/2 */
// Chan: 400kHz
TCCR4A = (1<<COM4B1);
TCCR4B = (1<<CS40);
TCCR4C = (1<<COM4B1S);
115
TCCR4D = (1<<WGM40);
TCCR4A |= (1<<PWM4B); //Enable PWM on OC4B
OCR4C = 0x18;
OCR4B = OCR4C/2;
490
/* Set up PWM for 4MHz DDS clock on TC3,
* Using OC3A on PC6 CTC mode,
* OCR3A: 0x01 = 4MHz, 0x02 = 2.67MHz, 0x18 = 320kHz
*/
TCCR3A = 0;
TCCR3B = (1<<WGM32)|(1<<CS30);
OCR3A = 0x02;
TCCR3A |= (1<<COM3A0);
495
500
}
void SPI_Init(void)
505 {
/* Set up SPI Data Directions:
− !SS (PB0): output
− MOSI (PB1): output
− SCK (PB2): output
510
− MISO (PB3): input
explicitly set !SS as output to ensure SPI configuration */
//DDR_SPI = (1<<DD_MOSI)|(1<<DD_SCK);
DDRB = ((1 << PB0) | (1 << PB1) | (1 << PB2));
PORTB |= (1 << PB0);
515
/* Enable SPI as Master with clock rate fck/16
Transmit MSB first (DORD=0), SCK low when idle (CPOL=0)
Sample data on trailing ( falling ) edge (CPHA=1) */
//SPCR = (1<<SPE)|(1<<MSRT)|(1<<CPHA)|(1<<SPR0);
520
SPCR = 0b01010101;
}
uint8_t SPI_transmit(uint8_t data)
{
525
/* Send data */
SPDR = data;
/* Wait for transmission complete */
while (!( SPSR & (1<<SPIF)));
530
/* Return received byte */
return SPDR;
}
535
void ADC_read(uint8_t chan)
{
116
/* Sample data on trailing edge (CPHA=1)
May need to reconfigure sample edge depending on how MOSI data works */
//SPCR = 0b01010101;
SPCR = 0b01011101;
540
/* Chip Select Enable */
PORTD &= ~(1 << chan);
/* Send dummy bytes over SPI and read back 4 byte conversion */
for ( int i = 0; i < 4; i++)
{
ADC_buf[i] = SPI_transmit(0x00);
}
545
550
/* Chip Select Disable */
PORTD |= (1 << chan);
}
555
void ADC_flush(void)
{
/* Clear ADC temp bytes and buffer*/
for ( int i = 0; i < 4; i++)
{
560
ADC_buf[i] = 0;
}
}
void DDS_Set(uint8_t chan, uint16_t data)
{
/* Ensure that only DDS can be selected */
if ((chan == PD6) || (chan == PD7))
{
unsigned char dataH = (data >> 8);
570
unsigned char dataL = (data & 0xFF);
565
/* Shift data on FALLING edge of SCK
SCK idles HIGH when FSYNC/CS goes low (mode 3) */
SPCR = 0b01011001;
575
/* Chip Select Enable */
PORTD &= ~(1 << chan);
580
/* Send DDS setup data (no data to read back) */
SPI_transmit(dataH);
SPI_transmit(dataL);
/* Chip Select Disable */
PORTD |= (1 << chan);
117
585
}
}
/* Configures DDS with a 10kHz and 100kHz sine wave on Ch. A and B */
void DDS_Init(void)
590 {
/* Reset and Initialize */
DDS_Set(PD6, 0x2100);
// Reset first DDS, set for loading a complete word into either
frequency register (B28 bit of control register )
//DDS_Set(PD7, 0x2100);
595
/* Write to frequency register (Fout,Fin):
* Fmclk = 320kHz:
* 10kHz = 0x00800000,
*
* Fmclk = 2.67MHz:
* 10.416kHz = 0x00100000,
* 83.3kHz = 0x00800000,
* 125kHz = 0x00C00000,
*
* (~10khz, 4MHz) = 0x000A3D70, (~100kHz, 4MHz) = 0x00666666
* (~10kHz, 5MHz) = 0x00083126, (~100kHz, 5MHz) = 0x0051EB85
*/
DDS_Freq(PD6,0,0x00800000);
600
605
/* Write PHASE0 Reg */
DDS_Phase(PD6,0,0);
610
/* Exit Reset and Begin Output */
DDS_Set(PD6, 0x2000);
//DDS_Set(PD7, 0x2000);
615
}
void DDS_Config(uint8_t chan, uint32_t freq)
{
//DDS_Set(chan, 0x2100);
// take this out −− no need to reset, making unnecessary offset
620
DDS_Freq(chan,0,freq);
DDS_Phase(chan,0,0);
//DDS_Set(chan,0x2000); //take this out −− redundant
}
625
void DDS_Freq(uint8_t en, uint16_t reg, uint32_t freg)
{
/*
*
*
630
* freg is the 28 bit result of the following :
* freg = (fout/fmclk)*2^28
118
*/
reg = (reg + 1) & 0x03;
635
uint16_t fregL = (reg << 14) | (0x3FFF & freg);
uint16_t fregH = (reg << 14) | (0x3FFF & (freg >> 14));
DDS_Set(en,fregL);
DDS_Set(en,fregH);
640
//DDS_Set(en,0x4000);
//DDS_Set(en,0x4040);
}
645
void DDS_Phase(uint8_t en, uint16_t reg, uint16_t preg)
{
/*
* The phase registers are written to with a 16−bit word.
650
* D15 and D14 are always 1, D13 selects PHASE0 or PHASE1
* registers . D12 doesn’t matter. The remaining 12 bits
* are preg.
*
* preg is the 12 bit result of the following :
655
* preg = (phase_shift*2^12)/(2*pi)
*/
reg = (reg & 0x01) << 13;
preg = (3 << 14) | reg | (0x0FFF & preg);
660
DDS_Set(en,preg);
}
665
void debugCheck(void)
{
uint8_t PF7Stat = (PINF & (1 << PF7));
if (! PF7Stat)
{
debugFlag = true;
}
else
debugFlag = false;
670
}
675
void CheckPE2(void)
{
uint8_t PE2Stat = (PINE & (1 << PE2));
char* ReportString = NULL;
119
680
static bool ActionSent = false;
685
if (! PE2Stat)
{
ADC_flush();
ADC_read(1);
690
ReportString = "Button␣Down\r\n";
}
else
ActionSent = false;
if ((ReportString != NULL) && (ActionSent == false))
{
ActionSent = true;
695
CDC_Device_SendString(&FullyDiff_CDC_Interface, ReportString);
ADC_response();
}
}
700
void ADC_response(void)
{
char ADC_chars[5];
705
// There are two methods for sending data over serial :
// Method 1: Using the CDC_Interface
for ( int i = 0; i < 4; i++)
{
sprintf(ADC_chars,"%02X",ADC_buf[i]);
CDC_Device_SendString(&FullyDiff_CDC_Interface, ADC_chars);
}
CDC_Device_SendString(&FullyDiff_CDC_Interface,"\r\n");
710
// Method 2: Using the USBSerialStream
/*for ( int i = 0; i < 4; i++)
{
fprintf (&USBSerialStream,"%XX",ADC_buf[i]);
}
CDC_Device_SendString(&FullyDiff_CDC_Interface,"\r\n");*/
715
720
}
/** Event handler for the library USB Connection event. */
void EVENT_USB_Device_Connect(void)
{
725
//LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
LEDs_SetBrightness(LEDS_BLU,LOW);
}
120
/** Event handler for the library USB Disconnection event. */
730 void EVENT_USB_Device_Disconnect(void)
{
//LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
LEDs_SetBrightness(LEDS_BLU,HALF);
}
735
/** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_Device_ConfigurationChanged(void)
{
bool ConfigSuccess = true;
740
ConfigSuccess &= CDC_Device_ConfigureEndpoints(&FullyDiff_CDC_Interface);
//LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY :
LEDMASK_USB_ERROR);
LEDs_SetBrightness(LEDS_BLU,ConfigSuccess ? LOW : HIGH);
745
}
/** Event handler for the library USB Control Request reception event. */
void EVENT_USB_Device_ControlRequest(void)
{
750
CDC_Device_ProcessControlRequest(&FullyDiff_CDC_Interface);
}
121
122
Appendix B
Long-Range Sensor Schematics
123
124
E
D
C
B
CB2
1u
GND
1u
GND
-5V
DRIVE
SMA-ONLY
CB1
+5V
PWR-1
PWR-2
PWR-3
22-23-2031
-5V
PLATE
GND
+5V
GND@4
GND@1
GND@2
GND@3
IN
2
PD
IC1
.01u
FB
OUT
C1
180pF
10M, .01%
R1
-5V
V-
ADA4817-1
V+
+5V
-5V
GND
GND
3
51, .05%
R3
GND
SHDN
IC2
500, .05%
R2
-5V
V-
LT1806
V+
+5V
-5V
GND
GND
4
51, .05%
R4
10, 1%
R5
VCM
SEN
GND
R6
5
51, .05%
A
1
CB3 CB5
CB4
CB6 CB9 CB8
CB7
.1u
.1u
.01u
.1u
.1u
.1u
GND
GND
GND
GND
6
E
D
C
B
A
B.1.1
CON2
CON1
B.1
Active Electrode
Schematic
B.1.2
PCB Layout
125
Detail of active electronics and connectors on corner of electrode.
126
B.2
B.2.1
Sensor Board
Schematic
127
128
129
130
131
132
133
134
135
136
137
138
B.2.2
PCB Layout
139
E
D
C
IN1
IN1
10u
IN2
IN2
VI
VO
IN
OP2
OP2
GAIN3
-40V
-VS
2 -
3 +VS
+
HVOUT
10u
C9
HVDIV
PWR1
PWR2
PWR3
3
GND
+50V
GND
SJ2
GND
10u
C8
ADJ
VO
Low
15V:
R1 = 2.8k
R2 = 249
VI
D6
IC4
317T
2
IN2
2
D5
+15V
-VS
2 -
3 +VS
+
High
26.5V:
R1 = 5.1k
R2 = 249
35V:
R1 = 6k
R2 = 249
CON2
SMA-W/_BNC
GND@3
GND@2
GND@1
GND@7
GAIN1
TERM-BLK-3
+50V
GND
-50V
1u
C13
+40V
-15V
GND
AD8610R
6
IC8
GAIN2 GAIN3 HVOUT HVDIV
GAIN2
.1u
.1u
-15V
CB6
CB9
CB3
.1u
+40V
2
GND
+15V
10u
C11
ADJ
D7
IC6
317T
C12
3
GND
+50V
GND@3
GND@2
GND@1
GND@7
GND
IN1
D8
7
4
CB1
OFF
OFF
CON1
SMA-W/_BNC
10k
R12
R13
B
1
RP1
R1
R2
1
5
IN
3
+15V
+15V
GND
AD8610R
6
IC1
GND
VIN-
GAIN2 VIN+
1u
C10
-50V
GND
+40V
2
10u
D3
3
GND
VO
10u
C5
ADJ
IC5
337T
VI
100k
-40V
R3
IC3
GND
OPA452/3S VO
C6
GND
-15V
R10
R11
CB2
CB4
CC1
.1u
.1u
7
4
1
5
CC2
V-
OFF
OFF
CB5
1u
.1u
.1u
CB15
.1u
.1u
330pF
330pF
R1
1
1
50k
CB14
V+
FLAG
CB8
CB7
1u
1
GAIN3
10
R5
P42/29-AUTO-TRANSFORMER
GND
-50V
GND
IN
2
10u
C4
D2
VO
10u
C2
ADJ
1
IC7
337T
VI
GND
GND@7
GND@1
GND@2
GND@3
HVOUT
HVDIV
GND
-15V
1u
C3
CTR
L1
5
1M
A
D4
R1
R2
10k
4
R8
R9
TOP
BOT
3
R2
R1
R4
R2
3
SMA-W/_BNC
CON3
D1
2
6
R6
1
R2
140
R7
-40V
1u
C7
E
D
C
B
A
B.3.1
R1
B.3
High-Voltage Source
Schematic
B.3.2
PCB Layout
141
142
Bibliography
[1] G.E. Gerpheide. Methods and apparatus for data input, April 19 1994. US Patent 5,305,017.
[2] Marty Jerome. Lightweight, low-cost challenger. PC Computing, page 96, December 1995.
[3] S. Madhusudana Rao, Kewu Zhu, Chi-Hwa Wang, and Sankaran Sundaresan. Electrical capacitance tomography measurements on the pneumatic conveying of solids. Ind. Eng. Chem. Res.,
40:4216–4226, 2001.
[4] Wenbiao Zhang, Chao Wang, Wuqiang Yang, and Chi-Hwa Wang. Application of electrical
capacitance tomography in particulate process measurement. Advanced Powder Technology,
25(1):174–188, 2014.
[5] Gert Holler, Anton Fuchs, Bernhard Schweighofer, and Georg Brasseur. Comparison of measurement results and simulations based on finite element method for an electrical capacitance
tomography system. In Sensors for Industry Conference, pages 109–115. IEEE, January 2004.
[6] A. V. Mamishev, A. R. Takahashi, Y. Du, B. C. Lesieutre, and M. Zahn. Parameter estimation
in dielectrometry measurements. Journal of Electrostatics, 56:465–492, 2002.
[7] R.C. Franklin and F.I. Fuller. Electronic wall stud sensor, July 4 1978. US Patent 4,099,118.
[8] T. Schlegl, T. Bretterklieber, M. Neumayer, and H. Zangl. Combined capacitive and ultrasonic
distance measurement for automotive applications. Sensors Journal, IEEE, 11(11):2636–2642,
Nov 2011.
[9] Boby George, Hubert Zangl, Thomas Bretterklieber, and Georg Brasseur. Seat occupancy detection based on capacitive sensing. IEEE Transactions on Instrumentation and Measurement,
58(5):1487–1494, 2009.
[10] Boby George, Hubert Zangl, Thomas Bretterklieber, and Georg Brasseur. A combined
inductive–capacitive proximity sensor for seat occupancy detection. IEEE Transactions on
Instrumentation and Measurement, 59(5):1463–1470, 2010.
[11] John J. Cooley, Al-Thaddeus Avestruz, and Steven B. Leeb. A retrofit capacitive sensing
occupancy detector using fluorescent lamps. IEEE Transactions on Industrial Electronics,
59(4):1898–1911, 2012.
[12] United States House of Representatives. Transportation security administration authorization
act of 2011. H. R. 3011, September 22 2011.
[13] Shahriar Khushrushahi. Electric capacitive tomography research. Final Draft, 2011-2012.
[14] J. R. Smith. Field mice: Extracting hand geometry from electric field measurements. IBM
Systems Journal, 35(3 & 4):587–608, 1996.
[15] Joshua Smith, Tom White, Christopher Dodge, Joseph Paradiso, Neil Gershenfeld, and David
Allport. Electric field sensing for graphical interfaces. Computer Graphics and Applications,
18(3):54–60, May/June 1998.
143
[16] William H. Thompson. A standalone capacitively coupled occupancy sensor. Master’s thesis,
Massachusetts Institute of Technology, 2012.
[17] Elizabeth C. George. Advanced applications in wide-area impedance sensing. Master’s thesis,
Massachusetts Institute of Technology, 2014.
[18] David B. Small, Paul S. Rago, and James M. Hair III. Interactive book reading system using
rf scanning circuit, January 16 2004. US Patent Application No. 10/758,779.
[19] Larry K. Baxter. Capacitive Sensors: Design and Applications. IEEE Press, New York, NY,
1997.
[20] United States Department of Energy. Annual energy outlook 2014. Energy Information Administration, Tables 4 and 5, February 2014.
[21] Zhiqiang Zhang, Xuebin Gao, J. Biswas, and Jian Kang Wu. Moving targets detection and
localization in passive infrared sensor networks. In Information Fusion, 2007 10th International
Conference on, pages 1–6, July 2007.
[22] John Jacob Cooley. Analysis, Modeling and Design of Energy Management and Multisource
Power Systems. PhD thesis, Massachusetts Institute of Technology, June 2011.
[23] Hermann A. Haus and James R. Melcher. Electromagnetic Fields and Energy. Prentice-Hall,
Englewood Cliffs, NJ, 1989.
[24] COMSOL. AC/DC Module User’s Guide, comsol 4.3b edition, May 2013.
[25] S. M. Musa and M. N. O. Sadiku. Fast computation of capacitance matrix and potential
distribution for multiconductor in non-homogenous multilayered dielectric media. In Proceedings
of the COMSOL Conference 2009 Boston, 2009.
[26] S. Gabriel, R. W. Lau, and C. Gabriel. The dielectric properties of biological tissues: Iii.
parametric models for the dielectric spectrum of tissues. Physics in Medicine and Biology,
41:2271, 1996.
[27] von Hippel, editor. Dielectric Materials and Applications. The MIT Press, 1954.
[28] Bruce Carter. Filter design in thirty seconds. High Performance Analog: Texas Instruments
Application Report, SLOA093, 2001.
144