10
\$\begingroup\$

I'm looking for a part that enables a user to frequently change a configuration. Right now I'm utilizing a SMD DIP switch connected to an I2C I/O expander.

What bothers me is the large footprint of these components (DIP switch combined with IO expander IC) as well at the rather tedious user interface. Are there DIP switches or something that serves the same function that I can talk to over a digital bus like I2C to read its state?

I'm also open to completely different approaches. All I need is something that can be mechanically altered in a permanent way and allows at least 64 different states. It is important that the configuration can be made when the circuit is not powered up and provides visual feedback of the exact configuration to the user. The only way where it would be ok to power up the circuit is if the configuration and visual feedback is self contained without the need for control from a microcontroller or SoC.

The question is somewhat related to this question from 6 years ago: DIP switch replacement

Edit: There are some great suggestions in the answers and I think I leave this question unanswered, community votes should decide what is helpful and what is not. If you have the same issue as I have, look through all the answers.

\$\endgroup\$
  • \$\begingroup\$ If you want it to be fancy, whack in bluetooth module and set all switches via smartphone. \$\endgroup\$ – Chupacabras Apr 18 '17 at 13:56
  • 8
    \$\begingroup\$ My first thought is that it's not the actual footprint that makes a dip switch large; it's the actual switches. Moving to a serial protocol wouldn't necessarily make it smaller. \$\endgroup\$ – pipe Apr 18 '17 at 14:06
  • 3
    \$\begingroup\$ Could you teach you users to count in Hex and use one or two of these? \$\endgroup\$ – brhans Apr 18 '17 at 14:28
  • \$\begingroup\$ Well I would like to get rid of the I2C multiplexer/port expander. If its just the DIP switch it would be fine. So if there is something like "digital DIP switch" that would be great. \$\endgroup\$ – PTS Apr 18 '17 at 15:09
  • 4
    \$\begingroup\$ How much smaller than a small 6-switch package do you expect it can be made before it's no longer mechanically manipulable? \$\endgroup\$ – Phil Frost Apr 18 '17 at 16:56

11 Answers 11

19
\$\begingroup\$

You could use a SIP switch instead of a DIP. The saving in board area would give you the space for your I2C interface (or a simpler interface like a shift register with input latch):

enter image description here

The picture shows it horizontal but it actually mounts vertically.

\$\endgroup\$
  • \$\begingroup\$ They are nice indeed and I'm considering them for my design though in a multilayer SMD board its a little difficult to use one of these without blocking a large area for routing. \$\endgroup\$ – PTS Apr 19 '17 at 22:19
  • 1
    \$\begingroup\$ There may be SMD versions. SMD SIP packages usually have staggered feet. \$\endgroup\$ – Passerby Apr 20 '17 at 1:14
  • \$\begingroup\$ SMD could be a challenge, Apem (who make the one in the picture) don't do them, I don't recall seeing them anywhere else. I'd normally have them near the edge of the PCB where routing isn't always so crucial. \$\endgroup\$ – Finbarr Apr 20 '17 at 7:24
9
\$\begingroup\$

"DIP" switch

First of all, a "DIP"-switch doesn't have to be large. Here is a 6-bit SMD switch with J-hook pins and a 1.27 mm pitch:

CHS-06TAenter image description here

Potentiometer

If you're desperate reducing the footprint, and you can inconvenience the user a bit, you could use a potentiometer connected to an A/D converter. Since you need 64 settings, a 12-bit converter should have more than enough resolution headroom to discern between the steps, given some electrical and software filtering and thresholding. Here's a 2 by 2 mm solution:

PVF2A

However, I have never seen an analog potentiometer with 64 physical detents. This means that you won't have any reliable tactical feedback for the user when configuring the device. It's also difficult to reliably find the correct setting at boot, since it can be left right on a threshold between two settings - I would store the previous setting in an EEPROM, and if the potentiometer is close enough to the stored value at boot, I would consider them equal.

Also, I would probably not use that 2 by 2 mm trimmer, but there are thousands of different trimpots.

