2-Wire Controlled Digital DIP Switch Using the DS3904

2-Wire Controlled Digital DIP Switch Using the DS3904



The DS3904 contains three digitally controlled nonvolatile (NV) variable resistors. It has the capability of placing each of the variable resistors into a high-impedance state. Using this feature, it is possible to create a 2-wire controlled NV digital DIP switch. This application note will explain the resistor settings necessary to create a digital DIP switch using the DS3904, and how to create NV outputs that can be used to configure digital systems.

Resistor Register Settings

To place one of the DS3904 in high-impedance mode, the MSB of the selected resistor register must be written to a '1'. For example, writing 80h to one of the variable resistor registers enables the high-impedance mode for that resistor. This value can be used to generate a HIGH when combined with a pullup resistor. To attain the smallest resistance available from the variable resistors (typically 400Ω), the resistor register must be set to 00h (position 0). This will generate a LOW.

Hardware Requirements

When using a mechanical DIP switch to control a digital input, pullup resistors are used to create a HIGH state (see Figure 1). A LOW is generated by closing the DIP switch.

Figure 1. Mechanical DIP switch.

Figure 1. Mechanical DIP switch.

The DS3904 can be used to replace a mechanical DIP switch by taking advantage of the high-impedance mode. By connecting a pullup resistor from each of the H terminal pins to a voltage potential, a HIGH state will be created when the corresponding variable resistor is placed in high-impedance mode. A LOW state is created by writing 00h to the resistor register. The voltage limit on the H pins is 5.5V and the current limit is 3mA. To satisfy those limits and the voltage level requirements for a digital input, a 10kΩ pullup resistor is used (see Figure 2). Assuming a voltage of 5.0V, a position 0 variable resistor value of 400Ω, and a pullup resistor value of 10kΩ, a LOW state will produce a voltage of approximately 0.19V.

Figure 2. Example DS3900 interface board.

Figure 2. Example DS3900 interface board.

Advantages of Using a Digital DIP Switch

Using the DS3904 instead of a conventional mechanical DIP switch offers the advantages of smaller size and better security. The 8-pin µSOP footprint of the DS3904 is much smaller than mechanical DIP switches. Even with two DS3904s placed side-by-side, the combined footprint is much smaller than that of an 8-pin DIP switch. The profile of the µSOP package is also much lower than that of a mechanical DIP switch.

With the DS3904, there is no temptation to accidentally toggle the switches. The resistor registers must be addressed before a change can be made, thus the resistor register values are protected from curious users or unintentional toggling. This is an advantage for production testing because human interaction is not required to toggle the switches. With the 2-wire controlled digital switch, the production program can toggle the instead of an operator. The switches are non-volatile and will remain set after power is cycled to the device.

While a mechanical DIP switch typically provides at least 5000 operations, the DS3904 provides a minimum of 50,000 operations at 85°C. The 2-wire interface allows the DS3904 to toggle quickly, and its monolithic design is resistant to vibrations. The DS3904 is also less than half the cost of a mechanical DIP switch.


If a system requires a status indicator or just a method of toggling a bit or two, then the DS3904 is an ideal solution. It has a small footprint, a low-profile, and is a surface-mount device. It is electronically and physically secure from accidental switching. Finally, it offers fast switching, has a longer life than mechanical DIP switches, and is half the cost of a conventional mechanical DIP switch.