# Sloppy PWM wave with DRV8801

I doubt those are resistors on the motor leads. Capacitors are more likely, for noise reduction. Post a picture!

It is nearly impossible to troubleshoot a circuit if you don’t know the relevant parameters and for a motor, free run and stall currents are among the most important. Another way to estimate the stall current is to measure the winding resistance, while rotating the motor shaft very slowly to overcome brush contact resistance.

A brushed motor briefly draws the stall current upon startup. It could be that the DRV8801 is limiting the startup current, or current limiting in general. If that is the case, you could try a higher current driver like the VNH5019.

Ok, here is a picture.

This motor doesn’t have the resistor connecting the motor leads, but does have a resistor between the leads and the motors. The color codes are green, blue, gold, silver. If I look that up, it should be 4.6 ohms, but if I measure the resistance on my multimeter I get .5 ohms.

So could you elaborate on how to calculate the stall current by measuring the resistance? If I connect my multimeter to the motor leads (inside the resistors - I’m connecting right to the leads), I measure 7.5 ohms. If I turn the motor, the resistance goes up, and the faster I turn it the higher the number is, so it’s hard to know how fast to turn and which number to use. If it’s important, I could try your idea of applying a low voltage and stalling a motor, but that does make me nervous!

- Dave

Those are inductors and they serve the same purpose as capacitors – noise reduction.

Taking the 7.5 ohm value for the winding resistance, the stall current at 24 V would be 3.2 amps. That is a bit too much for the DRV8801, and it could indeed be limiting.

Oh! Thanks for clearing that up.

And, I know the drv8801 can’t handle that current level, but the current draw never gets near that in this machine, not the entire machine, and not even close for a single motor. These motors get very little resistance in this machine. There are three of these motors, plus two stepper motors, plus another smaller motor. They all run at once, and the power supply is only a 2.5 amp power supply.

But back to my original question, if you could shed some light on why the drv8801 can’t get the motors moving at the same duty cycle and PWM frequency as the old controller, I’d appreciate it! And to be clear, the drv8801 CAN move the motors at that duty cycle at a lower PWM frequency (such as 490 Hz). It’s only at the higher frequencies that it works poorly.

It is difficult to tell what is going on without knowing what the signal to the motor looks like. Could you post an oscilloscope capture of your MOSFET controller’s output while it is driving the motor? Could you also post captures of the DRV8801 driver’s output when is driving the motor at a lower frequency and when it fails to drive the motor?

- Jeremy

Sure! I think you’re onto something.

Ok, here are two oscilloscope captures from the original controller, motor running, with a 27us duty cycle and a 3.9kHz (255us period) PWM frequency. (apologies for the upside-down images. They’re hosted on photobucket and look fine there, but when linked to here they’re showing up upside-down.)

The first shows the waveform and the second is zoomed in on a single wave:

And here is the same thing with the DRV8801:

So as you see - the waveform for the old controller looks basically the same whether the motor is running or not. But the wave with the motor running on my DRV8801 controller is very different! Can you explain what’s going on here?

Thanks!

- Dave

We tried duplicating your setup here but could not reproduce the problem. Could you tell me and post pictures of how you were measuring the motor outputs with the oscilloscope? Could you also post pictures of your overall setup, including how the driver is connected? If possible, could you try bypassing the inductors on the motor to connect it directly to the driver and see if that helps? One easy way to bypass the inductor is to clip test leads across them.

- Jeremy

Here is an image of the oscilloscope screen when I bypassed the inductors.

Basically the same signal, but it is noisier.

To get this oscilloscope reading, I connected the PWM outputs of the DRV8801 directly to test leads, connected the test leads to the motor connections, and clipped the oscilloscope leads to the test leads. I didn’t take a picture of that, it’s a lot of wires and didn’t seem useful. But I can send a pic if you want…

For the other readings, I connected the oscilloscope probes inline with the motor outputs of the DRV8801. The connections to the machine are via a DB25 cable, so I connect to a DB25 breakout box I have inline with the cable connecting the controller to the machine.

