RASPBERRY PI 2, 3 & ZERO
Connecting devices to the Raspberry Pi Broadcom processor using the 40 pin GPIO. The pins can be configured and set up to interface with other devices.
GPIO (General Purpose Input Output) connections used to send signals to devices such as on and off to a LED.
I2C (Inter-Integrated Circuit) pins connect and talk to hardware modules that support I2C Protocol. Typically using 2 pins.
SPI (Serial Peripheral Interface Bus) pins connect to devices using SPI protocol.
UART (Universal asynchronous receiver/transmitter) are the serial pins used to communicate with other devices.
DNC do not connect, ID_SD and ID_SC pins are reserved for EEPROM ID that identifies attached pi hat board
3.3V/5V power pins provide constant voltage from the power bus.
GND are the pins connected to ground reference for your devices. The ground pins are all connected to the same ground bus.
Configuring and using the Pins
This section covers how to setup the pins so you can use them on the Raspberry Pi using Raspbian operating system(OS).
To get the latest version packages of Raspbian and GPIO update on your Pi run the following commands
#If you don’t have GPIO installed run the command: sudo apt-get install rpi.gpio
Configuring Raspberry Pi I2C
Set up the I2C pins on the Raspi-Config tool by entering the following command:
Navigate to Interfacing options and then enable I2C. An alert will indicate that I2C was enabled.
To verify modules were successfully enabled enter the following command:
lsmod | grep i2c
The command will return any modules that are running starting with i2c.
Configuring Raspberry Pi SPI
Configure the Raspberry Pi SPI go to the Raspi-Config tool by entering the following command:
Once the config tool has loaded navigate to advanced options and then to SPI. Enable SPI which will require a reboot. Raspi-Config tool will ask if it is to be loaded by default. Select yes if using it every time the Pi boots up. To check that SPI is successfully up and running use the following command:
lsmod | grep spi
This command will return any modules that are running starting with SPI. It should return something like:
spidev 7034 0
spi_bcm2835 7424 0
Configuring Raspberry Pi UART