Support » Pololu Motoron Motor Controller User’s Guide » 3. Getting started »
3.3. Enabling I²C on the Raspberry Pi
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.
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 /dev/i2c-1
: 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.
Try typing ls /dev/i2c*
to list your system’s available I²C busses. If /dev/i2c-1
is not in the list then you should run sudo raspi-config nonint do_i2c 0
to enable it. You must reboot your Raspberry Pi for this change to take effect.
We recommend adding your user to the i2c
group so you can access the Motoron and other I²C devices without using sudo
. Run the groups
command to see what groups your user belongs to. If i2c
is not in the list, then you should add your user to it by running sudo usermod -a -G i2c $(whoami)
, logging out, and then logging in again.
After you have enabled I²C and connected your Motoron to your Raspberry Pi’s I²C bus, run i2cdetect -y 1
. If everything is set up correctly, you should see output like this:
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: -- -- -- -- -- -- -- --
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.