Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connecting to a membrane 3x4 Keypad without I2C? #1440

Closed
the-freshlord opened this issue Jan 23, 2018 · 7 comments
Closed

Connecting to a membrane 3x4 Keypad without I2C? #1440

the-freshlord opened this issue Jan 23, 2018 · 7 comments

Comments

@the-freshlord
Copy link

Hello,

I am working on a project that uses an Adafruit 3x4 membrane keyboard on a Raspberry Pi 3 Model B+. I read the documentation in regards to 12 Button Keypad but it says that it requires I2C backpack. Does that only apply to Arduino boards? If so, is there another way to read input from the keypad using the Board class methods for interacting with pins?

@dtex
Copy link
Collaborator

dtex commented Jan 25, 2018

Hi @eman6576

Sorry nobody has responded. I'm not familiar with the membrane keyboard or the Raspberry Pi, but I think I can hazard a guess (and it's just a guess).

The keypad requires tight timing when checking the pins. The commands required to toggle the pin state, check the values, and switch the pins back cannot be executed quickly enough over firmata/serialport. This limitation may not exist on the Pi, but it would stop the functionality from being added to Johnny-Five since firmata + firmata.js leads the way with functionality and drives where we go with the public API.

Maybe it's possible to do with rasp-io. I'm really not sure. Maybe it's possible to go even lower and write something custom. Have you seen any examples (besides the i2c backpack) where the membrane keyboard is used in node? What are they using?

@the-freshlord
Copy link
Author

@dtex The way that I am doing it currently is running a separate program in python that polls the keypad and prints to stdout the key entered. Then I am using python-shell to read in the output and handle it in Node. But I haven't seen anyone that has tried to do it in Node. But rasp-io might be the best place to add the functionality.

@dtex
Copy link
Collaborator

dtex commented Jan 26, 2018

Neat. Is the python program online somewhere? I'd like to see how it works.

@the-freshlord
Copy link
Author

The project is closed source but I could post a sample project if you want to take a look.

@rwaldron
Copy link
Owner

Membrane keypads like the one described here require synchronous digital pin read and write operations that interleave in nested loops (for each row, for each column) to determine "currently pressed button": https://github.com/rwaldron/johnny-five/blob/master/firmwares/keypad_3x4_i2c_nano_backpack.ino#L91-L107 This simply won't work with Node.js IO

@the-freshlord
Copy link
Author

@rwaldron Yes I have tried that approach but the performance is terrible. In Python, you can use event handlers for detecting when a button was tapped which is better than using loops. It would be cool if that could be done here.

@mpacary
Copy link

mpacary commented Mar 4, 2020

Hello,

I could get this 4x4 membrane keypad, directly wired on 8 GPIO pins, to work with Johnny-Five.

Setup :

  • Hard : Raspberry Pi 4B, 16x2 LCD display behind PCF8574T, 4x4 membrane keypad

  • Soft : Node v10+, Johnny-Five 1.4, Raspi-IO 11.0

Source

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants