Sensors, Circuits, and Data Interpretation/Management for Infrastructure Systems

Mario Bergés

8/23/22

Preface

This is a Quarto book. Testing it is fun.

To learn more about Quarto books visit https://quarto.org/docs/books.

1 How to use this book

Warning

As stated elsewhere in the material, this book is still very much a work in progress. Nevertheless, here are (evolving) instructions for how to make the best use of it.

The material presented here is presented as both a website and a stand-alone book (in both PDF and EPUB formats). It can be daunting to know how it is all organized, so here are some tips for navigating the content. In particular, the type of information you may be seeking probably falls under one of these categories:

Overview of what technical content is covered and in what order

Lecture slides and notes

Supplemental reading material

Logistical and administrative information about the course

Assignments and solutions

Example problems

If the information you are looking for does not fall into any of those categories, please feel free to e-mail me. Otherwise, below is a more detailed description of each of those categories and where to find the corresponding content in this book.

1.1 Overview of technical content

Though the table of contents (shown on the left-hand side for the website, or in the initial pages for the PDF) is a good guide for the technical content contained herein, Chapter 3 contains a view of the schedule by which the content will be covered during class and may be a more useful guiding source. In particular, Chapter 3 has direct links to the lecture slides, the reference material and assignments for each lecture.

1.2 Lecture slides and notes

For each lecture, accompanying lecture notes are provided in the book. Additionally, during some lectures I also utilize slides and when I do, these are made available via this book as an external reference. To know which chapter of the book refers to a particular lecture, you will want to look at Chapter 3 (i.e., the schedule).

Lecture notes are currently very thin, as they are only meant to provide an orientation for how the lecture will proceed. However, they contain links to the slides (when appropriate), citations for the reading material from which the lecture was sourced, as well as a collection of questions that were left unanswered during the lecture.

1.3 Supplemental reading material

As stated in the previous section, supplemental reading material is typically provided as a reference for each of the lectures. To find this material you can either request a copy of the book or reference through the library or, more conveniently, navigate to the Files -> Readings section in Canvas to find a copy of the book chapters that were referenced.

1.4 Logistical and administrative information about the course

The full course syllabus is available on Canvas under Syllabus, or under File -> syllabus -> syllabus.pdf. An abridged version is also available in this book in Chapter 2.

1.5 Assignments and solutions

A list of assignments, along with their due date is available in Appendix B. It is also available in the course syllabus as found in Canvas.

1.6 Example problems

As we work on problems in class, I will make an effort to post those problems directly on the lecture notes for the corresponding lecture.

2 Syllabus

This syllabus will be continuously updated throughout the course.

2.1 Course Description

The proliferation of low-cost and high-performing sensors has led to sensing in the built environment across a broad range of civil and environmental engineering applications. The applicability of such sensing technologies has been profoundly impacted by advancements in wireless communication and cloud computing, which have enabled the implementation of wireless sensing networks in structural, transportation, geotechnical and environmental systems, to name a few. This course conveys recent advancements that have led to technologies from across engineering disciplines becoming increasingly relevant (and available) to our field, and emphasizes the critical role that civil and environmental engineers must play in leveraging our domain knowledge to augment these advances. As a result, this course studies sensors from a physics-based perspective in which the development and use of sensors stems directly from principles of mechanics (i.e., how physical processes can be measured and filtered using electrical analog signals and then converted to digital information for interpretation), and builds upon this perspective to provide a better understanding of the “upstream” tasks of a sensing system (e.g., data interpretation and management). This course will cover the practical and theoretical knowledge of sensor technologies for implementation in civil and environmental infrastructure systems. This includes the fundamentals of measurement and instrumentation theory, fabrication, operation, and deployment of capacitive, resistive, inductive, piezoelectric, and microelectromechanical systems. The course also covers DC and AC circuit analysis, signal amplification, interface circuits, filter design, frequency analysis, and analog-to-digital converter architectures. This physics-based perspective on the topic prepares students to extrapolate how domain knowledge can be used beyond the sensors to interpret the data that they collect. Thus, the latter part of the course covers the implications of design choices in data interpretation and management tasks such as data compression, measurement error and database designs. Through a final project, students use their learned knowledge to develop a sensing system solution to solve problems rooted in civil and environmental engineering applications.

2.2 Policies

Here are the course’s policies

2.2.1 Assignments

A total of four assignments will be given out. The topics covered in each assignment will closely follow the ones listed in the schedule of classes.

All assignments are to be solved individually. Discussions and conversations with other students regarding the problem sets are encouraged. However, the final solutions along with the reasoning behind them need to come from you and be clearly explained in the submitted documents.

Lateness. All assignments have due dates indicated on the syllabus. In general, submitting assignments on time lets the instructional team provide feedback in a more timely and efficient manner. Assignments build on each other, so timely submissions are crucial to your progress in the class. However, sometimes life happens. If you cannot submit an assignment on time, the default will be that you will be eligible for 90% of the grade the first 48 hours that the assignment is late. If you have to submit beyond 48 hours past the due date, please contact me as soon as possible so we can make arrangements.

Each assignment will be worth 10%.

2.2.2 Group Projects

A large portion of the grades for the course will be based on a group project, which consists of a written report and a presentation.

2.2.3 Collaboration

Collaboration is expected within the limits of discussing concepts and problems. However, each student must produce his/her own solution to the problems. Copying from another student’s assignment is clearly plagiarism. Using information directly from websites, books, papers and other literary sources without appropriate attribution is also plagiarism. Assignments submitted for this class will be reviewed by the instructor and TA and may be scanned through web-based academic integrity software. Occurrences of cheating or plagiarism will be handled according to the university policy on Academic Integrity, https://www.cmu.edu/policies/documents/Academic%20Integrity.htm. Students are expected to have read this policy and conform to the highest standards of academic integrity. For incidents of academic misconduct, the University Academic Disciplinary Actions Policy, found at https://www.cmu.edu/student-affairs/theword/acad_standards/creative/disciplinary.html, will be followed.

2.2.4 Class Participation

Students are expected to be in class on time and participate in class discussions. Participation will be loosely monitored and used to calculate the participation grade. If you cannot make class, please inform your instructors and group members ahead of time. In class, students are expected to be courteous and respectful of the views and needs of other students and instructors.

2.2.5 Student with Disabilities

If you have a disability and have an accommodations letter from the Disability Resources office, I encourage you to discuss your accommodations and needs with me as early in the semester as possible. I will work with you to ensure that accommodations are provided as appropriate. If you suspect that you may have a disability and would benefit from accommodations but are not yet registered with the Office of Disability Resources, I encourage you to contact them at access@andrew.cmu.edu.

2.2.6 Posting of course materials

All the material used in the course (syllabus, readings, problem sets, reports) is intended for use in the class only. No unauthorized posting, publication or redistribution is expected. Uploading course materials to Course Hero or other web sites is not an authorized use of the course material.

2.2.7 Take care of yourself

In general, do your best to maintain a healthy lifestyle this semester by eating well, exercising, getting enough sleep and taking some time to relax. This will help you achieve your goals and cope with stress.

All of us benefit from support during times of struggle. You are not alone. There are many helpful resources available on campus and an important part of the college experience is learning how to ask for help. Asking for support sooner rather than later is often helpful.

If you or anyone you know experiences any academic stress, difficult life events, or feelings like anxiety or depression, we strongly encourage you to seek support. Counseling and Psychological Services (CaPS) is here to help: call 412-268-2922 and visit their website at http://www.cmu.edu/counseling/. Consider reaching out to a friend, faculty or family member you trust for help getting connected to the support that can help.

3 Schedule

The schedule is subject to change. Here’s the most updated version:

Date | Topic | Slides | References | Assignments
Tuesday 08/29/23 | 1: Introduction | Slides | Chapter 4 |
Thursday 08/31/23 | 2: Principles of Sensors | Slides | Chapter 7; Chapters 2 and 3 from Fraden (2010) |
Tuesday 09/05/23 | 3: Setting up your computing environment | Slides | Chapter 6 | HW1 Out
Thursday 09/07/23 | 4: Sensing with your RPi Pico | Getting Started with Raspberry Pi Pico | Chapter 6 |
Tuesday 09/12/23 | 5: Circuit Theory and Electronic Devices | Hand-written Notes (posted soon) | Chapter 2 of Dally, Riley, and McConnell (1993) |
Thursday 09/14/23 | 6: Fundamentals of Data Acquisition | Slides, Hand-written Notes (posted soon) | Chapter 2 of Dally, Riley, and McConnell (1993) |
Tuesday 09/19/23 | 7: Fundamentals of Data Acquisition (Part II) | Slides | Chapter 6 and 7 of Figliola and Beasley (2019) |
Thursday 09/21/23 | 8: Resistive Ssensors | Hand-written Notes | Chapter 3 of Fraden (2010) | HW1 Due
Tuesday 09/26/23 | 9: Resistive Sensors | Hand-written Notes | Chapter 3 of Fraden (2010) | HW2 Out
Thursday 09/28/23 | 10: Sensing with the Raspberry Pi Pico |  |  |
Tuesday 10/03/23 | 11: |  |  |
Thursday 10/05/23 | 12: |  |  |
Tuesday 10/10/23 | 13: |  |  |
Thursday 10/12/23 | 14: |  |  |
Tuesday 10/17/23 | Mid-Semester Break |  |  |
Thursday 10/19/23 | Mid-Semester Break |  |  |
Tuesday 10/24/23 | 15: Measurement Errors |  |  |
Thursday 10/26/23 | 16: Project Presentations |  |  |
Tuesday 10/31/23 | 17: Uncertainty Analysis |  |  |
Thursday 11/02/23 | 18: |  |  |

4 Introduction

Welcome to 12-778: Sensors, Circuits and Data Interpretation/Management for Infrastructure Systems. This course will provide you with the necessary knowledge and skills to design and develop an instrumentation system for physical phenomena of interest to civil and environmental engineers.

During the first lecture, we will first get to know each other beginning with a short introduction to myself (your instructor) and following with a short introduction to each of you in the class. We will also review the syllabus and go through a simple introduction to measurements, instruments and transducers to set our bearings for the remainder of the course. Towards the end of the lecture, I provide two examples of instrumentation systems from my own research(Sensor Andrew and FORK) so as to ground the discussion and the concepts on practical applications.

The slides for the lecture can be found here.

Here is a list of questions you should try to answer after this first lecture (even if you can’t come up with an answer, trying these is useful!):

Logistical Questions

How will grades be calculated?

What are good topics for the final project?

What pre-requisites do I need to fulfill to be successful in this course?

Technical Questions

What is a sensor?

What is an actuator?

How are sensors and actuators related to transducers?

Philosophical Questions

If we assume physical reality exists independent of ourselves, but we can only experience it through our senses (i.e., through measurements), how accurate is our own internal model of the world?

If we assume measurements can be performed with perfect accuracy and infinite resolution, would the answer to the previous question change?

What biases may still persist during our interpretation of perfectly accurate measurements?

4.1 About this Book

This is a book created from markdown and executable code. It is very much a work in progress, it will be always evolving, and it is intended to serve as a companion document to the course.

5 Analysis of Electrical Circuits

The information gleaned from a measurand and carried by a measurement system can be instantiated/handled in a variety of means. There are many reasons favoring electronic measurement systems (as opposed to, say, pneumatic or hydraulic, which are steam-punk alternatives that could have emerged), though Putten (1988) provides a list of such reasons, including:

a very large dynamic range of power available to us (from nano-Watts to giga-Watts)

an equally large time-range can be handled (from very short, to very long)

electrons are very light and travel very fast

transporting electricity is easy and cheap now

amplification is also relatively easy

modulation of the information (translation to other means, storage, modifications) can be done easily

So it’s not surprising that we are using electronic measurement systems today virtually everywhere. This also means that the key to understanding modern instruments lies in understanding electrical circuit theory, the basic laws that dictate how dc and ac circuits behave, and how they affect the signals that are being transformed by them.

Today we’ll make sure you have a good understanding of how to analyze electrical circuits by going through Chapter 2 of Dally, Riley, and McConnell (1993), in detail. You can find a copy of this chapter on Canvas.

After the lecture, there were some questions that remained open and answering them would prove beneficial to our learning:

Technical Questions

Why is the following equation true?