As far as my overall setup, it’s a custom PCB I built. There’s a bunch of stuff in there that’s irrelevant to what we’re talking about here, and it’s kind of proprietary, so I don’t want to post it on a public forum. But I can PM you the circuit diagram if you want.

As far as the DRV8801 connections go, I’m sending a PWM signal from an Arduino. The Arduino normally outputs a 490 Hz PWM signal, so I have some code to modify the system clock to send the 3.9kHz signal. I expect you know all about how to do that, but I can send you a link explaining it if you want, and it doesn’t seem relevant to what’s going on here. But maybe it is - what do I know.

My connections to the DRV8801 are as follows:

VCC → 5 volts
BRAKE-> GND
SLEEP-> Arduino digital pin
DIR-> VCC
PWM → Arduino digital pin (PWM output)
GND-> GND
FAULT → floating
VMM → 24 volts
OUT- → motor negative
OUT+ → motor positive
GND → GND

So pretty straightforward…

I’ve probably left some things out and you probably have more questions, so would it make sense if we talked on the phone instead?

Thanks again.

- Dave

And just to be clear - even though I know how to hook up an oscilloscope, I’m an electronics newbie. I don’t understand what we’re seeing with that wave. What does the part going down tell us? Why would we see that when the motors are connected, but if you disconnect the motors you get the normal square wave you’d expect. Does it have something to do with back EMF? And is this significant with regards to my main issue - that I can’t turn the motors at a lower duty cycle at a 3.9kHz PWM frequency?

Try setting the BRAKE pin high, as recommended. That should give better control at low PWM ratios.

Yes, I will do that in the next iteration of my board. But is that relevant to this issue? Having the brake pin low just means that the motor will coast when power is removed or decreased, making it slow down slower than you might want - correct? It wouldn’t prevent it from starting up at low duty cycles, would it? I can see how braking would keep it from starting up, but not that “not braking” would keep it from starting up…

[quote]I will do that in the next iteration of my board.[/quote]Do you want to solve this problem, or just argue about it?
Or, is it too difficult for you to cut a PCB trace?

I can’t cut the traces, the DRV8801s are mounted to female headers on the board, which obscure the traces to the pins. But I did manage to finagle setting BRAKE high, and that did seem to make a difference! So would you mind explaining what’s going on? Not being argumentative, just want to understand this. I don’t get why braking lets it run faster, nor do I understand the wave I was seeing.

It is unclear from the description above how you had the oscilloscope probe connected to your motor. It sounds like you might have had the ground lead of the oscilloscope connected to the motor, which could potentially damage things (including your scope). Could you post a picture of how you had it connected?

- Jeremy

I think about the effect of braking this way, but I may be wrong.

During the PWM off period, braking slows down the rotor quickly (much more quickly than coasting), so during the next PWM on period, you have less back EMF to counter and consequently, can drive more current into the windings, generating greater torque.

[quote=“Jeremy”]It is unclear from the description above how you had the oscilloscope probe connected to your motor. It sounds like you might have had the ground lead of the oscilloscope connected to the motor, which could potentially damage things (including your scope). Could you post a picture of how you had it connected?

• Jeremy[/quote]

Yes, that’s exactly how I had it connected. So that be bad, huh? Doh! I guess I can see that now. I told you I was a newbie at this. Ok, I will connect the ground lead to gnd going forward. The scope seems fine so far, I hope I didn’t damage it.

Any comment on the wave I was seeing? And can you explain how braking works, electrically? Jim’s explanation as to how braking allows the motor to go faster at lower PWM frequencies sort of makes sense to me (thanks, Jim!), but if the motor is slowed down during PWM off, it will have more inertia to overcome during PWM on…

Since you were measuring across the motor outputs with your oscilloscope, I am not sure how valid those screen captures are. If you post new captures, I might be able to comment on the shape of the signal.