3.3. Enabling I²C on the Raspberry Pi

<p>This section explains how to enable the correct I&sup2;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&#8217;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&sup2;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&#8217;s I&sup2;C bus, run <code>i2cdetect -y 1</code>. If everything is set up correctly, you should see output like this:</p> <pre>&#x000A; 0 1 2 3 4 5 6 7 8 9 a b c d e f&#x000A;00: -- -- -- -- -- -- -- --&#x000A;10: 10 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --&#x000A;20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --&#x000A;30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --&#x000A;40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --&#x000A;50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --&#x000A;60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --&#x000A;70: -- -- -- -- -- -- -- --</pre> <p>This output means that the Raspberry Pi detected a device at address 16 (0x10 in hex), which is the default I&sup2;C address used by the Motoron.</p>

Related Products

Motoron M3S256 Triple Motor Controller Shield for Arduino (Connectors Soldered)
Motoron M1T550 Single I²C Motor Controller (Header Pins Soldered)
Motoron M3H550 Triple Motor Controller for Raspberry Pi (Connectors Soldered)
Motoron M3S550 Triple Motor Controller Shield for Arduino (Connectors Soldered)
Motoron M1T256 Single I²C Motor Controller (Header Pins Soldered)
Motoron M2T256 Dual I²C Motor Controller (Header Pins Soldered)
Motoron M2H18v18 Dual High-Power Motor Controller for Raspberry Pi (Connectors Soldered)
Motoron M2S18v18 Dual High-Power Motor Controller Shield for Arduino (Connectors Soldered)
Motoron M3H256 Triple Motor Controller for Raspberry Pi (Connectors Soldered)
Motoron M2T550 Dual I²C Motor Controller (Header Pins Soldered)

Related Categories

Motoron Motor Controllers
Log In
Pololu Robotics & Electronics
Shopping cart
(702) 262-6648
Same-day shipping, worldwide
Menu
Shop Blog Forum Support
My account Comments or questions? About Pololu Contact Ordering information Distributors