0
\$\begingroup\$

Circuit used for my questionI'm using a SN754410NE h-bridge to drive two DC motors (4.5V each) with Arduino. After testing the circuit and the code, I made a standalone Arduino on a perma-proto breadboard.

My problem is that while the motors are running I see that led13 (the red led on the schematic) flashes periodically, while it's not supposed to (my code doesn't use that pin at all). After a while my atmel328 chip is kind of "erased" and in order to make my robot work again, I have to reprogram the chip.

So after looking around I found out that my h-bridge doesn't come with protection/flyback diodes (correct me if I'm wrong) and I need to add them myself. I have some 1N40001 diodes but am not sure how and where to connect them. Should I connect parallel to the motor leads? And if so, what the polarity should be given that the polarity can change (the motors run in both directions). Alternatively, should I connect the diodes serially to the wires connecting the Arduino digital pins to the driver input pins on the h-bridge?

\$\endgroup\$

closed as unclear what you're asking by placeholder, uint128_t, Daniel Grillo, Dmitry Grigoryev, Dave Tweed Jun 10 '16 at 12:59

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • \$\begingroup\$ What is LED13? that has no meaning out of context, include a schematic. \$\endgroup\$ – placeholder Jun 5 '16 at 19:30
  • 2
    \$\begingroup\$ The first datasheet I found <ti.com/lit/ds/symlink/sn754410.pdf> states at page 8 "Four high current and high voltage outputs feature clamp diodes for inductive load driving." \$\endgroup\$ – Wouter van Ooijen Jun 5 '16 at 19:33
  • \$\begingroup\$ @WoutervanOoijen Yes, I saw that, too, but I guess I was influenced by other things that I read! Any ideas why my chip is erased? How can it be connected with the flashing led13? \$\endgroup\$ – panos Jun 5 '16 at 20:07
  • \$\begingroup\$ @placeholder By "led13" I mean the led connected to the digital pin 13. \$\endgroup\$ – panos Jun 5 '16 at 20:11
  • \$\begingroup\$ Freewheel diodes deliver current to the power supply rail. If nothing absorbs that current it will raise the power supply, which might cause trouble. Maybe a big capacitor would help. \$\endgroup\$ – Wouter van Ooijen Jun 5 '16 at 21:00
3
\$\begingroup\$

From your breadboard diagram, one point stands out as missing: you have no bypass capacitors. The fast switching and inductive loads of the motor drivers will generate electromagnetic interference (EMI). Bypass capacitors are connected to between positive or negative rails and ground to stabilize the DC power rails and allow the currents causing EMI to be contained locally.

I would recommend using at least a 10uF-range electrolytic capacitor directly on the motor driver (H-bridge) power/ground pins, along with 0.1uF ceramic capacitors at the MCU and additionally at the motor driver. You don't want to put large capacitance on the motor driver output.

Additionally, you could put smaller ceramic capacitors (10nF to 0.1uF) directly on the motor, but these will slightly increase the power losses inside the motor driver. They are commonly connected as in this photo:

hobby motor with three 0.1uF capacitors soldered on, from https://cdn1.bigcommerce.com/server800/a8995/products/765/images/2257/hobby_motor_280p__32150.1437087552.380.500.Jpg

\$\endgroup\$
  • \$\begingroup\$ Thanks a lot! I put a 0.1μF ceramic capacitors parallel to the motor and I think it's better, even though I still have occasional problems... Would higher capacity capacitors be even better? What if I soldered more than one capacitors (as I've seen in some motors)? Regarding the electrolytic capacitors, where should I put those (couldn't find what a "motor driver" is)? Also, parallel to the motor? And since these have polarity, what the polarity should be (since my motors run forward and reverse). \$\endgroup\$ – panos Jun 8 '16 at 22:11
  • \$\begingroup\$ @panos I have updated my answer. Electrolytic+ceramic on the H-bridge power supply, plus optional small ceramic capacitors on the motor itself. \$\endgroup\$ – user2943160 Jun 8 '16 at 23:34
  • 1
    \$\begingroup\$ After testing, it looks like a single ceramic capacitor connected in parallel to the motor leads makes all the difference! I will nevertheless connect the other two capacitors as well (from each of the motor leads to its body) and see if it is even better. Thanks! \$\endgroup\$ – panos Jun 10 '16 at 19:10
1
\$\begingroup\$

Add them in parallel to your motors, but in the reverse direction of the current flow. This allows the current still flowing through the motor (an inductor) to slowly dissipate back through the motor. This video gives a pretty good demonstration of the reasoning behind this.

\$\endgroup\$
  • \$\begingroup\$ Thanks for the comment and the video! Yes, I've seen that people also add diodes in cases where you control motors. But my problem is that if I connect a diode I'm not sure about the polarity, since my motors run in both directions (see my comment in the other answer). Is there a way to connect a diode in such cases? \$\endgroup\$ – panos Jun 8 '16 at 22:17

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