0
\$\begingroup\$

I've got a BLDC motor which I can control with a PWM signal ranging from 0V to 5V. So I use the PCA9685 PWM driver to create a signal. The PCA9685 product page at Adafruit says this about the output voltages:

It is 5V compliant, which means you can control it from a 3.3V microcontroller and still safely drive up to 6V outputs

I provide 5V as input to the PCA9685. However, when I set the pulse length to the max of 4096 it outputs 3.3V on the signal line (as measured with a multimeter), instead of the 5V which I expect (and need).

The simple code I use with the Adafruit Python library:

import Adafruit_PCA9685
pwm = Adafruit_PCA9685.PCA9685()
pwm.set_pwm_freq(60)
pwm.set_pwm(0, 0, 4090)

I tried setting the pulsewidth to higher than 4096, but then the voltage I measure returns to 0V.

Is this a software thing or am I misinterpreting the quoted information on the product page? What am I missing here?

Adafruit board schematic

\$\endgroup\$
4
  • \$\begingroup\$ Have you checked if the address of the board is 0x40 which is the default on the PCA9685 board? \$\endgroup\$
    – Deepak
    Oct 3, 2020 at 19:57
  • 1
    \$\begingroup\$ I've added the board schematic to your question, so people don't have to follow the link chain and that could break in future. It shows 220R in series with each PWM output, which may be dropping the voltage going to the motor. Please measure the voltage at each end of the 220R resistor and edit those into your question. \$\endgroup\$
    – TonyM
    Oct 3, 2020 at 20:03
  • \$\begingroup\$ You cannot meaningfully measure a PWM signal with a multimer, as you cannot distinguish between an amplitude issue and a duty cycle one. If the chip is getting 5 volts on its power supply, the output amplitude will be 5 volts as well. An no, a series resistor will NOT drop the voltage unless the chip is driving something more than just the meter or the scope probe you should be using. \$\endgroup\$ Oct 3, 2020 at 22:12
  • \$\begingroup\$ Is anything connected to the output when you measure the voltage? What reading do you get with a PWM 'off' value of 2045? What voltage do you measure on the V+ pin of the servo connector? \$\endgroup\$ Oct 3, 2020 at 22:58

1 Answer 1

1
\$\begingroup\$

I'm working through similar issues and have done some testing using clone versions of the PCA9685 board (same design as the Adafruit board) and measuring the output PWM waveform on an oscilloscope.

First Test: PCA9685 (#1) connected to an Arduino DUE (3.3V)

  • PCA9685 Vcc powered by Due 3V3 pin
  • I2C signal levels therefore 3V3 friendly (assumed, not tested)
  • PCA9685 V+ powered by 5V external supply
  • Output PWM signal Vpp 3.5V @46.3Hz

Second Test: PCA9685 (#2) connected to an Arduino UNO (5V).

  • PCA9685 Vcc powered by Uno 5V pin
  • I2C signal levels therefore 5V friendly (assumed, not tested)
  • PCA9685 V+ unconnected
  • Output PWM signal Vpp 4.95V @48.9Hz

Conclusion: That the PWM output signal level (i.e., Vpp) is dependent on the Vcc supplied to the PCA9685. This is useful for managing I2C input levels, but may be undesirable on the output side.

So to answer your specific questions:

  • I don't think you're doing anything wrong, this is the way this board works.
  • The behavior you noted when setting the pulsewidth to 4096 or higher may be a software feature of the Adafruit library which is expecting values 0 to 4095
  • If it's important for your purpose to achieve a ~5V Vpp PWM output then you may need to redesign to power the PCA9685 Vcc at 5V. However this may then require a level shifter on the I2C input side if you need to protect a 3.3V MCU.
  • Finally, Comments made by Evan on another post indicate that it may not matter in most situations. That the servo will recognise the ~3.3V PWM signal as a high TTL value (i.e., > 2V).

Final Update: In re-reading just realised you're using the PWM output to drive a Brushless motor, so the last comment about TTL levels recognised by servos is probably not relevant. Redesigning for a 5V Vcc may be the way forward.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.