0
\$\begingroup\$

I would like to use the following component in my design:

https://www.alps.com/prod/info/E/HTML/MultiControl/Switch/RKJXW/RKJXW1014002.html

This is a 8 way directional switch with push button (it also has an encoder (photo interrupter) and I have already figured that part out and it works fine).

What I don't understand is how the different switches should be wired to a micro-controller.

There are 3 inputs (A to C) and 4 outputs (a-d). See the image below: enter image description here

As an example according to the connection chart, if S3 & S4 is activated then the joystick is in direction A, but at the same time S8 & S7 would also be activated and that would imply the switch is in direction E.

Could someone please describe what I am missing here. How should these input/output be connected.

enter image description here

\$\endgroup\$
0
\$\begingroup\$

Looks like the idea is similar to that of a computer keyboard. In a keyboard, the controller would apply a high voltage to a row, and read back the voltage at each column. If you only set one row high at a time, you know which switch is causing its column to go high. Comparing this to your device, a "row" would be [A, B, or C] and a "column" would be [a, b, c, or d].

The example given in your second image seems to indicate this. Set the switch to position A. Then set B high. You'll observe both a and b are high (because S3 and S4 are closed), c is high or low (because S10 is either open or closed), and d is low (because S9 is closed). Since you're not setting C high yet, S7 and S8 play no role.

You can extend that example and consider what happens when you set B low again, then set C high. What outputs would you observe as high, assuming your switch is still in position A? (Answer: d only)

Your controller should set each of A, B, and C high independently, observe the outputs, and compare to the chart. A, B, and C will be outputs of your controller, and a, b, c, and d should be inputs.

I would recommend a series diode at each of A, B, and C. Without diodes, consider what happens if you set B low and C high while switches S4 and S5 are both closed. You will have your "high" shorted directly to "low".

Weak pulldown resistors on the outputs would be prudent, to ensure a good logic-low when the connected switches are closed.

\$\endgroup\$

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.