Initially Enable the I2C protocol feature in raspberry pi:
- sudo raspi-config
- Enable the I2C
- Reboot your system
- Connect the I2C device to its SDA and SCL pin respectively refer the pin out of raspberry pi.
- Meanwhile also add two line in the mention path :sudo nano /etc/modules -- # i2c-bcm2708 -- i2c-dev
- Now cross check whether the correct connection are made or not
- Go to the terminal and type "sudo i2cdetect -y 1" it will list all the connected peripheral with raspberry pi
- If the address of the connected device is shown then initial validation is over.
- Further you can proceed with your program.