Source: https://mokxi.com/parts/microswitch
Updated: 2026-11-10

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.

Hold the button

This is the simulator itself, running here. Click anything to open it in the editor.

Open this project in the editor Read the full tutorial

The bumpers, from the bumper car

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.

### Learn articles

2 lessons

- DIY Rhythm Game Controller: Guitar and Dance Pad
- DIY Stream Deck and Camera Slider With Arduino

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.

- Arduino Uno R3
- SparkFun Pro Micro
- Arduino Nano

More parts

## The rest of the bench

Every one of these is drawn and simulated the same way.

Full-size breadboard

A real 0.1 inch grid with the rails and the center channel, 63 columns wide.

Jumper wires

Drag from any pin or hole to any other. Corners snap, and you can drag them.

Power

A supply rail at the voltage you choose.

Ground

The other end of every circuit.

LED

Lights when current flows. Five colors, and the brightness is what your eye would see.

Filament lamp

A tungsten bulb in a holder: an inrush when it is switched on cold, tens of milliseconds to warm up, and dim on half its voltage.

Resistor

Any value you like, with the color bands drawn to match.

ESP32-C3-DevKitM-1

A RISC-V board that runs your firmware at 160 MHz on the real memory map.

Pushbutton

A 12 mm tactile switch. Hold it while the simulation runs.

Raspberry Pi Pico

The RP2040 board on our own Cortex-M0+ core. Pick a program and press Run.

Raspberry Pi Pico W

Raspberry Pi Pico W (RP2040). The same board and the same pinout as a Pico, with the CYW43439 on it. The WiFi is simulated (no radio; real internet through the Cloud panel’s switch), and the on-board LED, which hangs off that chip rather than off GP25, is driven through the same path. Everything else is the Pico.

Raspberry Pi 4 Model B

Raspberry Pi 4 Model B: the 40-pin header, driven by main.py with RPi.GPIO or gpiozero.

See every part

## 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.

Start building free Open the editor
