GPIO stands for General Purpose Input/Output and on the Raspberry Pi they are the physical interface between the software side of the Raspberry PI and the outside world. In our case here we are going to use the Pixel Pi Adapter to connect the Raspberry Pi and Chip so that we can control Chip’s Eyes.
You might notice that different versions of the Raspberry Pi have a different amount of GPIO pins. In early versions of the Raspberry Pi there were 26 pins and the more recent versions have 40 pins. Even though more pins were added, pins 1 through 26 are the same on all versions. When we connect the Pi Pal Pi we will be using the first 10 pins in the right hand column (which is the even numbered pins).
When you look at a reference for Raspberry Pi GPIO pins you will will find several notations for each pin. Most commonly you will find one reference for the physical name of the pin (1 to 40) and the other for the GPIO Name (GPIO1, etc). The physical name is just that, the physical ordered number of the pin. This is the easier one to remember and it is what we will use with ScratchGPIO for the pin identification. See the chart below for the Physical Pin numbers. The GPIO Name is designated from the chip set and more commonly used in advanced projects. For now just familiarize yourself with the Physical Pin Numbers.
Input / Output
The GPIO pins are a two way street, we can send signals out to external circuits and we can take in signals from external circuits. However, you should take care with the GPIO pins. The Raspberry Pi is a computer and does not take well to random plugging in of things to the GPIO. With a little care and guidance you will be ok and with the Pi Pals we have made the projects so that you can safely work with the Raspberry Pi.
You might have heard about GPIO pins being referred to as “pull-up”, “pull-down”, “high”, or “low.” All these terms they are referring to whether the pin is on or off. When we say a pin is “up” or “high” we are saying that it is on and has a value of 3volts. When a pin is off it is 0 volts and is in the “down” or “low” state. in ScratchGPIO we will refer to the pin as on or off.
When we want to output a high (on) or low (off) value of a pin we can set it with software on the Raspberry Pi, just as we will do with Scratch. When we want to input into the Raspberry Pi we can read the value of a pin and determine if an exterior source (our circuit) has changed the value of our pin we are watching. An example would be a a circuit that we create that has a button connected to Pin 3. We could make it so that when the button is pressed we “pull-up” pin 3 and make it equal to 3 volts, or we could make it so the button “pulls-down” pin 3 and sets it to 0 volts.