Hi,
I have a simple circuit with an Arduino, Pololu DRV8835, and a Pololu micrometal gearmotor.
I’m using the Phase/Enable mode, and varying the PWM duty cycle from 0-100%.
I notice the voltage (across the motor) increases linearly with PWM duty cycle and the motor spins proportionately faster (both as expected):
But I notice the current draw (from the batteries providing the motor power) is not linear, and in fact over twice as high at 50% than it is at 100%:
Is that expected?
I would have expected the current draw to be linear too. The website here suggests a linear relationship too.
I followed the wiring diagram on the DRV8835 website, and have separate 4xAA batteries powering motor. I added two capacitors (1000uf and 1uf) across the DRV8835 motor power inputs, VIn and Ground, and have my multimeter reading current flowing from batteries. (It didn’t give a good reading without the capacitors, I’m guessing since the current was pulsing).
For now, I’m using default PWM frequency on the Arduino Uno pin 9 which I believe is 490Hz from here.
The code I’m using for testing is below.
Btw, this happens in both directions. Also I’ve tried switching the motor and tried switching the DRV8835, and get consistent behaviour.
If this isn’t expected I can provide more details.
Regards,
Dan
const int modePin = 12;
const int enablePin = 9;
const int phasePin = 10;
void setup() {
Serial.begin(9600);
pinMode(modePin, OUTPUT);
pinMode(enablePin, OUTPUT);
pinMode(phasePin, OUTPUT);
digitalWrite(modePin, 1); // Set phase/enable mode
}
int phase = 0;
void loop() {
digitalWrite(phasePin, phase);
for (int enable = 0; enable <= 256; enable += 32) {
analogWrite(enablePin, min(255, enable));
Serial.print("phase="); Serial.print(phase);
Serial.print("\t enable="); Serial.println(enable);
delay(10000);
}
phase = 1 - phase; // toggle phase
}