\$\endgroup\$
  • \$\begingroup\$ Interesting idea with the potentiometer. Though visual feedback of the exact setting would be important. \$\endgroup\$ – PTS Apr 18 '17 at 15:06
  • \$\begingroup\$ Mini rotary encoders are available, similar profile to a trimmer pot but with binary outputs, usually 4-bit / 16 steps marked 0-F with clear detents. \$\endgroup\$ – John U Apr 19 '17 at 16:42
  • \$\begingroup\$ @JohnU You need two of those, leading to a larger solution. \$\endgroup\$ – pipe Apr 19 '17 at 16:44
  • \$\begingroup\$ Two of those (perhaps upright rather than flat) could make packaging easier. \$\endgroup\$ – John U Apr 19 '17 at 16:59
  • \$\begingroup\$ @PTS If there's already some kind of display available on your device, you can abuse the software to read the value and display it. Assuming you already got some kind of configuration menu loaded, this doesn't need to be a lot of work either. Of-course, you won't be able to read the display while the device is off. \$\endgroup\$ – Mast Apr 20 '17 at 6:03
9
\$\begingroup\$

Do you have a spare ADC?

If you have a spare 8-bit ADC on a nearby microcontroller, you could probably ditch the IO expander in favour a resistor network - either a R-2R ladder or a binary weighted ladder. That would encode the switch positions as an analog level. Resistor ladders are available in very small packages, but I don't know if you'll get one smaller than your I2C expander.

How many general purpose IO lines do you have?

If you can get by with fewer IO lines, maybe you can ditch the IO expander and use the ones you have? You can multiplex the switches onto less then six IO lines. In fact, if you have space for 3 diodes and your microcontroller has tristate pins, then you can manage with just 3 pins.

Can your users manage something a little technical?

If your users can follow instructions, and the configuration only changes rarely, you could have open terminals where they can put in a resistor. You'd measure the resistor with an ADC, or by measuring the time constant it makes against a capacitor. You'd need to be able to distinguish 64 resistor values, which could be tricky with the latter approach. And of course your users would need to have the right resistor values/case styles on hand.

\$\endgroup\$
  • \$\begingroup\$ With the resistors, you could also do 2 resistors, then you only need an 4 bit A/D convertor, and you need less amount of resisters to distribute, so you save the price \$\endgroup\$ – Ferrybig Apr 19 '17 at 7:24
  • \$\begingroup\$ I reworded my question. Its not necessarily the DIP switch size that concerns me but the need of the extra component in form of an I/O expander. Apart from my I2C bus I only have 3 IOs left. \$\endgroup\$ – PTS Apr 20 '17 at 13:53
  • \$\begingroup\$ Three tri-state IO lines is enough to address six switches. In general you can address n^2-n switches with n IO lines and n diodes. Should I add a schematic? \$\endgroup\$ – Jack B Apr 20 '17 at 14:07
6
\$\begingroup\$

One or more Coded rotary switches are what you're looking for.

Theoretically jumpers offer more configurations when you're requiring 100s of options because users can short any number of them together in different configurations, add resistors, capacitors, diodes, etc. but that is very technical for users and for the board to decipher!

\$\endgroup\$
  • \$\begingroup\$ Sorry I must have missed your answer when I added mine. Indeed they are a great alternative to DIP switches! \$\endgroup\$ – PTS Apr 20 '17 at 13:46
4
\$\begingroup\$

NFC NTAG from NXP + smartphone. It is basically an I2C EEPROM, that can also be read and written over NFC without system power.

\$\endgroup\$
2
\$\begingroup\$

Lots of great options here! One more somewhat obscure one: Use an IR receiver, and then use a TV remote or computer to beam over settings. That's how the RGB lights do it.

\$\endgroup\$
  • 1
    \$\begingroup\$ IR does provide a bit of energy, so it might just work when the device itself isn't powered, but how would you realize that in hardware? \$\endgroup\$ – MSalters Apr 19 '17 at 7:17
2
\$\begingroup\$

While researching this I got a recommendation for Rotary Coded Switches. Their footprint is comparable to a bit equivalent 1.27mm pitch DIP switch. Though they do offer a vastly superior user interfaces compared to DIP/SIP switches in my opinion.

