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

Part

# 4-way DIP switch

Four little switches in a chip-sized body.

See every part

- 8 pins
- 1 setting
- In 1 project
- In 1 lesson

Drawn live by the editor's own code, at the size you see it.

At a glance

## The 4-way DIP switch in brief

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

A 4-way DIP switch is four tiny slide switches in the body of a chip that sits across the breadboard’s center channel, with pins 1A to 4A along the bottom and 1B to 4B along the top. Switch n joins nA to nB when its lever is up toward ON, and no two switches share a pin. Wire it like four pushbuttons: the A side of every switch to ground and each B side to an Arduino Uno or ESP32 input with a pull-up, so an on switch reads 0 and an off switch reads 1. Mokxi models each closed switch as a 50 milliohm contact that passes current either way and each open one as two floating pins. The on property is a bitmask of where the switches start, bit 0 for switch 1, so 5 means switches 1 and 3. The classic mistakes are leaving out the pull resistors and assuming both rows number the same way, when switch 1 is first on the bottom row and last on the top. Contact bounce and current rating are not modeled.

Family

Inputs

Pins

8

on

0

Pins

## 8 pins

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

- 1A
- 2A
- 3A
- 4A
- 4B
- 3B
- 2B
- 1B

How to use it

## How to use a 4-way DIP switch with an Arduino

Treat it as four separate switches. On an Arduino, wire one side of every switch to GND and each other side to its own digital pin set to INPUT_PULLUP; an on switch then reads LOW. Read all four pins and add up the bits, switch 1 worth 1, switch 2 worth 2, switch 3 worth 4 and switch 4 worth 8, to get a number from 0 to 15.

The circuit here does the same job with no processor: the B side of every switch goes to 5 V, a 10 k resistor network pulls each A side to ground, and a CD4511 turns the four bits into a digit. Wired this way, an on switch reads 1. It starts on 5, switches 1 and 3.

Part pin

Board pin

1B, 2B, 3B, 4B

5 V

1A, 2A, 3A, 4A

CD4511 inputs A, B, C, D

10 k resistor network

Each A side to GND

Click to open it in the editor

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

How it is modeled

## What is true about the 4-way DIP switch, here

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

### Modeled

A closed switch is a real contact (a fraction of an ohm) that passes current either
way, so a DIP switch can route a supply as well as set a logic level, and an open
switch leaves both of its pins floating, as on the bench.

### Not modeled

No contact bounce. A slide contact does bounce for a fraction of a millisecond, but a
DIP switch is set by hand and left, so nothing reads one fast enough to see it; use
the pushbutton for bounce. No contact rating: a real DIP
switch carries a few tens of milliamps at most.

From DIP switch (4 and 8 way), in full.

Projects

## See the 4-way DIP switch in a project

One built-in project uses it. It opens in the editor, already wired.

Lessons

## Where it turns up in a lesson

One lesson places it in its own circuit.

### Learn articles

1 lesson

- BCD to 7 Segment Decoder: CD4511 Truth Table, Live

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 4-way DIP switch

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
