Shop OBEX P1 Docs P2 Docs Learn Events
PCA9685 with the propeller? — Parallax Forums

PCA9685 with the propeller?

Hey guys, noob here.
Is there any way to use the PCA9685 i2c port expender with the propeller?
https://www.adafruit.com/product/815
Thanks!

Comments

  • kwinnkwinn Posts: 8,697
    pico wrote: »
    Hey guys, noob here.
    Is there any way to use the PCA9685 i2c port expender with the propeller?
    https://www.adafruit.com/product/815
    Thanks!

    Yes. I2C is used often on the propeller. Several objects in the OBEX.
  • Indeed -- and you don't have to give up any IO pins, either, as you can share the SDA and SCL pins used by the EEPROM.
  • @anybody
    or if possible: Jérôme Decock

    I found code on the obex for a PCA9685.
    Going to try it soon. No instructions as to supposedly control individual servos.
    Any simple ideas?
    Thank you in advance.
    Martin

  • @jeromelab

    Hello. I have downloaded your code for the PCA9685. Wondering If you are still around and
    If you could give me some simple instructions as to get started. I will be using two servos
    on this device.
    Thank you.
    Martin

  • JonnyMacJonnyMac Posts: 9,612
    edited 2026-01-26 05:06

    If you're only needing to control two servos -- and you have cog to spare -- you can easily do that in Spin (or any other P1 language). The CTRx module has two counters which will let your run two servos (without reconfiguring) and you get nice precision with your pulses. I've attached a simple object. it uses the PWM/NCO mode of the counter to create the servo pulses. The code as is lets you set the position in microseconds, but with the resolution of the system counter you could do sub-microsecond (e.g., 0.1) pulses if you like.

    Here's quick check of the object output setting servo channel 0 to 1000us and servo channel 1 to 2000us.

    If you're set on the PCA9685 you should start with downloading the datasheet. You'll need to learn the register assignments for controlling the PWM frequency and the settings for each pin/channel. I think I found the object you reference; with the datasheet you should be able to suss out how things work, and get confirmation from an AI agent.

    Link to my PCA9685 chat: https://chatgpt.com/share/6976dc93-4fd0-8006-97ca-524d29b35fb3

Sign In or Register to comment.