DTMF BASED PICK AND PLACE ROBOT
Nov 03, 2014
DTMF BASED PICK AND PLACE ROBOT
INDEX
Technical Specifications
Project Abstract
Project Block Diagram
Introduction
Explanation of each block
Regulated Power Supply
AT89C52 Microcontroller
DTMF
DC Motor and H-Bridge
Wireless camera
Software Tools
Keil Compiler
Proload Flash
Source Code
Advantages
Applications
Conclusion
Reference
TECHNICAL SPECIFICATIONg
Title of the project : DTMF Based Moving Robot for Pick and Place
applications
Domain : Embedded
Microcontroller : AT89S52
Software : C, Keil, Proload
Power Supply : +5V, 500mA Regulated Power Supply
DTMF : MT8870P
Relay Boards : 6 DPDT Relays
Crystal : 11.0592MHz
Developed By : M/S Wine Yard Technologies
Phone : 040-64646363 www.WineYardTechnologioes.com
ABSTRACT
Abstract:
In recent years, the definition of a robot is generally used to mean an unmanned system
or automation, as often seen in industrial applications, deep sea planetary probes. Historically
speaking, a robot used to be shaped like humans, and referred to as machines and electric
systems that were capable of performing similar actions as humans. It is these robots that play
active roles in comic magazines, animation and science fiction. Because they are artificially
created, they are called “artificial man”. And since they look like humans in appearance, they are
often called “androids” or “humanoids.”
In this highly developing society; time and man power are critical constrains for
completion of task in large scales. the automation is playing important role to save human efforts
in most of the regular and frequently carried works e.g. most of the industrial jobs like welding,
painting, assembly, container filling etc. one of the major and most commonly performed work is
picking and placing of jobs from source to destination. For this purpose, ‘pick and place robot
‘maybe used.
The pick and place robot is a mechatronics system that detects the object, picks that
object from source location and places at desired location. For detection of object, infrared
sensors are used which detect presence of object as the transmitter to receiver path for infrared
sensor is interrupted by placed object. As soon as robot senses presence of object, it moves
towards object, picks it with end effectors, and places it on destination. If another object causes
interrupt, it again does the same job. This project uses AT89S52 MCU as its controller for
performing different operations by the robot.
This robot is controlled by a DTMF (mobile) remote. This can be moved forward and
reverse direction using geared motors of 60RPM. Also this robot can take sharp turnings towards
left and right directions. This project uses AT89S52 MCU as its controller.
This project uses 12V Lead Acid Battery.
BLOCK DIAGRAM
Power supply to all sections
Lead acid
battery
Bridge Rectifier
Filter Circuit Regulator
BLOCK DIAGRAM
DTMF Decoder
89S52 MCU
Power – On Reset
11.0592MHzCrystal
Oscillator
H-BridgeGeared Motor -
I
Geared Motor - II
Mobile
Wireless camera
INTRODUCTION
INTRODUCTION
An embedded system is a combination of software and hardware to perform a dedicated
task.
Some of the main devices used in embedded products are Microprocessors and
Microcontrollers. Microprocessors are commonly referred to as general purpose processors as
they simply accept the inputs, process it and give the output.
In contrast, a microcontroller not only accepts the data as inputs but also manipulates it,
interfaces the data with various devices, controls the data and thus finally gives the result. As
everyone in this competitive world prefers to make the things easy and simple to handle, this
project sets an example to some extent.
ROBOT
A robot is a virtual or mechanical artificial agent. In practice, it is usually an electro-
mechanical machine which is guided by computer or electronic programming, and is thus able to
do tasks on its own. Another common characteristic is that by its appearance or movements, a
robot often conveys a sense that it has intent or agency of its own
Pick and Place Robot
In this application, the powerful indexing capability of the Allen-Bradley ULTRA 200
servo drive is used to rotate a pick and place system into position so parts can be transferred from
one operation to another. The system uses an Allen-Bradley Micro Logix 1000 programmable
logic controller to select the position of the rotary table by activating digital inputs on the
ULTRA 200 servo drive.
In manufacturing industry and nuclear industry, a large fraction of the work is repetitive
and judicious application of automation will most certainly result in optimum utilization of
machine and manpower.
A pneumatic `Pick and Place' Robot has been developed to achieve automation in
applications where great sophistication is not needed and simple tasks like picking up of small
parts at one location and placing them at another location can be done with great ease. The
flexibility of robotic pick and place systems over pneumatics also helps a factory justify the cost
of a new production line. By adding vision to robotic pick and place systems, integrators are able
to bring additional capabilities to a manufacturing line, capabilities that boost the bottom line.
In a typical application it can replace the human operator in feeding industrial presses with
discrete components. Its low cost ensures early return on investment and its modular design with
a minimum number of components promotes reliability. It can be easily integrated into
automation systems as it provides a wide range of auxiliary control interfaces for digital and
analog inputs, digital outputs, pneumatics, and stepper control.
Pick and Place Automation:
Pick and place robot work cells are among the most popular material handling systems.
They provide dependable solutions for production lines. Pick and place robot work cells perform
tedious, repetitive tasks with ease, speed and accuracy.
The 'SCARA' style robot is a four degree-of-freedom robotic arm that can be used to pick and
place small parts on a production line. It has been designed as an appliance; it is totally self
contained.
Specific applications:
The machine will be of great use to perform repetitive tasks of picking and placing of small parts
(up to 500 gms) in an industrial production line.
Its use can be extended and exploited by few modifications to do difficult and hazardous
tasks for nuclear applications.
As a basic tool for automation.
It can be used to do small assembly work effectively due to its great added accuracy for
placement of parts.
The machine provides motion to the end effectors in the theta and Z directions. The end effectors
can be a pair of pneumatic grippers, a set of multiple grippers, magnetic pick-up, vacuum pick-
up etc. The device has its own in-built logic and all the movements of the device are controlled
by the combination of control valve and reversible valve which form the vital part of the
machine. A single pulse of air given to the control valve activates the reversible valve and admits
air alternately to the two pneumatic cylinders during one cycle. This causes to and fro linear
motion of the common rack which is converted into the rotary motion of the pinion and
ultimately imparts angular sweep (theta) and vertical motion (Z) at the end of each stroke to the
head carrying the pick up arm with the end effectors. Angular sweep (theta) as well as the
vertical motion (Z) is adjustable by means of mechanical stoppers. The operating speed of the
pick up arm can be varied to suit the requirement by operating the flow control valves provided
on the two cylinder heads. During one operating cycle the pick up arm carrying the end effectors
starts from its home position, goes to the other end, picks up the part and returns to its original
home position. The picked up part is delivered to the home position when the next cycle is
triggered.
The Advantage of Pick and Place Robots:
Speed - Pick and place robots allow for faster cycle times.
Accuracy - Robotic systems are more accurate and consistent than their human
counterparts.
Production - Work cells create more because they perform applications with more
accuracy, speed and tirelessness. The consistent output of a robotic system along with
quality and repeatability are unmatched
Reliability - Robots can work 24 hours a day, seven days a week without stopping or
tiring.
Flexibility - Pick and place robots can be reprogrammable and tooling can be
interchanged to provide for multiple applications.
Savings - Managers are realizing the long term savings with a pick and place robotic
work cell rather than the operation they are currently doing. An increase in output with a
material handling robotic system has saved factories money.
Affordability - With the advancements in technology, and affordable robotics becoming
available at less cost, more pick and place robotic cells are being installed for automation
applications.
EXPLANATION OF EACH BLOCK
BLOCK DESCRIPTION
POWER SUPPLY:
Fig: Power supply
RegulatorFilterBridge
RectifierLead Acid
Battery
D.C Output
Lead Acid Battery:
Rectifier:
The output from the transformer is fed to the rectifier. It converts A.C. into pulsating
D.C. The rectifier may be a half wave or a full wave rectifier. In this project, a bridge rectifier is
used because of its merits like good stability and full wave rectification.
The Bridge rectifier is a circuit, which converts an ac voltage to dc voltage using both
half cycles of the input ac voltage. The Bridge rectifier circuit is shown in the figure. The circuit
has four diodes connected to form a bridge. The ac input voltage is applied to the diagonally
opposite ends of the bridge. The load resistance is connected between the other two ends of the
bridge.
Fig: Rectifier Circuit
For the positive half cycle of the input ac voltage, diodes D1 and D3 conduct, whereas
diodes D2 and D4 remain in the OFF state. The conducting diodes will be in series with the load
resistance RL and hence the load current flows through RL.
For the negative half cycle of the input ac voltage, diodes D2 and D4 conduct whereas,
D1 and D3 remain OFF. The conducting diodes D2 and D4 will be in series with the load
resistance RL and hence the current flows through RL in the same direction as in the previous half
cycle. Thus a bi-directional wave is converted into a unidirectional wave.
Fig: Rectifier output Waveforms
Filter:Capacitive filter is used in this project. It removes the ripples from the output of rectifier
and smoothens the D.C. Output received from this filter is constant until the mains voltage and
load is maintained constant. However, if either of the two is varied, D.C. voltage received at this
point changes. Therefore a regulator is applied at the output stage.
Voltage regulator:
As the name itself implies, it regulates the input applied to it. A voltage regulator
is an electrical regulator designed to automatically maintain a constant voltage level. In this
project, power supply of 5V and 12V are
required. In order to obtain these
voltage levels, 7805 and 7812
voltage regulators are to be used. The
first number 78 represents positive
supply and the numbers 05, 12
represent the required output voltage
levels. The L78xx series of three-terminal positive regulators is available in TO-220, TO-220FP,
TO-3, D2PAK and DPAK packages and several fixed output voltages, making it useful in a wide
range of applications. These regulators can provide local on-card regulation, eliminating the
distribution problems associated with single point regulation. Each type
employs internal current limiting, thermal shut-down and safe area protection,
making it essentially indestructible. If adequate heat sinking is provided, they
can deliver over 1 A output current. Although designed primarily as fixed
voltage regulators, these devices can be used with external components to
obtain adjustable voltage and currents.
Introduction of Embedded System:
An Embedded System is a combination of computer hardware and software, and
perhaps additional mechanical or other parts, designed to perform a specific function. A good
example is the microwave oven. Almost every household has one, and tens of millions of them
are used every day, but very few people realize that a processor and software are involved in the
preparation of their lunch or dinner.
This is in direct contrast to the personal computer in the family room. It too is
comprised of computer hardware and software and mechanical components (disk drives, for
example). However, a personal computer is not designed to perform a specific function rather; it
is able to do many different things. Many people use the term general-purpose computer to make
this distinction clear. As shipped, a general-purpose computer is a blank slate; the manufacturer
does not know what the customer will do wish it. One customer may use it for a network file
server another may use it exclusively for playing games, and a third may use it to write the next
great American novel.
Frequently, an embedded system is a component within some larger system. For
example, modern cars and trucks contain many embedded systems. One embedded system
controls the anti-lock brakes, other monitors and controls the vehicle's emissions, and a third
displays information on the dashboard. In some cases, these embedded systems are connected by
some sort of a communication network, but that is certainly not a requirement.
At the possible risk of confusing you, it is important to point out that a general-purpose
computer is itself made up of numerous embedded systems. For example, my computer consists
of a keyboard, mouse, video card, modem, hard drive, floppy drive, and sound card-each of
which is an embedded system. Each of these devices contains a processor and software and is
designed to perform a specific function. For example, the modem is designed to send and receive
digital data over analog telephone line. That's it and all of the other devices can be summarized
in a single sentence as well.
If an embedded system is designed well, the existence of the processor and software
could be completely unnoticed by the user of the device. Such is the case for a microwave oven,
VCR, or alarm clock. In some cases, it would even be possible to build an equivalent device that
does not contain the processor and software. This could be done by replacing the combination
with a custom integrated circuit that performs the same functions in hardware. However, a lot of
flexibility is lost when a design is hard-cooled in this way. It is mush easier, and cheaper, to
change a few lines of software than to redesign a piece of custom hardware.
History and Future:
Given the definition of embedded systems earlier is this chapter; the first such systems
could not possibly have appeared before 1971. That was the year Intel introduced the world's
first microprocessor. This chip, the 4004, was designed for use in a line of business calculators
produced by the Japanese Company Busicom. In 1969, Busicom asked Intel to design a set of
custom integrated circuits-one for each of their new calculator models. The 4004 was Intel's
response rather than design custom hardware for each calculator, Intel proposed a general-
purpose circuit that could be used throughout the entire line of calculators. Intel's idea was that
the software would give each calculator its unique set of features.
The microcontroller was an overnight success, and its use increased steadily over the
next decade. Early embedded applications included unmanned space probes, computerized traffic
lights, and aircraft flight control systems. In the 1980s, embedded systems quietly rode the
waves of the microcomputer age and brought microprocessors into every part of our kitchens
(bread machines, food processors, and microwave ovens), living rooms (televisions, stereos, and
remote controls), and workplaces (fax machines, pagers, laser printers, cash registers, and credit
card readers).
It seems inevitable hat the number of embedded systems will continue to increase
rapidly. Already there are promising new embedded devices that have enormous market
potential; light switches and thermostats that can be central computer, intelligent air-bag systems
that don't inflate when children or small adults are present, pal-sized electronic organizers and
personal digital assistants (PDAs), digital cameras, and dashboard navigation systems. Clearly,
individuals who possess the skills and desire to design the next generation of embedded systems
will be in demand for quite some time.
Real Time Systems:
One subclass of embedded is worthy of an introduction at this point. As commonly
defined, a real-time system is a computer system that has timing constraints. In other words, a
real-time system is partly specified in terms of its ability to make certain calculations or
decisions in a timely manner. These important calculations are said to have deadlines for
completion. And, for all practical purposes, a missed deadline is just as bad as a wrong answer.
The issue of what if a deadline is missed is a crucial one. For example, if the real-time
system is part of an airplane's flight control system, it is possible for the lives of the passengers
and crew to be endangered by a single missed deadline. However, if instead the system is
involved in satellite communication, the damage could be limited to a single corrupt data packet.
The more severe the consequences, the more likely it will be said that the deadline is "hard" and
thus, the system is a hard real-time system. Real-time systems at the other end of this discussion
are said to have "soft" deadlines.
All of the topics and examples presented in this book are applicable to the designers of real-time
system who is more delight in his work. He must guarantee reliable operation of the software and
hardware under all the possible conditions and to the degree that human lives depend upon three
system's proper execution, engineering calculations and descriptive paperwork.
Application Areas
Nearly 99 per cent of the processors manufactured end up in embedded systems. The embedded
system market is one of the highest growth areas as these systems are used in very market
segment- consumer electronics, office automation, industrial automation, biomedical
engineering, wireless communication,
data communication, telecommunications, transportation, military and so on.
Consumer appliances: At home we use a number of embedded systems which include digital
camera, digital diary, DVD player, electronic toys, microwave oven, remote controls for TV and
air-conditioner, VCO player, video game consoles, video recorders etc. Today’s high-tech car
has about 20 embedded systems for transmission control, engine spark control, air-conditioning,
navigation etc. Even wristwatches are now
becoming embedded systems. The palmtops are powerful embedded systems using which we can
carry out many general-purpose tasks such as playing games and word processing.
Office automation: The office automation products using em embedded systems are copying
machine, fax machine, key telephone, modem, printer, scanner etc.
Industrial automation: Today a lot of industries use embedded systems for process control.
These include pharmaceutical, cement, sugar, oil exploration, nuclear energy, electricity
generation and transmission. The embedded systems for industrial use are designed to carry out
specific tasks such as monitoring the temperature, pressure, humidity, voltage, current etc., and
then take appropriate action based on the monitored levels to control other devices or to send
information to a centralized monitoring station. In hazardous industrial environment, where
human presence has to be avoided, robots are used, which are programmed to do specific jobs.
The robots are now becoming very powerful and carry out many interesting and complicated
tasks such as hardware assembly.
Medical electronics: Almost every medical equipment in the hospital is an embedded system.
These equipments include diagnostic aids such as ECG, EEG, blood pressure measuring devices,
X-ray scanners; equipment used in blood analysis, radiation, colonscopy, endoscopy etc.
Developments in medical electronics have paved way for more accurate diagnosis of diseases.
Computer networking: Computer networking products such as bridges, routers, Integrated
Services Digital Networks (ISDN), Asynchronous Transfer Mode (ATM), X.25 and frame relay
switches are embedded systems which implement the necessary data communication protocols.
For example, a router interconnects two networks. The two networks may be running different
protocol stacks. The router’s function is to obtain the data packets from incoming pores, analyze
the packets and send them towards the destination after doing necessary protocol conversion.
Most networking equipments, other than the end systems (desktop computers) we use to access
the networks, are embedded systems
.
Telecommunications: In the field of telecommunications, the embedded systems can be
categorized as subscriber terminals and network equipment. The subscriber terminals such as key
telephones, ISDN phones, terminal adapters, web cameras are embedded systems. The network
equipment includes multiplexers, multiple access systems, Packet Assemblers Dissemblers
(PADs), sate11ite modems etc. IP phone, IP gateway, IP gatekeeper etc. are the latest embedded
systems that provide very low-cost voice communication over the Internet.
Wireless technologies: Advances in mobile communications are paving way for many
interesting applications using embedded systems. The mobile phone is one of the marvels of the
last decade of the 20’h century. It is a very powerful embedded system that provides voice
communication while we are on the move. The Personal Digital Assistants and the palmtops can
now be used to access multimedia services over the Internet. Mobile communication
infrastructure such as base station controllers, mobile switching centers are also powerful
embedded systems.
Insemination: Testing and measurement are the fundamental requirements in all scientific and
engineering activities. The measuring equipment we use in laboratories to measure parameters
such as weight, temperature, pressure, humidity, voltage, current etc. are all embedded systems.
Test equipment such as oscilloscope, spectrum analyzer, logic analyzer, protocol analyzer, radio
communication test set etc. are embedded systems built around powerful processors. Thank to
miniaturization, the test and measuring equipment are now becoming portable facilitating easy
testing and measurement in the field by field-personnel.
Security: Security of persons and information has always been a major issue. We need to protect
our homes and offices; and also the information we transmit and store. Developing embedded
systems for security applications is one of the most lucrative businesses nowadays. Security
devices at homes, offices, airports etc. for authentication and verification are embedded systems.
Encryption devices are nearly 99 per cent of
the processors that are manufactured end up in~ embedded systems. Embedded systems find
applications in . every industrial segment- consumer electronics, transportation, avionics,
biomedical engineering, manufacturing, process control and industrial automation, data
communication, telecommunication, defense, security etc. Used to encrypt the data/voice being
transmitted on communication links such as telephone lines. Biometric systems using fingerprint
and face recognition are now being extensively used for user authentication in banking
applications as well as for access control in high security buildings.
Finance: Financial dealing through cash and cheques are now slowly paving way for
transactions using smart cards and ATM (Automatic Teller Machine, also expanded as Any Time
Money) machines. Smart card, of the size of a credit card, has a small micro-controller and
memory; and it interacts with the smart card reader! ATM machine and acts as an electronic
wallet. Smart card technology has the capability of ushering in a cashless society. Well, the list
goes on. It is no exaggeration to say that eyes wherever you go, you can see, or at least feel, the
work of an embedded system!
Overview of Embedded System ArchitectureEvery embedded system consists of custom-built hardware built around a Central Processing
Unit (CPU). This hardware also contains memory chips onto which the software is loaded. The
software residing on the memory chip is also called the ‘firmware’. The embedded system
architecture can be represented as a layered architecture as shown in Fig.
The operating system runs above the hardware, and the application software runs above the
operating system. The same architecture is applicable to any computer including a desktop
computer. However, there are significant differences. It is not compulsory to have an operating
system in every embedded system. For small appliances such as remote control units, air
conditioners, toys etc., there is no need for an operating system and you can write only the
software specific to that application. For applications involving complex processing, it is
advisable to have an operating system. In such a case, you need to integrate the application
software with the operating system and then transfer the entire software on to the memory chip.
Once the software is transferred to the memory chip, the software will continue to run for a long
time you don’t need to reload new software.
Now, let us see the details of the various building blocks of the hardware of an embedded
system. As shown in Fig. the building blocks are;
· Central Processing Unit (CPU)
· Memory (Read-only Memory and Random Access Memory)
· Input Devices
· Output devices
· Communication interfaces
· Application-specific circuitry
Central Processing Unit (CPU):
The Central Processing Unit (processor, in short) can be any of the following: microcontroller,
microprocessor or Digital Signal Processor (DSP). A micro-controller is a low-cost processor. Its
main attraction is that on the chip itself, there will be many other components such as memory,
serial communication interface, analog-to digital converter etc. So, for small applications, a
micro-controller is the best choice as the number of external components required will be very
less. On the other hand, microprocessors are more powerful, but you need to use many external
components with them. D5P is used mainly for applications in which signal processing is
involved such as audio and video processing.
Memory:
The memory is categorized as Random Access 11emory (RAM) and Read Only Memory
(ROM). The contents of the RAM will be erased if power is switched off to the chip, whereas
ROM retains the contents even if the power is switched off. So, the firmware is stored in the
ROM. When power is switched on, the processor reads the ROM; the program is program is
executed.
Input devices:
Unlike the desktops, the input devices to an embedded system have very limited capability.
There will be no keyboard or a mouse, and hence interacting with the embedded system is no
easy task. Many embedded systems will have a small keypad-you press one key to give a
specific command. A keypad may be used to input only the digits. Many embedded systems used
in process control do not have any input device for user interaction; they take inputs from sensors
or transducers 1’fnd produce electrical signals that are in turn fed to other systems.
Output devices:
The output devices of the embedded systems also have very limited capability. Some embedded
systems will have a few Light Emitting Diodes (LEDs) to indicate the health status of the system
modules, or for visual indication of alarms. A small Liquid Crystal Display (LCD) may also be
used to display some important parameters.
Communication interfaces:
The embedded systems may need to, interact with other embedded systems at they may have to
transmit data to a desktop. To facilitate this, the embedded systems are provided with one or a
few communication interfaces such as RS232, RS422, RS485, Universal Serial Bus (USB), IEEE
1394, Ethernet etc.
Application-specific circuitry:
Sensors, transducers, special processing and control circuitry may be required fat an embedded
system, depending on its application. This circuitry interacts with the processor to carry out the
necessary work. The entire hardware has to be given power supply either through the 230 volts
main supply or through a battery. The hardware has to design in such a way that the power
consumption is minimized.
CONCLUSION:
Embedded Systems plays a vital role in our day today life. They are used for household
appliances like microwave oven to the satellite applications. They provide good man to machine
interface.
Automation is the further step in the world of Embedded Systems, which includes the
elimination of the human being in the mundane applications. They are cost effective, accurate
and can work in any conditions and round the clock.
AT89S52 MICROCONTROLLER
MICROCONTROLLERS:
Microprocessors and microcontrollers are widely used in embedded systems
products. Microcontroller is a programmable device. A microcontroller has a CPU in addition to
a fixed amount of RAM, ROM, I/O ports and a timer embedded all on a single chip. The fixed
amount of on-chip ROM, RAM and number of I/O ports in microcontrollers makes them ideal
for many applications in which cost and space are critical.
The Intel 8052 is Harvard architecture, single chip microcontroller (µC) which was
developed by Intel in 1980 for use in embedded systems. It was popular in the 1980s and early
1990s, but today it has largely been superseded by a vast range of enhanced devices with 8052-
compatible processor cores that are manufactured by more than 20 independent manufacturers
including Atmel, Infineon Technologies and Maxim Integrated Products.
8052 is an 8-bit processor, meaning that the CPU can work on only 8 bits of data at a
time. Data larger than 8 bits has to be broken into 8-bit pieces to be processed by the CPU. 8052
is available in different memory types such as UV-EPROM, Flash and NV-RAM.
The present project is implemented on Keil uVision. In order to program the device,
proload tool has been used to burn the program onto the microcontroller.
The features, pin description of the microcontroller and the software tools used are
discussed in the following sections.
FEATURES
• Compatible with MCS-51® Products
• 8K Bytes of In-System Programmable (ISP) Flash Memory
– Endurance: 1000 Write/Erase Cycles
• 4.0V to 5.5V Operating Range
• Fully Static Operation: 0 Hz to 33 MHz
• Three-level Program Memory Lock
• 256 x 8-bit Internal RAM
• 32 Programmable I/O Lines
• Three 16-bit Timer/Counters
• Eight Interrupt Sources
• Full Duplex UART Serial Channel
• Low-power Idle and Power-down Modes
• Interrupt Recovery from Power-down Mode
• Watchdog Timer
• Dual Data Pointer
• Power-off Flag
DESCRIPTION
The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K
bytes of in-system programmable Flash memory. The device is manufactured using Atmel’s
high-density nonvolatile memory technology and is compatible with the industry- standard
80C51 instruction set and pinout. The on-chip Flash allows the program memory to be
reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a
versatile 8-bit CPU with in-system programmable Flash on a monolithic chip, the Atmel
AT89S52 is a powerful microcontroller which provides a highly-flexible and cost-effective
solution to many embedded control applications.
The AT89S52 provides the following standard features: 8K bytes of Flash, 256 bytes of
RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters, a six-vector
two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry.
In addition, the AT89S52 is designed with static logic for operation down to zero frequency and
supports two software selectable power saving modes.
The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port, and
interrupt system to continue functioning. The Power-down mode saves the RAM contents but
freezes the oscillator, disabling all other chip functions until the next interrupt or hardware reset.
PIN CONFIGURATIONS
PIN DESCRIPTION
VCC
Supply voltage.
GND
Ground.
Port 0
Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can sink eight
TTL inputs. When 1s are written to port 0 pins, the pins can be used as high impedance inputs.
Port 0 can also be configured to be the multiplexed low order address/data bus during accesses to
external program and data memory. In this mode, P0 has internal pullups. Port 0 also receives the
code bytes during Flash programming and outputs the code bytes during program verification.
External pullups are required during program verification.
Port 1
Port 1 is an 8-bit bidirectional I/O port with internal pullups. The Port 1 output buffers can
sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled high by the
internal pullups and can be used as inputs. As inputs, Port 1 pins that are externally being pulled
low will source current (IIL) because of the internal pullups. In addition, P1.0 and P1.1 can be
configured to be the timer/counter 2 external count input (P1.0/T2) and the timer/counter 2
trigger input (P1.1/T2EX), respectively, as shown in the following table. Port 1 also receives the
low-order address bytes during Flash programming and verification.
Port 2Port 2 is an 8-bit bidirectional I/O port with internal pullups. The Port 2 output buffers can
sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high by the
internal pullups and can be used as inputs. As inputs, Port 2 pins that are externally being pulled
low will source current (IIL) because of the internal pullups. Port 2 emits the high-order address
byte during fetches from external program memory and during accesses to external data memory
that use 16-bit addresses (MOVX @ DPTR). In this application, Port 2 uses strong internal pull-
ups when emitting 1s. During accesses to external data memory that use 8-bit addresses (MOVX
@ RI), Port 2 emits the contents of the P2 Special Function Register. Port 2 also receives the
high-order address bits and some control signals during Flash programming and verification.
Port 3
Port 3 is an 8-bit bidirectional I/O port with internal pullups. The Port 3 output buffers can
sink/source four TTL inputs. When 1s are written to Port 3 pins, they are pulled high by the
internal pullups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled
low will source current (IIL) because of the pullups. Port 3 also serves the functions of various
special features of the AT89S52, as shown in the following table. Port 3 also receives some
control signals for Flash programming and verification.
RST
Reset input. A high on this pin for two machine cycles while the oscillator is running resets the
device. This pin drives High for 96 oscillator periods after the Watchdog times out. The DISRTO
bit in SFR AUXR (address 8EH) can be used to disable this feature. In the default state of bit
DISRTO, the RESET HIGH out feature is enabled.
ALE/PROG
Address Latch Enable (ALE) is an output pulse for latching the low byte of the address during
accesses to external memory. This pin is also the program pulse input (PROG) during Flash
programming. In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator
frequency and may be used for external timing or clocking purposes. Note, however, that one
ALE pulse is skipped during each access to external data memory. If desired, ALE operation can
be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a
MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable
bit has no effect if the microcontroller is in external execution mode.
PSEN
Program Store Enable (PSEN) is the read strobe to external program memory. When the
AT89S52 is executing code from external program memory, PSEN is activated twice each
machine cycle, except that two PSEN activations are skipped during each access to external data
memory.
EA/VPP
External Access Enable. EA must be strapped to GND in order to enable the device to fetch code
from external program memory locations starting at 0000H up to FFFFH. Note, however, that if
lock bit 1 is programmed, EA will be internally latched on reset.
EA should be strapped to VCC for internal program executions. This pin also receives the 12-
volt programming enable voltage (VPP) during Flash programming.
XTAL1
Input to the inverting oscillator amplifier and input to the internal clock operating circuit.
XTAL2
Output from the inverting oscillator amplifier.
XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier that can be
configured for use as an on-chip oscillator, as shown in Figure. Either a quartz crystal or ceramic
resonator may be used. To drive the device from an external clock source, XTAL2 should be left
unconnected while XTAL1 is driven, as shown in the below figure. There are no requirements on
the duty cycle of the external clock signal, since the input to the internal clocking circuitry is
through a divide-by-two flip-flop, but minimum and maximum voltage high and low time
specifications must be observed.
Fig: Oscillator Connections
C1, C2 = 30 pF ± 10 pF for Crystals = 40 pF ± 10 pF for Ceramic Resonators
Fig: External Clock Drive Configuration
8052 MICROCONTROLLER MEMORY ORGANIZATION
The microcontroller memory is divided into Program Memory and Data Memory. Program
Memory (ROM) is used for permanent saving program being executed, while Data Memory
(RAM) is used for temporarily storing and keeping intermediate results and variables. Depending
on the model in use (still referring to the whole 8052 microcontroller family) at most a few Kb of
ROM and 128 or 256 bytes of RAM can be used. However…
All 8052 microcontrollers have 16-bit addressing bus and can address 64 kb memory. It is
neither a mistake nor a big ambition of engineers who were working on basic core development.
It is a matter of very clever memory organization which makes these controllers a real
“programmers’ tidbit“.
Program Memory The oldest models of the 8052 microcontroller family did not have any internal program
memory. It was added from outside as a separate chip. These models are recognizable by their
label beginning with 803 (for ex. 8031 or 8032). All later models have a few Kbytes ROM
embedded, Even though it is enough for writing most of the programs, there are situations when
additional memory is necessary. A typical example of it is the use of so called lookup tables.
They are used in cases when something is too complicated or when there is no time for solving
equations describing some process. The example of it can be totally exotic (an estimate of self-
guided rockets’ meeting point) or totally common (measuring of temperature using non-linear
thermo element or asynchronous motor speed control). In those cases all needed estimates and
approximates are executed in advance and the final results are put in the tables (similar to
logarithmic tables).
How does the microcontroller handle external memory depend on the pin EA logic state?
EA=0 In this case, internal program memory is completely ignored, only a program stored in
external memory is to be executed.
EA=1 In this case, a program from built-in ROM is to be executed first (to the last location).
Afterwards, the execution is continued by reading additional memory.
in both cases, P0 and P2 are not available to the user because they are used for data and address
transmission. Besides, the pins ALE and PSEN are used too.
Data Memory
As already mentioned, Data Memory is used for temporarily storing and keeping data and
intermediate results created and used during microcontroller’s operating. Besides, this
microcontroller family includes many other registers such as: hardware counters and timers,
input/output ports, serial data buffers etc. The previous versions have the total memory size of
256 locations, while for later models this number is incremented by additional 128 available
registers. In both cases, these first 256 memory locations (addresses 0-FFh) are the base of the
memory. Common to all types of the 8052 microcontrollers. Locations available to the user
occupy memory space with addresses from 0 to 7Fh. First 128 registers and this part of RAM is
divided in several blocks.
The first block consists of 4 banks each including 8 registers designated as R0 to R7. Prior to
access them, a bank containing that register must be selected. Next memory block (in the range
of 20h to 2Fh) is bit- addressable, which means that each bit being there has its own address
from 0 to 7Fh. Since there are 16 such registers, this block contains in total of 128 bits with
separate addresses (The 0th bit of the 20h byte has the bit address 0 and the 7th bit of the 2Fh
byte has the bit address 7Fh). The third groups of registers occupy addresses 2Fh-7Fh (in total of
80 locations) and does not have any special purpose or feature.
Additional Memory Block of Data Memory
In order to satisfy the programmers’ permanent hunger for Data Memory, producers have
embedded an additional memory block of 128 locations into the latest versions of the 8052
microcontrollers. Naturally, it’s not so simple…The problem is that electronics performing
addressing has 1 byte (8 bits) on disposal and due to that it can reach only the first 256 locations.
In order to keep already existing 8-bit architecture and compatibility with other existing models a
little trick has been used.
Using trick in this case means that additional memory block shares the same addresses with
existing locations intended for the SFRs (80h- FFh). In order to differentiate between these two
physically separated memory spaces, different ways of addressing are used. A direct addressing
is used for all locations in the SFRs, while the locations from additional RAM are accessible
using indirect addressing.
Fig: Microcontroller internal structure
How to extend memory?
In case on-chip memory is not enough, it is possible to add two external memory chips with
capacity of 64Kb each. I/O ports P2 and P3 are used for their addressing and data transmission.
From the users’ perspective, everything functions quite simple if properly connected because the
most operations are performed by the microcontroller itself. The 8052 microcontroller has two
separate reading signals RD#(P3.7) and PSEN#. The first one is activated byte from external data
memory (RAM) should be read, while another one is activated to read byte from external
program memory (ROM). These both signals are active at logical zero (0) level. A typical
example of such memory extension using special chips for RAM and ROM is shown on the
previous picture. It is called Hardward architecture.
Even though the additional memory is rarely used with the latest versions of the
microcontrollers, it will be described here in short what happens when memory chips are
connected according to the previous scheme. It is important to know that the whole process is
performed automatically, i.e. with no intervention in the program.
When the program during execution encounters the instruction which resides in external
memory (ROM), the microcontroller will activate its control output ALE and set the first
8 bits of address (A0-A7) on P0. In this way, IC circuit 74HCT573 which "lets in" the
first 8 bits to memory address pins is activated.
A signal on the pin ALE closes the IC circuit 74HCT573 and immediately afterwards 8
higher bits of address (A8-A15) appear on the port. In this way, a desired location in
additional program memory is completely addressed. The only thing left over is to read
its content.
Pins on P0 are configured as inputs, the pin PSEN is activated and the microcon troller
reads content from memory chip. The same connections are used both for data and lower
address byte.
Similar occurs when it is a needed to read some location from external Data Memory. Now,
addressing is performed in the same way, while reading or writing is performed via signals
which appear on the control outputs RD or WR.
Addressing
While operating, processor processes data according to the program instructions. Each
instruction consists of two parts. One part describes what should be done and another part
indicates what to use to do it. This later part can be data (binary number) or address where the
data is stored. All 8052 microcontrollers use two ways of addressing depending on which part of
memory should be accessed:
Direct Addressing
On direct addressing, a value is obtained from a memory location while the address of that
location is specified in instruction. Only after that, the instruction can process data (how depends
on the type of instruction: addition, subtraction, copy…). Obviously, a number being changed
during operating a variable can reside at that specified address. For example:
Since the address is only one byte in size ( the greatest number is 255), this is how only the first
255 locations in RAM can be accessed in this case the first half of the basic RAM is intended to
be used freely, while another half is reserved for the SFRs.
Indirect Addressing
On indirect addressing, a register which contains address of another register is specified in the
instruction. A value used in operating process resides in that another register. For example:
Only RAM locations available for use are accessed by indirect addressing (never in the SFRs).
For all latest versions of the microcontrollers with additional memory block (those 128 locations
in Data Memory), this is the only way of accessing them. Simply, when during operating, the
instruction including “@” sign is encountered and if the specified address is higher than 128 (7F
hex.), the processor knows that indirect addressing is used and jumps over memory space
reserved for the SFRs.
On indirect addressing, the registers R0, R1 or Stack Pointer are used for specifying 8-bit
addresses. Since only 8 bits are available, it is possible to access only registers of internal RAM
in this way (128 locations in former or 256 locations in latest versions of the microcontrollers). If
memory extension in form of additional memory chip is used then the 16-bit DPTR Register
(consisting of the registers DPTRL and DPTRH) is used for specifying addresses. In this way it
is possible to access any location in the range of 64K.
SFRs (Special Function Registers)
SFRs are a kind of control table used for running and monitoring microcontroller’s operating.
Each of these registers, even each bit they include, has its name, address in the scope of RAM
and clearly defined purpose ( for example: timer control, interrupt, serial connection etc.). Even
though there are 128 free memory locations intended for their storage, the basic core, shared by
all types of 8052 controllers, has only 21 such registers. Rest of locations are intensionally left
free in order to enable the producers to further improved models keeping at the same time
compatibility with the previous versions. It also enables the use of programs written a long time
ago for the microcontrollers which are out of production now.
A Register (Accumulator)
This is a general-purpose register which serves for storing intermediate results during operating.
A number (an operand) should be added to the accumulator prior to execute an instruction upon
it. Once an arithmetical operation is preformed by the ALU, the result is placed into the
accumulator. If a data should be transferred from one register to another, it must go through
accumulator. For such universal purpose, this is the most commonly used register that none
microcontroller can be imagined without (more than a half 8052 microcontroller's instructions
used use the accumulator in some way).
B Register
B register is used during multiply and divide operations which can be performed only upon
numbers stored in the A and B registers. All other instructions in the program can use this
register as a spare accumulator (A).
During programming, each of registers is called by name so that their exact address is not so
important for the user. During compiling into machine code (series of hexadecimal numbers
recognized as instructions by the microcontroller), PC will automatically, instead of registers’
name, write necessary addresses into the microcontroller.
R Registers (R0-R7)
This is a common name for the total 8 general purpose registers (R0, R1, R2 ...R7). Even they
are not true SFRs, they deserve to be discussed here because of their purpose. The bank is active
when the R registers it includes are in use. Similar to the accumulator, they are used for
temporary storing variables and intermediate results. Which of the banks will be active depends
on two bits included in the PSW Register. These registers are stored in four banks in the scope of
RAM.
Description:
The AT89S52 is a low-voltage, high-performance CMOS 8-bit microcomputer with 4K
bytes of Flash programmable memory. The device is manufactured using Atmel’s high-density
nonvolatile memory technology and is compatible with the industry-standard MCS-51
instruction set. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel
AT89S52 is a powerful microcomputer, which provides a highly flexible and cost-effective
solution to many embedded control applications.
In addition, the AT89S52 is designed with static logic for operation down to zero
frequency and supports two software selectable power saving modes. The Idle Mode stops the
CPU while allowing the RAM, timer/counters, serial port and interrupt system to continue
functioning. The power-down mode saves the RAM contents but freezes the oscillator disabling
all other chip functions until the next hardware reset.
Machine cycle for the 8052
The CPU takes a certain number of clock cycles to execute an instruction. In the 8052 family,
these clock cycles are referred to as machine cycles. The length of the machine cycle depends on
the frequency of the crystal oscillator. The crystal oscillator, along with on-chip circuitry,
provides the clock source for the 8052 CPU.
The frequency can vary from 4 MHz to 30 MHz, depending upon the chip rating and
manufacturer. But the exact frequency of 11.0592 MHz crystal oscillator is used to make the
8052 based system compatible with the serial port of the IBM PC.
In the original version of 8052, one machine cycle lasts 12 oscillator periods. Therefore, to calculate the machine cycle for the 8052, the calculation is made as 1/12 of the crystal frequency and its inverse is taken.
Light-emitting diode (LED)
Light-emitting diodes are elements for light signalization in electronics. They are manufactured
in different shapes, colors and sizes. For their low price, low consumption and simple use, they
have almost completely pushed aside other light sources- bulbs at first place. They perform
similar to common diodes with the difference that they emit light when current flows through
them.
It is important to know that each diode will be immediately destroyed unless its current is
limited. This means that a conductor must be connected in parallel to a diode. In order to
correctly determine value of this
conductor, it is necessary to know diode’s
voltage drop in forward direction, which
depends on what material a diode is made
of and what colour it is. Values typical for the
most frequently used diodes are shown in table
below: As seen, there are three main types
of LEDs. Standard ones get ful
brightness at current of 20mA. Low
Current diodes get ful brightness at ten times lower current while Super Bright diodes produce
more intensive light than Standard ones.
Since the 8051 microcontrollers can provide only low input current and since their pins are
configured as outputs when voltage level on them is equal to 0, direct connectining to LEDs is
carried out as it is shown on figure (Low current LED, cathode is connected to output pin).
Switches and Pushbuttons
There is nothing simpler than this! This is the simplest way of controlling appearance of some
voltage on microcontroller’s input pin. There is also no need for additional explanation of how
these components operate.
Nevertheless, it is not so simple in practice... This is about something commonly unnoticeable
when using these components in everyday life. It is about contact bounce- a common problem
with m e c h a n i c a l switches. If contact switching does not happen so quickly, several
consecutive bounces can be noticed prior to maintain stable state. The reasons for this are:
vibrations, slight rough spots and dirt. Anyway, whole this process does not last long (a few
micro- or miliseconds), but long enough to be registered by the microcontroller. Concerning
pulse counter, error occurs in almost 100% of cases!
The simplest solution is to connect simple RC circuit which will “suppress” each quick voltage
change. Since the bouncing time is not defined, the values of elements are not strictly
determined. In the most cases, the values shown on figure are sufficient.
If complete safety is needed, radical measures should be taken! The circuit, shown on the figure
(RS flip-flop), changes logic state on its output with the first pulse triggered by contact bounce.
Even though this is more expensive solution (SPDT switch), the problem is definitely resolved!
Besides, since the condensator is not used, very short pulses can be also registered in this way. In
addition to these hardware solutions, a simple software solution is commonly applied too: when
a program tests the state of some input pin and finds changes, the check should be done one more
time after certain time delay. If the change is confirmed it means that switch (or pushbutton) has
changed its position. The advantages of such solution are obvious: it is free of charge, effects of
disturbances are eliminated too and it can be adjusted to the worst-quality contacts.
DTMF
DUAL TONE MULTIPLE FREQUENCY (DTMF)
The DTMF (Dual Tone Multiple Frequency) application is associated with digital
telephony, and provides two selected output frequencies (one high band, one low band) for a
duration of 100 ms. A benchmark subroutine has been written for the COP820C/840C
microcontrollers, and is outlined in detail in this application note. This DTMF subroutine takes
110 bytes of COP820C/840C code, consisting of 78 bytes of program code and 32 bytes of ROM
table. The timings in this DTMF subroutine are based on a 20 MHz COP820C/840C clock,
giving an instruction cycle time of 1 ms.
DTMF DECODER
The photo depicts a DTMF generator/decoder pair you can build in an afternoon or two.
Dual-tone-multi-frequency (DTMF, also known as touch-tone) are the audible sounds you hear
when you press keys on your phone. The tone generator (top) uses the 5589 chip and a DIP
switch. You can actually hear the tones through the speaker. The bottom circuit uses the 8870 to
decode a tone and display its associated number on the 7-segment LED. Touch-tone is familiar to
many (telephone), it is a mature technology, and readily available with off-the-shelf, single-chip,
low-cost components. For these reasons DTMF is often used in remote control applications that
typically use telephones (e.g. accessing your messages from an answering machine, retrieving
your account balance info from your bank's database).
This tutorial will not discuss telephone interfacing. Rather it will give you a basic
working foundation which you can build upon. The generator/decoder above are tethered
together by a single wire. But you can expand upon this foundation for wireless remote control
using a microphone. For longer distances maybe you can add a pair of walkie-talkies, generating
audible tones into one, and decoding with the other. Another possibility is to use infrared (IR).
Since tones are just electrical pulses, you can replace the speaker with an IR emitter and add an
IR detector to the decoder. Yet another experiment is to interface either the generator or the
emitter or both to a PC or embedded microprocessor (e.g. 8051, PIC or Stamp). In this scenario,
the PC or a peripheral, through touch-tones, can respond and control. If you are familiar with
how telephones work, the basic circuit might also help you to build devices the respond to your
call. For example, you can build upon the decoder and add relays to control household devices
that respond when you call your home.
Well hopefully I got you motivated. The bottom line is that DTMF was designed for
optimal performance with each tone being very distinct. This makes decoding the tone very easy
even in surrounding noise. It is this performance that makes DTMF ideal for clear transmission
and reception in remote control (wireless or through phone lines) applications.
In DTMF there are 16 distinct tones. Each tone is the sum of two frequencies: one from a
low and one from a high frequency group. There are four different frequencies in each group.
Your phone only uses 12 of the possible 16 tones. If you look at your phone, there are only 4
rows (R1, R2, R3 and R4) and 3 columns (C1, C2 and C3). The rows and columns select
frequencies from the low and high frequency group respectively. The exact value of the
frequencies are listed in below
LOW-FREQUENCIES
ROW #FREQUENCY (HZ)
R1: ROW 0697
R2: ROW 1770
R3: ROW 2852
R4: ROW 3941
HIGH-FREQUENCIES
COL #FREQUENCY (HZ)
C1: COL 01209
C2: COL 11336
C3: COL 21477
C4: COL 31633
C4 not used in phones
Features of DTMF decoder
Complete DTMF Receiver
Low power consumption
Internal gain setting amplifier
Adjustable guard time
Central office quality
Power-down mode
Inhibit mode
Backward compatible with MT8870C and MT8870C-1
Typical Applications for DTMF decoders
Paging systems
Repeater systems/mobile radio
Credit card systems
Remote control
Personal computers
Telephone answering machine
Dual-tone multi-frequency signaling (DTMF) is used for telecommunication signaling over analog telephone lines in the voice-frequency band between telephone handsets and other communications devices and the switching center. The version of DTMF that is used in push-button telephones for tone dialing is known as Touch-Tone. It was first used by AT&T in commerce as a registered trademark, and is standardized by ITU-T Recommendation Q.23. It is also known in the UK as MF4.
Other multi-frequency systems are used for internal signaling within the telephone network.
The Touch-Tone system, using the telephone keypad, gradually replaced the use of rotary
dial starting in 1963, and since then DTMF or Touch-Tone became the industry standard for
both cell phones and landline service.
The DTMF keypad is laid out in a 4×4 matrix, with each row representing a low frequency, and
each column representing a high frequency. Pressing a single key (such as '1' ) will send
a sinusoidal tone for each of the two frequencies (697 and 1209 hertz (Hz)). The original
keypads had levers inside, so each button activated two contacts. The multiple tones are the
reason for calling the system multi frequency. These tones are then decoded by the switching
center to determine which key was pressed.
DTMF keypad frequencies (with sound clips)
1209 Hz 1336 Hz 1477 Hz 1633 Hz
697 Hz 1 2 3 A
770 Hz 4 5 6 B
852 Hz 7 8 9 C
941 Hz * 0 # D
DTMF Generation697 Hz770 Hz
852 Hz941 Hz
1209 Hz
1336 Hz
1477 Hz
RowSelec
tor
Column
Selector
Desired
Digit+ Dual
Tone
Row
Calculatio
n
Frequency Detection
697 Hz
770 Hz
852 Hz
941 Hz
Digit
Calculatio
n
Calculated
Digit
• The DTMF is a popular signaling method between telephones and switching centers
• DTMF is also used for signaling between the Telephone network and computer networks
• The DTMF signals are Transmitted over a telephone line
• Uses speech frequency signals
• DTMF signals are the superposition of 2 sine waves with different frequencies
\
Description:
The MT8870D/MT8870D-1 is a complete DTMF receiver integrating both the band split
filter and digital decoder functions. The filter section uses switched capacitor techniques for high
and low group filters; the decoder uses digital counting techniques to detect and decode all 16
DTMF tone pairs into a 4-bit code. External component count is minimized by on chip provision
of a differential input amplifier, clock oscillator and latched three-state bus interface.
DC MOTOR AND H-BRIDGE
THEORY OF DC MOTOR
The speed of a DC motor is directly proportional to the supply voltage, so if we reduce
the supply voltage from 12 Volts to 6 Volts, the motor will run at half the speed. How can this be
achieved when the battery is fixed at 12 Volts? The speed controller works by varying the
average voltage sent to the motor. It could do this by simply adjusting the voltage sent to the
motor, but this is quite inefficient to do. A better way is to switch the motor's supply on and off
very quickly. If the switching is fast enough, the motor doesn't notice it, it only notices the
average effect.
When you watch a film in the cinema, or the television, what you are actually seeing is a
series of fixed pictures, which change rapidly enough that your eyes just see the average effect -
movement. Your brain fills in the gaps to give an average effect.
Now imagine a light bulb with a switch. When you close the switch, the bulb goes on and
is at full brightness, say 100 Watts. When you open the switch it goes off (0 Watts). Now if you
close the switch for a fraction of a second, then open it for the same amount of time, the filament
won't have time to cool down and heat up, and you will just get an average glow of 50 Watts.
This is how lamp dimmers work, and the same principle is used by speed controllers to drive a
motor. When the switch is closed, the motor sees 12 Volts, and when it is open it sees 0 Volts. If
the switch is open for the same amount of time as it is closed, the motor will see an average of 6
Volts, and will run more slowly accordingly. The graph below shows the speed of a motor that is
being turned on and off.
DC motor
A DC motor is an electric motor that runs on direct current (DC) electricity.
DC Motor Connections
Figure shows schematically the different methods of connecting the field and armature circuits in
a DC Motor. The circular symbol represents the armature circuit, and the squares at the side
of the circle represent the brush commutator system. The direction of the arrows indicates the
direction of the magnetic fields.
Brushed
The brushed DC motor generates torque directly from DC power supplied to the motor by using
internal commutation, stationary permanent magnets, and rotating electrical magnets.It works on
the principle of Lorentz force , which states that any current carrying conductor placed within an
external magnetic field experiences a torque or force known as Lorentz force. Advantages of a
brushed DC motor include low initial cost, high reliability, and simple control of motor speed.
Disadvantages are high maintenance and low life-span for high intensity uses. Maintenance
involves regularly replacing the brushes and springs which carry the electric current, as well as
cleaning or replacing the commutator. These components are necessary for transferring electrical
power from outside the motor to the spinning wire windings of the rotor inside the motor.
Brushed DC motor
Brushless
Brushless DC motors use a rotating permanent magnet in the rotor, and stationary electrical
magnets on the motor housing. A motor controller converts DC to AC. This design is simpler
than that of brushed motors because it eliminates the complication of transferring power from
outside the motor to the spinning rotor. Advantages of brushless motors include long life span,
little or no maintenance, and high efficiency. Disadvantages include high initial cost, and more
complicated motor speed controllers.
Torque and speed of a DC motor
The torque of an electric motor is independent of speed. It is rather a function of flux and
armature current.
Characteristics of DC motors
DC motors respond to load changes in different ways, depending on the arrangement of the
windings.
Shunt wound motor
A shunt wound motor has a high-resistance field winding connected in parallel with the
armature. It responds to increased load by trying to maintain its speed and this leads to an
increase in armature current. This makes it unsuitable for widely-varying loads, which may lead
to overheating.
Series wound motor
A series wound motor has a low-resistance field winding connected in series with the armature.
It responds to increased load by slowing down and this reduces the armature current and
minimizes the risk of overheating. Series wound motors were widely used as traction motors in
rail transport of every kind, but are being phased out in favor of AC induction motors supplied
through solid state inverters. The counter-emf aids the armature resistance to limit the current
through the armature. When power is first applied to a motor, the armature does not rotate. At
that instant the counter-emf is zero and the only factor limiting the armature current is the
armature resistance. Usually the armature resistance of a motor is less than 1 Ω; therefore the
current through the armature would be very large when the power is applied. Therefore the need
arises for an additional resistance in series with the armature to limit the current until the motor
rotation can build up the counter-emf. As the motor rotation builds up, the resistance is gradually
cut out.
Permanent magnet motor
A permanent magnet DC motor is characterized by its locked rotor (stall) torque and its no-load
angular velocity (speed).
Principles of operation
In any electric motor, operation is based on simple electromagnetism. A current-carrying
conductor generates a magnetic field; when this is then placed in an external magnetic field, it
will experience a force proportional to the current in the conductor, and to the strength of the
external magnetic field. As you are well aware of from playing with magnets as a kid, opposite
(North and South) polarities attract, while like polarities (North and North, South and South)
repel. The internal configuration of a DC motor is designed to harness the magnetic interaction
between a current-carrying conductor and an external magnetic field to generate rotational
motion.
Let's start by looking at a simple 2-pole DC electric motor (here red represents a magnet or
winding with a "North" polarization, while green represents a magnet or winding with a "South"
polarization).
Every DC motor has six basic parts -- axle, rotor (a.k.a., armature), stator, commutator, field
magnet(s), and brushes. In most common DC motors (and all that Beamers will see), the external
magnetic field is produced by high-strength permanent magnets. The stator is the stationary part
of the motor -- this includes the motor casing, as well as two or more permanent magnet pole
pieces. The rotor (together with the axle and attached commutator) rotates with respect to the
stator. The rotor consists of windings (generally on a core), the windings being electrically
connected to the commutator. The above diagram shows a common motor layout -- with the
rotor inside the stator (field) magnets.
The geometry of the brushes, commutator contacts, and rotor windings are such that when power
is applied, the polarities of the energized winding and the stator magnet(s) are misaligned, and
the rotor will rotate until it is almost aligned with the stator's field magnets. As the rotor reaches
alignment, the brushes move to the next commutator contacts, and energize the next winding.
Given our example two-pole motor, the rotation reverses the direction of current through the
rotor winding, leading to a "flip" of the rotor's magnetic field, driving it to continue rotating.
In real life, though, DC motors will always have more than two poles (three is a very common
number). In particular, this avoids "dead spots" in the commutator. You can imagine how with
our example two-pole motor, if the rotor is exactly at the middle of its rotation (perfectly aligned
with the field magnets), it will get "stuck" there. Meanwhile, with a two-pole motor, there is a
moment where the commutator shorts out the power supply (i.e., both brushes touch both
commutator contacts simultaneously). This would be bad for the power supply, waste energy,
and damage motor components as well. Yet another disadvantage of such a simple motor is that
it would exhibit a high amount of torque "ripple" (the amount of torque it could produce is cyclic
with the position of the rotor).
So since most small DC motors are of a three-pole design, let's tinker with the workings of one
via an interactive animation.
You'll notice a few things from this -- namely, one pole is fully energized at a time (but two
others are "partially" energized). As each brush transitions from one commutator contact to the
next, one coil's field will rapidly collapse, as the next coil's field will rapidly charge up (this
occurs within a few microsecond). We'll see more about the effects of this later, but in the
meantime you can see that this is a direct result of the coil windings' series wiring:
The use of an iron core armature (as in the Mabuchi, above) is quite common, and has a number
of advantages. First off, the iron core provides a strong, rigid support for the windings -- a
particularly important consideration for high-torque motors. The core also conducts heat away
from the rotor windings, allowing the motor to be driven harder than might otherwise be the
case. Iron core construction is also relatively inexpensive compared with other construction
types.
But iron core construction also has several disadvantages. The iron armature has a relatively high
inertia which limits motor acceleration. This construction also results in high winding
inductances which limit brush and commutator life.
In small motors, an alternative design is often used which features a 'coreless' armature winding.
This design depends upon the coil wire itself for structural integrity. As a result, the armature is
hollow, and the permanent magnet can be mounted inside the rotor coil. Coreless DC motors
have much lower armature inductance than iron-core motors of comparable size, extending brush
and commutator life.
DC motor behavior
High-speed output
This is the simplest trait to understand and treat -- most DC motors run at very high output
speeds (generally thousands or tens of thousands of RPM). While this is fine for some BEAM
bots (say, photo poppers or solar rollers), many BEAM bots (walkers, heads) require lower
speeds -- you must put gears on your DC motor's output for these applications.
Back EMF
Just as putting voltage across a wire in a magnetic field can generate motion, moving a wire
through a magnetic field can generate voltage. This means that as a DC motor's rotor spins, it
generates voltage -- the output voltage is known as back EMF. Because of back EMF, a spark is
created at the commutator as a motor's brushes switch from contact to contact. Meanwhile, back
EMF can damage sensitive circuits when a motor is stopped suddenly.
Noise (ripple) on power lines
A number of things will cause a DC motor to put noise on its power lines: commutation noise (a
function of brush / commutator design & construction), roughness in bearings (via back EMF),
and gearing roughness (via back EMF, if the motor is part of a gearmotor) are three big
contributors.
Even without these avoidable factors, any electric motor will put noise on its power lines by
virtue of the fact that its current draw is not constant throughout its motion. Going back to our
example two-pole motor, its current draw will be a function of the angle between its rotor coil
and field magnets:
Since most small DC motors have 3 coils, the coils' current curves will overlay each other:
Added together, this ideal motor's current will then look something like this:
Reality is a bit more complex than this, as even a high-quality motor will display a current
transient at each commutation transition. Since each coil has inductance (by definition) and some
capacitance, there will be a surge of current as the commutator's brushes first touch a coil's
contact, and another as the brushes leave the contact (here, there's a slight spark as the coil's
magnetic field collapses).
As a good example, consider an oscilloscope trace of the current through a Mabuchi FF-030PN
motor supplied with 2 V (1ms per horizontal division, 0.05 mA per vertical division):
In this case, the peak-to-peak current ripple is approximately 0.29 mA, while the average motor
current is just under 31 mA. So under these conditions, the motor puts about less than 1% of
current ripple onto its power lines (and as you can see from the "clean" traces, it outputs
essentially no high-frequency current noise). Note that since this is a 3-pole motor, and each coil
is energized in both directions over the course of a rotor rotation, one revolution of the rotor will
correspond to six of the above curves (here, 6 x 2.4 ms = 0.0144 sec, corresponding to a motor
rotation rate of just under 4200 RPM).
Motor power ripple can wreak havoc in Nv nets by destabilizing them inadvertently. Fortunately,
this can be mitigated by putting a small capacitor across the motor's power lines (you'll only be
able to filter out "spikey" transients this way, though -- you'll always see curves like the ones
above being imposed on your power). On the flip side of this coin, motor power ripple can be put
to good use -- as was shown above, ripple frequency can be used to measure motor speed, and its
destabilizing tendencies can be used to reverse a motor without the need for discrete "back-up"
sensors.
H-BRIDGE:
An H-bridge is an electronic circuit which enables DC electric motors to be run forwards or
backwards. These circuits are often used in robotics. H-bridges are available as integrated
circuits, or can be built from discrete components.
The two basic states of a H-bridge.The term "H-bridge" is derived from the typical
graphical representation of such a circuit. An H-bridge is built with four switches (solid-state or
mechanical). When the switches S1 and S4 (according to the first figure) are closed (and S2 and
S3 are open) a positive voltage will be applied across the motor. By opening S1 and S4 switches
and closing S2 and S3 switches, this voltage is reversed, allowing reverse operation of the motor.
Using the nomenclature above, the switches S1 and S2 should never be closed at the same
time, as this would cause a short circuit on the input voltage source. The same applies to the
switches S3 and S4. This condition is known as shoot-through.
Operation
The H-Bridge arrangement is generally used to reverse the polarity of the motor, but can also be
used to 'brake' the motor, where the motor comes to a sudden stop, as the motors terminals are
shorted, or to let the motor 'free run' to a stop, as the motor is effectively disconnected from the
circuit. The following table summarizes operation.
S
1S2 S3 S4 Result
1 0 0 1Motor moves
right
0 1 1 0Motor moves
left
0 0 0 0 Motor free runs
0 1 0 1 Motor brakes
H-Bridge Driver:
The switching property of this H-Bridge can be replace by a Transistor or a Relay or a Mosfet or
even by an IC. Here we are replacing this with an IC named L293D as the driver whose
description is as given below.
Features:
600mA OUTPUT CURRENT CAPABILITY
PER CHANNEL
1.2A PEAK OUTPUT CURRENT (non repetitive)
PER CHANNEL
ENABLE FACILITY
OVERTEMPERATURE PROTECTION
LOGICAL "0" INPUT VOLTAGE UP TO 1.5 V
(HIGH NOISE IMMUNITY)
INTERNAL CLAMP DIODES
DESCRIPTION
The Device is a monolithic integrated high voltage, high current four channel driver designed to
accept standard DTL or TTL logic levels and drive inductive loads (such as relays solenoides,
DC and stepping motors) and switching power transistors. To simplify use as two bridges each
pair of channels is equipped with an enable input. A separate supply input is provided for the
logic, allowing operation at a lower voltage and internal clamp diodes are included. This device
is suitable for use in switching applications at frequencies up to 5 kHz. The L293D is assembled
in a 16 lead plastic packaage which has 4 center pins connected together and used for heatsinking
The L293DD is assembled in a 20 lead surface mount which has 8 center pins connected
together and used for heatsinking.
BLOCK DIAGRAM:
ABSOLUTE MAXIMUM RATINGS
PIN CONNECTIONS
RELAYS:
A relay is an electrically controllable switch widely used in industrial controls, automobiles
and appliances.
The relay allows the isolation of two separate sections of a system with two different voltage
sources i.e., a small amount of voltage/current on one side can handle a large amount of
voltage/current on the other side but there is no chance that these two voltages mix up.
Inductor
Fig: Circuit symbol of a relay
Operation:
When a current flow through the coil, a magnetic field is created around the coil i.e., the
coil is energized. This causes the armature to be attracted to the coil. The armature’s contact acts
like a switch and closes or opens the circuit. When the coil is not energized, a spring pulls the
armature to its normal state of open or closed. There are all types of relays for all kinds of
applications.
Fig: Relay Operation and use of protection diodes
Transistors and ICs must be protected from the brief high voltage 'spike' produced when the
relay coil is switched off. The above diagram shows how a signal diode (eg 1N4148) is
connected across the relay coil to provide this protection. The diode is connected 'backwards' so
that it will normally not conduct. Conduction occurs only when the relay coil is switched off, at
this moment the current tries to flow continuously through the coil and it is safely diverted
through the diode. Without the diode no current could flow and the coil would produce a
damaging high voltage 'spike' in its attempt to keep the current flowing.
In choosing a relay, the following characteristics need to be considered:
1. The contacts can be normally open (NO) or normally closed (NC). In the NC type, the
contacts are closed when the coil is not energized. In the NO type, the contacts are closed when
the coil is energized.
2. There can be one or more contacts. i.e., different types like SPST (single pole single throw),
SPDT (single pole double throw) and DPDT (double pole double throw) relays.
3. The voltage and current required to energize the coil. The voltage can vary from a few volts to
50 volts, while the current can be from a few milliamps to 20milliamps. The relay has a
minimum voltage, below which the coil will not be energized. This minimum voltage is called
the “pull-in” voltage.
4. The minimum DC/AC voltage and current that can be handled by the contacts. This is in the
range of a few volts to hundreds of volts, while the current can be from a few amps to 40A or
more, depending on the relay.
TRANSISTOR DRIVER CIRCUIT:
An SPDT relay consists of five pins, two for the magnetic coil, one as the common
terminal and the last pins as normally connected pin and normally closed pin. When the current
flows through this coil, the coil gets energized. Initially when the coil is not energized, there will
be a connection between the common terminal and normally closed pin. But when the coil is
energized, this connection breaks and a new connection between the common terminal and
normally open pin will be established. Thus when there is an input from the microcontroller to
the relay, the relay will be switched on. Thus when the relay is on, it can drive the loads
connected between the common terminal and normally open pin. Therefore, the relay takes 5V
from the microcontroller and drives the loads which consume high currents. Thus the relay acts
as an isolation device.
Digital systems and microcontroller pins lack sufficient current to drive the relay. While the
relay’s coil needs around 10milli amps to be energized, the microcontroller’s pin can provide a
maximum of 1-2milli amps current. For this reason, a driver such as a power transistor is placed
in between the microcontroller and the relay.
AT89C51
P1.0
Vcc
RELAY
GROUND
The operation of this circuit is as follows:
The input to the base of the transistor is applied from the microcontroller port pin P1.0.
The transistor will be switched on when the base to emitter voltage is greater than 0.7V (cut-in
voltage). Thus when the voltage applied to the pin P1.0 is high i.e., P1.0=1 (>0.7V), the
transistor will be switched on and thus the relay will be ON and the load will be operated.
When the voltage at the pin P1.0 is low i.e., P1.0=0 (<0.7V) the transistor will be in off
state and the relay will be OFF. Thus the transistor acts like a current driver to operate the relay
accordingly.
DRIVER CIRCUIT
RELAY LOAD
RELAY INTERFACING WITH THE MICROCONTROLLER:
METAL DETECTOR:
Metal detectors use electromagnetic induction to detect metal. Metal detector can help you to
find the metals sburied deep in the ground. Uses include de-mining (the detection of land mines),
the detection of weapons such as knives and guns, especially at airports, geophysical
prospecting, archaeology and treasure hunting. Metal detectors are also used to detect foreign
bodies in food, and in the construction industry to detect steel reinforcing bars in concrete and
pipes and wires buried in walls and floors.
The simplest form of a metal detector consists of an oscillator producing an alternating current
that passes through a coil producing an alternating magnetic field. If a piece of electrically
conductive metal is close to the coil, eddy currents will be induced in the metal, and this
produces an alternating magnetic field of its own. If another coil is used to measure the magnetic
AT 89C51
P1.0
field (acting as a magnetometer), the change in the magnetic field due to the metallic object can
be detected.
WIRELESS CAMERA WITH VOICE TRANSMISSION
WIRELESS CAMERA WITH VOICE TRANSMISSION:
A portable small-sized camera has a case having a ball-point pen appearance in a portion
thereof and a through hole in one side, and a camera circuit part built in the case and for
photographing an object through the through hole. The portable small-sized camera has the ball-
point pen appearance, photographing a particular location in secret is possible without exposure
to others. The camera circuit part is connected to a wireless transmission device for outputting a
signal by a cable. A wireless receiving device at a remote location from the wireless transmission
device receives a signal of the wireless transmission device for outputting or recording. The
portable camera further includes a microphone and the transmission device transmits a voice
signal.
1.2 GHz wireless receiver
Key Specifications :
1) System: PAL/CCIR NTSC/EIA
2) Validity pixel: PAL: 5.78 x 4.19mm;
NTSC:4.69x3.45mm
3) Horizontal definition: 380 lines
4) Scan frequency: PAL /CCIR: 50Hz; NTSC/EIA: 60Hz
5) Minimum illumination: 3 LUX
6) Sensitivity: +18DB-AGL ON-OFF
7) Output power: 50MW
8) Output frequency: 0.9G/1.2G
9) Wireless range: 50-100m
10) Voltage: DC+8V
11) Current: 200mA
12) Power consumption: ≤640MW
13) Dimensions: 20 x 20 x 20mm
14) Camera apparatus: 1/3, 1/4 picture sensor
•
SOFTWARE TOOLS
KEIL SOFTWARE:
Keil compiler is a software used where the machine language code is written and
compiled. After compilation, the machine source code is converted into hex code which is to be
dumped into the microcontroller for further processing. Keil compiler also supports C language
code.
STEPS TO WRITE AN ASSEMBLY / C LANGUAGE PROGRAM IN KEIL AND HOW
TO COMPILE IT:
1. Install the Keil Software in the PC in any of the drives.
2. After installation, an icon will be created with the name “Keil uVision3”. Just drag this
icon onto the desktop so that it becomes easy whenever you try to write programs in keil.
3. Double click on this icon to start the keil compiler.
4. A page opens with different options in it showing the project workspace at the leftmost
corner side, output window in the bottom and an ash coloured space for the program to be
written.
5. Now to start using the keil, click on the option “project”.
6. A small window opens showing the options like new project, import project, open project
etc. Click on “New project”.
7. A small window with the title bar “Create new project” opens. The window asks the user
to give the project name with which it should be created and the destination location. The
project can be created in any of the drives available. You can create a new folder and then
a new file or can create directly a new file.
8. After the file is saved in the given destination location, a window opens where a list of
vendors will be displayed and you have to select the device for the target you have
created.
9. The most widely used vendor is Atmel. So click on Atmel and now the family of
microcontrollers manufactured by Atmel opens. You can select any one of the
microcontrollers according to the requirement.
10. When you click on any one of the microcontrollers, the features of that particular
microcontroller will be displayed on the right side of the page. The most appropriate
microcontroller with which most of the projects can be implemented is the AT89S52.
Click on this microcontroller and have a look at its features. Now click on “OK” to select
this microcontroller.
11. A small window opens asking whether to copy the startup code into the file you have
created just now. Just click on “No” to proceed further.
12. Now you can see the TARGET and SOURCE GROUP created in the project workspace.
13. Now click on “File” and in that “New”. A new page opens and you can start writing
program in it.
14. After the program is completed, save it with any name but with the .asm or .c extension.
Save the program in the file you have created earlier.
15. You can notice that after you save the program, the predefined keywords will be
highlighted in bold letters.
16. Now add this file to the target by giving a right click on the source group. A list of
options open and in that select “Add files to the source group”. Check for this file where
you have saved and add it.
17. Right click on the target and select the first option “Options for target”. A window opens
with different options like device, target, output etc. First click on “target”.
18. Since the set frequency of the microcontroller is 11.0592 MHz to interface with the PC,
just enter this frequency value in the Xtal (MHz) text area and put a tick on the Use on-
chip ROM. This is because the program what we write here in the keil will later be
dumped into the microcontroller and will be stored in the inbuilt ROM in the
microcontroller.
19. Now click the option “Output” and give any name to the hex file to be created in the
“Name of executable” text area and put a tick to the “Create HEX file” option present in
the same window. The hex file can be created in any of the drives. You can change the
folder by clicking on “Select folder for Objects”.
20. Now to check whether the program you have written is errorless or not, click on the icon
exactly below the “Open file” icon which is nothing but Build Target icon. You can even
use the shortcut key F7 to compile the program written.
21. To check for the output, there are several windows like serial window, memory window,
project window etc. Depending on the program you have written, select the appropriate
window to see the output by entering into debug mode.
22. The icon with the letter “d” indicates the debug mode.
23. Click on this icon and now click on the option “View” and select the appropriate window
to check for the output.
24. After this is done, click the icon “debug” again to come out of the debug mode.
25. The hex file created as shown earlier will be dumped into the microcontroller with the
help of another software called Proload.
PROLOAD:
Proload is a software which accepts only hex files. Once the machine code is converted
into hex code, that hex code has to be dumped into the microcontroller placed in the programmer
kit and this is done by the Proload. Programmer kit contains a microcontroller on it other than the
one which is to be programmed. This microcontroller has a program in it written in such a way
that it accepts the hex file from the keil compiler and dumps this hex file into the microcontroller
which is to be programmed. As this programmer kit requires power supply to be operated, this
power supply is given from the power supply circuit designed above. It should be noted that this
programmer kit contains a power supply section in the board itself but in order to switch on that
power supply, a source is required. Thus this is accomplished from the power supply board with
an output of 12volts or from an adapter connected to 230 V AC.
1. Install the Proload Software in the PC.
2. Now connect the Programmer kit to the PC (CPU) through serial cable.
3. Power up the programmer kit from the ac supply through adapter.
4. Now place the microcontroller in the GIF socket provided in the programmer kit.
5. Click on the Proload icon in the PC. A window appears providing the information like
Hardware model, com port, device type, Flash size etc. Click on browse option to select
the hex file to be dumped into the microcontroller and then click on “Auto program” to
program the microcontroller with that particular hex file.
6. The status of the microcontroller can be seen in the small status window in the bottom of
the page.After this process is completed, remove the microcontroller from the
programmer kit and place it in your system board. Now the system board behaves
according to the program written in the microcontroller.
APPLICATIONS
APPLICATIONS:
1. For lifting the objects.
2. Used for placing the objects wherever required.
3. Used for making the machine move in all directions
4. Used in constructions, etc.
CCONCLUSIONONCLUSION
CONCLUSION:
This project presents a moving robot with pick and place arm using DTMF
communication which is designed and implemented with Atmel 89S52 MCU in embedded
system domain. This project is used for lifting objects up to 300gms and it can place the objects
wherever required. This robot moves its full body with which it becomes easier for it to do the
movement easily. Experimental work has been carried out carefully. The result shows that higher
efficiency is indeed achieved using the embedded system. The proposed method is verified to be
highly beneficial for the security purpose and industrial purpose. This added advantage of this
project is it can be driven any where using advanced DTMF technology.
REFERENCESREFERENCES
REFERENCES:
1. www. howstuffworks.com
2. EMBEDDED SYSTEM BY RAJ KAMAL
3. 8052 MICROCONTROLLER AND EMBEDDED SYSTEMS BY MAZZIDI
4. Magazines
5. Electronics for you
6. Electrikindia
7. www.google.com
8. www.electronic projects.com