My project is to use an Arduino to control the lighting of a small apartment. My preferred option is to replace each wall light switch with a 4x4 membrane keypad (https://www.amazon.co.uk/Mirocle-Matrix-Membrane-Keyboard-Arduino/dp/B01LMU6OPG/ref=sr_1_19?s=electronics&ie=UTF8&qid=1504376458&sr=1-19&keywords=membrane+keypad). The UX would allow any keypad to control any light, eg. pressing 1-4 will set light 1 to brightness 4.

The problem I have is this will result require 4 x 8 = 32 pins, so I'm looking for alternatives.

So my questions:-

1/ Is there a simple pll to serial converter that I should be using to interface the keypads?

2/ Can I wire multiple keypads onto the same set of 8 pins? Only one keypad will ever be touched at one time.

3/ Are there simple serial versions of the classic membrane keypad.

  • Why? The only reason for that is to avoid searching the light switch in the dark, but that's not the case when you are in your own house. I can walk around mine in complete darkness and find the light switch for any room.
    – user31481
    Sep 2 '17 at 18:46
  • 2
    the short answer is "because it's my apartment and that's what I want to do". The slightly longer answer is "my apartment is never pitch black, also some lights are on photocell-gated, PIR motion detectors, and also the bottom left key will turn on a light with a single press. Luckily it's not a requirement of SE that every Arduino question needs to come with a justification for the project. Notwithstanding that, thanks for sharing that you can walk around your apartment in complete darkness with the SE community. We're all enriched by that knowledge.
    – pinoyyid
    Sep 2 '17 at 19:01

As far as I know, you can connect multiple keypads of this type to a single set of 8 pins. However, it seems like a lot of wire needs to be strung to get this to work, for each switch, 8 wires for the keypad, and two, or more, for power control.

Were I to do this project. I would likely handle each switch independently, embedding a Pro Mini in each switch box along with an HC-12, or some such. This means no wires are needed, any pad could control any switch, and expansion is much easier.

Of course, this is only what I would do, and you understand your own requirements far better than I.

  • many thx. I'm very open to alternative approaches, so I'll look into HC12. My architecture is the way it is because I want to run everything off a dedicated 12V circuit, and was trying to avoid having to distribute too much power.
    – pinoyyid
    Sep 2 '17 at 19:30
  • @pinoyyid Good luck in your endeavour, whatever path you choose. You will find the HC-12 to be very easy to work with, and highly reliable. I have used a few dozen with different networked projects of mine, and it is one of my favourite components.
    – KC Tucker
    Sep 2 '17 at 19:36
  • Cool. Part of my architecture is to link the Arduinos with a controlling Raspberry. The HC-12 looks a great option for that aspect.
    – pinoyyid
    Sep 2 '17 at 19:38

Or the 8 pins 4 will be connected to output pins to be enabled one at a time and 4 will be connected to input pins that get shorted to the input pins when the button is pressed.

The way to get a keypress from this will be to pull a single output pin high and then check all of the inputs, if any of them are high then the corresponding button is pressed.

If you want to treat all keypads the same then you can simply put them in parallel. If you want to treat each of them differently then you can parallel either the inputs or the outputs. But the other set needs to have a S2P or P2S shift register to get the proper data or make the correct pin high.

Though it will probably be simpler if each got their own microcontroller to poll the keypad and use a different longer range protocol to communicate to the main controller.

  • I will be treating all keypads the same.
    – pinoyyid
    Sep 2 '17 at 19:31

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.