Wireless Control of A DC Motor....
Wireless Control of A DC Motor....
This project is practical in the economic view and hence gives a reliable, durable, accurate
and most efficient way of a DC motor control.
CHAPTER 1: INTRODUCTION
1.1 Project Definition
The wireless control of a DC Motor involves the design and implementation of a
microcontroller based control unit to use RF (radio frequency) to wirelessly control a
DC Motor. DC motors have played a vital role in the development of industrial power
transmission systems. It was the first practical device to convert electrical power into
mechanical power.
And thus as a result of the above advantages they have a wide range of applications,
in places where constant speed is to be maintained at varying loads, e.g. conveyor
belts, cranes, mixers, elevators are few applications where DC motors are used.
Compared to other wireless communication protocols such as Wi-Fi (IEEE 802.11), GPRS
GSM networks, FM modules and Bluetooth, RF is cheap and reliable network with data
delivery guaranteed, and also able to communicate over large distances up to 100m.
The first step in the designing process was to be able to switch direction of motor rotation
(clockwise and anti-clockwise rotation) and vary speed of motor (clockwise and
counterclockwise). And in order to achieve the desirable effects we used an H-bridge
configuration which reverses the voltage on motor leads. Pulse Width Modulation was
employed so as to drive the DC motor at the desirable speed, which was measured by
observing, in set periods of time, the pulsation produced by the pulse generator of motor.
The above was achieved by utilizing open software of which digital inputs were used
during pulse measurements, digital outputs were used for current alteration. A C/C++
code was produced that was to enumerate the pulses and to transform the measurement
into revolutions per minute. Also to make the system user friendly a Human Machine
Interface program was made so it would be possible to supervise the motor’s speed
performance, as well as create a control unit to change those parameters.
Finally a PCB board was developed and aiming to integrate the H-bridge, pulse generator,
RF module and input/output of microcontroller.
Chapter1: Introduction
This gives the full description of the project, justification, objectives, scope of work,
methodology and project report organization.
Chapter2: literature review
This chapter gives a detailed description of hardware and software
components required in the design and implementation.
And thus it comes at a great expense such as time consuming and expensive since
more personnel will be involved.
1. Radio
It’s the radiation (wireless transmission) of electromagnetic signals through the
atmosphere or free space.
Advantages
The technology is useful where physical connections are impractical due to high costs or
other considerations. For example free space optical links are used in cities between office
buildings which are not wired for networking, where the cost of running cable through
the building and under the street would be prohibitive.
3. Sonic
Sonic, especially ultrasonic short range communication involves the transmission
and reception of sound.
Advantages
· Relatively accurate
· Inexpensive
Disadvantages
· Sensitive to temperature and pressure, and also sensitive to other sensors with
the same frequency.
· Its accuracy is dependent on the distance.
4. Electromagnetic induction
Electromagnetic induction short range communication and power. This has been used
in biomedical situations such as pacemakers, as well as for short-range RFID tags.
5. Infrared
IR data transmission is also employed in short-range communication among
computer peripherals and personal digital assistants.
Advantages
· Many things are controlled by infrared. Sensors are invisible to the naked eye
and are very reliable.
· Are relatively accurate.
Disadvantages
6. Bluetooth
2.2 Block diagram description
The basic block diagram of RF based microcontroller based control unit.
BATTERY Rf_TX
SWITCHES
RF_RX L293D
MOTOR
2.3 Hardware and software components
USBasp, Breadboard, RF module 433MHz, l293d h-bridge IC, HT12E/HT12D encoder
and decoder, Atmega 32 microcontroller, connecting wire, DC Motor, push buttons,
resistors, capacitors, LEDs, personal computer running atmelStudio.
2.3.1 Microcontroller
A microcontroller is a compact microcomputer designed to govern the operation of
embedded systems in motor vehicles, robots, office machines, complex medical devices,
mobile radio transceivers, vending machines, home appliances, and various other devices.
A typical microcontroller includes a processor, memory, and peripherals.
The following things have had a crucial influence on development and success of
the microcontrollers
A four channel encoder/decoder pair will also be used in this system. The input signal at
the transmitter side, are taken through four switches while output are monitored on a
microcontroller considering to each input switch.
This circuit will be used for designing the Remote Appliance Control System, and
outputs from receiver will drive the corresponding DC motors.
The RF module, as the name suggests, operates at Radio Frequency. The corresponding
frequency range varies between 30 kHz & 300 GHz. In this RF system, the digital data is
represented as variations in the amplitude of carrier wave. This kind of modulation is
known as Amplitude Shift Keying (ASK).
2.2.1 Description
This radio frequency (RF) transmission system employs Amplitude Shift Keying (ASK) with
transmitter/receiver (Tx/Rx) pair operating at 434 MHz; the transmitter module takes
serial input and transmits these signals through RF. The transmitted signals are received by
the receiver module placed away from the source of transmission. The system allows one
way communication between two nodes, namely, transmission and reception. The RF
module has been used in conjunction with a set of four channel encoder/decoder ICs.
Here HT12E & HT12D have been used as encoder and decoder respectively. The encoder
converts the parallel inputs (from the remote switches) into serial set of signals. These
signals are serially transferred through RF to the reception point. The decoder is used after
the RF receiver to decode the serial format and retrieve the original signals as outputs.
These outputs can be observed on corresponding DC motor.
Figure 10 RX/TX
RF RECEIVER
RF TRANSMITTER
SERIAL DATA
ENCODER DECODER
The Encoder IC (HT12E) receives parallel data in form of address bits and control bits. This
control signals from remote switches along with 8 address bits constitute a set of 12
parallel signals. It encodes the parallel signals into serial bits.
4 DATA BITS
1 +
RF
2 8 ADDRESS
SERIAL DATA
3 BITS TRANSMITTER
4 ENCODER
HT12 E
Buttons
4 DATA BITS
+ 1
RF 8 ADDRESS 2
SERIAL DATA
RECEIVER BITS 3
DENCODER 4
HT12 D
Outputs
When no signal is received at data pin of HT12D, it remains in standby mode and
consumes very less current (less than 1μA) for a voltage of 5V. When signal is received by
receiver, it is given to DIN pin (pin14) of HT12D. On reception of signal, oscillator of HT12D
gets activated. IC HT12D then decodes the serial data and checks the address bits three
times. If these bits match with the local address pins (pins 1-8) of HT12D, then it puts the
data bits on its data pins (pins 10-13) and makes the VT pin high.
An LED is connected to VT pin (pin17) of the decoder. This LED works as an indicator to
indicate a valid transmission. The corresponding output is thus generated at the data pins
of decoder IC. A signal is sent by lowering any or all the pins 10-13 of HT12E and
corresponding signal is received at receiver’s end (at HT12D).
Address bits are configured by using the first 8 pins of both encoder and decoder ICs.
To send a particular signal, address bits must be same at encoder and decoder ICs. By
configuring the address bits properly, a single RF transmitter can also be used to
control different RF receivers of same frequency.
Figure 15
Table 1
Figure 16
Since PWM is a method of transmitting information on a series of pulses. The data that is
being transmitted is encoded on the width of these pulses to control the amount of power
being sent to a load. PWM is very handy tool, you can use it for power delivery, voltage
regulation and amplification and audio effects. In this document we will go through the
basic understanding of PWM, register configuration for different modes of PWM in
atmega32. Analog voltage and current can be used to control devices directly like speed of
a DC Motor.
Analog circuits can get very hot; the power dissipated is proportional to the voltage
across the active elements multiplied by the current through them. Analog circuitry
can also be sensitive to noise. By controlling analog circuits digitally, system costs and
power consumption can be drastically reduced.
What's more, many microcontrollers already include on-chip PWM controllers, making
implementation easy, for an example atmega32 comes with 3 timers all can be
configured to use for PWM.
NB: As intuitive and simple as analog control may seem, it is not always
economically attractive or otherwise practical
2.3.1 Frequency:
Using the switch example, the frequency would be how fast the switch was turned on and
off. If the frequency is too low (switch is changed slowly), then the motor will run at full
speed when the switch is on, and completely stop when the switch is off. But if the
frequency is too high, the switch may mechanically fail. In reality there is no switch, but
rather an electronic board named an H-Bridge that switches the motor on and off. So in
electrical terms; if the frequency is too low, the time constant of the motor has enough
time to fully switch between on and off. Similarly the upper limit on the frequency is the
limit that the H-Bridge board will support, analogous to the mechanical switch.
The maximum frequency of this H-Bridge Board is 500 kHz, but the recommended
frequency of the PWM for this board is 31.25 kHz.
Figure 17
Figure 18
2.4 H BRIDGE
An H-Bridge is an electronic power circuit that allows motor speed and direction to be
controlled. Often motors are controlled from microcontroller to accomplish a mechanical
goal. The microcontroller provides the instructions to the motors, but does not provide
the power required to drive the motors. An H-bridge circuit inputs the microcontroller
instructions and amplifies them to drive a mechanical motor. The H-bridge takes in the
small electrical signal and translates it into high power output for the mechanical motor.
Basically current is amplified which takes a low-current signal from MCU and gives a
proportionalhigher current signal to which can control and drive a motor. In most
cases, a transistor can as a switch and perform this task.
Most DC Motors can rotate in two directions depending on how the battery is connected to
the motor. Both the DC motor and the battery are two terminal devices that have positive and
negative terminals. In order to run the motor in the forward direction, connect the positive
motor wire to the positive battery wire and negative to negative. However, to run the motor
in reverse just switch the connections; connect the positive battery wire to the negative
motor wire, and the negative battery wire to the positive motor wire. An H-Bridge circuit
allows a large DC motor to be run in both direction with a low level logic input signal.
The H-Bridge electronic structure is explicit in the name of the circuit H -Bridge. The
power electronics actually form a letter H configuration, as shown below.
The switches are symbolic of the electronic Power;
The image cannot be display ed. Your computer may not hav e enough memory to open the image, or the image may hav e been corrupted. Restart y our computer, and then open the file again. If the red x
still appears, y ou may hav e to delete the image and then insert it again.
Figure 19 h bridge
Figure 2.4.2
If it is desired to turn the motor on in the forward direction, switches 1 and 4 must be
closed to power the motor. If it is desired to turn the motor on in the reverse direction,
switches 2 and 3 must be closed to power the motor.
This section will explain what the “switches” above actually are in terms of electronic
components. The switches are power transistors that have certain properties that allow
them to switch high currents based on an input signal. The transistors are used in two
regions of operation; Cut-off mode and Saturation mode which correspond to switch off
and switched on respectively.
In the H-Bridge case, to put a transistors into the Cut-off mode, the input signal (Gate
Voltage) to the transistors must be grounded. However, to turn on the transistors and
put them into saturation mode requires a more complicated process. Transistors are
three terminal devices with the terminals being the Base, Collector and Emitter.
This circuit uses the basic concept of transistors as a switch. Transistor with proper
biasing can be used as switch, i.e. it can be used to toggle between the two states of a
switch on or off.
In this example, I have used an ordinary BC547, which is a general purpose NPN transistor.
It is inexpensive and commonly available. However, this transistor isn’t very powerful, and
can provide maximum driving current up to 100 mA. This particular driver circuit is still
good for driving small dc motors that require less than 100 mA current.
The working principle of this circuit is very simple. The transistor acts as a power switch for the
motor. The switch can be controlled through the logic voltage applied at the On/Off terminal.
When the On/Off pin is at logic 1 (+5 V), the transistor is turned on and the motor is connected
across VCC and ground. The VCC voltage could be greater than 5 V. Therefore, one benefit of
this transistor motor driver is that you can control a higher voltage motor (> 5
V) with a 5 V logic output from a microcontroller. The logic 0 at the On/Off terminal
turns the transistor off and the motor is stopped.
The 1K resistor connected in series with the base of the transistor limits the base current
to a safe level.
The diode connected across the motor terminals is for the protection of the transistor.
When the switch is turned off, the collapsing electromagnetic field inside the motor
generates a high voltage across the motor terminals with reverse polarity. This voltage
could be high enough to damage the transistor permanently. The diode provides a current
path back through the motor coil, and hence prevents any high voltage formation. During
normal condition the diode is reverse biased and doesn’t affect the switching operation of
the transistor.
NB: H-bridges can be built from scratch as shown above using relays, mosfets, FET
(field effect transistors) or BJT transistors.
Figure 21 circuit diagram or h-bridge
Since the motor is controlled by the 4 switches above. For the speed control explanation
that follows only switches 1 and 4 will be considered because speed control is identical in
the forward and reverse direction. Say the switches 1 and 4 are turned on, the motor will
eventually run at full speed. Similarly if only switch 4 is turned on while switch 1 is off the
motor stops. Using this system, how could the motor be run at 1/2 of the full speed? The
answer is actually quite simple; turn switch 1 on for half the time and turn it off for the
other half. In order to implement this system in reality, one must consider two main
factors, namely frequency and duty cycle.
Since my current requirement is not too high and all I need is a single package which
does the job of driving a small DC motor in two directions, thus we will use a L293D IC.
This has an inbuilt fly-back diode which protects the driving transistors from voltage
spikes that occur when motor coil is turned off.
L293D IC
It generally comes as a standard 16 dual-in line package. This can simultaneously control 2
small motors in either direction forward reverse with just four microcontroller pins;
1. Output current capability is limited to 600mA per channel with peak output
current limited to 1.2A (non-repetitive). Also note the words "non-repetitive"; if
the current output repeatedly reaches 1.2A, it might destroy the drive transistors.
2. Supply voltage can be as large as 36 Volts.
3. L293D has an enable facility which helps you enable the IC output pins. If an enable
pin is set to logic high, then state of the inputs match the state of the outputs. If you
pull this low, then the outputs will be turned off regardless of the input states.
4. The datasheet also mentions an "over temperature protection" built into the IC.
This means an internal sensor senses its internal temperature and stops driving the
motors if the temperature crosses a set point
5. Another major feature of L293D is its internal clamp diodes. This fly-back diode
helps protect the driver IC from voltage spikes that occur when the motor coil is
turned on and off (mostly when turned off)
6. The logical low in the IC is set to 1.5V. This means the pin is set high only if the
voltage across the pin crosses 1.5V which makes it suitable for use in high
frequency applications like switching applications (upto 5 KHz)
7. Lastly, this integrated circuit not only drives DC motors, but can also be used to
drive relay solenoids, stepper motors etc.
L293D connections
1. Pin1 and Pin9 are "Enable" pins. They should be connected to +5V for the drivers to
function. If they pulled low (GND), then the outputs will be turned off regardless of
the input states, stopping the motors. This pins are connected to a regulated
positive 5 Volts.
2. Pin4, Pin5, Pin12 and Pin13 are ground pins which should ideally be connected
to microcontroller's ground.
3. Pin2, Pin7, Pin10 and Pin15 are logic input pins. These are control pins which
should be connected to microcontroller pins. Pin2 and Pin7 control the first motor
(left); Pin10 and Pin15 control the second motor (right).
4. Pin3, Pin6, Pin11, and Pin14 are output pins. Tie Pin3 and Pin6 to the first
motor, Pin11 and Pin14 to second motor
5. Pin16 powers the IC and it should be connected to regulated +5Volts.
6. Pin8 powers the two motors and should be connected to positive lead of
a secondary battery.
. CONCLUSION
This paper presents the design and the implementation of a Smart Security System for
homes using Arduino and the Wireless RF. Arduino and RF modules are adopted. The
system has a friendly user interface so the community can use wherever they need high
security. Communication of the system is completely wireless, which makes the system easy
to install and use. The system is low cost, low power consumption and easily operable. In
addition, the wireless RF modules enable the system to transfer other information such as
voice and picture rather than just alarm signals.
FUTURE WORK
In future the Smart Security can include an image processing tool at the entrance
of the house. This system scans the photo of the person entering the password, scanned
photo gets compared with the predefined image of the authorized user in the system. If the
both images match, then the system operation takes place or else the access will be denied.
This future design will still enhance the security of the system because only authorized
persons should enter the password so that intruder cannot access the system even though he
knows the password and also the wireless transceiver modules enable the system to transfer
other information such as voice and picture rather than just alarm.