
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.
3.4. Setting I²C addresses with a Raspberry Pi
Each device on an I²C bus should have a unique address so that you can communicate with the device
without interfering with other devices on the bus. By default, the Motoron uses I²C address 16, so if
you have connected two or more Motorons to your bus, or you have another device that uses address
16, you will need to change the I²C addresses of one or more Motorons.
Warning:
If you have devices on your I²C bus that are not Motorons, the procedure below
could cause undesired behavior when it sends commands to them that are intended for the
Motorons.
The recommended procedure for setting the I²C address of one or more Motorons that are connected
to the I²C bus of your Raspberry Pi is:
1. Ensure that the JMP1 pin on each Motoron is not connected to anything.
2. Download the
Motoron Motor Controller Python library for Raspberry Pi
, and install its dependencies, as described in the “Getting started” section
of its README file.
3. In a Terminal, use
cd
to navigate into the directory holding the library and its examples.
4. Run
./set_i2c_addresses_example.py
. This utility will print some information and then
prompt you for a command.
5. Perform a scan of the I²C bus by typing “s” followed by “Enter”. You should get output that
looks like this:
Pololu Motoron Motor Controller User’s Guide
© 2001–2022 Pololu Corporation
3. Getting started
Page 17 of 67