You are on page 1of 10

3.

2 Motor Driver
The most common method to drive DC motors in two directions under control of a
controller is with an H-bridge motor driver. H-bridges can be built from scratch with bi-polar
junction transistors (BJT) or with field effect transistors (FET), or can be purchased as an
integrated unit in a single integrated circuit package such as the L293. The L293 is simplest and
inexpensive for low current motors, For high current motors, it is less expensive to build your
own H-bridge from scratch.

The L293 is an integrated circuit motor driver that can be used for simultaneous, bi-
directional control of two small motors. The L293 is limited to 600 mA, but in reality can only
handle much small currents unless you have done some serious heat sinking to keep the case
temperature down. Unsure about whether the L293 will work with your motor? Hook up the
circuit and run your motor while keeping your finger on the chip. If it gets too hot to touch, you
can't use it with your motor.

The L293 comes in a standard 16-pin, dual-in line integrated circuit package. There is an
L293 and an L293D part number. Pick the "D" version because it has built in fly back diodes to
minimize inductive voltage spikes. The pin out for the L293 in the 16-pin package is shown
below in top view. Pin 1 is at the top left when the notch in the package faces up. Note that the
names for pin functions may be slightly different than what is shown in the following diagrams.
Assume you have only one motor connected with the enable tied to Stamp Pin 0, and the two
direction controls tied to Stamp Pins 1 and 2. Here is a table describing the control pin functions.

ENABLE DIRA DIRB Function


H H L Turn right
H L H Turn left
H L/H L/H Fast stop
L either either Slow stop

3.4.1 H-Bridge working


An H-bridge is an arrangement of transistors that allows a circuit full control over a
standard electric DC motor. That is, with an H-bridge a microcontroller, logic chip, or remote
control can electronically command the motor to go forward, reverse, brake, and coast.

For the purposes of this article, I'm focusing on a basic H-bridge that is a good choice for most
robots and portable gadgets. This H-bridge can operate from a power source as low as two
nearly-exhausted 'AAA' batteries (2.2V) all the way up to a fresh 9V battery (9.6V).

The H-bridge circuit (below) looks complicated at first glance, but it is really just four copies of
a resistor + transistor + diode.
Schematic of a bipolar transistor hbridge circuit to drive a DC motor. Can you see the letter 'H'?

There are many different ways to draw the circuitry, but the above wiring diagram matches the
model of most h-bridges.

Q1, Q3: These are NPN transistors. They connect the motor to ground (negative terminal
of the battery).

Q2, Q4: These are PNP transistors. They connect the motor to +2.2V to +9.6V (positive
terminal of the battery).

R1-R4: These resistors prevent too much current from passing through the base (labeled
B) control pin of the transistor. The resistor value of 1 kilohm (1000 ohms) was chosen to
provide enough current to fully turn on (saturate) the transistor. A higher resistance would
waste less power, but might cause the motor to receive less power. A lower resistance
would waste more power, but wouldn't likely provide better performance for motors
running on consumer batteries.

D1-D4: Diodes provide a safe path for the motor energy to be dispersed or returned to the
battery when the motor is commanded to coast or stop. I notice many H-bridge circuits on
the web lack these diodes. I suppose that's safe enough for light loads at low voltages, but
without diodes, a motor voltage spike can force its way through the unprotected
transistors, damaging or destroying them.
M1: This is a direct-current (DC) motor. These are very common. You can find them in
surplus stores online or in salvaged toys. The motor should have only two wires. Measure
the resistance of the two motor wires using a multimeter. If it is much less than 5 ohms,
then the transistor parts listed in this article are too weak to power the motor.

Controlling the H-Bridge Motor Driver


The resistors are the inputs that control the H-bridge. By connecting a resistor to either +VDC or
GND, it turns on or off the corresponding transistor. (+VDC is the positive end of the battery.
GND is the negative end of the battery.) When a particular pair of transistors is turned on, the
motor does something.

Command R1 R2 R3 R4

GND or +VDC or GND or +VDC or


Coast/Roll/ disconnec disconnec disconnec disconnec
Off: ted ted ted ted

GND or +VDC or
Forward: disconnec GND +VDC disconnec
ted ted

+VDC or GND or
Reverse: +VDC disconnec disconnec GND
ted ted

+VDC or +VDC or
Brake/Slow
Down:
+VDC disconnec +VDC disconnec
ted ted

Since there are 4 resistors, there are actually sixteen possible ways this circuit can be
commanded. Don't sweat the other variations (they're in the book if you're curious). Except,

Never apply +VDC to R1 and GND to R2 at the same time! You'll short circuit the battery.

Never apply +VDC to R3 and GND to R4 at the same time! You'll short circuit the battery.
3.3 Wireless Module Pair (TX & RX)
These days, the term wireless is very much hyped! Whenever we hear the term wireless,
stuffs like Mobile telecommunication GSM, Wi-Fi, Bluetooth, RF Communication, Wireless
networks, Zigbee, I2C, SPI, DTMF, 802.11b etc. Well, fortunately or unfortunately, all of these
protocols can be interfaced with a microcontroller in one way or the other. But what matters is
the level of complexity. To start off, RF (Radio Frequency) Communication is the most
preferred and low cost solution. All you need is a RF Module (Transmitter-Receiver Pair). Now,
thats not all. RF Communication works on the principle of Serial Communication. Thus, you
need something which converts the conventional n-bit (4-bit, 8-bit, 16-bit, etc) data into serial
data. For this, we have two choices:

