I2C and SMBus on the Tinker Board
Configuring I2C and SMBus with Python on the Asus Tinker Board
The Asus Tinker Board contains two I²C buses on the 40-pin GPIO header named I2C1 and I2C4, as shown in the image below. I2C1 uses pin 3 for SDA and 5 for SCL. I2C4 uses pin 27 for SDA and 28 for SCL.
This page details how to set up I²C support for the I2C1 bus, which is used by most Raspberry Pi compatible hats and expansion boards, including those from AB Electronics UK.
Step 1: Download the latest TinkerOS Debian image for your Tinker Board and burn it to your SD Card following the instructions on http://elinux.org/RPi_Easy_SD_Card_Setup
Step 2: Next, you need to update your Tinker Board to ensure all the latest packages are installed:
sudo apt-get update sudo apt-get upgrade
Step 3 a: Once you have updated your Tinker Board, run the following command to install the Python smbus and dev libraries and the i2c-tools packages:
sudo apt-get install python3-smbus python3-dev i2c-tools
Step 4: Edit the /boot/config.txt file using nano or your preferred text editor:
sudo nano /boot/config.txt
Uncomment the line "intf:i2c1=on" as shown in the screenshot below, and save the file. To use the I2C4 bus, uncomment the "intf:i2c4=on" line changing "off" to "on".
Step 5: To avoid needing to run the I²C tools at root, add the 'linaro' user to the "i2c" group:
sudo adduser linaro i2c
Step 6: Next, reboot the Tinker Board:
sudo reboot
When your Tinker Board has rebooted, you will now have I²C and SMBus Python support.
You can find available I²C devices using the following command.
sudo i2cdetect -y 1
A grid of I²C addresses will be displayed with available devices shown by their address number.
To learn more about I²C and how to use it, read our tutorial series Introducing I2C.
Related Expansion Boards
Related Expansion Boards
8 Channel 18-bit Differential Analogue to Digital converter for the Raspberry Pi
8 Channel 17-bit Single-Ended Analogue to Digital converter for the Raspberry Pi
Analogue, Digital and RTC Expansion Interface for the Raspberry Pi
32 channel MCP23017 digital I/O expander for the Raspberry Pi
32 channel digital I/O expander for the Raspberry Pi
Real-time clock for the Raspberry Pi
Related Articles
Using the 1 Wire File System with the 1 Wire Pi Plus and 1 Wire Pi Zero