How to controler 2 DRV8833 modules with arduino nano

Hello everyone, I have purchased 2 drv8833 modules or I think they are called HW-627 motor drivers that look like this:


How do I connect them to an Arduino Nano with speed control?
Because the Arduino has only 6 PWM pins, while we need 8 PWM pins, keep in mind that I don't need to control each motor's speed individually, all I need is to control the speed of the front motors, and the back motors at the same time, so I don't need individual control of each motor (so I think 2 PWM pins to the first motor driver, and 2 for the second motor driver. Here are my connections:

As you can see I have plenty of digital pins but no PWM pins left (I need 3 more because D11 is taken from the NRF24L01 module).

If you have 2 motors that always run together, you can simply link the inputs together.

For speed control of four independent motors, you only need 4 pwm pins. The other pin can be (should be) plain digital

See the data sheet table on fast vs slow decay pwm.

how will you do that, what are the connections that I will do in order to use only 4 PWM pins?

For example, hook pwm to the xIN1 pins and plain digital to the xIN2 pins.

The trick is that in “reverse” you need to use

analogWrite(MotFrontRight1, 255-speed);
digitalWrite(MotFrontRight2,HIGH);

Can you tell me the code more in detail? For example what is the code to make the drv8833 module 1 make its 2 motors go forward and go backward with the speed control option, and what is the code to make the drv8833 module 2 wheels go forward and backward with the speed control option?

Can you find some project that does the rest of what you want to do using other drivers? How is the thing supposed to know when to be going forward or backward or different speeds?

Using different drivers isn't a difficult change.

Arduino shows this:

What would you want to do differently?

I used to use the L298N motor driver, but it's way too inefficient and big, plus my DRV8833 motor driver doesn't overheat, gets the job done, has better safety features, smaller, and gives out more voltage to the motors than the L298N (in result making the motors spin faster)

1 Like