0
\$\begingroup\$

Posted recently this: https://electronics.stackexchange.com/questions/210904/detect-rotation-of-a-rotary-switch

But I want to be more precise about what I'm trying to do. I have a 1 pole 8 position rotary switch with continuous rotation, and I need an interface (a micro?) to send pulse A for each click clockwise, pulse B for each click counterclockwise. Cannot use a rotary encoder as they have a low activation torque, and I need a strong "click" feeling. Any way to achieve this?

\$\endgroup\$
2
  • \$\begingroup\$ Have you considered getting an encoder with larger detents? \$\endgroup\$ Commented Jan 14, 2016 at 11:53
  • \$\begingroup\$ Yes I tried like a few different encoders but they all have a low activation torque. The best one is this: alps.com/prod/info/E/HTML/Encoder/Incremental/EC20A/… but the torque is still too low... \$\endgroup\$
    – Mssc
    Commented Jan 14, 2016 at 12:05

1 Answer 1

1
\$\begingroup\$

Two possible solutions both using micros. Currently you can get a PIC or ARM for under $2 so that is a good way to go.

a) Analog solution.

Wire a ring of resistors in series round the rotary switch.

Sense the voltage either using onboard ADC or time to charge a small cap past the schmidt trigger level of one of the inputs.

Compare 'ADC' value to previos to work out direction

b) Digital solution

Wire 8 lines to 8 inputs (even on a 20 pin TSSOP you have enough IO)

Wire the wiper to ground.

Wire pull ups from each of the 8 poles to Vcc (preferably use internal pull ups)

Set an IRQ on low to high change for any of the input pins, debounce

You can invert the sense of this wiring.

I have recently implemented a design where an ARM MCU is used as an I2C to parallel port. The solution was simpler, cheaper per pin and more flexible than any discreet logic I could find - including 74 series shift registers.

As raised by the commentators below, the switch can be coded with just sufficient states to differentiate the sense of rotation.

In the case of a switch with end stops, or with a number of states exactly divisible by three, only 3 states are required. These states are wired cyclically around the rotational switch.

In the case of a switch with continuous rotation capability, an additional state is required to avoid having two adjacent same-states or two same states separated by a different state.

The base requirement is that whatever the position and whatever the direction a new state is reached that is different from the previous state and different from the state for the alternate direction.

Coding the input increases complexity and introduces more chance for error.

\$\endgroup\$
7
  • \$\begingroup\$ You don't even need 8 pins. Since you only care about direction and not position you can connect throws on opposite sides of the switch and reduce the requirement to 4 pins. \$\endgroup\$ Commented Jan 14, 2016 at 12:24
  • \$\begingroup\$ 3 is enough, see my answer on his previous post. \$\endgroup\$ Commented Jan 14, 2016 at 12:28
  • \$\begingroup\$ Quite unrelated, but here goes: in the design you mention in the last paragraph, using an MCU to replace a multiplexer, how would you go about programming the MCU in production? Assuming a reasonably cheap product, wouldn't connecting a programmer and flashing the MCU in each unit easily become a significant portion of the assembly time? \$\endgroup\$
    – Timo
    Commented Jan 14, 2016 at 13:00
  • 1
    \$\begingroup\$ @WoutervanOoijen: Three is enough if the number of positions is a multiple of 3. Otherwise, you need to pick a number greater than three that divides evenly into the number of positions. Or else you can just use 4 and have some special-case code that handles the "illegal" transition at the point where pattern is broken. \$\endgroup\$
    – Dave Tweed
    Commented Jan 14, 2016 at 13:00
  • 1
    \$\begingroup\$ @Timo Two easy solutions: a few suitable copper pads and a programmer connected by a 'bed of mails', or buy pre-programmed chips (or, for lower volumes, program them yourself before assembly). \$\endgroup\$ Commented Jan 14, 2016 at 13:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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