From adafruit_servokit_ import ServoKit. PCA9685

Hello.
I am trying to drive a servo motor on my Jetson Nano with a PCA9685 PWM card.

These are the specs for my 4.6 jetpack.

steven@steven-desktop:~$ sudo apt-cache show nvidia-jetpack
Package: nvidia-jetpack
Version: 4.6-b199
Architecture: arm64
Maintainer: NVIDIA Corporation
Installed-Size: 194
Depends: nvidia-cuda (= 4.6-b199), nvidia-opencv (= 4.6-b199), nvidia-cudnn8 (= 4.6-b199), nvidia-tensorrt (= 4.6-b199), nvidia-visionworks (= 4.6-b199), nvidia-container (= 4.6-b199), nvidia-vpi (= 4.6-b199), nvidia-l4t-jetson-multimedia-api (>> 32.6-0), nvidia-l4t-jetson-multimedia-api (<< 32.7-0)
Homepage: http://developer.nvidia.com/jetson
Priority: standard
Section: metapackages
Filename: pool/main/n/nvidia-jetpack/nvidia-jetpack_4.6-b199_arm64.deb
Size: 29368
SHA256: 69df11e22e2c8406fe281fe6fc27c7d40a13ed668e508a592a6785d40ea71669
SHA1: 5c678b8762acc54f85b4334f92d9bb084858907a
MD5sum: 1b96cd72f2a434e887f98912061d8cfb
Description: NVIDIA Jetpack Meta Package
Description-md5: ad1462289bdbc54909ae109d1d32c0a8

Package: nvidia-jetpack
Version: 4.6-b197
Architecture: arm64
Maintainer: NVIDIA Corporation
Installed-Size: 194
Depends: nvidia-cuda (= 4.6-b197), nvidia-opencv (= 4.6-b197), nvidia-cudnn8 (= 4.6-b197), nvidia-tensorrt (= 4.6-b197), nvidia-visionworks (= 4.6-b197), nvidia-container (= 4.6-b197), nvidia-vpi (= 4.6-b197), nvidia-l4t-jetson-multimedia-api (>> 32.6-0), nvidia-l4t-jetson-multimedia-api (<< 32.7-0)
Homepage: http://developer.nvidia.com/jetson
Priority: standard
Section: metapackages
Filename: pool/main/n/nvidia-jetpack/nvidia-jetpack_4.6-b197_arm64.deb
Size: 29356
SHA256: 104cd0c1efefe5865753ec9b0b148a534ffdcc9bae525637c7532b309ed44aa0
SHA1: 8cca8b9ebb21feafbbd20c2984bd9b329a202624
MD5sum: 463d4303429f163b97207827965e8fe0
Description: NVIDIA Jetpack Meta Package
Description-md5: ad1462289bdbc54909ae109d1d32c0a8

When I do a connection test between the PCA9685 and my Jetson Nano it shows that it can be connected well.

steven@steven-desktop:~$ sudo i2cdetect -y -r 1
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: 70 – – – – – – –

but when running the library I get an error.

steven@steven-desktop:~$ python3
Python 3.6.9 (default, Mar 15 2022, 13:55:28)
[GCC 8.4.0] on linux
Type β€œhelp”, β€œcopyright”, β€œcredits” or β€œlicense” for more information.

from adafruit_servokit import ServoKit
Traceback (most recent call last):
File β€œβ€, line 1, in
File β€œ/usr/local/lib/python3.6/dist-packages/adafruit_servokit.py”, line 35, in
import board
File β€œ/usr/local/lib/python3.6/dist-packages/board.py”, line 39, in
import adafruit_platformdetect.constants.boards as ap_board
File β€œ/usr/local/lib/python3.6/dist-packages/adafruit_platformdetect/init.py”, line 10, in
from .board import Board
File β€œ/usr/local/lib/python3.6/dist-packages/adafruit_platformdetect/board.py”, line 24
from future import annotations
^
SyntaxError: future feature annotations is not defined

Can you help me please.
Thank you

I don’t have expericne with this PCA9685, you may try to find if similar issues happend at those threads: Search results for β€˜PCA9685 Nano’ - NVIDIA Developer Forums

1 Like

Adafruit libraries are updated frequently, but they do not always work with Jetson.
Downgrade the library to find a version that works.
Example:

sudo pip3 install -U \
adafruit-circuitpython-busdevice==5.1.2 \
adafruit-circuitpython-motor==3.3.5 \
adafruit-circuitpython-pca9685==3.4.1 \
adafruit-circuitpython-register==1.9.8 \
adafruit-circuitpython-servokit==1.3.8 \
Adafruit-Blinka==6.11.1 \
Adafruit-GPIO==1.0.3 \
Adafruit-MotorHAT==1.4.0 \
Adafruit-PlatformDetect==3.19.6 \
Adafruit-PureIO==1.1.9 \
Adafruit-SSD1306==1.6.2
3 Likes

Thank you very much for your help, with the example it worked perfectly.
Problem solved.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.