@@ -31,10 +31,23 @@ void setup() {
31
31
Serial.println (" 16 channel PWM test!" );
32
32
33
33
pwm.begin ();
34
- // In theory the internal oscillator is 25MHz but it really isn't
35
- // that precise. You can 'calibrate' by tweaking this number till
36
- // you get the frequency you're expecting!
37
- pwm.setOscillatorFrequency (27000000 ); // The int.osc. is closer to 27MHz
34
+ /*
35
+ * In theory the internal oscillator (clock) is 25MHz but it really isn't
36
+ * that precise. You can 'calibrate' this by tweaking this number until
37
+ * you get the PWM update frequency you're expecting!
38
+ * The int.osc. for the PCA9685 chip is a range between about 23-27MHz and
39
+ * is used for calculating things like writeMicroseconds()
40
+ * Analog servos run at ~50 Hz updates, It is importaint to use an
41
+ * oscilloscope in setting the int.osc frequency for the I2C PCA9685 chip.
42
+ * 1) Attach the oscilloscope to one of the PWM signal pins and ground on
43
+ * the I2C PCA9685 chip you are setting the value for.
44
+ * 2) Adjust setOscillatorFrequency() until the PWM update frequency is the
45
+ * expected value (50Hz for most ESCs)
46
+ * Setting the value here is specific to each individual I2C PCA9685 chip and
47
+ * affects the calculations for the PWM update frequency.
48
+ * Failure to correctly set the int.osc value will cause unexpected PWM results
49
+ */
50
+ pwm.setOscillatorFrequency (27000000 );
38
51
pwm.setPWMFreq (1600 ); // This is the maximum PWM frequency
39
52
40
53
// if you want to really speed stuff up, you can go into 'fast 400khz I2C' mode
0 commit comments