Piicodev servo board i2c issue on pi 5

I am attempting to use the piicodev servo controller board on a Pi 5 and have been following the tutorial at

When I run the basic example for an angular servo the code fails on the initialisation of the servo driver module

controller = PiicoDev_Servo_Driver()

Following the stack trace down the failure is:

File “/home/pk/piicodvservos/lib/python3.11/site-packages/smbus2/smbus2.py”, line 311, in open
self.fd = os.open(filepath, os.O_RDWR)
FileNotFoundError: [Errno 2] No such file or directory: ‘/dev/i2c-1’

looking in /dev on my pi 5 I note that only the devices ic2-11 and ic2-12 exist. My simple attempts to force the code to set the bus number to 11 have not been successful. Is this what I should be trying to do, or is the issue elsewhere?

1 Like

Hey Peter,

Welcome to the forums!

It looks like the error here is most often seen when i2C is not enabled on the Pi itself. You can get this fixed up by going through raspi-config and then navigating to Interface Options and I2C then confirming your choice. From there reboot the Pi and give it another try.

Hopefully that fixes the issue you are having!

Cheers,
Blayden

Blayden, Many thanks. I now have i2c-1!

Alas I am still stuck at the controller initialisation
controller = PiicoDev_Servo_Driver()

I am now getting a timeout error within the i2c_rdwr() function in smbus2.py

File "/home/pk/piicodvservos/lib/python3.11/site-packages/smbus2/smbus2.py", line 658, in i2c_rdwr ioctl(self.fd, I2C_RDWR, ioctl_data) TimeoutError: [Errno 110] Connection timed out

What obvious thing have I missed now …?

I have just tried the servo control board on a Pi 3 and have ended up with the same timeout error.

On both the Pi 3 and Pi 5 I am using the 64 bit operating system. Could that be the problem, should I install the 32 bit system?

Wouldn’t think the operating system bit size is the problem.
Connection timed out means the I2C software cannot see the Servo Controller.
This could be wiring or address mismatch.

Open a terminal window and type the following.
i2cdetect -y 1

It will scan I2C bus ‘1’ for connected devices listing what it finds.
The Servo Controller addresses are 0x44, 0x45, 0x46, 0x47.
If you don’t see these it is a wiring problem.

The addresses above are referred to as channels 1,2,3,4 in the software.
ie servo = PiicoDev_Servo(controller, 1) is channel 1 address 0x044.

Changing the Dip switches changes the address.

I suggest using the PiicoDev Pi break out and the one of the Cables, it is the easiest way to connect I2C to a Pi 5.

Regards
Jim

1 Like

Jim, Many thanks for that. Unfortunately the i2cdetect probing comes up blank on all addresses. I am using the PiicoDev adapter and cable. I will get myself another cable and see if that is the failure point

1 Like

When you connect the Servo Controller to the Adaptor does the Power LED come on, it should ??

1 Like