Uncategorized

drv8833 notes

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

Ask QuestionAsked todayActive todayViewed 32 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
GPIO.setmode(GPIO.BOARD)

# 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
time.sleep(5)

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

raspberry-pi-osdc-motorShareEditFollowCloseFlagedited 6 hours agotlfong013,77733 gold badges88 silver badges2222 bronze badgesasked 13 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 13 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 13 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 13 hours ago
  • 1Oh..the DRV8833 component wants power between 2v and 10v though.. – Patrick Hession 13 hours ago
  • 1I have added some more info to my question now. Hope this helps 🙂 – Patrick Hession 13 hours ago 

Add a comment  |  Show 5 more comments

2 Answers

ActiveOldestVotes0

Question

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


drv8833 n20 motor

Answer


drv8833

  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 9V)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, …


References

(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, …


Appendices

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

Appendix B – Spec of the OP’s N20 Motor

Note – Load current = 150mA, Stall current = 400mA


N20 Motor Spec

/ to continue, …


ShareEditDeleteFlagedited just nowanswered 7 hours agotlfong013,77733 gold badges88 silver badges2222 bronze badgesAdd a comment2

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 11 hours agoanswered 11 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 )

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.