I've done a simple H Bridge with 5V relays and 2N2222A transistors using Arduino Nano, just like this one:

enter image description here

A 6V 4A battery supplies the Arduino (on Vin). Relays are supplied with 5V of the Arduino, but the Normally Open Contacts are connected to 6V.

When I connect just one DC motor, the H Bridge works fine. But If I want to connect two motors in parallel to the Common Pins, the relay I'm activating sounds, but the motors don't move, then, after some seconds, the Arduino restarts itself (because the Bluetooth module that I'm using disconnects itself and the LED of the Arduino blinks like when you reset it).

Also, if I connect the second motor in parallel while the first one is moving, it works fine, but then, if I try to invert direction, it happens what I said before: Arduino restarts itself.


The torque output of an electric motor is directly proportional to the motor current, and the current (I) is roughly equal to

Where V is the motor supply voltage, R is the winding resistance and ε is the back-electromotive force (back EMF).

The back EMF is the voltage that would be present at the motor terminals without anything being connected. It is produced by the motor acting as a generator, if you will, and it's proportional to the rotation speed.

If you connect an unloaded motor to a power supply, it will speed up until the back EMF exactly cancels out the supply voltage and then spin at a constant speed. If torque is demanded from the motor (even just the slight friction of spinning), it reaches a speed where the winding resistance lets just enough current to flow to balance any torque.

When you first switch your motor on, the speed is zero. This means that the back EMF is also zero, so the only things limiting the motor current are the winding resistance and the supply voltage. A motor which is rated for 500 mA and draws 50 mA without any load at 6 V might very briefly draw several amps of current when first switched on.

Apparently your setup somehow manages to supply this inrush current of one motor, but two motors starting at the same time draw so much current that the supply voltage drops below the level required by the arduino to function, causing it to reset and release the relay.

You need to limit the current draw of your motor when it first starts up so that the voltage stays stable. There are several ways to do this:

  • The simplest method is to add a current limiting resistor in series with the two parallel motors. For example, a 10 ohm resistor would limit the current to a maximum of 600 mA, assuming a 6 V supply. The resistor has to be a 3.6 W (or better rated) power resistor. The drawback is that you are wasting power in the resistor, and your maximum torque at speed will be severely limited.

  • You can use a current limiting resistor in combination with an extra relay, so that you can remove the resistor from the circuit after the motors have reached their full speed.

  • The optimum way is to use a semiconductor motor driver. They are more complicated to control, but they allow control over the average motor voltage (via pulse width modulation) and thus of the motor speed. By slowly ramping up the voltage from zero, you can keep the difference between the motor voltage and back EMF ("speed induced voltage") low, and consequently keep the current low.

  • \$\begingroup\$ ...only so long as nothing stalls the motor. If it does, you're back in high current territory when not planned to be. An no, a power resistor is not really a workable solution. \$\endgroup\$ – Chris Stratton Oct 5 '16 at 2:29
  • \$\begingroup\$ @ChrisStratton It depends. Motor drivers which aren't just plain H bridges usually provide built-in PWM, current sensing, current limiting and overtemperature protection (solving your stall current concern). Also, a current limiting resistor can be a more workable solution than a motor driver IC in this case: it's simple, dirt cheap and easier for somebody starting out with electronics. \$\endgroup\$ – jms Oct 5 '16 at 2:38
  • 2
    \$\begingroup\$ No, adding fixed resistance is really not the answer, proper supply design is. If the Arduino weren't being operated borderline in dropout, it really wouldn't be an issue. Take a look at practical bettery powered devices - series resistors are not something you find - very rarely PTC's to protect against stall, but not fixed resistors. In practical terms, small motors do not draw high starting currents for longer time than your supply caps should handle, unless they are mechancially loaded. \$\endgroup\$ – Chris Stratton Oct 5 '16 at 2:44
  • \$\begingroup\$ Of course you aren't going to see such an arrangement in a product, motor current limiting with a resistor is a non-starter for an electronics engineer or just an intermediate-level hobbyist as there are better solutions. However, it can be just fine if you don't care about battery life and RPM drop under load. I agree, OP should also use a better suited power supply and implement proper decoupling. \$\endgroup\$ – jms Oct 5 '16 at 2:53

There are many issues here. A 6v-nominal battery is insufficient for the Vin of a typical Arduino, as the regulator has a high drop-out voltage. And as it discharges or is loaded, the battery voltage will only get lower.

Additionally, the dropout voltage of most regulators increases the more current they have to supply. And you should really not be running relay coils off of the Arduino's regulator to begin with.

Of course adding a second motor in parallel only increases the battery sag.

What current do your motors typically require? If not too high, you might consider a modern FET bridge like a TB6612FNG - that will be quieter, give you unique control of each motor, and let you use PWM to modulate the drive, too.

  • \$\begingroup\$ I've tried supplying Arduino with its usb cable, an the contacts of the relay with the battery(6V), and still have the same problem. I'm using transistors for the relays, so I'm not understanding why it's a problem to use relays on Arduino. \$\endgroup\$ – XanderCraz Oct 5 '16 at 1:04
  • \$\begingroup\$ Even with the transistors, powering the relays from the arduino's regulator is dubious, both because it puts unecessary load on the regulator (which means heat) and because the switching transients end up on the arduino's power supply. Taking a step back you really don't need relays for this - that was a solution from a few decades back without today's power semiconductors. \$\endgroup\$ – Chris Stratton Oct 5 '16 at 2:26
  • \$\begingroup\$ I'm using these motors cdn.sparkfun.com/datasheets/Robotics/DG01D.jpg. Is it ok if I use L298N motor driver? \$\endgroup\$ – XanderCraz Oct 5 '16 at 2:50
  • \$\begingroup\$ No, the L298 and L293 are horrid and antiquated, do not use them. The TB6612FNG works pretty well with those motors. \$\endgroup\$ – Chris Stratton Oct 5 '16 at 3:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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