Use a microcontroller to convert the n-bit data into serial data and vice-versa

Use serial encoders/decoders to do the same

3.3.1 RF Communication Block Diagram

A general RF communication block diagram is shown above. Since most of the


encoders/decoders/microcontrollers are TTL compatible, most of the inputs by the user will be
given in TTL logic level. Thus, this TTL input is to be converted into serial data input using an
encoder or a microcontroller. This serial data can be directly read using the RF Transmitter,
which then performs ASK (in some cases FSK) modulation on it and transmit the data through
the antenna.
In the receiver side, the RF Receiver receives the modulated signal through the antenna,
performs all kinds of processing, filtering, demodulation, etc and gives out a serial data. This
serial data is then converted to a TTL level logic data, which is the same data that the user has
input.

3.3.2 RF Module
RF Modules are used wireless transfer data. This makes them most suitable for remote
control applications, as in where you need to control some machines or robots without getting in
touch with them (may be due to various reasons like safety, etc). Now depending upon the type
of application, the RF module is chosen. For short range wireless control applications, an ASK
RF Transmitter-Receiver Module of frequency 315 MHz or 433 MHz is most suitable.

Pin Description:
Features:

Range in open space(Standard Conditions) : 100 Meters

RX Receiver Frequency : 433 MHz

RX Typical Sensitivity : 105 Dbm

RX Supply Current : 3.5 mA

RX IF Frequency : 1MHz

Low Power Consumption

Easy For Application

RX Operating Voltage : 5V

TX Frequency Range : 433.92 MHz

TX Supply Voltage : 3V ~ 6V

TX Out Put Power : 4 ~ 12 Dbm

This has single channel for data transfer, thus serial data communication is used. Its required to
have an antenna for signal transmission. Usually, a 20-30 cm wire serves best. It is sufficient to
give a range of 80 meters in open region. To improve the efficiency, you can also use a coiled
wire (take a wire and make it into a coil). It increases the signal strength.

3.6 Relay Driver

The relay driver is used to drive the relay that is used in the circuit. The relay act similar
to the hook switch in the normal phone. When then line is in idle mode, the relay will be in OFF
state which is similar to the ON-Hook in the Phones. In On-hook state, through the relay path the
telephone line is connected to the ring indicator circuit. When a ring occurs, the ring indicator
will interrupt the controller and the controller will send a signal to the relay driver, for driving
the relay. The driving of the relay to the ON state will change the device to the OFF-hook state
and the call will be connected.

3.6.1 Relay Basics

A relay is a simple electromechanical switch made up of an electromagnet and a set of


contacts. It consists of a coil of wire surrounding a soft iron core, an iron yoke, which provides a
low reluctance path for magnetic flux, a movable iron armature, and a set, or sets, of contacts.
The armature is hinged to the yoke and mechanically linked to a moving contact or contacts. It is
held in place by a spring so that when the relay is de-energized there is an air gap in the magnetic
circuit. In this condition, one of the two sets of contacts in the relay pictured is closed, and the
other set is open. Other relays may have more or fewer sets of contacts depending on their
function. The relay also has a wire connecting the armature to the yoke. This ensures continuity
of the circuit between the moving contacts on the armature, and the circuit track on the printed
circuit board (PCB) via the yoke, which is soldered to the PCB.
When an electric current is passed through the coil, the resulting magnetic field attracts
the armature and the consequent movement of the movable contact or contacts either makes or
breaks a connection with a fixed contact. If the set of contacts was closed when the relay was
De-energized, then the movement opens the contacts and breaks the connection, and vice versa if
the contacts were open. When the current to the coil is switched off, the armature is returned by a
force, approximately half as strong as the magnetic force, to its relaxed position. Usually this
force is provided by a spring, but gravity is also used commonly in industrial motor starters.
Most relays are manufactured to operate quickly. In a low voltage application, this is to reduce
noise. In a high voltage or high current application, this is to reduce arcing.

If the coil is energized with DC, a diode is frequently installed across the coil, to dissipate
the energy from the collapsing magnetic field at deactivation, which would otherwise generate a
voltage spike dangerous to circuit components. Some automotive relays already include a diode
inside the relay case. Alternatively a contact protection network, consisting of a capacitor and
resistor in series, may absorb the surge. If the coil is designed to be energized with AC, a small
copper ring can be crimped to the end of the solenoid. This "shading ring" creates a small out-of-
phase current, which increases the minimum pull on the armature during the AC cycle.
5.3 Relay Driver

The system contains 2 relays for controlling the phase and neutral lines. The relay driver
circuit is designed by using 2 NPN transistors 2N2222. When the port PIN is high, the transistor
T1 & T3 will be in ON state, lead the energizing of the relay coil. Since the relay contains an
inductor part, switching ON/OFF will generated a back emf across it and it can spoil the
transistor. For protecting it from the back emf, a fly back diode is connected in reverse bias
across the relays coil.

You might also like