1
\$\begingroup\$

I'm trying to interface a steering wheel control interface with an Arduino.

The interface connector has 6 pins, A to F.
These pins are interconnected with 8 push buttons, SW1 to SW8:

schematic

simulate this circuit – Schematic created using CircuitLab

These buttons don't have a common ground, so I can't connect them directly to the Arduino.

How can I interface these with the Arduino, in order to know which button is pressed?

What came to my mind is creating a network of resistors, injecting +5V somewhere, and reading an analog value that would be dependent on which button is pressed, but I'm not sure how to do that, or even if it is the best solution.

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

Hoping that only one button will be pressed at a time, I have a software solution based on polling :

Let A is connected to Pin1, B is connected to Pin2 and so on..

First configure Pin1 as output port and all others as inputs. And out a logic '1' at Pin1. Read the values at Pin2 to Pin6.

  • if Pin2 = '1' then SW1 is pressed.
  • if Pin4 = '1' and then SW5 is pressed.

Now repeat the above steps with Pin2 as output port and others as input ports (Change the conditions accordingly).

EDIT: As Spehro Pefhany commented, this will work for upto two switches pressed simultaneously.

\$\endgroup\$
5
  • \$\begingroup\$ I think it will work for up to two switches pressed simultaneously. 1+2+5 is indistinguishable from 7 or both 7 + 1+2+5. \$\endgroup\$ Jul 27, 2014 at 18:24
  • \$\begingroup\$ @SpehroPefhany Yes.. I see my mistake. Edited the answer. \$\endgroup\$
    – nidhin
    Jul 27, 2014 at 18:31
  • \$\begingroup\$ I think you'd have to configure each input with an internal pull-down (not sure if Arduino has this capability). \$\endgroup\$
    – kjgregory
    Jul 27, 2014 at 20:39
  • \$\begingroup\$ @KGregory if the test bit is 0 then internal pull-up can do the job. But I am also not sure if Arduino has this capability. \$\endgroup\$
    – nidhin
    Jul 28, 2014 at 3:58
  • \$\begingroup\$ Thanks, Arduino does have the pull-ups, so I've done it this way: pin A to 0, pin B, D and F as INPUT_PULLUP, then read their values. Repeat with pin C against B, F and D, and finally pin E against D and F! \$\endgroup\$
    – BenMorel
    Jul 28, 2014 at 9:10

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.