Trevader24135
Posts: 7
Joined: Sun Jan 18, 2015 3:30 am

use just a couple GPIO pins to emulate a full keyboard

Wed Aug 09, 2017 10:44 pm

Basically I want to build a raspberry pi graphing calculator. I want to combine this LCD: http://www.ebay.com/itm/3-5-LCD-Touch-S ... 0005.m1851 with a raspberry pi zero and add some keys using what few IO pins remain after the LCD. how can I, say, multiplex the buttons and send that to the zero and use that as a keyboard? and, if possible, can I use some keys for both a number and alphanumeric like a regular calculator through the use of an alpha key or something like that.
I appreciate any help, thanks!

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

Re: use just a couple GPIO pins to emulate a full keyboard

Wed Aug 09, 2017 11:18 pm

there are many solutions to expand the I/O you need for a keyboard, but the most basic way (so that you don't need one I/O port for one key) is to use a keyboard matrix. The principle is that you have rows and column lines and switches on the crosspoints of a row and column line. You actively pull only one of the row lines low, then detect which one, if any, of the column lines (which are all pulled up by pullup resistors) goes low.
The row lines are normally connected to a 3 to 8 decoder with open collector outputs, and controlled with 3 GPIO outputs, the column lines (however many you need) are connected to GPIO inputs.
You could use I2C I/O expanders if you do not have the I/O's needed.

https://en.wikipedia.org/wiki/Keyboard_matrix_circuit

Return to “Other projects”