DRV8871 output not proportional to PWM input

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
jerryfaust
 
Posts: 5
Joined: Fri Oct 08, 2021 1:31 pm

DRV8871 output not proportional to PWM input

Post by jerryfaust »

Hello.
I recently set up 4 DRV8871 drivers to control 4 actuators, running at 30V, connected to an Arduino Mega. I'm running the same code that was already running, using a different set of motor drivers, but making the changes appropriate for the 8871 (setting one pin to digital low while the other pin submits analog PWM signals). With that, I am able to run the actuators up and down as expected, but the ramping algorithm was not working well.

Further investigation shows that the motors were not budging until reaching about half-way up (127 out of 255). And at one point I measured, a PWM value of 170 resulted in the motors only getting about 9V (and I verified 30V input). With the previous drivers, PWM values are resulting in the expected voltage (e.g. PWM of 127 results in just under 15 volts).

The only other variable I could think of was the frequency (there is verbiage I don't understand in the specs having to do with a minimum of 800ns). I am using an Arduino library that can set the PWM frequency to relatively high values, and I have been running the PWM at 10KHz. So I tried other options, including running at the Arduino's relatively low default frequency, and interestingly, the performance was better than before, although still not proportionally what would be expected (and of course, the actuators run loud).

The sample program online shows the standard loop from 1 to 255, then back down, so I have every reason to believe the drivers are capable. And as I'm writing this it occurs to me that I could try hooking up a small 9V motor, to see if the behavior differs...

In the meantime, if anyone has any ideas as to what I may be misunderstanding, or doing wrong, I would very much appreciate your feedback.

Kind Regards,
Jerry.

User avatar
sj_remington
 
Posts: 994
Joined: Mon Jul 27, 2020 4:51 pm

Re: DRV8871 output not proportional to PWM input

Post by sj_remington »

The actuator behavior is not a good indicator of how the motor driver is behaving, and the actuators will have a strongly nonlinear response to PWM percentage, with any motor driver. That nonlinear response will also depend very strongly on the PWM frequency, due to the actuator winding inductance, and switching behavior of the motor driver.

Different motor drivers will also behave somewhat differently, due to timing factors, especially if current limiting comes into play.

To check the linearity of the driver PWM output, use an oscilloscope to examine the voltage output across a purely resistive load on the motor driver. Choose a load resistor such that current draw is comparable to the (loaded) actuator running current.

User avatar
adafruit_support_bill
 
Posts: 88037
Joined: Sat Feb 07, 2009 10:11 am

Re: DRV8871 output not proportional to PWM input

Post by adafruit_support_bill »

sj_remington is correct. DC motors response is not linear with respect to PWM duty cycle.
the motors were not budging until reaching about half-way up (127 out of 255).
This is not unusual. Startup current for a DC motor is essentially the same as a stall condition until the rotor starts moving. This is further compounded in many actuators since you need even more current to overcome the static friction in the gear-train.

Furthermore, if the startup current pulled by your motor exceeds the current limit set for the DRV8871, it will "chop" the pulses to keep the current within the configured limit. This will look like a lower voltage to your multimeter. But you need an oscilloscope to see what is really going on.

User avatar
jerryfaust
 
Posts: 5
Joined: Fri Oct 08, 2021 1:31 pm

Re: DRV8871 output not proportional to PWM input

Post by jerryfaust »

Thank you for the feedback. The one other thing I wanted to try was adjusting the frequency of the PWM; and sure enough, the actuators run as expected if I use the stock PWM of the Arduino (just under 500Hz) rather than pushing the PWM frequency to 10000Hz as I did with the previous drivers. Measuring the voltage with a PWM of 127 resulted in roughly 15V (with a 30V input). So at lower frequencies, the output is as expected; but of course, the motors whine at that frequency. (As a side note, the reason we are looking at other drivers is because we want to run a higher voltage; the previous drivers capped at 30V, and the 8871 caps at 45).

The specs seem to indicate that I can push the frequency even up to 100's of KHz, and I did indeed try 100KHz. Any thoughts as to why it does not respond well to the higher frequencies? Perhaps I am misunderstanding the specs?

User avatar
sj_remington
 
Posts: 994
Joined: Mon Jul 27, 2020 4:51 pm

Re: DRV8871 output not proportional to PWM input

Post by sj_remington »

To fully understand and explain what is going on requires far more information about your setup than you have provided. That would include oscilloscope traces, complete details of the code, the wiring, circuit schematics, complete details of the motor (especially winding inductance) and power supply, etc.

Most people conduct tests, and settle on a set of parameters that works satisfactorily. I have never had much success with PWM frequencies greater than a few kHz, and live with the whine.

User avatar
adafruit_support_bill
 
Posts: 88037
Joined: Sat Feb 07, 2009 10:11 am

Re: DRV8871 output not proportional to PWM input

Post by adafruit_support_bill »

Perhaps I am misunderstanding the specs?
The specs on the DRV8871 pertain to what the chip is capable of. How the load responds to it is another story. Motors are inductive loads and inductors oppose changes in current flow. And PWM is constantly attempting to change the current flow

At higher PWM frequencies with a high inductance winding, the current rise in the windings may not ever reach steady-state, so the apparent average voltage will be lower than predicted based on the PWM duty-cycle.

User avatar
jerryfaust
 
Posts: 5
Joined: Fri Oct 08, 2021 1:31 pm

Re: DRV8871 output not proportional to PWM input

Post by jerryfaust »

Thank you both for your input. I will consider my next steps.

Regards,
Jerry.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”