PI_newbee
Posts: 164
Joined: Mon Aug 26, 2013 7:41 pm

4x4 keypad over expander ?

Sat Dec 02, 2017 5:43 am

Hi to all.
Am a bit short with wires so i have to find a way to connect 4x4 keypad with up to 5 wires.
Is there some ready made pcb board for this ?

PIN

broe23
Posts: 903
Joined: Thu Jan 28, 2016 9:35 pm
Location: Central IL
Contact: Website

Re: 4x4 keypad over expander ?

Sat Dec 02, 2017 5:51 am

Yes, it is called Breadboarding. It does help if you post a picture of your current setup and a schematic of what you are planning to do with the other module.
Ren: Now listen, Cadet. I've got a job for you. See this button? Ren: Don't touch it! It's the History Eraser button, you fool! Stimpy: So what'll happen? Ren: That's just it. We don't know. Maybe something bad, maybe something good.

PI_newbee
Posts: 164
Joined: Mon Aug 26, 2013 7:41 pm

Re: 4x4 keypad over expander ?

Sat Dec 02, 2017 7:55 am

Yes, it is called Breadboarding
--> :-) . Like i wrote, i need ready made PCB solution on which i can solder 8 input wires from keypad and expect 5 output wires for rsp.

Like this :
4x4 keypad ---> 8 wires --> extender module ---> 5 wires ---> RSP
Keypad will be used for unlocking doors..

Best regards !

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4247
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: 4x4 keypad over expander ?

Sat Dec 02, 2017 8:16 am

You are not likely to find a PCB for sale that does exactly what you are asking for.

We do need to know a little more before we can give you a solution to your problem (rather than just an answer to your question, which is "no" and doesn't help you.)

Do you have a plan for how you will write the software to control those 5 wires to communicate with the keypad?
Why are you limited to 5 wires? Is it just because you have a length of cable already or have you used up all but 5 GPIO pins? (If it's the latter, which pins are available?)
How far away from the Pi is the keypad to be mounted?

If you are trying to connect the Pi to a keypad mounted a short distance away and limited in that the available cable has only 5 cores, then the only answer I can suggest is a stand-alone I2C I/O expander. You might be able to find such a thing for sale, or make one on a piece of veroboard. But that's a lot of assumptions. You may not have I2C available if you have used it already or the distance may be too great.

PI_newbee
Posts: 164
Joined: Mon Aug 26, 2013 7:41 pm

Re: 4x4 keypad over expander ?

Sat Dec 02, 2017 11:17 am

Do you have a plan for how you will write the software to control those 5 wires to communicate with the keypad?
--> i have written sw before but at this time i have used 1:1 connection, so all 8 wires ware directly connected to RSP.
It worked great but like i wrote, now i have to reduce the wires so i will have to adapt the code...

How far away from the Pi is the keypad to be mounted?
--> that's a good question. I almost forget this part. The keypad will be mounted 4 meters from RSP.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 11015
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: 4x4 keypad over expander ?

Sat Dec 02, 2017 1:10 pm

you could use a 3-input to 8-output 3.3V demultiplexer IC with an 8 x 2 key (=16 keys, same as 4 x 4) arrangement, and buffer the two output lines with a 3.3V powered IC.
you will need 7 wires, 3-inputs, 2 outputs, and GND and 3V3.
perhaps it will work without the buffers, if you use strong pullups (2K2), but in time the carbon pads of the keys may make weaker contact, and may not be able to overcome the strong pullups sufficiently. so I would use somewhat weaker pullups (10K) and use a buffer.

If you absolutely cannot use more than 5 wires, then the only solution is to use some kind of intelligence at the end of the wire.
How about using shift registers to clock out 16 bits for 16 individual keys. GND, VCC, shift-clock, latch-data-in and data-out, thats 5 wires, and could work.

or simply use an I2C I/O expander, but four meter is a bit much for I2C.

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4247
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: 4x4 keypad over expander ?

Sat Dec 02, 2017 2:45 pm

Four metres is rather too much for I2C or USB. It's probably too much for 3.3V power as well although you could probably get away with passing 5V over the cable and regulating it down to 3.3V.

With all that in mind, I would tend toward using RS232 or the 5V alternative that the BBC Microcomputer used -- RS423 IIRC.

There are I/O boards out there that take an RS232 port and give 8 I/O pins, but they are for industrial applications and cost around $100.

To my mind, your best bet would be an AVRmega8 chip (£2.75 from RS). It has more than 8 I/O plus a UART. That's the same family of chip that is used in the Arduino, so community support is good and there's plenty of software available and you can write in C and compile it on the RaspPi. You'll need a programmer too, but those are also dirt cheap. (see http://www.ladyada.net/learn/avr/programmers.html). You'll need to build the circuit on a piece of Veroboard but it's three chips (ATMega8, buffer and voltage regulator), a ceramic resonator for the ATMega clock and some resistors and capacitors. At the RaspPi end you'll just need a USB-serial adapter.

There are other technologies out there -- Ethernet or wireless (Bluetooth, Zigbee, WiFi) -- but they are more expensive and will cause problems getting power to the keypad or need special cabling. At least the Zigbee will need programming anyway.

PI_newbee
Posts: 164
Joined: Mon Aug 26, 2013 7:41 pm

Re: 4x4 keypad over expander ?

Sat Dec 02, 2017 6:00 pm

I have one idea :-)
I can move instalation box ( place where electronics will be set ) closer to door. In that case i will be cca 2 - 2.5 meters form keypad.
Then i can use I2C.

Atmel
- thank you for suggestion. It's nice to see that some one is still using "old way" to develop things :-)
- i have worked with arm / microchip and Atmel and i have maybe 5 different programmers/debuggers :-)

Anyways, now we have to define / search for some product that will do the job.
Mahjong has suggested I2C expander and i also think that this is the best choice, but which one ?

PIN

Return to “General discussion”