DC Motor Lab: 1.1 The Experiment
DC Motor Lab: 1.1 The Experiment
DC Motor Lab: 1.1 The Experiment
In this lab, you'll learn how to control a DC motor's direction using an H-bridge. To reverse a DC motor,
you need to be able to reverse the direction of the current in the motor. The easiest way to do this is
using an H-bridge circuit.
Table of Contents
Table of Contents
1
Objective
1.1
The Experiment
1.2
Reference Documents
How it Works
2.1
DC Motors
2.2
2.3
Objective
How it Works
2.1 DC Motors
by solarbotics
Let's start by looking at the overall parts of a simple DC electric motor.
Every DC motor has six basic parts -- axle, rotor or armature, stator, commutator, field magnet(s), and
brushes.
Armature or rotor is an electromagnet made by coiling thin wire around two or more poles of a
metal core. The armature has an axle, and the commutator is attached to the axle.
Commutator commutator is a common feature of direct current rotating machines. By reversing
the current direction in the moving coil of a motor's armature, a steady rotating force, torque, is
produced.
Brushes transfers power from the battery to the commutator as the motor spins.
Axle holds the armature and the commutator.
Field magnet is formed by the can itself plus two curved permanent magnets.
Stator is the stationary part of a rotor system
The SN754410 H-Bridge you are using has 4 half-H bridges (i.e., two bridges), and can therefore control
2 motors. It can drive up to 1 amp of current, and operate between 4.5V and 36V. The motor that you
selected operates well within this range (5-15 volts) so will work well with this H-bridge. The SN754410
is a very basic H-bridge. This one in particular has two bridges, one on the left side of the chip and one
on the right.
Above is a diagram of the H-bridge IC that you are using and which pins do what in our example.
Included with the diagram is a truth table indicating how the motor will function according to the state
of the logic pins (which are set by our Arduino).
For this lab, the enable pin connects to a digital pin on your Arduino so you can send it either HIGH or
LOW and turn the motor ON or OFF. The motor logic pins also connected to designated digital pins on
your Arduino so you can send it HIGH and LOW to have the motor turn in one direction, or LOW and
HIGH to have it turn in the other direction. The motor supply voltage (VMOTOR) connects to the voltage
source for the motor, which is, in our case, an external power supply.
These circuits are often used in robotics and other applications to allow DC motors to run in the
clockwise and counterclockwise directions. H-bridges are available as integrated circuits, or can be built
from discrete components. The Texas Instruments SN754410 is a very popular H bridge IC used in many
hobby and robotic applications.
Basically, there are four switching elements in the H-Bridge as shown in the figure below.
As you can see in the figure above there are four switching elements named as "High side left", "High
side right", "Low side right", "Low side left". When these switches are turned on in pairs motor changes
its direction accordingly. Like, if we switch on High side left and Low side right then motor rotate in
forward direction, as current flows from Power supply through the motor coil goes to ground via switch
low side right. This is shown in the figure below.
Similarly, when you switch on low side left and high side right, the current flows in opposite direction
and motor rotates in backward direction. This is the basic working of H-Bridge. We can also make a small
truth table according to the switching of H-Bridge explained above.
Truth Table
High Left
On
High Right
Off
Low Left
Off
Low Right
On
Off
On
On
Off
On
On
Off
Off
Off
Off
On
On
Description
Motor runs
clockwise
Motor runs anticlockwise
Motor stops or
decelerates
Motor stops or
decelerates
As already said, H-bridge can be made with the help of trasistors as well as MOSFETs, the only thing
is the power handling capacity of the circuit. If motors are needed to run with high current then lot of
dissipation is there. So head sinks are needed to cool the circuit.
Now you might be thinking why i did not discuss the cases like High side left on and Low side left on or
high side right on and low side right on. Clearly seen in the diagram, you don't want to burn your power
supply by shorting them. So that is why those combinations are not discussed in the truth table.
Truth table
A
0
0
B
0
1
Motor
Stop
Run one
direction
Run on the
other direction
Stop
This example uses an H-bridge integrated circuit, the Texas Instruments SN754410. The H-bridge is
available for purchase online at many distributors such as: Digikey, SparkFun, Mouser, Futurlec, and
Jameco.
Control the motor speed by driving the motor with short pulse
Making a square wave with on-to-off ratio, the average on time varies from 0 to 100 percent
These pulses vary in duration to change the speed of the motor, the longer the pulses, the
faster the motor turns, and vice versa
Pulse-width Modulation is achieved with the help of a square wave whose duty cycle is changed to get a
varying voltage output as a result of average value of waveform.
A mathematical explanation of this is given below:
So you can see from the final equation the output voltage can be directly varied by varying the Ton value.
If Ton is 0, Vout is also 0.
switchPin
motor1Pin
motor2Pin
enablePin
ledPin 13
2 // switch input
3 // H-bridge leg 1 (pin 2, 1A)
4 // H-bridge leg 2 (pin 7, 2A)
9 // H-bridge enable pin
// LED
void setup() {
// set the switch as an input:
pinMode(switchPin, INPUT);
// set all the other pins you're using as outputs:
pinMode(motor1Pin, OUTPUT);
pinMode(motor2Pin, OUTPUT);
pinMode(enablePin, OUTPUT);
pinMode(ledPin, OUTPUT);
// set enablePin high so that motor can turn on:
digitalWrite(enablePin, HIGH);