Controlling two motors with DRV8835 Module on RPI Zero

Hello,
I’ve connected my RPI ZERO with the DRV8835 module and two motors which are called ( 136:1 SUB-MICRO PLASTIC PLANETARY GEARMOTOR 6DX19L MM ), I also have other size like the 26:1 ones.

I’m using the code provided in Polulu’s github for DRV8835 module:
https://github.com/pololu/drv8835-motor-driver-rpi

The code I’m running is example.py which can be found here in the same github:
https://github.com/pololu/drv8835-motor-driver-rpi/blob/master/example.py

The problem is that I can’t fully control the two motors (forward/backward).

When executing this line: motors.setSpeeds(0, -100), both motors drive forward which is very weird, and also the driving isn’t in straight path - which I’m trying to solve by tweaking the parameters that are responsible for driving the wheels straight, for now this fails and drives in a circle.

This is what happens when checking all the parameters: (very weird)

  1. motors.setSpeeds(0,100) - left forward
  2. motors.setSpeeds(0,-100) - both forward
  3. motors.setSpeeds(100,0) - left forward
  4. motors.setSpeeds(-100,0) - right backward
  5. motors.setSpeeds(-100,100) - left forward, right backward
  6. motors.setSpeeds(-100,-100) - both forward
  7. motors.setSpeeds(100,-100) - both forward
  8. motors.setSpeeds(100,100) - right backward, left forward

Any ideas why is this happening? Should I try different modules - if yes which modules should I try?

Hello.

Can you post some pictures of your setup that show all of your connections? Can you also describe what happens when you run the unmodified example program? A video showing what happens during the example program might also be useful. The forum does not allow users to post very large videos, but it does work well with videos linked from other sites (like YouTube or Vimeo).

- Patrick