A PCA9685 divides a PWM period into 4,096 steps. With an assumed output frequency of exactly 50 Hz the period is 20 ms. Multiply a count by 20/4,096 to calculate its ideal pulse width. In the worked example, On-time counts 205 gives pulse width of 1.001 ms.

The recorded quantity and the calculated result

Keep three columns in a commissioning export: the original on-time counts, the configuration used in the conversion and the resulting pulse width (ms). Recompute the result for the lower, middle and upper worked points before interpreting a field difference. A change in range, units or representation can otherwise be mistaken for a change in the process.

Two points to check independently

At 128 the calculated pulse width is 0.625 ms. At 205 it is 1.001 ms. Subtracting the first output from the second gives 0.37598 ms. These values give two independent checkpoints for a spreadsheet or a logger conversion.

PCA9685 pulse timing resolution. On-time counts changes from 1 to 512 and the calculated Pulse width (ms) changes from 0.004883 to 2.5.
PCA9685 pulse timing resolution. On-time counts changes from 1 to 512 and the calculated Pulse width (ms) changes from 0.004883 to 2.5. Figure by Industry Applied.

Worked data

On-time counts

Pulse width (ms)

1

0.004882812

64

0.3125

128

0.625

205

1.000977

307

1.499023

410

2.001953

512

2.5

Checking the ends of the working range

The interval from the middle to the upper test point runs from 205 to 512 on the on-time counts axis. Its average change in pulse width (ms) per input unit is 0.004883. This is a two-point slope for that interval. To check a spreadsheet or a gateway calculation, enter 512 in a separate test row and compare its result against 2.5 at the displayed precision.

Installation and interpretation

Measure the actual oscillator-derived period if pulse timing is critical. The same duty fraction produces a different pulse duration at another frequency. Keep the receiver’s accepted pulse range separate from the controller’s numerical capability.

For a repeatable verification, capture a small known case and a second case well away from it. Check whether the difference follows the response in the table, then restore the working configuration and repeat one reading. Store a separate status field for missing or invalid input. Substituting zero would make a dropped observation indistinguishable from a legitimate numerical zero.

Implementation and worked data

The source implementation is maintained in the .NET IoT device project. The component notes and manufacturer references document the supported device and its interfaces. Download the worked numerical example.