Instead of needing to convert a decimal or hex number to binary and flip a ton of little switches you can simply turn 1 or 2 of these rotary switches and work with hex numbers. Much easier to tell a user to "enter" E6 than to instruct them to flip many switches in a specific pattern.

enter image description here

\$\endgroup\$
1
\$\begingroup\$

A different approach could be a rotary encoder, an EEPROM and 6 small LEDs.

The state is saved in the EEPROM, and the LEDs indicate the current selected mode.

Turning the encoder will switch between modes.

Probably not saving much space either - your typical encoder has a 6 mm shaft and then you need space for the LEDs as well.

Just using a single rotary switch doesn't look promising. With 64 positions, you'd end up with just under 6° per position, feeling that or labeling will become difficult.


Just read your comment @Trevors answer, so this approach is also useless.

\$\endgroup\$
  • \$\begingroup\$ Thanks any way though, your idea would at least not require that the whole system is booted. I added that as an acceptable way to the question. \$\endgroup\$ – PTS Apr 18 '17 at 15:10
  • \$\begingroup\$ A tiny pushbutton with the LEDs for cycling could work though. I bet that is the way they use to reprogram tricorders in Star Trek TNG \$\endgroup\$ – PlasmaHH Apr 18 '17 at 20:24
1
\$\begingroup\$

Three options.

  1. Analog. An adjustable voltage divider. User supplies their own standard 5% range resistors to set the value.

  2. PWM. An opto isolated PWM or RC style circuit with 64 steps that your device reads. They can be powered separately or from the same source, but since it's opto isolated your device won't be on. You could disable the PWM circuit after boot.

  3. Digital. A digital potentiometer with push button control. Again, the circuit can be powered independently from your device.

\$\endgroup\$
1
\$\begingroup\$

Thumbwheel encoders? These range from 0 to 9, are stackable and have binary outputs:

Thumbwheel encoders

\$\endgroup\$
  • 2
    \$\begingroup\$ Is this really smaller than an SMD DIP-switch? \$\endgroup\$ – pipe Apr 19 '17 at 16:45
  • \$\begingroup\$ Ouch, no. It's about as big as my inability to read a simple question... Please vote as you see fit. Sorry for wasting your time. \$\endgroup\$ – peter Apr 20 '17 at 9:50
0
\$\begingroup\$

You could always bring out the I2C or other interface maybe USB and let the user attach his phone with a custom app that lets you configure some internal EEPROM address.

However, using a phone application can be quite problematic. You would need to support the app and keep up to date with the latest technologies, and you would need to support many phone vendors.

Or you could supply a custom "Dongle" that plugs in an lets you do similar.

But I doubt it would save you much space.

If you have other user inputs, say two or three buttons and some sort of indicator, it is also possible to, with appropriate user input on the buttons (hold down time etc.), put the device into a programming mode, and configure it that way. Same thing you see on domestic appliances like thermostats, water softeners, can computer etc.

You can do a heck of a lot with two or three buttons and an LED.

If it needs to be configured while unpowered, you are pretty much stuck with switches or jumpers.

\$\endgroup\$
  • 3
    \$\begingroup\$ Using a phone application can be quite problematic, since phones are quite volatile. An embedded system can easily survive 5 to 10 phone generations and providing support for the whole time period can be problematic. \$\endgroup\$ – AndrejaKo Apr 18 '17 at 14:46
  • \$\begingroup\$ @AndrejaKo good point.. good enuf for an add :) \$\endgroup\$ – Trevor_G Apr 18 '17 at 14:47
  • 3
    \$\begingroup\$ Unfortunately the application requires that the user can change the config without having the circuit powered up, hence why I need it to be mechanically configurable. Some interesting ideas though. \$\endgroup\$ – PTS Apr 18 '17 at 15:05
  • 2
    \$\begingroup\$ @PTS then you are pretty much stuck with switches or jumpers. \$\endgroup\$ – Trevor_G Apr 18 '17 at 15:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.