#ic2 comms between OPI zero 2w and PCA9685PCA9685 servo not working.

1 messages · Page 1 of 1 (latest)

abstract bison
#

root@hank1:~# ls -l /dev/i2c-*
crw-rw---- 1 root i2c 89, 0 Jan 5 13:51 /dev/i2c-0
crw-rw---- 1 root i2c 89, 1 Jan 5 13:51 /dev/i2c-1
crw-rw---- 1 root i2c 89, 2 Jan 5 13:51 /dev/i2c-2

why do 3 busses show up when only busses 1c2-0 and ic2-1 should exist?

sudo i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: 30 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- #only address on on any buss I found
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
servo-1-head configuration:
{
"i2c_bus": "1",
"i2c_addr": "30",
"channel": 0,
"starting_position_deg": 90
}
Error message:
1/7/2025, 8:14:57 AM error rdk.resource_manager.rdk:component:servo/servo-1-head resource/graph_node.go:297 resource build error: rpc error: code = Unknown desc = sysfs-i2c: input/output error resource rdk:component:servo/servo-1-head model viam-labs:servo:pca9685.

I have tried both hex and decimal values for 12c_addr but to no avail. I also tried configuring everything using gpio pins but that failed as well.

project wiring diagram attached.

Any help would be appreciated

scarlet cradle
#

Can you try checking the other buses with i2cdetect (change the number after -y to 0 or 2) to see what comes up?

abstract bison
#

Yea, sure. Hang on

#

Error writing session log (SSH raw data mode) to file: putty.log
login as: root
[email protected]'s password:


/ _ | _ _ | |_ /___ _ __ | \ \ / /
| | | | |) | | / // _ \ '__/ _ \ __) \ \ /\ / /
| |
| | /| | / /| / | | () / / \ V V /
_
/|
| |
| /_____
|_| _/____| _/_/

Welcome to Orange Pi 1.0.2 Bookworm with Linux 6.1.31-sun50iw9

System load: 37% Up time: 2 min Local users: 3
Memory usage: 13% of 3.84G IP: 192.168.4.86
CPU temp: 44°C Usage of /: 37% of 15G

Last login: Tue Jan 7 14:55:46 2025 from 1~# i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- UU -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@hank1:~# i2cdetect -y 2
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@hank1:~#

#

Ooops, posted in a bit more than I intended. 🙃

scarlet cradle
#

I will work on reproducing this issue on my end. I’m not sure why that address on bus 1 isn’t working with the driver.

abstract bison
#

Thanks! I am beginning to think it may be the breakout board. It came straight from china. Adafruit probably has their board made in China too but the quality of some knockoff brands are not well made.

scarlet cradle
#

So I fixed an issue with the periph-servo-pca9685 module when working on recreating your setup. My pca board works on my Pi 4 that I was testing on. I have a Orange Pi Zero that I should have time to set up tomorrow.

scarlet cradle
#

I set up my Orange Pi Zero3 and everything worked as expected, but I remembered some of the configuration details that could be relevant to debugging your setup. Can you share a screenshot of your hardware configuration in the orangepi-config terminal UI and confirm you have the pi-i2c1 bus enabled?

For example, I have the servo driver board connected to i2c-3 on my Orange Pi Zero3, so I have that bus enabled (see the attached screenshot). So the board shows up with the expected address in i2cdetect (see the other screenshot). You may need to reboot the device after changing those hardware settings.

abstract bison
#

I'm running the opi headless. Can I edit that file via putty? If not, I do have a tiny 7" monitor I can hook up if need be

abstract bison
#

Here is the info you want. When I first opened the orangepi-config window nothing was enabled. I added what you see here and rebooted the opi. Now I get no address at all on any bus.

root@hank1:~# sudo i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@hank1:~# sudo i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@hank1:~# sudo i2cdetect -y 2
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- --

#

here it is

scarlet cradle
#

Only the pi- prefixed fields should be enabled for the i2c bus you’d like to use.

abstract bison
#

