You need to log in to create posts and topics.

Implementing PCA9685 / Seeking Advices

Hello SimulIDE Community,

After extensive searching and experimentation, I'm reaching out for guidance on implementing a PCA9685 component, it's a 16-channel I2C PWM multiplexer, see https://www.nxp.com/docs/en/data-sheet/PCA9685.pdf

What I've Already Tried

  1.  Emulation via Arduino code: I attempted to create a software emulation layer that intercepts I2C commands and translates them to standard Arduino PWM outputs, but this approach is limited by the number of PWM pins available.
  2. Component substitution: I tried using combinations of existing components (shift registers, timers) to replicate the functionality, but accurately simulating the I2C interface and register structure proved challenging.
  3. Forum searches: I've searched both here and other electronics forums for anyone who might have already created this component, with no success.

Questions

  • What would be the best approach for a SimulIDE raw beginner to create a custom component?
  • Are there specific parts of the SimulIDE codebase I should study to understand component creation?
  • There are so many component categories... would the PCA9685 belong in 'Microcontrollers' like the CD74HC4067 multiplexer?

Any guidance would be greatly appreciated. I'm looking for a starting point from those with more experience.

Thank you!

Will

One possible solution would be scripted components, or even a combination with sub-circuits.
The biggest problem might be producing a PWM signal with a credible frequency and resolution (12 bits = 4096 steps, multiplied by the frequency).

PWM can be implemented with WaveGen components with Square wave, which has duty configurable.
The script can link to them and control Frequency and Duty.

Controlling duty can only be done by setPropStr() which is not very convenient, but I just added an option to control it by setLinkedValue(), It will be available at next Test build for 1.2.0 (hopefully soon).