DRV8838 pwm motor whine

I am using the drv8838 to control motor speed with pwm. It works perfectly with a bare dc motor. But when I use it on a dc water pump, the motor on the pump just whines but does not turn. If I eliminate the pwm code and just use the digitalWrite (enablePin, HIGH) the pump works fine. Any ideas? Are there some motors pwm just won’t work with?

Power is not an issue, running of a lab power supply. And again, the code works as expected with a plain dc motor.

I’ve done some more testing. Turns out it was something weird with my power supply. The circuit would work with the pump from 4-8 volts on the power supply. Anything over 8 volts and the pump would whine and not turn. The frequency of the whine increased with the voltage. Swapped the power supply for a 9v battery and it works.


I am glad to hear that you got it working.

Your solution is rather surprising; by “9V battery” do you mean an alkaline 9V battery? If so, I would not expect a battery like that to be great for running motors since they are generally not capable of supplying much current.

It sounds like maybe you have a current limit set on your adjustable power supply or that it is otherwise unable to supply as much current as the pump needs. If that is not the problem and want to troubleshoot what is going wrong when you use your adjustable supply, can you post some pictures of your setup, the code you were using to test it, and information about your pump and power supply?

- Patrick

The pump is only running for a couple of seconds at a time and pulling about 500 mA. What occurred to me was, I am using pwm to drive the motor. And maybe the power supply is also using pwm to adjust the voltage? So maybe I am having a problem running pwm with pwm? Don’t think it is a current issue on the power supply since the circuit works fine with a basic “enable HIGH” code without pwm.

This is my power supply: https://www.amazon.com/Tekpower-TP3005D-3-Digital-Variable-Linear-Type/dp/B00HX0UYBK/ref=sr_1_15?crid=2ENWVLL37WDEQ&dchild=1&keywords=lab+power+supply&qid=1592310140&sprefix=lab+power+sup%2Caps%2C143&sr=8-15

Here is the code:

int sensorPin = A3; // select the input pin for the light sensor
float rawRage = 1024; // 5v
int enablePin = 3; // connect arduino pin 3 to enable pin on drv8838
int phasePin = 4; //connect arduino pin 4 to phase pin on drv8838
void setup()
pinMode(enablePin, OUTPUT); //sets pin 3 to output
pinMode(phasePin, OUTPUT); // sets pin 4 to output
void loop() {
int rawValue = analogRead (sensorPin); // read the value from the light sensor
if (rawValue < 400) analogWrite (enablePin, 125); // if light is off, turn pump on
if (rawValue > 400) analogWrite (enablePin, 0); // if light is on, turn pump off

And the schematic:

Based on your schematic, I am not certain if you have a common ground connection with your microcontroller. Can you confirm that is there? Could you post some photos of your setup showing your connections?

If this behavior occurs with a common ground connection, then I suggest you try to look at what is going on with an oscilloscope to see if you can isolate the cause of the problem.

- Patrick

I definitely have a common ground. Confirmed it with a continuity checker.

All of your connections look okay, so I think the next thing to do is look at what is going on with a scope. If that does not produce any leads, you might consider trying to contact the manufacturer of your power supply.

- Patrick