drv8833 motor driver notes

Rpi python DRV8833 motor driver setting up and troubleshooting DC motor driving problem

Ask QuestionAsked todayActive todayViewed 21 times1

So what I am trying to do is to get the motor to spin but I want to raspberry pi between the motor so I can spin it clockwise for 5 seconds and then spin it anti-clockwise for 5 seconds. But initially, I just want to make sure it works.

Here is my circuit:   enter image description here

enter image description here
enter image description here

And here is the code I am running, should this code should output some voltage if I have a volt meter on the aout pins?

import RPi.GPIO as GPIO

# Declare the GPIO settings

# set up GPIO pins
GPIO.setup(19, GPIO.OUT) # Connected to AIN2
GPIO.setup(26, GPIO.OUT) # Connected to AIN1

# Drive the motor clockwise
GPIO.output(26, GPIO.HIGH) # Set AIN1
GPIO.output(19, GPIO.LOW) # Set AIN2

# Wait 5 seconds

GPIO.output(12, GPIO.LOW) # Set AIN1
GPIO.output(11, GPIO.LOW) # Set AIN2

raspberry-pi-osdc-motorShareEditFollowCloseFlagedited 56 mins agotlfong013,77733 gold badges88 silver badges2222 bronze badgesasked 8 hours agoPatrick Hession1122 bronze badges New contributor

  • 1Frankly it is unclear what you actually have or are asking. List components and connections and preferably a circuit. Attempting to power a motor with a 9V battery is unlikely to work. With the wiring is is likely to be faulty use proper connections. None of the pins listed in your code seem to be connected. β€“ Milliways 8 hours ago 
  • 1Why is a 9V battery no good? I will also address your other concerns now. Thanks so much for your answer though πŸ™‚ β€“ Patrick Hession 8 hours ago 
  • 1Those batteries are designed for low power electronic devices. They can’t supply sufficient current to run a motor. If it actually turns it won’t for long. β€“ Milliways 8 hours ago
  • 1Oh..the DRV8833 component wants power between 2v and 10v though.. β€“ Patrick Hession 8 hours ago
  • 1I have added some more info to my question now. Hope this helps πŸ™‚ β€“ Patrick Hession 8 hours ago 
  • This EESE Q&A might help: (1) How to troubleshoot a DRV8833 motor driver module problem? – rpi.se 2020nov09, Viewed 698 times: electronics.stackexchange.com/questions/531470/…, (2) DRV8833 Motor Driver Test – Youtube 2020nov18, 174 views youtube.com/watch?v=31-qPfkHcbg. Cheers. β€“ tlfong01 4 hours ago   
  • My above linked answer refers to the TI’s DRV8833 datasheet: (3) DRV8833 Dual H-Bridge Motor Driver Datasheet – TI 2015jul ti.com/lit/ds/symlink/…. This datasheet gives principles of operation, use of the input/output pins, and example application schematic. You might like to let me know which schematic in the datasheet you are using, then I would suggest how to assign logical values to the pins to do the troubleshooting. β€“ tlfong01 4 hours ago   
  • (4) Actually you don’t need to us Rpi to do online testing/troubleshoot. You can put Rpi aside and just use DC level signals to make sure your drv8833 is not fried. (5) You can see in my answer, before I use a Rpi program to do the testing, I use a cheapy 555 astable to as input to drv8833. (5) It is only after the preliminary basic offline testing, then I move on to write a simple python program to move the motor. β€“ tlfong01 4 hours ago   
  • (6) In case you find any thing you don’t understand when reading the drv8833 datasheet, you are welcome to ask me any newbie questions, and I would try to entertain your questions, by perhaps writing up an answer. Happy learning, cheers. β€“ tlfong01 4 hours ago   
  • (7) You seem to have forgotten to short ASEN (A sense) to ground. The coil current needs to go to ground through this sense terminal, with or without any current sensing resistor, otherwise motor won’t move! πŸ™‚ β€“ tlfong01 just now   Edit   

Add a comment

2 Answers




  1. I would suggest to do the hardware setup in Appendix A for preliminary testing.
  2. For this preliminary testing, no online Rpi and programming is need. We can do offline DC level signals input to DRV8833 and test one of the two outputs.
  3. We don’t even need any motor for testing.
  4. I would suggest the following wiring:4.1 Motor voltage 6V (or 12V)4.2 Status LED with serial current limiting resistor to simulate motor coil.4.2 Testing signals summary:AIN1 - 5V, 0V AIN2 - 5V, 0V BIN1 - N.C. BIN2 - N.C nSleep - 5V, 0V nFault - N.C AOUT1 - serial current protecting resistor, to status LED Anode. AOUT2 - LED Cathode BOUT1 - N.C. BOUT2 - N.C. ASEN - Ground BSEN - Ground
  5. Testing procedure:5.1 Set nSleep to enable drv88335.2 By hand, use jumper wire to connect AIN1 to High (5V)5.3 By hand, use jumper wire to connect AIN2 to Low (0V)5.4 LED should be now switched on by DRV8833, implying that if motor is used instead of (or at the same time as) LED, current will pass motor coil, and motor would move in one directions (CW or CCW).5.5 Now connect AIN1 to Low, and AIN2 to High, LED should be switched off.5.6 Replace LED by motor. Motor should move (a) in one direction if AIN1, AIN2 are connected by jumper wires to High, Low, and (b) in opposite direction if AIN1, AIN2 are connected to Low High.5.7 Use a NE555 timer to generate 0.5Hz square pulse (1 second High, 1 second Low), motor should repeatedly move in one direction for 1 second, and opposite direction for 1 second.5.8 Use a NE555 timer to generate PWM signals, say 1kHz and different duty cycles, to adjust the speed of the motor, (or the brightness of the status LED). For this motor speed adjustment test, AIN1 is set to High or Low, AIN2 is connected to the PWM signal.5.8 Then test the OP’s python program in the question.

/ to continue, …


(1) DRV8833 Dual H-Bridge Motor Driver Datasheet – TI 2015jul

(2) How to use motor drivers with H-bridge and PWM input, to control direction and speed of DC motors? – EESE 2020jul16

(3) How to troubleshoot a DRV8833 motor driver module problem? – EESE, 2020nov09, Viewed 701 times

(4) DRV8833 Motor Driver Test Demo Youtube Video – 2020nov18

/ to continue, …


Appendix A – Suggested hardware setup for troubleshooting DRV8833

drv8833 hardware setup for testing drv8833

drv8833 2

drv8833 3

drv8833 4

drv8833 5

drv8833 6

drv8837 7

drv8833 8

/ to continue, …

ShareEditDeleteFlagedited 4 mins agoanswered 2 hours agotlfong013,77733 gold badges88 silver badges2222 bronze badgesAdd a comment1

You need to do some more research.

I suggest you start with something simpler! Preferably light a few LEDs.

You use GPIO.setmode(GPIO.BOARD) BUT then use BCM numbering.

You DO NOT have a Gnd connection between the devices – this is ABSOLUTELY essential for all circuits.

You DO NOT have proper connections to the device. Sticking pins through the holes is not good enough! If you are lucky it may work, but then a loose connection may fry your Pi.

Better I suggest you try gpiozero which is simpler, is well documented and has good examples.

I do not know what a DRV8833 is or its connections. Maybe someone does, but YOU should supply this information.ShareEditFollowFlagedited 6 hours agoanswered 6 hours agoMilliways48.7k2424 gold badges8080 silver badges160160 bronze badges

Add a comment

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.