$$w = C \int_{0}^{V} v dv = \frac{1}{2} C V^2$$

Is the resistor the only element that produces a voltage drop in a dc circuit?

Why is ejωt = cos(ωt) + jsin(ωt)?

In class, we analyzed a simple circuit with an ac voltage source vs = vi(t) = viejωt and two impedances in series, Z₁ = R and $Z_2 = \frac{1}{j\omega C}$. We were interested in the voltage drop across Z₂ and by applying KVL found that $v_o(t) = \frac{1}{1+j\omega RC} v_i e^{j\omega t} = \frac{1-j\omega RC}{1 + (\omega RC)^2} v_i e^{j\omega t}$. Knowing that we can easily find the magnitude and phase of this complex periodic signal vo(t) if we know its real (Re) and imaginary (Im) parts (i.e., $\sqrt{(Re)^2 + (Im)^2}$ and $\text{tan}^{-1}\frac{(Im)}{(Re)}$) then what are they?

Answers to Technical Questions

Here’s the answer using the sympy library for Python:

import sympy
sympy.init_printing()
w, R, C, vi, vo = sympy.symbols(('\omega', 'R', 'C', 'vi', 'vo'),real=True)
vovi = 1/(1+sympy.I*w*R*C)
sympy.simplify(vovi)

$\displaystyle \frac{1}{i C R \omega + 1}$

The real part of this expression would be:

re_vovi = sympy.re(vovi)
sympy.simplify(re_vovi)

$\displaystyle \frac{1}{C^{2} R^{2} \omega^{2} + 1}$

And the imaginary part of the expression would be:

im_vovi = sympy.im(vovi)
sympy.simplify(im_vovi)

$\displaystyle - \frac{C R \omega}{C^{2} R^{2} \omega^{2} + 1}$

Using those we can now calculate the magnitude/amplitude of the phasor:

mag_vovi = sympy.sqrt(((re_vovi*re_vovi))+(im_vovi*im_vovi))
sympy.simplify(mag_vovi)

$\displaystyle \frac{1}{\sqrt{C^{2} R^{2} \omega^{2} + 1}}$

Similarly, we can compute its phase:

ph_vovi = sympy.atan(im_vovi/re_vovi)
sympy.simplify(ph_vovi)

 − atan (CRω)

Philosophical Questions

What is the hydraulic component equivalent to an inductor?

6 Hardware Preparations

In this course we will be utilizing the new (as of August, 2022) Raspberry Pi Pico W board, which adds a WiFi radio to the previously released Raspberry Pi Pico board that the Rasbperry Pi foundatoin released in 2021. These boards are very low-cost (about 6 US dollars currently) and provide great functionalities for the kinds of projects and ideas we will be exploring through this course. In particular, the Pico W boards have the following interesting specifications:

A microcontroller chip designed by Raspberry Pi (RP2040)

A 133MHz dual-core Arm processor

26 General Purpose Input Output (GPIO) pins

A 3-channel 12-bit ADC

An on-board temeprature sensor

A 2.4GHz wireless (802.11n) single-band radio

Much more information about the Raspberry Pi family of boards can be found here.

We will begin by be covering this tutorial: Getting started with Raspberry Pi Pico

Additionally, you may want to prepare the hardware by soldering the headers that come with the Pi Pico W kit that you received. Instructions for doing so can be found here.

Although we would like to ultimately connect the Pico W board to the wireless network on campus, we will deal with those steps later in the process.

7 What is Sensing

Measurements are at the heart of the scientific revolution. Generally speaking, a measurement is the estimation of the magnitude of some attribute of an entity. It usually involves a measuring instrument (e.g., a ruler, a thermometer, etc.). Due to the fundamental (and practical) physical limitations, all measurements are imperfect.

The basic physical component of an instrument that is used to perform a measurement is a transducer. Generally speaking, transducers are devices that convert one type of energy into another. For our purposes, they are devices that convert between electrical signals and physical stimulus (in either direction). Depending on the direction of this conversion transducers can be either sensors (from a physical stimulus to an electrical signal) or actuators (from an electrical signal to a physical stimulus). A single sensor (or actuator), in fact, can be composed of multiple transducers inside.

7.1 Instruments

