Keypads that operate this way don’t need any power to work. This means that you can simply connect all eight data lines of the keypad to the bottom 8 GPIO pins on your Raspberry Pi
From left to right
GPIO 6
GPIO 13 (PWM1)
GPIO 19 (PCM FS)
GPIO 26
GPIO 12 (PWM0)
GPIO 16
GPIO 20 (PCM DIN)
GPIO 21 (PCM DOUT)
On the right is some code to test that your Keypad is working. Don’t be concerned if you don’t understand it right now, you only need it once for testing. Just copy and paste the code into a python file and run it.
As you can see, the test program has a readLine function.
The readLine function delivers the pulse to a single line and then determines which of the buttons was pressed while the line was pulled high. This is just repeated for the last four rows. The function additionally accepts a list of symbols that match to the buttons.
This program is a simple example. It will only output the input it is receiving and no more. It will not detect if a button is being held down. It will simply recognize a new keystroke with every pulse it sends on the output line.
4 Digit 7 Segment Display is a simple electronic display, similar to a Single 7 segment display, but composed of 4 digits than can show at the same time 4 chars. It also has dot LEDs, but in different configurations (single for each digit, central colon, etc.).
It is used within a wide number application, usually to display time.
Its operation is based on persistence of vision principle: you can drive one digit at time, so you must drive each digit at a speed so that human eye cannot perceive power off moments.
These devices have a simple internal wiring diagrams:
As shown in picture, once configured A…DP pins are set to 1 (HIGH) to display correct number, pins 12, 9, 8 and 6 drive in what digit position to display. For cathode elements, these four pins must all stay to 1 (HIGH) except for the digit you want to power on. For anode elements, these pins must all stay to 0 (LOW) except for the digit you want to power on.
This LED will later serve to indicate whether or not you got the code correct.
Connect GPIO 8 to a resistor follow by an LED then connected to ground.
Place your seven segment display on the bread board with the two sets of legs straddling the center piece. It is a good idea to place the ends on a number to make it easier when the pins are hidden and you need to put power in.
Place a resistor connecting pin 6 of the display to an unused portion of the breadboard
Place a resistor connecting pins 12, 9, and 8 of the display to unused portions of the breadboard. At this point all of the digit pins can be accessed by via the resisters.
Be careful to not let the resistors touch each other. If this is difficult with the arrangement shown to the right then you can make one or two of them lead to the right instead of the left.
Place a cable connecting the Resistor connected to pin 6 of the display to GPIO 22
Now connect the pins for the resistors in the following pattern
GPIO 14 – pin 12
GPIO 23 – pin 9
GPIO 24 – pin 8
Connect the GPIO pins to the listed Display Pins
GPIO 2 - pin 1 (E)
GPIO 3 - pin 2 (D)
GPIO 4 - pin 3 (DP)
GPIO 17 - pin 4 (C)
GPIO 27 - pin 5 (G)
Connect the final GPIO pins to the listed Display Pins
GPIO 15 - pin 1 (A)
GPIO 18 - pin 2 (F)
GPIO 25 - pin 3 (B)