Support » Pololu Motoron Motor Controller User’s Guide » 3. Getting started »
3.3. Enabling I²C on the Raspberry Pi
<p>This section explains how to enable the correct I²C bus on your Raspberry Pi, make sure that your user has permission to access it, and test your setup.</p>
<p>The Motoron is designed to connect to the I2C1 bus on the Raspberry Pi, which uses GPIO pin 2 for SDA and GPIO pin 3 for SCL. If you are using Raspberry Pi OS, this bus is represented by <code>/dev/i2c-1</code>: that is the name of the device node that programs on your Raspberry Pi will open in order to communicate with the Motoron or any other targets on the bus.</p>
<p>Try typing <code>ls /dev/i2c*</code> to list your system’s available I²C busses. If <code>/dev/i2c-1</code> is not in the list then you should run <code>sudo raspi-config nonint do_i2c 0</code> to enable it. You must reboot your Raspberry Pi for this change to take effect.</p>
<p>We recommend adding your user to the <code>i2c</code> group so you can access the Motoron and other I²C devices without using <code>sudo</code>. Run the <code>groups</code> command to see what groups your user belongs to. If <code>i2c</code> is not in the list, then you should add your user to it by running <code>sudo usermod -a -G i2c $(whoami)</code>, logging out, and then logging in again.</p>
<p>After you have enabled I²C and connected your Motoron to your Raspberry Pi’s I²C bus, run <code>i2cdetect -y 1</code>. If everything is set up correctly, you should see output like this:</p>
<pre>
 0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: 10 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --</pre>
<p>This output means that the Raspberry Pi detected a device at address 16 (0x10 in hex), which is the default I²C address used by the Motoron.</p>