The instruments used for measurement allow us to asses the relationship between an attribute of the item under study (e.g., the length of a beam), and a referenced unit of measurement (e.g., a standard meter). Traditional instruments are physical / hardware based, with fixed/limited versatility and respond to a specific stimulus. An oscilloscope, for instance, is an example of a traditional instrument. With advances in computing hardware and software, instruments can now be completely virtual (digital) and/or significantly miniaturized. Below are diagrams depicting common components of different types of instruments (typical, analog and digital):

Figure 7.1: A diagram for a typical instrument

Figure 7.2: A diagram for an analog instrument

Figure 7.3: A diagram for a digital instrument

7.2 Sensors

Sensors can be classified in many different ways depending on the objective of the classification. Some of those, as expressed by Fraden (2010) are as follows:

Passive or Active

Absolute or Relative

By their characteristics:

Specifications

Materials

Detection means

Conversion phenomena

Application area

Stimulus

7.2.1 Sensor Characteristics

Because there may be multiple transduction processes in place to get from a physical stimulus to an electrical signal inside a sensor, it is convenient to characterize this input/output relationship as a black box and define common terms that can be used to describe it.

8 Behavior of Systems

This week we will be leveraging the concepts we have learned so far (e.g., Fourier analysis, the physical basis for the operation of resistive and capacitive sensors) to shed light on a topic that we covered earlier but without much mathematical intuition: dynamic behavior of measurement systems. We even had a homework problem designed to gain some intuition into the response of a second order system (a damped forced oscillator).

Though the behavior of a system can only be truly understood experimentally, creating models of their behavior can provide very useful approximations or at least provide a tool with which once can gain very important intuition about the behavior of the system under idealized assumptions. Each component of a measurement system (e.g., sensors, signal conditioning circuits, etc.) have their own response and together they generate the overall sensing system’s response to any input signals (forcing functions). What we’d like to do is to characterize this response by using mathematical models of the individual components and/or the overall system. In other words, we want to create mathematical models that allow us to understand how the output signal varies in response to different input signals. This is especially useful when the input signals are time-varying (dynamic), where the system’s characteristics determine how well it is able to “keep-up” (follow) the changing input signal.

Consider, for example a bulb thermometer used to measure body temperature.

A step function input (dynamic)

A slow response (in the order of seconds to minutes)

Consider now the vibration inside a vehicle as it travesl on a road.

The input signal is the normal force at the contact point of the tires to the road surface.

The output signal is not just a direct copy of that input force…

To study the response of the system, we could model the system in great spatial and temporal detail, taking into account the physical properties that are distributed across space and time. This model would take the general form of a partial differential equation relating inputs and outputs. And it could then be “calibrated” through experiments that provide us with pairs of input F(t) signals and their corresponding output y(t), along with the initial conditions of the experiment y(0). A very useful simplifying assumption is to suppose that the spatially distributed properties of the system can be lumped into discrete elements. This idea is called lumped parameter modeling. Since there is no spatial dependence for the behavior, the partial differential equations are transformed into ordinary differential equations of order n:

$$a_n \frac{d^n y}{d t^n} + a_{n-1} \frac{d^{n-1}y}{d t^{n-1}} + \dots + a_1 \frac{dy}{dt} + a_0 y = F(t)$$

Let’s see Example 3.1 from Figliola and Beasley (2019)

There are some special cases of the above system when n < 3 and lead to very useful characterizations. Let’s see them.

8.0.1 Zeroth order systems

Let’s now see Example 3.2 from Figliola and Beasley (2019)

8.0.2 First order systems

a₁ẏ + a₀y = F(t)

or more conveniently, by dividing both sides by a₀:

τẏ + y = KF(t)

Where τ is the time constant for the system and represents the time it takes for the system to get to 63.8% of the steady state value. Why?

Step function input

If F(t) = AU(t) where A is a constant and U(t) is the unit step function, then

y(t) = KA + (y₀−KA)e−t/τ

9 Sensing with the Raspberry Pi Pico

