# Prelab 5

If you are a current student, please Log In for full access to the web site.

Note that this link will take you to an external site (

`https://shimmer.csail.mit.edu`) to authenticate, and then you will be redirected back to this page.

## 1) Proximity sensors

In this week's lab, we'll make a proximity sensor. A proximity sensor is similar to the touch sensors that we are all familiar with on our phones, except that instead of just measuring touch, a proximity sensor can measure an object (in our case a finger or hand) that is near to (*aka* in proximity) but not touching the sensor. A proximity sensor can also resolve differences in distance, i.e., as the hand or finger approaches and recedes from the sensor. Pretty cool.

## 2) Measuring proximity

To electrically measure proximity, we need to turn distance into an electrical phenomenon. There are a few phenomena that electric circuits are good at measuring: voltage, charge/current, and time/frequency. So the trick is to figure out how to turn the thing we care about (proximity *aka* distance)
into something we can measure (voltage/charge/time).

Proximity sensors are usually created by turning distance into capacitance, and capacitance into time. How?

We know from 8.02 that the capacitance of a parallel plate capacitor is:

In a proximity sensor, we usually form a capacitor between the sensor electrode and the object, and as the distance d between them changes, so does the capacitance.

Then we have to turn capacitance into time. We've already seen how we can do that: capacitors change the dynamics of a circuit, i.e., they "slow down" the responses. In particular, we're very familiar by now with the idea that a simple RC circuit has a time constant \tau given by RC. So a change in C will lead to a change in \tau.

Then to actually *measure* \tau, we make use of a digital circuit, which operates according to a clock. Every clock cycle, the Teensy does an operation. The Teensy can easily count clock cycles, and so we can measure changes in \tau by counting how many clock cycles \tau takes.

So here's our overall pipeline:

**change in distance d \Rightarrow change in C \Rightarrow change in \tau \Rightarrow change in number of clock cycles**

In practice, we won't actually measure \tau, but a time parameter related to \tau, and then calibrate that parameter to \tau. To better understand that process, it helps to determine an expression for the time t_0 that it takes for an RC circuit to charge up to some fraction of the final value \alpha = \frac{V_0}{V_f}, as shown in the plot below:

`tau`

and \alpha as `a`

, and ln as `log`

(Python syntax). t_0=
## 3) RC circuit step response

Our proximity sensor will work by sensing the small change in capacitance that results when you move your hand near the circuit. We'll infer the capacitance by measuring charging of an RC circuit with a known R. To get started, we need to have a sense of reasonable values and times.

It just so happens that the capacitance of a human finger (which is what we'll be sensing) is in the 0.1 to 1 pF range. But let's suppose for now that it's 47 pF because that is, conveniently, one of the standard capacitance values. The Teensy runs at 96 MHz, which means the finest time resolution it has (one cycle) is ~10 ns. To obtain good resolution with the timing, we want the time constant \tau of our circuit --the charging time-- to be much larger than 10 ns. Let's choose 100 \mu s for now.

## 4) Next up

That's it for now.

```
```