ME102 Lab 3: DC Motor Control

  1. DC Motors and the TA7291P H-bridge
    • Half Bridges
  2. Hardware Setup
    • H –Bridge
    • Analog Input
  3. Software Tasks
    • Throttle Control
    • Mimicking motion
    • Hints
  4. Putting it together and Check Off
  5. Appendix
    • Sign/Direction PWM
    • Simple PWM
  6. References

1| DC Motors and the TA7291P H-bridge

In Lab 1, we used buffer IC’s (7417, 7414) to isolate the signals to and from the Arduino. This protected the board, and provided power for external devices without drawing it from the Arduino. An H-bridge can be thought of in much the same way. It is the interface between an electrical signal and an electrical power source. Though they share the same medium, their functions are vastly different.

The H-bridge is a common circuit used to control the speed and direction of a DC motor with low current PWM signals. The H-bridge you will be using is the TA7291P (datasheet). It is a pair of half bridges that can source 1 Amp.

Half bridges

DC motors are turned on by applying a voltage across the two terminals. The rotation speed can be controlled by increasing or decreasing the applied voltage. Changing the polarity of the applied voltage changes the motor's direction of rotation.

We can use half bridges to control both the speed and direction of rotation of a DC motor. Half bridges are essentially high power digital buffers; the output goes to 0V when the input is low, and the output goes to Vs when the input is high. To power a motor, we can use half bridges to drive one terminal high and the other low.

We also can control the voltage applied to the motor by sending one half bridge a PWM signal. For example, if we hold one bridge low and drive the other bridge high 50% of the time, (for Vs=+12) the motor will behave as if we applied 6VDC.

Switching the direction of rotation is done by swapping the input signals.



Notice that we can apply zero volts to the motor by either driving both bridges low or both high. Some h-bridges are designed so that one of these modes puts the outputs in a "coast to stop" mode (L-L for the TA7291P); the other mode causes a stronger "brake" stop.




2| Hardware setup

In this lab, you will be using only the digital output buffer and the voltage follower. As breadboard space is limited, these are the following schematics you should implement.

H-Bridge


Analog Input

Before you continue to the software tasks, make sure that your DC motor is working by supplying 5V from the benchtop power supply. The Arduino will not be able to supply enough current. Plugging the DC motor into the 5V and GND will trigger a board shutdown in order to prevent further damage.

3| Software Tasks

Throttle Control

Control the direction and speed of the provided DC motor with a potentiometer. The motor should behave like the throttle of a boat. A potentiometer twisted all the way to the right should have the motor spinning fast in one direction. As the potentiometer is twisted left, the motor should slow down and then begin spinning the other direction.

Mimicking motion

Tie the direction and speed of the motor spinning to the direction and speed of the potentiometer rotation. The faster you spin the potentiometer, the faster the motor should spin.

Hints

The map function provided by the Arduino libraries provides an easy way to scale a number within a range. It is called by map (value, fromLow, from High, toLow, toHigh). fromLow and fromHigh are the initial range of value. toLow and toHigh are the new range of values. The function returns the scaled value.

Velocity can be approximated as a change in position over a change in time. You can keep track of time in the Arduino with the millis()function. millis() returns the millisecond value of the onboard clock. It takes about 5 days for this counter to run-over and restart.

4| Check Off

Show the GSI that both your throttle control and mimicking motion code works properly.

5| Appendix

Sign and Direction PWM

Some H-bridges, such as the LMD18200, simply have inputs for direction and speed (PWM). The most intuitive way of using them is to provide two input signals for direction and PWM. (The LMD18200 is rated for 55V, 3 Amps, and can be checked out from the department.)

Simple PWM

Simple PWM consists of a single, variable duty-cycle signal in which both direction and amplitude information is encoded. A 50% duty-cycle PWM signal represents zero drive, since the net value of voltage (integrated over one period) delivered to the load is zero. A 25% duty-cycle PWM signal represents current flow from OUT2 to OUT1 whereas  a 75% duty-cycle represents current flowing from OUT1 to OUT2. To use simple PWM for driving the DC motor, wire the PWM signal from the Arduino to the DIRECTION input (pin 3) while the PWM input (pin 5) is tied to logic high. If you used a pull-up resistor on the PWM input, you can control the direction and magnitude of a DC motor with only one output from the Arduino.

6| References


http://hades.mech.northwestern.edu/wiki/index.php/Main_Page

NorthWestern’s wiki for their mechatronics classes. They pages contain amazing amounts of information about DC motors, RC servos, and stepper motors. They also have links to past student projects which may serve to inspire.

http://www.arduino.cc/en/Reference/

Arduino’s own reference section. Everything and anything you’d want to know about the Arduino, you can find here.