Ok, I fixed the config file so it only enables Pi -i2c0. Now I get a slightly different error message as follows:

1/11/2025, 7:18:55 AM error rdk.resource_manager.rdk:component:servo/servo-1-head resource/graph_node.go:297 resource build error: rpc error: code = Unknown desc = sysfs-i2c: resource temporarily unavailable resource rdk:component:servo/servo-1-head model viam-labs:servo:pca9685

scarlet cradle
#

Does i2cdetect show the expected address on the 0 bus?

#

Also, based on your wiring diagram, I thought you were using pi-i2c1

abstract bison
#

I was using pi-i2c, but when it failed I switched back to pi-i2c0 and tried again. It failed, but the odd thing was that when I ran i2cdetect on 0, it showed that addresses 60, and 70 instead of 30 which is what it was doing. So, I changed my Viam config to talk to 60. It failed again, and I rechecked with i2cdetect and there were NO address at all, no UU or anything just blank.

I'm going to be out of town today, will continue working on this this evening. Uuug!
Thanks for all your help, your amazing!

abstract bison
#

I have a small O scope (FNIRSI 10130). Do you see any value in using it to trouble shoot?

scarlet cradle
#

I’m not sure. One thing I noticed about your wiring of the servo board that’s different from my setup: the external power is connected to the header connections normally used for daisy-chaining boards rather than the terminal block at the top of the board. Have you tried using that instead?

abstract bison
#

The instructions I am following for this build come form here: https://www.instructables.com/Hack-Skellington-AI-powered-Halloween-Skeleton/

Instructables

Hack Skellington - AI-powered Halloween Skeleton: Tired of halloween skeletons that repeat the same 3 phrases over and over again? Using a few inexpensive hardware components plus modern technology, you can bring your skeleton to life in a truly customizable way. It might be the star of your neighb…

scarlet cradle
abstract bison
#

Let me take a closer look at that and I'll get back to ya.

abstract bison
#

Ok, I now have set up two power sources for the project. One is supplying 4 V to the opi via the usb port. The second one is providing 5V to the breakout board's terminal block.

I am still getting errors, but at least I now show a address on bus 0 to use (60).

Last login: Mon Jan 13 22:35:44 2025 from 192.168.4.23
root@hank1:~# i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: 60 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

{
"starting_position_deg": 90,
"i2c_bus": "0",
"i2c_addr": "60",
"channel": 0
}

1/14/2025, 9:20:02 AM error rdk.resource_manager.rdk:component:servo/servo-1-head resource/graph_node.go:297 resource build error: rpc error: code = Unknown desc = sysfs-i2c: no such device or address resource rdk:component:servo/servo-1-head model viam-labs:servo:pca9685

1/14/2025, 9:19:57 AM error rdk.resource_manager.rdk:component:servo/servo-1-head resource/graph_node.go:297 resource build error: rpc error: code = Unknown desc = sysfs-i2c: resource temporarily unavailable resource rdk:component:servo/servo-1-head model viam-labs:servo:pca9685

abstract bison
#

Is there a debug mode I can turn on when starting the viam-agent??

scarlet cradle
#

I would expect the pca9685 i2c address to show up on i2c bus 1 instead of 0, based on the wiring diagram you shared earlier and looking at the pinout

abstract bison
#

root@hank1:~# i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: 40 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@hank1:~# i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@hank1:~# i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@hank1:~# i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: 40 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@hank1:~# Do you know why my i2c address changes if I run i2cdetect multiple times as seen above?

abstract bison
#

In the above example, it shows "40" at the top and bottom. But sometimes to changes to 70.

scarlet cradle
#

Sounds like the connection might not be stable. Are any of the wires between the PCA9685 board and the OPi loose at all?

abstract bison
#

Yes, I have 3" jumper wires going from the OPI to the PCA9685. This also makes me think I may have a bad solder joint on the OPI

abstract bison
#

Yea, I think it's the solder joint. If I wiggle the wires the i2c address goes away or changes.