Dual MAX14870 Motor Driver Shield for Arduino
This small shield is an easy, economical way to control two small brushed DC motors with an Arduino or Arduino-compatible board. Its two integrated MAX14870 motor drivers allows it to operate from 4.5 V to 36 V, making it a great for higher-voltage motors and applications, and the shield can 1.7 A continuous (2.5 A peak) per motor. The shield can optionally be configured to power the Arduino from the same power supply as the motor driver, and the Arduino pin mappings can be customized (by cutting traces) if the defaults are not convenient.
Dual MAX14870 Motor Driver Shield for Arduino, top view with dimensions.
Overview
This motor driver shield and its corresponding Arduino library make it easy to control a pair of bidirectional, brushed DC motors with an Arduino or compatible board. The board features a pair of Maxim’s MAX14870 H-bridge motor driver ICs, which allows it to operate from 4.5 V to 36 V and makes it well suited for driving higher-voltage motors like our 12V 20D gearmotors. The shield can deliver 1.7 A continuous per channel and tolerate peak currents up to 2.5 A per channel for a few seconds. The shield ships fully populated with its SMD components, including the MAX14870 drivers and a FET for reverse battery protection; header pins for interfacing with an Arduino and terminal blocks for connecting motors and power are included but are not soldered in (see the Assembly with included hardware section below).
The shield uses digital pins 4, 7, 8, 9, 10, and 12 for its control lines, though the control pin mappings can be customized if the defaults are not convenient. It should be compatible with any board that has a standard Arduino pin arrangement and the ability to generate PWM signals on pins 9 and 10. Compatible control boards include:
- A-Star 32U4 Prime
- Arduino Uno
- Arduino Leonardo
- Arduino Mega 2560
This shield is intended to provide a low-cost, basic motor driver option for Arduinos, so it is much smaller than typical Arduino shields.
Features
- Two single-channel H-bridge motor drivers with shoot-through protection and internal free-wheeling diodes (can each drive one DC motor)
- Motor supply voltage: 4.5 V to 36 V
- Output current: 1.7 A continuous (2.5 A peak) per motor
- PWM operation up to 50 kHz (ultrasonic frequencies allow for quieter motor operation)
- Simple two-pin DIR/PWM interface (one pin controls direction and another controls speed)
- Shield can optionally power the Arduino base directly when motor supply voltage is suitable
- Shield has convenient location for adding a 3-pin voltage regulator to power the Arduino base in applications where the motor supply voltage is not suitable for powering the Arduino directly
- Arduino library makes it easy to get started using this board as a motor driver shield
- Arduino pin mappings can be customized (by cutting traces) if the default mappings are not convenient
- Reverse-voltage protection on motor power supply
- Under-voltage lockout
- Active-low fault output indicates over-current or over-temperature condition
- Surface-mount resistors can optionally be added to enable automatic current limiting
Dual MAX14870 Motor Driver Shield for Arduino, top and bottom sides.
Assembly with included hardware
Before the shield can be plugged into your Arduino, header pins must be mounted to the bottom of the board (the side without any components or text) by soldering them into the appropriate holes. The shield ships with a 0.1″ straight breakaway male header strip that can be broken into smaller pieces and used for this purpose. Ground is the only necessary connection on the left side of the board (though VIN must also be soldered if you intend to power the Arduino from the shield). Along the right side of the board, digital pins 4, 7, 8, 9, 10, and 12 are used by default. Male header pins should be soldered to at least these locations so that the shield will make the appropriate connections to the Arduino. Once the header pins are soldered in, one easy way to ensure that you are plugging the shield properly into the Arduino is to align the gap between pins 7 and 8 on the shield with the gap between pins 7 and 8 on the Arduino’s female headers.
When the input voltage for the motors is appropriate for the Arduino or Arduino compatible board, reverse-protected power can be provided to the Arduino’s VIN pin through the shield. For this configuration, solder two male header pins to the “VM = AVIN” jumper location and install the included blue shorting block across them (as shown in the above assembled picture). These pins should point up, away from the Arduino.
Warning: The MAX14870 shield works with voltages well above what typical Arduino boards can tolerate, so it is very important that you only use the “AVIN = VM” jumper in situations where the motor supply voltage is also within the operating limits of your Arduino. Otherwise, your Arduino could be permanently damaged.
If the motor supply voltage is higher than the Arduino or Arduino compatible board can handle, a voltage regulator can optionally be used to provide a suitable voltage to VIN pin of the Arduino. For this configuration, solder the regulator into the VM, GND, and AVIN pins outlined in the shield’s silkscreen. Be careful to orient the regulator so its input pin lines up with VM and its output pin lines up with AVIN. For a more modular setup, a three pin female header can be soldered to the shield and used as a socket for a regulator.
The Arduino’s power jack must remain disconnected at all times if power is supplied to the AVIN pin through the shield.
Warning: When powering the Arduino from the motor shield, you must never connect a different power supply to the Arduino’s VIN pin or plug a power supply into the Arduino’s power jack, as doing so will create a short between the shield’s power supply and the Arduino’s power supply that could permanently damage both the Arduino and the motor shield.
Three 2-pin, 5 mm terminal blocks are included for making easy motor and power connections to the shield once they have been slid together and soldered to the six large through-holes. Alternatively, you can solder 0.1″ male header pins to the smaller through-holes above the terminal block holes, or you can just solder wires directly to the shield for more compact (and permanent) installations.
Additional header pins and shorting blocks beyond what is included can be used to make some of the more advanced optional modifications to the shield, such as remapping the control pins.
An Arduino is not included.
Default pin mappings
The shield plugs into Arduino digital pins 4 – 12 on one side and A1 through RST on the other. The upper-left corner of the shield partially blocks the Arduino’s IOREF pin, but this region of the board (marked with a white silkscreen box) can be removed if necessary to allow access. The shield also blocks Arduino digital pins 5, 6, and 11, but these pins are not used by default and alternate access points to them are provided via the neighboring through-holes.
This table shows how the Arduino’s GPIO pins are used to interface with the motor drivers:
Arduino digital pin |
Motor driver pin | Description |
---|---|---|
4 | EN | Inverted enable input: The shield pulls this pin low by default, enabling the drivers. Driving this pin high puts both motor driver ICs into a low-current sleep mode and disables the motor outputs (setting them to high impedance). |
7 | Motor 1 DIR | Motor direction input: When DIR is low, motor current flows from output A to output B; when DIR is high, current flows from B to A. |
8 | Motor 2 DIR | |
9 | Motor 1 PWM | Motor speed input: A PWM (pulse-width modulation) signal on this pin corresponds to a PWM output on the corresponding driver’s motor outputs. When this pin is low, the motor brakes low. When it is high, the motor is on. The maximum allowed PWM frequency is 50 kHz. A 100 kΩ pull-down resistor on the shield makes this pin default low. |
10 | Motor 2 PWM | |
12 | FAULT | Fault output: The internal pull-up on the Arduino pin connected to the FAULT input should be enabled so when the drivers are functioning normally it is pulled high. In the event of an over-current or over-temperature condition, the driver IC experiencing the fault drives FAULT low. |
Using the shield
In the shield’s default state, the motor driver shield and Arduino are powered separately, though they share a common ground. When used this way, the Arduino must be powered via USB, its power jack, or its VIN pin, and the shield must be supplied with 4.5 V to 36 V through its large VIN and GND pads. Attempting to power the shield from the Arduino is not recommended as this could result in large currents flowing through small traces. However, it is possible to power the Arduino from the shield either directly with the motor power supply or through an added regulator. See the Assembly with included hardware section above for more information on powering the Arduino from the shield, including some important warnings.
The MAX14870 offers a simple two-pin DIR/PWM control interface, where the DIR pin determines the motor direction and the PWM pin can be supplied with a PWM signal to control the motor speed. The PWM control input is pulled low on the shield through a 100 kΩ pull-down resistor. When the PWM pin is low, the motor outputs are both shorted to ground, which results in dynamic braking of a connected motor.
The shield’s EN pin can be driven high to turn off motor outputs for both motor channels, which is useful if you want to let the motors coast. The EN pin is pulled low through a 100 kΩ pull-down resistor on the shield so that both motor channels are enabled by default. To get individual control of the enable lines for both drivers, the trace between the M1EN and M2EN through holes can be cut. This will leave M2EN connected to Arduino digital pin 4. A jumper can be used across the M1EN pin and the neighboring through hole to connect it to digital pin 5.
The following simplified truth table shows how the driver operates:
Inputs | Outputs | ||||
---|---|---|---|---|---|
EN | DIR | PWM | MxA | MxB | operating mode |
0 | 0 | PWM | PWM (H/L) | L | forward/brake at speed PWM % |
0 | 1 | PWM | L | PWM (H/L) | reverse/brake at speed PWM % |
0 | X | 0 | L | L | brake low (outputs shorted to ground) |
1 | X | X | Z | Z | coast (outputs off) |
The MAX14780 shield has a fault pin that combines the fault outputs of the two on-board drivers, M1FAULT and M2FAULT. It is an open-drain, active-low fault output that goes low during an over-current or over-temperature condition on either motor channel. To get individual fault outputs, the trace between the M1FAULT and M2FAULT through holes can be cut. This will leave M2FAULT connected to Arduino digital pin 12. A jumper can be used across the M1FAULT pin and the neighboring through hole to connect it to digital pin 11.
Optional current limiting
The MAX14870 IC features a SNS input that can be used for optional automatic current limiting. By default, this input is connected to ground for both drivers on this board, which bypasses the current regulation feature. To enable current limiting, you must first cut the traces between each pair of unpopulated 1206 resistor pads near the driver chips.
Then, you will need to add your own appropriate surface-mount 1206 resistor to these pads.
Each driver tries to keep the voltage on the SNS pin from exceeding 100 mV, so for example, a 100 mΩ resistor limits the current to 1 A and a 200 mΩ resistor limits it to 0.5 A. For more information on current limiting, see the MAX14870 datasheet (492k pdf).
Real-world power dissipation considerations
The MAX14870 datasheet recommends a maximum continuous current of 2.5 A. However, the chip by itself will typically overheat at lower currents. In our tests, a continuous current of 1.7 A per channel was sustainable for many minutes without triggering a thermal shutdown.
The actual current you can deliver will depend on how well you can keep the motor driver cool. The shield’s printed circuit board is designed to help with this by drawing heat out of the motor driver chip. PWMing the motor will introduce additional heating proportional to the frequency.
This product can get hot enough to burn you long before the chip overheats. Take care when handling this product and other components connected to it.
Schematic
Schematic diagram for the Dual MAX14870 Motor Driver Shield for Arduino.
This schematic is also available as a downloadable pdf (139k pdf).