Made by National Semiconductor, the LMD18200 is one of my favorite H-bridge motor driver integrated circuits (ICs) for small robots because of it’s ability to drive both DC and stepper motors. The chip is a relatively inexpensive way to get solid motor control without any headaches. For this project, get a free sample or two from National Semiconductor, a custom-made PCB or perf board, some male headers, resistors, and a couple of capacitors from around the lab and you’ll be quickly running those motors.
The above image shows the most common package for the H-bridge — 11-pin TO-220. Before going any further, consider the pinout:
Operating on supply voltages between 12V and 55V DC, the LMD18200 handles up to 3A of continuous current and can also withstand up to a 6A spike. I’ve found that running about 24V at anything higher than a continuous 1.5A warrants the use of an aluminum heat sink to dissipate the heat from the back of the LMD18200. In more extreme cases, the datasheet recommends heat sinking Vs — pin 6 — to one square inch of copper on the printed circuit board. This helps dissipate any potentially destructive wattage due to a hard short circuit between an output and ground where current power through the device can reach upwards of 15A.
The direction pin could easily be the most hazardous pin on the chip because it controls the current flow between output 1 and output 2. Thus, it controls which way the motor turns. The reason for concern is that if the PWM input has a large duty cycle (eg, 90%-100%) and the direction pin toggles (on purpose or by accident) then there is a surge of current through the motor that will eventually come back to the motor driver. Should this happen and be over 6A or for an extended period of time (eg, the pin keeps toggling), then there’s a good chance the LMD18200 will be damaged.
By effectively shorting the motor terminals the brake pin stops the motor. Sometimes this is advantageous but some people do not like using the brake pin so in the schematic below it can easily be jumpered to ground and thus tying it low and making it unusable. Should you wish to use the brake, then ensure when the break pin is pulled high that the PWM input has a duty cycle of 100%. The direction pin in this case determines which transistors are shorted — sourcing or sinking.
PWM – Pulse Width Modulation
Without this input, nothing would happen. To turn the motor on full speed then set a logic high to the PWM input. Similarly, to turn it off set a logic low. Usually, though, this is not ideal for accurate motor control. Instead, consider the following two most common modes of operation (these modes are also explained in the product datasheet).
Signed Magnitude PWM: This method most likely achieves more resolution than can be realized by the motor itself, but it also the most intuitive. The direction pin chooses the direction while the PWM input controls to speed. A logic low on the direction pin with a 50% duty cycle PWM yields a half reverse speed. Changing the PWM affects the speed at which the motor will turn in reverse while toggling the direction pin changes the direction at which the motor turns.
Simple, locked anti-phase PWM: A PWM signal in which both the direction and the speed are encoded. A 0% duty cycle (active low input) represents a full reverse, a 75% duty cycle represents a half forward, and a 50% duty cycle is the stopping point. To achieve this operation, the PWM output from the microcontroller is tied to the direction pin and the PWM input pin on the LMD18200 is pulled high.
Current Sensing Output
The current sensing output can be used to determine what kind of load the motor is under or if the motor is stalling. As can be seen in the motor driver schematic, there is a voltage generating resistor between the current sensing output — pin 8 — and ground. The purpose of this resistor is to provide the resistance, R, in the Ohm’s Law Equation, V = IR. The resistance you need is directly proportional to the voltage desired (usually 5V) based on the amount of current being sourced from pin 8 on the LMD18200. According to the datasheet, the current sensing output has a sensitivity of 377 uA per ampere of output current. For demonstration purposes, assume the user wants a maximum voltage of 5V coming from pin 8 so that this voltage may be read by an analog-to-digital (A/D) converter. The user wants to know when the output current spikes and approaches the physical withstanding limit of the LMD18200, or about 6A, but also wants the flexibility of determining when the motor is consuming 1, 2, and 3 amperes of continuous current. Therefore, Vout = 5V, Imax = 6A, I1 = 1A, I2 = 2A, and I3 = 3A. Rearranging Ohm’s Law finds that:
RVG = Vout / Imax
RVG = (5V) / [(0.000377A / A of output current) * (6A of output current)]
RVG = 2210.4 Ω = 2.2 kΩ.
Since the voltage generating resistor value was calculated with a theoretical voltage maximum of 5V, it is easy to see the corresponding voltages generated with different values of the current output. Using the sample currents above of 1, 2, and 3 amperes and a common 2.2 kΩ resistor, then the corresponding voltage at pin 8 should be 0.83V, 1.66V, and 2.5V. Subsequently, if the microcontroller performing the sensing has an analog reference voltage (for A/D conversion) of 3.3V (very common in low power devices) then the Vout variable above changes to 3.3V and thus RVG = 1458.9 Ω = 1.5 kΩ.
When choosing this resistor value, it is a good idea to err on the side of caution and choose a value high enough so that the input voltage to the microcontroller from pin 8 does not exceed that of the analog reference voltage or the maximum allowable voltage of the microcontroller — doing so may cause the individual pin to blow, or even the entire microcontroller to stop working if the voltage is too high for too long.
Thermal Warning Flag
Pin 9 on the LMD18200 is the thermal flag. As an open collector output the pin needs to be manually pulled high (to a maximum 12V) and becomes active low when the junction temperature exceeds 145 degrees C. If the junction temperature reaches 170 degrees C, then the IC turns itself off to prevent any further damage. Multiple thermal flags can be tied together and connected to an external interrupt pin so if it fires then appropriate action can be taken to either lessen the load or enter an error/shutdown mode.