# Exercise: Switch with pullup¶

## Objective¶ Sense a mechanical action as a varying voltage.

A switch is a special case of a resistor with two states: it has either near-zero resistance when closed or near-infinite resistance when open. A resistor in series with a switch is a very common voltage divider construction in which the pull-up resistor can supply a small current through the switch. If the switch is closed, its resistance is near zero, so the output is connected directly to ground. If the switch is open, the current through the resistor is zero, so there is no voltage drop and the output is pulled up to the supply voltage.

In this example, R1 is the 5.6K pull-up resistor. The exact value of 5.6K is not critical; for our purposes values from 1K to 100K will all work fine to supply a logic signal to an Arduino.

The switch is drawn as a single-pole single-throw switch (SPST) which can only open or close the connection between two pins. It is drawn as a normally-open switch which makes the connection when operated.

## Steps and observations¶

1. Set up the resistor and switch on a breadboard; a suggested layout is shown below.

2. Measure the exact resistor value.

3. Measure the supply voltage.

4. Measure the voltage across the switch in both states.

5. Measure the current through the resistor in both states. Compare to predictions.

6. Create a simple switch from wire and use it to sense some kind of mechanical activity. (Keep this simple, this should only take a minute or two.) 1. Fritzing file: switch-with-pullup.fzz
2. EAGLE file: switch-with-pullup.sch