Sensor connection to Raspberry Pi

Sensor connection to Raspberry Pi

This tutorial will demonstrate how to connect the I2C sensor to the Raspberry Pi and get data.

Requirements

Connection Diagram

colour interface
VCC
GND
SCL
绿 SDA

System Configuration

Open the terminal (Terminal), type the following command, and press Enter:

sudo raspi-config

Select "3. Interfacing Options ", press enter

Select "P5 I2C", press Enter to confirm "YES".

I2C mode has been turned on, just select "Finish" to exit the setting.

In the terminal, type the following commands in sequence and press Enter:

sudo apt-get update
sudo apt-get install build-essential python-dev python-smbus git

"Success" will be prompted after completion