1
$\begingroup$

I have a raspberrypi zero V1.3 which I connected to multiple DRV8833 motor drivers. the DRV8833 chip is a motor driver that allows bidirectional movement of brushless motors by setting the two pins that a single motor is connected to. So setting both pins to 0 causes the motors to stand still, setting one to 1 and the other to zero causes it to turn in one direction and vice versa. I am using the raspberrypi GPIO pins to control my motors.

Before starting my program that controls the GPIO pins, some of the connected motors already start performing "micro movements", as in they try to move into a direction and quickly move back and forth. This behavious is exacerbated when I move the raspberry pi around alongside all the connected motor drivers and motors. When I then run my program that does something along the lines of

import RPi.GPIO as GPIO
from time import sleep

GPIO.setmode(GPIO.BCM)

for i in my_selected_gpio_pins:
    GPIO.setup(i, GPIO.OUT)
    GPIO.output(i, False)

while True:
    sleep(1)

most of the motors stand still for most of the time, but some of the motors still sometimes make this fluctuating movement, especially when I move the raspberrypi around.

What is a good way of figuring out what might be causing this problem?

I already tried switching out the raspberry pi models but still experience the same behaviour.

EDIT: attaching a capacitor to each of the outputs of the motor drivers seems to have solved this problem. Is there also a way to prevent this from happening in the first place, e.g. by making modifications to the raspberrypi oder the inputs to the motor driver?

$\endgroup$
1
  • $\begingroup$ Smoothing the output without addressing the underlying problem is just storing up problems for yourself later. It might make tuning you motors much more difficult. $\endgroup$
    – Mark Booth
    Commented Nov 15, 2022 at 16:32

1 Answer 1

2
$\begingroup$

This sounds like you're bringing the chip out of sleep mode before your GPIO pins are set up. Until they are set up, their behaviour will be undefined.

The nSLEEP pin is pulled low with a 500k$\Omega$ internal resistor, so the driver should be disabled until it is enabled by a GPIO pin on the Raspberry Pi.

If you're only connecting the DRV8833 control pins to the Raspberry Pi GPIO pins, and have connected nSLEEP to the a 3.3V or 5V PWR pin to enable it all of the time, then I would suggest that you connect nSLEEP to another GPIO pin and only enable the driver chip after all other pins are set up and zeroed.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.