Arduino Micro with SN754410NE DIP-16 H Bridge

  1. Please use code tags (the # button in the editor) when posting your code.

  2. The problem is that the SN754410 has inputs that float high. So before you make the pinMode calls, both the 1A and 2A inputs are effectively high. Therefore, when you make the first pinMode call, you bring one input low while the other is high, which applies full power to the motor. This sudden load on your power supply is causing its voltage to droop, which in turn is causing the Arduino to malfunction.

Here are some possible solutions, any one of which may fix the problem:

(a) Use a power supply with higher current rating

(b) Use a separate power supply for the Arduino

(c) Connect a large capacitor (2200uF or more) across the power supply to better provide the surge current that is drawn between the two pinMode calls

(d) Before making the pinMode calls, digitalWrite HIGH to both pins, so that the input state doesn't change wheh you make the pinMode calls. Also change the motorStop code to write HIGH to both pins instead of low.

(e) Connect the 754410 EN (enable input, pin 1) to an Arduino output, preferably a PWM pin (then the 1A and 2A pins can be connected to any digital outputs, not necessarily PWM pins). Before you set pinMode for the pins driving 1A and 2A, set the pinMode for the pin driving EN. This will force EN low, disabling the whole driver. Then set 1A and 2A to select the direction you want, and use the EN pin to do on/off and PWM.

(f) Add 1K pulldown resistors on the pins driving 1A and 2A.