Useful for detecting passage of a moving part or for implementing an electronic limit stop. Setup so that your mechanism wipes the lever and closes the switch as it moves by.
Some pictures of microswitches
![]() |
![]() |
![]() |
Most microswitches have three terminals labelled C, NO, and NC, standing for Common, Normally Open, and Normally Closed, as shown below.
For regular switch action, connect to the C and NO terminals. The switch will be open when not pressed and closed when pressed.
Interface to the Stamp in the usual manner as shown here.
In ME2011 lecture, Durfee has a demo showing a motor driven wheel that stops precisely at a pre-determined position because of a microswitch. The code for the demo is in the files below.
badpizza.bs2 -- Attempts to stop the wheel by timing. No good because the wheel velocity slows down as the battery runs down.
goodpizza.bs2 -- Wheel stops by looking for the microswitch to be pressed.
4turnpizza.bs2 -- Same as above, but wheel turns four times then stops.
Robot store, or Ax-man, or Radio Shack 275-017 (SPDT, 5A contacts, lever arm with roller, $1.99), or many other sources.