2 Line DIP Switch

Hi everyone,

I'm looking for a way to set a value on an arduino project, manually, like using a DIP switch.

The limitation with dip switches is the number of lines/pins needed.

I was thinking of using an array of resistors connected to each pin on a dip switch, so I could determine which switch was on or off.

Is there something I could use on an arduino project, where I only use 2 or 3 pins, and I can let the user set the value?

J

Create an R-2R Ladder, feed the analog result to an analog pin. Use the Dip Switch to set binary values.

Resistor_ladder

One option is to use a quadrature encoder switch (which uses two inputs), as well as a display. The encoder knob increments or decrements a value that is then displayed.

An encoder doesn't hold state, which would mean having to store value in EEPROM, and not being
able to set it without the power on and feedback from the code.

In the back old days a diode matrix would be used for such things I think, but that's rather
permanent. A rotary switch with a resistor chain is possible - just use it as one arm of a
resistor divider.

Even better (more reliable and requiring no calibration), use a shift register such as a 74HC165.

3 pins - clock, latch and data (2 inputs, one output) but the two output pins may be shared with any other function which does not matter if they are set randomly when that function is not immediately in use.

And of course, you can chain them for any reasonable multiple of eight digital inputs. You will need pull-up resistor arrays.

Why do I not like resistor ladders as control inputs? Experience with consumer devices such as computer monitors, TVs, MP3 players and tablet computers where this "kludge" is used.

Hi
Rotary DIP Switches, google it

Example,

16 positions using 4 lines.

Tom.... :slight_smile:

TomGeorge:
Rotary DIP Switches, google it

Hmmm.

jgporteous:
The limitation with dip switches is the number of lines/pins needed.