MICRO SWITCHES

Description

  • Normally open and normally closed terminals
  • Straight lever actuator
  • 125 VAC 1 A
  • Two included in the kit
  • Easy to use and set up

These switches are ideal to use as end sensors or for homing. Use them as normally open, normally closed or wire the three pins to have a low reference and a high reference. You can pin the microswitch directly on to the breadboard for testing.

Voltage 250 VAC 1 A
Electrical life 6000 cycles
Mechanical life 1000000 cycles
Operation frequency 10 cycles/min
Contact resistance 100m Ohms
Weight 0.5 g

Wire the normally open to ground and the common to your digital input, enabling the internal pull-up of the Arduino-compatible board, or wire the normally closed to ground the normally open to 5V and never leave your switch floating. Pin it to your breadboard and use male to male jumper cables to connect it to your Arduino-compatible board for testing.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*Rewieved by Dr. Mangus for MangoLabs
  Button
 
  Turns on and off a light emitting diode(LED) connected to digital pin 13,
  when pressing a pushbutton attached to pin 2.
 
  The circuit:
  - LED attached from pin 13 to ground
  - Microswitch common attached to pin 2
  - Normally open attached to 5V
  - Normally closed attached to GND
  
 
  Based on sketch created
  by DojoDave <http://www.0j0.org>
  modified 30 Aug 2011
  by Tom Igoe
 
  This example code is in the public domain.
 
  http://www.arduino.cc/en/Tutorial/Button
*/
 
// constants won't change. They're used here to set pin numbers:
const int buttonPin = 2;     // the number of the pushbutton pin
const int ledPin =  13;      // the number of the LED pin
 
// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status
 
void setup() {
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT);
}
 
void loop() {
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);
 
  // check if the pushbutton is pressed. If it is, the buttonState is HIGH:
  if (buttonState == HIGH) {
    // turn LED on:
    digitalWrite(ledPin, HIGH);
  } else {
    // turn LED off:
    digitalWrite(ledPin, LOW);
  }
}
  1. In this example we are connecting:
    Arduino    Microswitch
    D2     —  C
    GND —  NC
    5V     —  NO
  2. Download and install the Arduino environment from here or use the web editor.
  3. Download the sketch here and open, or open the Arduino environment and copy the code into a blank sketch.
  4. Connect your board to your computer with the included USB cable.
  5. Select your board in Tools / Board / Arduino Uno.
  6. Select your port in Tools / Port / COM# (Arduino Uno). This may be slightly different depending on your operating system.
  7. Upload by pressing the arrow in the circle to the upper left.
  8. Press the microswitch actuator and check if it the LED on pin 13 (labeled L) lights up.