0
\$\begingroup\$

I need to build a wired remote control unit for a project with 16 switches, where multiple switches will be pressed at the same time. Due to conduit size limitations, I can't have 17 wires running the length of about a meter. The switching voltage will be under 5 V. I can't use wireless connection due to metal parts and other electrical interference. What is the best way to design this? The remote control unit has limited space, about 5 x 3 cm (I will be using 5-way tactile switches). I was looking at ESP32 boards connected over I2C or 16-channel multiplexer boards. The mux boards I saw used 4 wires (4-bit), so they wouldn't allow multi-switch presses.

What is the recommended way for doing this? I an relatively new to DIY electronic design, so any suggestions will be helpful.

Edit 1: 5-way Tactile Switch: https://www.sparkfun.com/5-way-tactile-switch.html

Edit 2: The power system is 12V for a vehicle. The thickness of the cables I can use is limited by the pre-drilled holes on the structural pipes. I cannot safely enlarge the holes without compromising structural integrity. I am using a two of those 5-way switches and a two each of 2-way and momentary switches.

Edit 3: A max limit of 6 key rollover can be assumed.

\$\endgroup\$
7
  • \$\begingroup\$ what is a 5-way tactile switch? ... please add a link to the datasheet ... edit your post ... do not write a comment \$\endgroup\$ Commented Feb 17 at 16:47
  • \$\begingroup\$ Do you mean a 5 x 5 switch matrix? Are they simple push-to-make buttons? Can you post a link to the switches' datasheet? Hit the Edit link below your question. \$\endgroup\$ Commented Feb 17 at 17:02
  • 2
    \$\begingroup\$ @jsotola: 5-way switch usually refers to a simple joystick that has contact closures for up, down, left and right, plus one more for pushing in. \$\endgroup\$ Commented Feb 17 at 17:40
  • 2
    \$\begingroup\$ What makes you think that a 4-wire interface can't handle an arbitrary number of switches? Your PC keyboard (PS/2 or USB) has on the order of 100 switches and does just fine. \$\endgroup\$ Commented Feb 17 at 17:43
  • \$\begingroup\$ Hopefully you don’t have mains or other wires in the conduit - that would cause significant interference with low level logic signals. \$\endgroup\$ Commented Feb 17 at 22:42

6 Answers 6

0
\$\begingroup\$

A full microprocessor to run the keypad seems a bit much, especially if you don't have experience designing around them. There are I/O expanders that should be easier for you to work with; most have interrupts that make interfacing with another microprocessor a snap. I don't like recommending I2C for off-board, but 1m isn't too terribly long. Shift registers are another possibility. An exponential resistance ladder is probably not tenable with 16 switches.

\$\endgroup\$
1
  • \$\begingroup\$ I am not familiar with I/O expanders. I will try to learn more about them. Thanks. \$\endgroup\$ Commented Feb 26 at 5:05
0
\$\begingroup\$

There are plenty of examples of implementing the PS/2 protocol — both host side and device side — in the Arduino environment. My recommendation would be to use a simple Arduino board at each end of the connection and the PS/2 keyboard protocol to connect them.

\$\endgroup\$
1
  • \$\begingroup\$ I won't recommend because it makes no sense. For the same amount of wires (4) with two bidirectional open-drain wires for communication, you can just use I2C which is much simpler. No need for MCU at button end. \$\endgroup\$ Commented Feb 18 at 9:43
0
\$\begingroup\$

Wire the switches to a 16-bit D to A converter (or use a resistors). Then connect to an analog input port that has at least 16-bit resolutions. If your analog inputs have only 8-bit resolution, then wire 8 switches to each.

\$\endgroup\$
2
  • \$\begingroup\$ For detecting multiple buttons, an 8-bit DAC made with buttons cannot be reliably detected by 8-bit ADC. You always have 1 LSB noise. \$\endgroup\$ Commented Feb 19 at 20:16
  • \$\begingroup\$ Not sure, but it's possible. Anyway, the basic idea is scalable. \$\endgroup\$ Commented Feb 19 at 20:29
0
\$\begingroup\$

You could use two 74HC151 to sense 16 switches using a total of 7 wires.

1. Vdd
2. GND
3.4.5. address
6. address (via OE and inverter) or data 1 
7. data 0 

Just scan the switches fast enough to detect changes. No point going really fast- you will need debouncing for mechanical switches anyway, so maybe scan at 100~150usec per switch, or about 500Hz for the array. I would use a periodic ISR and incorporate debouncing into the ISR (adjusting the scan rate to suit the bounce specifications of the switches).

Each switch will need a pullup resistor (could be part of an array). No diodes are required with this approach.


An even simpler approach is to use a PCF8575 I2C port expander. That requires only 4 wires, and the chip does not necessarily require pullup resistors for each input (and hobbyist modules are available). There are at least 3 manufacturers of the chip, so it's not single-sourced. Again you would poll the chip at < 1kHz to find the switch states and debounce.

\$\endgroup\$
1
  • \$\begingroup\$ I will look more into these. Thanks. \$\endgroup\$ Commented Feb 26 at 5:23
0
\$\begingroup\$

If you can fit two x 1m Cat-5e cables;

That gives you 8 pairs and a ground wire shield for 16 signals and 2 shields that can be 0V and/or 5V and switch closure to ground or 5V.

You may use hardwire or use RJ-45 plug/jacks.

  1. Typical standard Cat‑5e patch cords are about 5.0–5.5 mm OD.
  2. Slim Cat‑5e cables with 28 AWG are around 3.5–3.8 mm OD, e.g. C2G and Tripp‑Lite/Eaton “slim” Cat‑5e lines.
  3. “Ultra‑flat” Cat‑5e exists at about 5.0 mm × 1.2 mm if a flat profile helps more than a small round OD.
\$\endgroup\$
2
  • \$\begingroup\$ That sounds like an option. But two Cat-5e cables with their insulation will be a bit too thick for my routing holes. I could probably fit 1 of those cables. \$\endgroup\$ Commented Feb 26 at 5:02
  • \$\begingroup\$ that's too bad. \$\endgroup\$ Commented Feb 26 at 6:27
-1
\$\begingroup\$

Few wires and lots of switches, means you can make a long word of the switch status (0 for open, 1 for closed...) and squirt that word every millisecond or ten over your cable. There's serial communication chips in most old PCs that facilitated that, and some of those 'serial port' functions are still built-ins on modern controller ICs.

If you need speed, fast updating can be handled by the old AMD taxi chips Am7968/Am7969 which might still be available. You could alternate between two 9-bit halves of your 16 bit switch state, allowing the 'extra' bit to choose which of two output latches to update.

Better, DS92LV16 is a serializer/deserializer (SERDES) that's still available, it's kinda overkill because it can be clocked at gigabit rates... but it kills the problem.

\$\endgroup\$
2
  • 2
    \$\begingroup\$ Seriously, using a 3 decade old 140Mbps SERDES chipset just for reading 16 buttons? The two chips alone are $150. Are you absolutely sure you want to recommend this, and why? \$\endgroup\$ Commented Feb 18 at 11:16
  • \$\begingroup\$ @Justme Oh, at $150 I'd consider those unavailable, but I've got two sets of 'em, soldered in, in my junk pile of old boards. \$\endgroup\$ Commented Feb 18 at 21:03

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.