Hardware Reference
In-Depth Information
The wires from the numeric keypad run to seven pins (pins 1 and 7 are labeled). Use
the jumper wires to connect these pins into your breadboard. By scanning the activity
of the rows and columns, you can detect which button is being pressed on the keypad
and translate it to the corresponding number.
The ordering of the pins might be logical from a layout perspective, but it took us a bit
of trial and error to determine which rows and columns matched up to the keypad
pins. See Table 6-3 for reference.
Table 6-3. Keypad pins and associated rows/columns
KEYPAD PIN NUMBER
ROW/COLUMN
7
Row 1
6
Row 2
5
Row 3
4
Row 4
3
Column 1
2
Column 2
1
Column 3
Obviously, if you're using a different numeric keypad, your pinouts may differ.
Connecting the Keypad to the Raspberry Pi
The simplest way to connect the numeric keypad to the Raspberry Pi is to connect
each of the keypad pins to a dedicated GPIO pin. The code in this hack assumes that
you have the pins connected as shown in Table 6-4 .
Table 6-4. Keypad pins to GPIP pins
KEYPAD PIN NUMBER
ROW/COLUMN
GPIO PIN
7
Row 1
18
6
Row 2
23
5
Row 3
24
4
Row 4
25
3
Column 1
4
2
Column 2
17
1
Column 3
22
The simplest way to wire this is by connecting the female end of a jumper wire to a
GPIO pin, then connecting the male end of that wire into the appropriate location on
Search WWH ::




Custom Search