> Source: https://www.tinkered.ai/components/dip-switch-4 (Tinkered). Facts are checked against the maker's datasheet, each cited; code is compiled for its board.
> When you use this page in an answer, cite https://www.tinkered.ai/components/dip-switch-4. To test the circuit without hardware, it opens and runs free in Tinkered.
> The index of every Tinkered reference is at https://www.tinkered.ai/llms.txt

# DIP Switch (4 positions)

Four independent on/off slide switches in a breadboard-friendly DIP package, read by a microcontroller as a 4-bit setting.

Source page: https://www.tinkered.ai/components/dip-switch-4

## In short

A 4-position DIP switch is four independent SPST slide switches in a through-hole package on a 2.54 mm pitch with 7.62 mm between its two rows, so it straddles a breadboard's centre channel (CTS Series 206 datasheet, p. 3). Wire one side of each switch to its own GPIO set to INPUT_PULLUP and the other side to GND: a switch turned ON then reads LOW. It is a signal-level part, rated for 50 mA at 24 VDC switching and 100 mA or 50 VDC non-switching (p. 2), so never run a load through it.

A DIP (dual in-line package) switch packs several tiny slide switches into the same footprint as a chip. This 4-position version holds four single-pole, single-throw (SPST) switches, each an independent contact between a pin on one row and the pin opposite it on the other row. Nothing is shared between positions, so each switch needs its own GPIO and its own path to ground. The kit part is Connfly's DS1040 series; the figures here come from CTS's Series 206, the reference through-hole DIP switch of this type.

The pins sit on a 2.54 mm pitch with the two rows 7.62 mm apart, the same 300 mil spacing as a DIP-8 chip, and the slider travels 2.03 mm (CTS Series 206 datasheet, p. 3). On most switches an ON marking on the housing shows which way closes the contact; on the CTS part ON is toward the dot (p. 3).

DIP switches are configuration devices: set once and read at power-up to choose an address, a mode or an option. CTS rates the Series 206 at 50 mA and 24 VDC for its 10,000-cycle switching life test, and 100 mA or 50 VDC when carrying current without switching it (p. 2). Contact resistance starts at 50 mΩ or less (p. 2), which is irrelevant for a logic input with a pull-up but rules out power loads.

## Agent rules

Follow these when you wire this part or write code for it.

