A DIP switch (Dual In-line Package switch) is a set of tiny toggle switches mounted in a package that fits standard IC sockets. DIP switches are used to configure hardware settings on PCBs — think of them as physical configuration bits that do not need any software to change.
What Is a DIP Switch?
A DIP switch is a manual switch packaged in a standard DIP (Dual In-line Package) form factor with 2.54 mm pin spacing. It contains multiple individual SPST switches arranged in a row. Common configurations include 2, 4, 6, 8, 10, and 12 positions.
Each switch position represents one binary bit — ON (1) or OFF (0). An 8-position DIP switch can represent 256 different binary values (2^8), making it useful for setting device addresses, configuration modes, and baud rates.
Types of DIP Switches
- Slide DIP — The most common type. Each switch has a tiny slider that you push to one side or the other. Requires a pen tip or small screwdriver.
- Rocker DIP — Each switch has a miniature rocker mechanism. Slightly easier to operate than slide types.
- Rotary DIP — A single rotary wheel that encodes a multi-bit value. Each wheel position corresponds to a hexadecimal digit (0-F).
- Piano DIP — Switches look like miniature piano keys. Less common but ergonomic for frequent adjustments.
Reading DIP Switch Settings
DIP switch settings are typically read as binary numbers, with switch 1 being the Least Significant Bit (LSB):
| SW8 | SW7 | SW6 | SW5 | SW4 | SW3 | SW2 | SW1 | Value |
|---|---|---|---|---|---|---|---|---|
| OFF | OFF | OFF | OFF | OFF | OFF | OFF | ON | 1 |
| OFF | OFF | OFF | OFF | OFF | OFF | ON | OFF | 2 |
| OFF | OFF | OFF | OFF | ON | ON | OFF | ON | 13 |
Using DIP Switch with Arduino
Connect each DIP switch position to a digital input pin with the internal pull-up resistor enabled. When a switch is ON, it connects the pin to GND (reads LOW). When OFF, the pull-up holds the pin HIGH.
// Read 8-position DIP switch
int dipPins[] = {2, 3, 4, 5, 6, 7, 8, 9};
int address = 0;
void setup() {
for (int i = 0; i < 8; i++) {
pinMode(dipPins[i], INPUT_PULLUP);
}
Serial.begin(9600);
}
void loop() {
address = 0;
for (int i = 0; i < 8; i++) {
if (digitalRead(dipPins[i]) == LOW) {
address |= (1 << i);
}
}
Serial.print("DIP Address: ");
Serial.println(address);
delay(1000);
}
Common Applications
- I2C/SPI address selection — Many sensor breakout boards have DIP switches or solder jumpers to set the device address on the bus.
- Baud rate configuration — Serial communication modules use DIP switches to set the baud rate without needing firmware changes.
- Stepper motor driver settings — DRV8825 and A4988 drivers use DIP switches (or jumper pins) to set microstepping mode.
- Industrial PLCs — Address and mode configuration for Modbus slaves and network devices.
- Garage door openers and RF remotes — Older remote systems use matching DIP switch codes for pairing.
Recommended Products from Zbotic
Tactile Push Button Switch 6x6x5mm (Pack of 10)
830 Tie Points Solderless Breadboard
10CM Male To Female Breadboard Jumper Wires 2.54MM – 40Pcs
Frequently Asked Questions
What is the difference between a DIP switch and a jumper?
A DIP switch is a proper switch you can toggle without tools. A jumper is a removable shorting block on header pins — it is cheaper but easier to lose and harder to change frequently.
Can I replace DIP switches with software configuration?
Yes, modern devices often use EEPROM or flash-based configuration instead of DIP switches. However, DIP switches are still preferred for settings that need to be changed without a computer (such as field-deployed equipment).
How many positions do I need?
It depends on the number of configuration bits. For I2C address selection (3 bits), a 4-position DIP switch is sufficient. For a full byte of configuration, use an 8-position DIP switch.
Get Your PCB Components
Find DIP switches, resistors, and prototyping essentials at Zbotic.in!
Add comment