This blog post on the 3x4 matrix-style keypad is an excerpt from Lesson B-7 of our Intro to Robotics program. Level B is the second level in Intro to Robotics and covers working with electronic components (including a variety of sensors), writing intermediate-level code commands in Python, and using a Raspberry Pi to control your electronics projects with the code you write. It contains 18 lessons including 65+ videos and 50+ projects and activities. Sample lessons and a full scope and sequence for Level B can be found here.
The Intro to Robotics Level B kit contains a 3x4 matrix-style keypad. This membrane switch is made up of an adhesive backing layer, a circuit layer with conductive traces printed on its face, a layer of non-conductive spacer, a layer of metal domes or conductive material, and a layer of thin plastic on which is printed the graphic for the buttons.
When the switch is pressed, the metal dome or conductive sheet, will come in contact with the circuit layer, completing a connection between the two sides of the switch. This will allow current to flow until the switch is no longer pressed, causing the metal dome to spring back away from the circuit layer, causing the switch to open.
Membrane switches can be found everywhere from the front of your microwave oven to the keyboard on your computer. Since keyboards usually contain over 100 switches, manufacturers often opt for membrane-style switches due to lower cost and how much they simplify the manufacturing process. Some higher end keyboards will separate pushbutton switches for every key to increase key-press performance for gaming and other applications.
Matrix Keypad Wiring
The matrix keypad supplied in your kit has 7 wires exiting the keypad that connect to the rows and columns. This keypad is called a 3x4 matrix since it has three columns and four rows. Each row and column has its own connection, as seen in the photo below:
The connections above will only be correct with the keypad facing up. If the keypad is flipped over, or face down, then the connections listed above will be reversed.
Each row and column keypad connection must be properly identified in your program. If the program is checking column 2 on GPIO21, then GPIO21 must be physically connected to column 2, or the keypad values the program has stored for column 2 will not match the keys being pressed.
The keypad is also slightly different than the rest of your parts, in that it uses female sockets for the connector. Your breadboard also uses female sockets, so the two devices cannot connect directly to each other. The keypad comes with a 7-pin male to male adapter that can be inserted into the keypad connector, after which the header can then be inserted into the breadboard.
This blog post on the 3x4 matrix-style keypad is an excerpt from Lesson B-7 of our Intro to Robotics program. Level B is the second level in Intro to Robotics and covers working with electronic components (including a variety of sensors), writing intermediate-level code commands in Python, and using a Raspberry Pi to control your electronics projects with the code you write. It contains 18 lessons including 65+ videos and 50+ projects and activities. Sample lessons and a full scope and sequence for Level B can be found here.