0

8-channel PWM controlling servos and DRV8850 simultaneously
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

8-channel PWM controlling servos and DRV8850 simultaneously

by Xzylon on Wed Dec 06, 2017 3:05 pm

Hello all,

I'm working on a school project that has been a bit of a train wreck, with one thing after another failing. I've managed to fix most of the problems but one in particular is causing me troubles because I don't fully understand the PWM outputs. I am running two DRV8850EVM boards from a combination of the Adafruit Feather Bluefruit M0 and an 8-channel PWM breakout board. One is being driven from the pins 5,6,10,11 GPIO outputs (mapped to the IN1H, IN1L, IN2H, IN2L if I recall correctly, respectively) and the other is being driven from the 4,5,6,7 PWM signal points (similar mapping on the second motor controller) on the PWM breakout board while the other side is fitted with headers for the servos.

I've instructed my teammate (CS programmer) to use the following for troubleshooting and his setup, and he was able to get one of the GPIO's attached to the board to drive one motor but he also reported a low current on the output (or what appears to be) when it does work, and even that is intermittent. https://e2e.ti.com/support/applications ... VM#1625201
I will personally be running this through an oscilloscope to check it more thoroughly and be looking at his code, but one thing I noticed could be a particular issue is that the PWM output can be either set to push-pull or open drain, but I can't seem to find the documentation that talks about forcing push-pull output. Can you shed a little light on this particular piece of output? I believe the driver should be signaled with push-pull and I assume that is what the standard PWM libarary will do, but I can't find more information on it.
In my searching I noticed someone mentioning the ground reference not being connected. I will double check this and make sure it is, but I am powering both from the same battery so I don't think this should be an issue. Regardless, I will double check it.
I did take advantage of the eval board and tested the output on my motors before starting, even under an incredibly heavy load the motors responded far more powerfully than I expected, so I know the controller is capable of the power required.

As a final side note, the battery is a 4.2V Lithium-Polymer 2000mAh pack. There are other peripherals but they shouldn't be interfering (one IMU).

Edit: I forgot to mention that he has the servos being driven just fine. So we know the PWM is connected correctly and the I2C communication works properly.

Xzylon
 
Posts: 4
Joined: Wed Dec 06, 2017 2:24 pm

Re: 8-channel PWM controlling servos and DRV8850 simultaneou

by adafruit_support_bill on Wed Dec 06, 2017 3:18 pm

A photo or wiring diagram would be helpful. But it sounds like you are trying to drive servos and control motors from the same PWM board.

Common RC servos require a control pulse update frequency of about 50-60Hz. That is much too low a frequency for most motors.

adafruit_support_bill
 
Posts: 63479
Joined: Sat Feb 07, 2009 10:11 am

Re: 8-channel PWM controlling servos and DRV8850 simultaneou

by Xzylon on Wed Dec 06, 2017 3:33 pm

This is the closest I have to a diagram. Since the DRV8850EVM doesn't exist on Fritzing and I don't have the time to build one, I'm using the closest motor drive (DRV8833 I believe) available.

The update frequency could be it. This would depend on the DRV-8850 response time correct? Also, since it's relies on duty cycle wouldn't it end up being pretty much an analogue signal?

Edit: Just realized that I was thinking the wrong direction. So the GPIO is faster than the PWM?
Attachments
Screen Shot 2017-12-06 at 12.29.09.png
Screen Shot 2017-12-06 at 12.29.09.png (147.22 KiB) Viewed 139 times

Xzylon
 
Posts: 4
Joined: Wed Dec 06, 2017 2:24 pm

Re: 8-channel PWM controlling servos and DRV8850 simultaneou

by adafruit_support_bill on Wed Dec 06, 2017 3:38 pm

The PWM frequency of the PCA9685 applies to all channels. You will need to set it to around 50-60Hz to run the servos.

But that will not work well for driving motors. Small motors typically need 1KHz or more. You would have better results with a second PCA9685 for the motors. Or possibly just use some PWM-capable GPIO pins on your Feather.

adafruit_support_bill
 
Posts: 63479
Joined: Sat Feb 07, 2009 10:11 am

Re: 8-channel PWM controlling servos and DRV8850 simultaneou

by Xzylon on Wed Dec 06, 2017 5:12 pm

Okay. Based on what I see from the information provided it should be able to run from a PWM drive on the IN1L and IN2L and simply set the other two pins to drive either high or low. Could this be accomplished through the PWM pins by simply setting my duty cycle to 100% and 0%? Or should I use another pin for this function? When driving low or driving high I would like to use push-pull.

Xzylon
 
Posts: 4
Joined: Wed Dec 06, 2017 2:24 pm

Re: 8-channel PWM controlling servos and DRV8850 simultaneou

by adafruit_support_bill on Wed Dec 06, 2017 5:30 pm

Yes, you can simply set the PWM outputs to 100% duty cycle for HIGH or 0% for LOW. We use the same technique in our motor shield.

adafruit_support_bill
 
Posts: 63479
Joined: Sat Feb 07, 2009 10:11 am

Re: 8-channel PWM controlling servos and DRV8850 simultaneou

by Xzylon on Thu Dec 07, 2017 1:25 am

That seemed to fix most of the issue. Thanks a bunch! Is there any way to increase the frequency of the PWM output on the GPIO pins 5,10,12, and 13? Or is there more information on what this frequency is?

Xzylon
 
Posts: 4
Joined: Wed Dec 06, 2017 2:24 pm

Re: 8-channel PWM controlling servos and DRV8850 simultaneou

by adafruit_support_bill on Thu Dec 07, 2017 7:20 am

There is a lot of good info on how to configure the Arduino PWM here: https://www.arduino.cc/en/Tutorial/SecretsOfArduinoPWM

adafruit_support_bill
 
Posts: 63479
Joined: Sat Feb 07, 2009 10:11 am

Please be positive and constructive with your questions and comments.