I have a question about the MC33887 Motor Driver. I’m using it to drive two 20D pololu gear motors, and I noticed that whenever one motor encounters any resistance, the other motor on the opposite side of the robot will slow down in sync with it. Also, the indicator both the red and green LEDs on the driver light up, which makes it seem like the driver is sending HIGH AND LOW signals through the same channel. I’m assuming this is due to feedback from the motor, but how can I fix this? If I were to stick a diode in one of the channels to prevent feedback, this would limit me to one-way control. Note that to save IO pins on my microcontroller, I connected the D1’s from both motor Inputs to Gnd, and I connected both the FS’s and EN’s to 5 volts. Would this shortcut somehow lead to my problem?
Your problem is most likely due to an inadequate power supply. As your motor encounters resistance, it draws more current from the power supply, and if the power supply cannot deliver that current, the voltage will drop and the other motor will slow down. What are you using for your power supply?
The behavior you are seeing from the LEDs is normal when PWMing one of the disable pins at duty cycles under 100%. During the driving portion of the duty cycle, the LED corresponding to the motor direction will light; during the off portion of the duty cycle, the motor driver outputs become high-impedance and the only path for the motor current to continue circulating is through the other LED, which causes it to light. This does not cause any harm, and it is not something you need to prevent.
By the way, connecting the FS pins directly to 5 V can permanently damage the driver and could potentially be responsible for some of your troubles. These pins are outputs that drive low when a fault occurs or when a disable pin is disabling the driver, at which point you are shorting your 5 V rail to ground. If you don’t plan on reading the fault pins, you should leave them disconnected. Otherwise, you should connect them to an input on your microcontroller and either enable an internal pull-up resistor on that pin or use an external pull-up resistor to 5 V (this pull-up resistor gives the fault pin a default value of high when there is no fault while allowing the pin voltage to safely go low when FS drives low).
Thanks Ben. For my power supply I am using two 9v batteries in series. Also, about the FS, if the only behaviours I want my motors to do is spin C and CC, with an occasional freewheeling, would disconnecting FS completely still allow the driver to work?
What made you choose two 9V batteries in series? There are a number of problems with this:
Your motors are intended for use at 6 V. As the product page says:
You are running them at over 18 V, which is three times higher than their rated voltage and gives them a stall current of approximately 10 A.
You are using a driver with a peak current rating of 5 A, and the 10 A stall current of your motors significantly exceeds this. This problem will go away if you reduce your motor voltage to something closer to what your motors can actually handle, like 6 V.
You don’t need to do anything with the fault status (FS) pins to use the driver. These pins exist to give you feedback about the state of the driver so you can detect and potentially respond to faults. If you want to use them, you need to connect them as I (and the product page) describe, but it is fine to leave them disconnected. As the product page says:
Thank you so much for your help! I hadn’t caught the wiring error for the batteries. facepalm
I had intended to double their current and not their voltage. If I were to fix this mistake, would they operate the robot with sufficient power? I’m working on a mini sumo robot, and don’t need energy for prolonged periods, just 3 mins at max for a round, so I assumed quick spurts would work fine.
The peak current a battery can deliver is related to its capacity, so not only will you drain 9V batteries quickly, but you will also not be able to get much current out of them, and I think they are not a good choice for your sumo bot. I would suggest either a few LiPo cells in series or four alkaline cells in series (you would probably be ok with AAAs).