A miniature snap-action switch, also trademarked and frequently known as a micro switch, is an electric switch that is actuated by very little physical force. Micro switches are very widely used; among their applications are appliances, machinery, industrial controls, vehicles, and many other places for control of electrical circuits. They are usually rated to carry current in control circuits only, although some switches can be directly used to control small motors, solenoids, lamps, or other devices.

This is a small micro switch sensor designed for the Arduino micro controller. It could be directly connected to the IO Expansion shield. It integrates the pull-up resistor and the status indicator LED onboard. This makes it easier for testing and integration. The miniature snap-action micro switch with roller lever makes it suitable for more different environment application and can be applied to any imaginative project you can think of!

Common Applications



Connection Diagram

Connection Diagram

Sample Code

// #
// # Editor     : Lauren from DFRobot
// # Date       : 26.09.2012
// # E-Mail :

// # Product name: Crash sensor
// # Product SKU : SEN0138
// # Version     : 0.1

int ledPin = 13;                // choose the pin for the LED
int inputPin = 3;               // Connect sensor to input pin 3

void setup() {
  Serial.begin(9600);           // Init the serial port

  pinMode(ledPin, OUTPUT);      // declare LED as output
  pinMode(inputPin, INPUT);     // declare Micro switch as input

void loop(){
  int val = digitalRead(inputPin);  // read input value
  if (val == HIGH) {                // check if the input is HIGH
    digitalWrite(ledPin, LOW);      // turn LED OFF
  } else {
    digitalWrite(ledPin, HIGH);     // turn LED ON
    Serial.println("Switch Pressed!");