Part

Limit switch, lever microswitch

COM rests on NC and moves to NO while the lever is held. The robot limit switch.

See every part
  • 3 pins
  • 1 setting
  • In 19 projects
  • In 2 lessons
Drawn live by the editor's own code, at the size you see it.
At a glance

The Limit switch, lever microswitch in brief

What it is, and every setting the properties panel gives it.

A lever microswitch is the limit switch on 3D printer end stops, robot bumpers and conveyor ends: a small black body with a steel lever and three tags, COM, NO and NC. The KW11-3Z and Omron D2F are this part. It is a changeover, not a plain button: at rest COM touches NC, and pressed it touches NO. The simplest wiring needs no resistor, COM to ground and NO to an Arduino Uno or ESP32 pin set to INPUT_PULLUP, so the pin reads LOW at the stop. Printers wire NC instead, so a broken wire reads as triggered and the motor stops rather than grinding. Mokxi models break before make, with the blade touching neither contact for 200 microseconds, then bounce on the contact it lands on: with bounce set to typical, the default, each press or release is 3 to 7 edges settling within 1 to 5 milliseconds, so a sketch that counts presses without debouncing miscounts exactly as on the bench. Lever force and travel are not modeled; hold the mouse on it when the axis would arrive.

Family
Inputs
Pins
3
bounce
typical (or none)
Pins

3 pins

Named as the editor names them, so a wire lands where you expect it.

Pin
What it does
COM
The moving blade.
NC
Normally closed: joined to COM while the lever is up.
NO
Normally open: joined to COM while the lever is pressed.
How to use it

How to use a limit switch with an Arduino

Use COM and NO. COM goes to GND and NO to a digital pin set to INPUT_PULLUP, so digitalRead() gives LOW while the lever is pressed and HIGH the rest of the time. The bumper car here has two, left on pin 7 and right on pin 8, and backs away from whichever side reads LOW. Hold a switch with the mouse to bump it.

The contact bounces when it lands, so a sketch that counts presses, rather than just reacting to the level, needs to ignore changes for a few milliseconds after each one. A 3D printer wires its end stops to NC instead, so the pin reads LOW until the stop and a broken wire looks like a hit rather than letting the motor grind.

Part pin
Board pin
COM (both switches)
GND
NO (left bumper)
Pin 7
NO (right bumper)
Pin 8

An ESP32 or a Pico reads it the same way, COM to ground and NO to any input with its pull-up turned on.

Arduino Uno: bumper carlive0.000 s 0.00x
Hold the button
This is the simulator itself, running here. Click anything to open it in the editor.
The bumpers, from the bumper car
const int BUMP_LEFT = 7;
const int BUMP_RIGHT = 8;
void setup() {
  pinMode(BUMP_LEFT, INPUT_PULLUP);
  pinMode(BUMP_RIGHT, INPUT_PULLUP);
}
void loop() {
  if (digitalRead(BUMP_LEFT) == LOW) {
    // hit on the left: back off and turn right
  }
}
How it is modeled

What is true about the Limit switch, lever microswitch, here

In its help article’s own words: what the simulation gets right, and where it stops.

Modeled

  • The changeover: COM on NC at rest, on NO when pressed.
  • Break before make, and bounce on the contact it lands on.

Not modeled

  • The lever's travel and force: it is pressed while you hold it.
  • A machine pressing it. Nothing on the canvas moves into it, so the hand is the mechanism: hold it when the axis would have reached it.

From Limit switch (lever microswitch), in full.

Projects

See the Limit switch, lever microswitch in a project

19 built-in projects use it. Each opens in the editor, already wired.

Lessons

Where it turns up in a lesson

2 lessons place it in their own circuits.

Boards

The boards it is shown on

Each of these 3 boards has a built-in project with the Limit switch, lever microswitch in it.

Wire up the Limit switch, lever microswitch

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.