Pololu Robotics & Electronics
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

Raspberry Pi connect to tic with I2C


I am trying to connect one tic with my raspberry Pi with I2C and follow the guidelines according to the manual. I added the dtoverlay=i2c-gpio line to the config.txt file and also connected the tic with SCL to GPIO24 and SDA to GPIO 23.

When I try to run the example code for python on the raspberry pi I get the following error

FileNotFoundError: [Errno 2] No such file or directory: ‘/dev/i2c-3’

It seems like the tic was not detected by the pi. If I run i2cdetect -y 1 I also do not see any device in the list.

I use a 12V,5A power supply.

Best wishes,

Hello, Tobia.

Which version of the Raspberry Pi are you using?

Can you reboot your Raspberry Pi and run cat /boot/config.txt then ls /dev/i2c* and post the results here?

- Amanda

Hi Amanda,

I am using a RaspberryPi B+

If I run these command lines I get:

pi@raspberrypi:~ $ cat /boot/config.txt
# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border

# uncomment to force a console size. By default it will be display's size minus
# overscan.

# uncomment if hdmi display is not detected and composite is being output

# uncomment to force a specific HDMI mode (this will force VGA)

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display

# uncomment for composite PAL

#uncomment to overclock the arm. 700 MHz is the default.

# Uncomment some or all of these to enable the optional hardware interfaces

# Uncomment this to enable infrared communication.

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)

# Enable DRM VC4 V3D driver on top of the dispmanx display stack


# NOOBS Auto-generated Settings:

# Addition for Pololu motor controller I2C

pi@raspberrypi:~ $ ls /dev/i2c*

Best wishes,

It looks like you mistyped; you have dtoverlay=i2c/gpio instead of dtoverlay=i2c-gpio in your /boot/config.txt file. Can you change the forward slash (/) to a hyphen (-), save and restart the Raspberry Pi, run the ls /dev/i2c* command again and post the result here?

- Amanda

Hi Amanda,

Now I get the desired /dev/i2c-1 /dev/i2c-3. However, the example code still does not work and if I run i2cdetect -y 1 I do not get any device there. If I connect the pins with GPIO 2 and 3 instead, I get a device with the address 0e. How would I need to convert it so I can write it into the example code?

Best wishes,

Just to clarify, when you connected the Tic’s SDA and SCL pins to GPIO23 and GPIO24 on the Raspberry Pi, respectively, the Python example did not work and running i2cdetect -y 1 did not return anything for you, is that correct?

The i2cdetect command you used is incorrect. When the Tic is connected to GPIO23 and GPIO24, you should be using the command i2cdetect -y 3 in order to scan /dev/i2c-3. See the the man page for i2cdetect for more information on the command and its options, and the overlay documentation for i2c-gpio.

Can you connect the Tic’s SDA and SCL pins to GPIO23 and GPIO24, run i2cdetect -y 3, and post the results here?

The Tic’s I2C address, 0x0E, is 14 in decimal and is the default address value used in the code, so that looks fine and you wouldn’t need to make any changes to the code.

- Amanda

Thanks for your help! Now it works, I am able to actuate the stepper motors. I was able to detect them with i2cdetect -y 3, the tic was on channel 14 as you said.

Best wishes,

1 Like