This project is a set of Go bindings for the I²C bus, focused on sensors compatible with Raspberry Pi (and RPi clones). This project was forked from github.com/d2r2/go-i2c, which itself was forked from github.com/davecheney/i2c.
i2c is licensed under MIT License.
Pre-fork this project was tested on Raspberry Pi 1 (Model B), Raspberry Pi 3 (Model B+), Banana Pi (model M1), Orange Pi Zero, Orange Pi One.
This section is a work in progress. Ideally the GoDoc page provides enough context to get started.
-
How to enable I2C bus on RPi device: If you employ RaspberryPI, use raspi-config utility to activate i2c-bus on the OS level. Go to "Interfacing Options" menu, to active I2C bus. Probably you will need to reboot to load i2c kernel module. Finally you should have device like /dev/i2c-1 present in the system.
-
How to find I2C bus allocation and device address: Use i2cdetect utility in format "i2cdetect -y X", where X may vary from 0 to 5 or more, to discover address occupied by peripheral device. To install utility you should run
apt install i2c-toolson debian-kind system.i2cdetect -y 1sample output:0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- 76 --