Wiring Switches and Other 2 Wire Sensors


When using a switch or other unpowered two wire sensor (e.g. many pressure sensors), you need to use a resistor to make the third wire. This creates what is known as a voltage divider network, which in basic terms is a three wire hookup consisting of:

  • ground
  • power
  • signal

The resistor is used with sensors that only have two outputs, including switches, bend sensors, and pressure sensors. The value of the resistor depends on the kind of sensor, but it often has a 10K ohm value.

In the case of sensors like pressure sensors, they have their own basic resistance values, which means a resistor value of less than 10K ohm is needed. For example, for the pressure sensors we sometimes use, a good value for the resistor is 4.8K ohm.

The wiring for turning a two output sensor into a voltage divider network with three wires is as follows:

  • the power lead (red) is attached to one terminal of the switch
  • the signal (white) is attached directly to the other terminal of the switch
  • a 10K ohm resistor is attached to the same terminal of the switch as the signal, and the ground (black) is then attached to the other end of the resistor

The two terminals of the sensor are equivalent

switch pole 1: ——————————– power (red) ——– microcontroller
switch pole 2: ——————————– signal (white) —— microcontroller
\—- 10K ohm resistor —- ground (black) —- microcontroller

If you are working with a switch, you should normally use a single pole, single throw (SPST) switch. You can use either a momentary switch or a toggle switch. The momentary switch only makes contact while you depress it. The toggle switch holds it position in either on or off position.



Last modified March 6th, 2013