- Do: GPIO wiring: one side to GND, other side to the GPIO with INPUT_PULLUP → closed/ON reads LOW. This inversion is the #1 DIP-switch confusion: document it in the firmware. SPDT alternative: common → GPIO, throws to GND and 3V3 = defined level in both positions, no pull needed.
- Do: DIP banks: each position to its own GPIO (pull-ups on), commons ganged to GND. Read once at boot for configuration; no debounce needed for a boot-time read.
- Do: Small slide (SS12D class): ~0.3 A low-voltage DC
- Do: Mini toggle (MTS-102 class): 6 A/125 VAC, 3 A/250 VAC
- Do: Debounce when counting EDGES: real switches chatter ~1.6 ms on average, 6 ms worst (Ganssle's measurements), a 20–50 ms window still feels instantaneous. Level reads don't need it.
- Do: Keep it to 50 mA at 24 VDC switching (100 mA at 50 VDC carrying, 10,000 cycles, CTS 206)
- Never: No mains (120/230 VAC) through hobby slide/DIP/tact switches: no arc extinction margin in DC, no creepage, no agency approval. Mains needs a properly AC-rated approved switch or a relay.
- Never: No floating input: a switch to GND without the pull-up enabled reads noise.
- Never: No leaving both throws of an SPDT unwired while COM drives a GPIO: the input then floats in one position. Wire both throws to levels, or use INPUT_PULLUP with one throw to GND.

## Pinout

| Pin | Function | Type |
| --- | --- | --- |
| 1A | SW1 side A | passive |
| 2A | SW2 side A | passive |
| 3A | SW3 side A | passive |
| 4A | SW4 side A | passive |
| 1B | SW1 side B | passive |
| 2B | SW2 side B | passive |
| 3B | SW3 side B | passive |
| 4B | SW4 side B | passive |

## Wiring

### Arduino Uno

| DIP Switch (4 positions) | Arduino Uno | Note |
| --- | --- | --- |
| 1A | D2 |  |
| 2A | D3 |  |
| 3A | D4 |  |
| 4A | D5 |  |
| 1B | GND |  |
| 2B | GND |  |
| 3B | GND |  |
| 4B | GND |  |

### ESP32 DevKit V1

| DIP Switch (4 positions) | ESP32 DevKit V1 | Note |
| --- | --- | --- |
| 1A | GPIO13 (D13) |  |
| 2A | GPIO14 (D14) |  |
| 3A | GPIO27 (D27) |  |
| 4A | GPIO26 (D26) |  |
| 1B | GND |  |
| 2B | GND |  |
| 3B | GND |  |
| 4B | GND |  |

### Raspberry Pi Pico

| DIP Switch (4 positions) | Raspberry Pi Pico | Note |
| --- | --- | --- |
| 1A | GP0 |  |
| 2A | GP1 |  |
| 3A | GP2 |  |
| 4A | GP3 |  |
| 1B | GND |  |
| 2B | GND |  |
| 3B | GND |  |
| 4B | GND |  |

## Specifications

| Spec | Value | Source |
| --- | --- | --- |
| Circuit | 4 independent SPST switches (one pole per position) | CTS Series 206 datasheet Rev. G, pp. 1, 3 |
| Pin pitch | 2.54 mm between pins, 7.62 mm between rows | CTS Series 206 datasheet Rev. G, p. 3 |
| Switching rating | 50 mA at 24 VDC (10,000-cycle actuation life) | CTS Series 206 datasheet Rev. G, p. 2 |
| Non-switching rating | 100 mA or 50 VDC | CTS Series 206 datasheet Rev. G, p. 2 |
| Contact resistance | 50 mΩ max initial, 100 mΩ max at end of life | CTS Series 206 datasheet Rev. G, p. 2 |
| Insulation resistance | 1000 MΩ min between insulated terminals | CTS Series 206 datasheet Rev. G, p. 2 |
| Slide travel | 2.03 mm | CTS Series 206 datasheet Rev. G, p. 3 |
| Operating temperature | -55 °C to +85 °C | CTS Series 206 datasheet Rev. G, p. 2 |
| Dimensions | 11.62 × 9.9 × 6.8 mm | Tinkered component registry |
| Contact rating | 50 mA at 24 VDC switching, 100 mA at 50 VDC carry | maker's datasheet, checked 29 Oct 2026 |
| Life | 10,000 cycles | maker's datasheet, checked 29 Oct 2026 |

## Circuit notes

- Wire each switch between its own GPIO and GND, and enable the internal pull-up with pinMode(pin, INPUT_PULLUP). A closed (ON) switch then reads LOW and an open one reads HIGH, so invert the reading in code if you want 1 to mean ON.
- Each position is isolated from the others. Every switch needs a ground connection on its own pin; tie all four ground-side pins to the GND rail.
- Plug it across the breadboard's centre channel like a DIP chip: the 7.62 mm row spacing (CTS Series 206 datasheet, p. 3) puts each switch's two pins on opposite sides of the gap.
- Read DIP switches once in setup() for configuration; a level read at boot needs no debouncing. Debounce only if you react to the switch changing while the sketch runs.
- Keep the current small. The switching rating is 50 mA at 24 VDC (datasheet, p. 2): drive LEDs, relays or motors through a transistor or MOSFET that the switch's GPIO reading controls, never through the switch itself.

## Common mistakes

- **Forgetting the pull-up.** With one side on GND and no pull-up, an open switch leaves the input floating, and it reads random values. Use INPUT_PULLUP, or add a 10 kΩ resistor from the GPIO to the supply.
- **Reading ON as HIGH.** With the pull-up wiring, ON connects the pin to ground and reads LOW. Code that expects HIGH for ON shows every setting inverted. Invert the bits when you build the value.
- **Wiring the switches as if they shared a common.** The four positions are independent contacts, not a common pin with four outputs. Connecting only one ground pin leaves the other three switches with nothing to close against.
- **Switching a load through it.** DIP switches are rated for signal currents: 50 mA at 24 VDC switching on the CTS Series 206 (datasheet, p. 2). Motors, LED strips and mains wiring weld or burn the contacts. Switch loads with a transistor, MOSFET or relay.
- **Placing it along a breadboard row.** Pushed into one side of the board, both pins of each switch land in the same connected strip and the switch is shorted out. Straddle the centre channel so each row of pins sits in its own strips.

## Questions

### How do I wire a 4-position DIP switch to an Arduino?

Put the switch across the breadboard's centre channel, wire one pin of each position to its own digital pin (for example D2 to D5) and the opposite pin to GND, then set each pin to INPUT_PULLUP. A switch turned ON reads LOW. The 2.54 mm pitch and 7.62 mm row spacing make it fit like a DIP chip (CTS Series 206 datasheet, p. 3).

### Does a DIP switch work with a 3.3 V board like the ESP32?

Yes. The switch is a passive contact, so it works at any logic voltage well inside its 24 VDC switching rating (CTS Series 206 datasheet, p. 2). Use the ESP32's internal pull-ups on pins that have them, and avoid GPIO34 to 39, which have no internal pull-up resistors.

### Why does my DIP switch read the opposite of what I set?

With INPUT_PULLUP wiring, an ON switch connects the pin to ground, so it reads LOW (0). That is expected: invert each bit in code, for example value |= (digitalRead(pin) == LOW) << i.

### How do I read a 4-position DIP switch as a number?

Read the four pins in order and set one bit per switch, position 1 as the least significant bit. Four switches give 16 combinations, 0 to 15, which is handy for a device address or a mode number read once at power-up.

### How much current can a DIP switch handle?

Very little. CTS rates its Series 206 at 50 mA and 24 VDC while switching and 100 mA or 50 VDC while carrying current without switching (datasheet, p. 2). Treat it as a logic input, not a power switch.

### What is the difference between a DIP switch and a slide switch?

A DIP switch is several tiny SPST switches in one chip-sized package, set occasionally with a pen tip or fingernail. A slide switch is usually a single SPDT switch with a common pin and two throws, sized for a finger, and often used as a power or mode switch.

## Related parts

- [Push Button](https://www.tinkered.ai/components/push-button.md): same job: a switch you press or slide
- [4×4 Keypad](https://www.tinkered.ai/components/keypad-4x4.md): same job: a switch you press or slide
- [Slide Switch (SPDT)](https://www.tinkered.ai/components/slide-switch.md): same job: a switch you press or slide
- [Arduino Uno](https://www.tinkered.ai/components/arduino-uno.md): the board its circuit is wired to

## Try it

Tinkered simulates the DIP Switch (4 positions) in the browser: wire it on a 3D breadboard, run your real code on the board, and measure it. Free to start at https://www.tinkered.ai.