As described in Section Chapter 6, the hardware platform we are using is well suited to carry out sensing tasks by interfacing with digital and/or analog sensors. In essence, the Pico W board can do basic analog signal conditioning, provide multiplexing capabilities (for 3 ADC channels), perform the analog-to-digital conversion with a 12-bit ADC, and serve as the micro-controller unit (MCU) on which to digitally process the signals. Additionally, it can transmit signals wirelessly via WiFi.

During today’s lecture, we will be finishing this tutorial: Getting started with Raspberry Pi Pico

The slides for today’s lecture can be found here

10 Resistive Sensors

Today we’ll learn about how to utilize physical effects causing changes in electrical resistance to design sensors.

We will be using Sections 3.5 and 3.9 of Chapter 3 from Fraden (2010).

11 Fundamentals of Data Acquisition

We will first finish reviewing electrical circuits, to finish up Chapter 5 and Chapter 2 of Dally, Riley, and McConnell (1993). Then we will start do discuss analog-to-digital conversion.

The first set of slides can be found here.

We are then ready to understand the following concepts, as illustrated in Chapters 6 and 7 of Figliola and Beasley (2019):

Loading errors and impedance matching (Section 6.5, Example 7.8)

Analog-to-Digital Converters (Equations 7.14, 7.15, Example 7.4)

Filters: (maybe Example 7.9)

Technical Questions

When conneting different stages of our instrument (e.g., an analog device to an A/D converter), why is it that for current source inputs, we want to have Z₂ (the impedance of the next stage) be smaller than that of the source? Can you derive the expression for the loading error in this case (i.e., eI = I₂ − I₁ where I₁ is the current that would circulate if we short-circuit the terminals of our first device – the source – and I₂ is the current that is pushed through the second device when connected)? Why is it $e_I = V_1 \frac{-Z_2}{Z_1^2 + Z_1 Z_2}$?

Can you show that equation 7.6 from Figliola implies a folding point for aliased frequencies, that is exactly at fs/2?

12 Measurement Errors

So far we have assumed measurements are, for the most part, free of errors. Save for when we discussed the process of digitization (quantization and sampling) we assumed that transformations between stages of the measurement system were lossless (i.e., information was preserved between stages). But as we all know, this is just an idealization and there are multiple sources of error that can corrupt the signals as they move along the measurement system.

This week we will be reviewing some concepts of probability theory, uncertainty quantificatoin and statistics in order to better understand these errors and their implications on our measurements. We will largely be drawing from Chapter 5 of Figliola and Beasley (2019).

Appendix A — Some (Possibly) Useful Links

A.1 Periodic functions and complex exponentials

3blue1brown’s e(iπ) in 3.14 minutes, using dynamics

A.2 Circuit analysis

CircuitLab – Build and simulate circuits right in your browser.

[Interactive Electronics Textbook] – a great resource, and the companion book for CircuitLab.

A.3 Strain Gauges

Sensors of changing length – Lecture notes containing the derivation of the gauge factor

A.4 About embedded systems (ESP32, not Raspberry Pi Pico)

ESP32-EVB development board with WiFi BLE Ethernet micro SD card UEXT and GPI

ESPHome

Getting started with MicroPython on the ESP32

Appendix B — Assignments for the Course

Assignment Number | Due Date | Resources | Solutions
Assignment #1 | 9/21 | [HTML], [PDF], [Jupyter Notebook] | HTML PDF
Assignment #2 | 10/12 | [HTML], [PDF], [Jupyter Notebook] | [HTML], [PDF], [Jupyter Notebook]
Assignment #3 | 11/10 | [HTML], [PDF], [Jupyter Notebook] | [HTML], [PDF], [Jupyter Notebook]
Assignment #4 | 11/28 | [HTML], [PDF], [Jupyter Notebook] |

References

Dally, James W., William F. Riley, and Kenneth G. McConnell. 1993. Instrumentation for Engineering Measurements. 2nd ed. New York: Wiley.

Figliola, Richard S., and Donald E. Beasley. 2019. Theory and Design for Mechanical Measurements. Seventh edition. Hoboken, NJ: Wiley.

Fraden, Jacob. 2010. Handbook of Modern Sensors: Physics, Designs, and Applications. 4th ed. New York: Springer.

Putten, Anton F. P. van. 1988. Electronic Measurement Systems. New York: Prentice-Hall.