# Exercise: Analog Sensing with Photocells or Pressure Pad Sensors¶

## Objective¶

Measure changing light level as a varying voltage. Understand how resistive analog transducers can measure a physical property.

A CdS photocell (i.e. Cadmium-Sulfide photoresistor) is a light sensor in which the resistance changes in response to illumination. They are relatively slow, with a time constant of hundreds of milliseconds, but useful for measuring ambient light and shadow. The resistance decreases in bright light; a typical range might be from 50K in darkness down to a few hundred ohms near a lamp.

A voltage divider circuit can be used for creating a voltage which depends on the light level. The value of the fixed resistor depends upon the desired sensitivity range; a good starting point to try is roughly equal to the photocell resistance at mid-range.

## Steps and observations¶

1. Measure the resistance of the photocell over different illumination conditions.

2. Measure the photocell voltage in the given circuit over different illumination conditions.

3. Using the oscilloscope to observe the photocell voltage, try creating rapidly changing shadows to estimate the response speed.

4. Construct a simple setup to indirectly measure a physical property using a photocell. This can be as simple as using paper to occlude the light sensor as a function of mechanical position. (Keep this simple, this should only take a minute or two.)

Rapid light changes and optically encoded data are better measured with phototransistors and photodiodes. But even slow and cheap light sensors can be adapted to measure many other properties indirectly, e.g. chemicals, dust, mechanical position, acceleration, proximity, etc.

The circuit is drawn with a pull-up resistor. What happens when the roles of R1 and the photoresistor are swapped?

For a challenge, find one of the laser diodes and measure the photocell response to the laser beam.

## Pressure Sensing¶

There are many other sensors which change resistance in response to a physical process. These can be used in a divider circuit just like the photocell, although the appropriate bias voltage and bias resistor value will depend on the properties of the sensor.

In particular, a pressure pad (i.e. force-sensing resistor, or FSR) is a contact sensor in which the resistance changes in response to mechanical pressure. The resistance decreases with increased force. A voltage divider circuit can be used for forming a voltage which depends on the pressure.

Commercial FSRs can be damaged by excessive force. In practice, it can take care to design them within a mechanical assembly so they are not directly exposed to excessive force or forces which pull them apart. But they are a relatively cheap and robust way to make an analog human interface.

As a challenge, rather than use a packaged FSR device, make your own using tape and conductive fabric. Please see the following as a guide.

Conductive fabric can also be damaged by excessive force and can some types can wear out from washing. But these sensors can be incorporated into clothing, made with multiple sensitive points, turned into tilt sensors and linear controls, etc.

## Other Files¶

1. Fritzing file: photocell-with-bias-resistor.fzz

2. EAGLE file: photocell-with-bias-resistor.sch