CHAPTER – 1 CHAPTER – 1
EMBEDDED SYSTEMS
1.1 INTRODUCTION TO EMBEDDED SYSTEMS
Embedded systems are the systems which performs a specific or a pre-defined task. It is
the combination of hardware and software. It is nothing but a computer inside a product. It is a
programmable hardware design nothing but an electronic chip.
A general-purpose definition of embedded systems is that they are devices used to
control, monitor or assist the operation of equipment, machinery or plant. “Embedded” reflects
the fact that they are an integral part of the system. In many cases their embedded ness may be
such that their presence is far from obvious to the casual observer and even the equipment for
sometime before being able to conclude that an embedded control system was involved in its
functioning. At the other extreme a general-purpose computer may be used to control the
operation of a large complex processing plant, and its presence will be obvious.
All embedded systems include computers or microprocessors. Some of these
computers are how ever very simple systems as compared with a personal computer.
The very simplest embedded systems are capable of performing only single functions
to meet single functions to meet a single predetermined purpose. In more complex systems an
application program that enables the embedded system to be used for a particular purpose in a
specific application determines the functioning of the embedded systems. The ability to have
programs means that the same embedded system can be used for a variety of purposes. In some
cases a microprocessor may be designed in such way that application software for a particular
purpose can be added to the basic software in a second process, after which it is not possible to
make further changes. The applications software on such processors is sometimes referred to as
firmware.
The simplest devices consist of a single microprocessor (often called a “chip”), which
may itself be packaged with other chips in a hybrid systems or Application Specific Integrated
Circuit (ASIC). Its input comes from a detector or sensor and its output goes to a switch or
activator which (for example) may start or stop the operation of a machine or, operating a value,
may control the flow of fuel to an engine.
1
Figure:1.1 Blockdiagram of the embedded system
Courtesy:www.alldatasheets.com
1.2 PROCESSORS:
Processors are the ones which performs some specific task or operation. These are
divided in to several types like:
1. Digital Signal Processors.
2. Application Specific Integrated Circuits.
3. Micro Processors.
4. Micro Controllers.
1.2.1 Digital Signal Processors:
This is a one which performs scientific and mathematical Calculations. The output of
this type of processors will be in floating point values. Hence, we can get accurate values as
outputs.
Best example of a Digital Signal Processors will be Weather Forecasting.
1.2.2 Applications specific Integrated Circuits:
As the name itself specifies, this is integrated circuit designed for a specific
application. IC designed for one specific application cannot be used in other applications.
Best Example for ASIC will be Cell phone card.
1.2.3 Microprocessors:
These are the ones which perform arithmetic and logical operations.
2
Figure:1.2.3 Block Diagram of Microprocessor
Courtesy: www.alldatasheets.com
Arithmetic and logical unit performs arithmetical and logical calculations. Control unit
controls all the peripheral devices connected to the microprocessors. Memory is a one which is
used to store some data or information.
Best Example for a microprocessor will be our Personal Computer.
1.2.4 Micro Controllers:
These are the ones which are similar to that of a microprocessor which performs
arithmetic and logical calculations. These have additional advantage to that it is having additional
inbuilt features like:
Figure:1.2.4 Block diagram of Micro controller
Courtesy: www.alldatasheets.com
1. Electrically Erasable Programmable Read Only Memory (EEPROM)
2. Universal Synchronous Asynchronous Receiver and Transmitter (USART).
3
3. Analog to Digital Converter (ADC).
4. Digital to Analog Converter (DAC).
5. Oscillators.
6. Timers.
7. Many others.
The output of a microcontroller is a always in integer format only. It cannot provide accurate
values or floating point values.
Best Example for Micro Controller will be Traffic Light Controller.
Out of all these Processors, we are using Micro Controllers.
Coming to the software point of View, we have many software languages. Out of all, we are using
Assembly Level Language to load the program in to the controller.
ALP coding is done and loaded into the microcontroller. These are different companies that
manufacture Microcontrollers like Atmel, Motorola, Intel, Philips, PIC, etc.
We are using Atmel manufactured microcontrollers. Atmel Company manufactures different
series of microcontrollers like
AT89C, AT90S, ATMega, ATCAN. Here we are using ATMega Microcontrollers. Again in
ATMega we are having different ATMega 8, ATMega 8515, ATMega 16, ATMega 32,
AT Mega 162v, etc.Here, in this project we are using AT89c51 Microcontroller.
1.2.5 Introduction to applications of Embedded System:
Embedded Controllers may be found in many different kinds of system and are used for
many different applications. The list, which follows, is a indicative rather than exhaustive. An
item in the list may be relevant to a particular company because either
(a) It is or involves a core process or product,
(b) It is or involves an ancillary function or services performed by the company or
(c) It refers to a product or services provided by a contractor under some form of agreement
and the vulnerability of the supplier may need to be considered.
1.2.6 List of Applications of Embedded Systems:
(a) Manufacturing and process control:
Manufacturing plants.
Water and sewage systems.
Power stations.
Power grid systems.
Oil refineries and related storage facilities.
4
Bottling plants.
Automated factories.
Simulators.
Test equipment for control system development, maintenance and testing.
(b) Construction industry:
Surveying and location Equipment.
Construction Plant.
(c) Transport:
Aero planes
Trains and Buses.
Marine craft (known cases include: radar mapping; ballast monitoring; cargo loading;
ship main control system)
Automobiles
Fuel services.
Air Traffic Control Systems.
Signaling system.
Radar Systems.
Traffic Lights.
Ticketing systems and Machines.
Car Parking and other meters.
(d) Buildings and premises:
Electrically supply- supply, measurement, control, protection.
Backing lighting and generators.
Fire control systems.
Heating and ventilating systems.
Lifts Elevators, escalators.
Security Systems.
Security Cameras.
Door locks.
(e) Domestic service:
Catering.
Cleaning.
(f) Communications:
Telephone.
5
Cable systems.
Telephone switches.
Satellites.
(g) Office systems and mobile management:
Telephone systems
Faxes and Copier.
Time recording systems.
Mobile telephones
Still and Video Cameras.
(h) Banking, Finance and Commercial:
Automated teller systems.
Credit card Systems.
Point of scale systems including scanner / cash systems.
CHAPTER-2
PROJECT DESCRITION
2.1 DESCRIPTION
6
AVRATmega16Controller
MOTORDRIVER
RIGHTMOTOR
RELAYS
DTMFDECODER
LEFTMOTOR
RELAYS
“CELL PHONE OPERATED LAND ROVER USING AVR MICROCONTROLLER” is
used to control the Robot in Remote areas also. Conventionally, wireless-controlled robots use RF
circuits, which have the drawbacks of limited working range, limited frequency range and limited
control. Use of a mobile phone for robotic control can overcome these limitations. It provides the
advantages of robust control, working range as large as the coverage area of the service provider,
no interference with other controllers and up to twelve controls.
In this project, the robot is controlled by a mobile phone that makes a call to the mobile
phone attached to the robot. In the course of a call, if any button is pressed, a tone corresponding
to the button pressed is heard at the other end of the call. This tone is called ‘dual-tone multiple-
frequency’ (DTMF) tone. The robot perceives this DTMF tone with the help of the phone stacked
in the robot and operated
BLOCK DIAGRAM:
Figure2.1 Blockdiagram cell landrover
The Figure shows the block diagram and cicuit diagram of the microcontroller- based robot. The
important components of this robot are DTMF decoder, Microcontroller and motor driver.
An MT8870 series DTMF decoder is used here. All types of the MT8870 series use digital
counting techniques to detect and decode all the sixteen DTMF tone pairs into a four-bit code
7
output. The built -in dial tone rejection circuit eliminated the need for pre- filtering. When the
input signal given at pin2 (IN-) single ended input configuration is recognized to be effective, the
correct four bit decode signal of the DTMF tone is transferred to Q1(pin11) through Q4(pin14)
outputs.
The ATmega 16 is a low power, 8 bit, CMOS micro-controller based on the AVR
enhanced RISC architecture. It provides the following feature: 16kb of in system programmable
flash memory with read write capabilities, 512bytes of EEPROM, 1KB SRAM, 32 general
purpose input/output lines. 32 general purpose working registers.
All the 32 registers are directly connected to the arithmetic logic unit, allowing two
independent registers to be accessed in one signal instruction executed in one clock cycle. The
resulting architecture is more code efficient. Outputs from port pins PD0 through PD3 and PD7 of
the micro-controller are fed to inputs IN1 through IN4 and enable pins (EN1 and EN2) of motor
driver L293d respectively, to drive geared motors. Switch S1 is used for manual reset.
2.2 PROJECT OUTLINE:
A brief introduction to internal architecture of micro-controller.
An over view of programming of micro-controller.
An overview on C language.
An overview on mechanical arrangement.
DTMF interfacing with micro-controller.
2.3 INTERFACES USED:
Serial communication used for downloading the hex code.
DTMF circuit interface.
L293D interfacing.
DC motor interfacing.
2.4 SOFTWARES USED:
A Cross compiler for compiling and linking the code written for ATmega16.
Serial communication software for downloading code to ATmega16.
Operating system: Windows XP.
2.5 CELL PHONE OPERATED ROBOT:
Conventionally, Wireless-controlled robots use of circuits, which have the drawbacks of
limited working range, limited frequency range and the limited control. Use of a mobile phone for
8
robotic control can overcome these limitations. It provides the advantage of robust control,
working range as large as the coverage area of the service provider, no interference with other
controllers and up to twelve controllers.
Although the appearance and the capabilities of robots vary vastly, all robots share the
feature of a mechanical, movable structure under some form of control. The Control of robot
involves three distinct phases: perception, processing and action. Generally, the preceptors are
sensors mounted on the robot , processing is done by the on-board micro-controller or processor,
and the task is performed using motors or with some other actuators.
Figure 2.5 cell phone operated robot
Courtesy: www. 8051 projects.net.com
2.6 OVERVIEW OF THE PROJECT
In this project the robot, is controlled by a mobile phone that makes call to the mobile phone
attached to the robot in the course of the call, if any button is pressed control Corresponding to
the button pressed is heard at the other end of the call. This tone is called dual tone multi
frequency tome (DTMF) robot receives this DTMF tone with
the help of phone stacked in the robot.
9
The received tone is processed by the atmega16 microcontroller with the help of DTMF
decoder MT8870 the decoder decodes the DTMF tone in to its equivalent binary digit and this
binary number is send to the microcontroller, the microcontroller is preprogrammed to take a
decision for any give input and outputs its decision to motor drivers in order to drive the motors
for forward or backward motion or a turn.
The mobile that makes a call to the mobile phone stacked in the robot acts as a remote. It does not
require the construction of receiver and transmitter units.
DTMF signaling is used for telephone signaling over the line in the voice _ frequency band
to the call switching center. The version of DTMF used for telephone dialing is known as touch
_tone .DTMF assigns a specific frequency (consisting of two separate tones) to each keys that it
can easily be identified by the electronic circuit.
CHAPTER-3
MICROCONTROLLER
10
3.1 INTRODUCTION TO AVR :
The AVR is a Modified Harvard architecture 8-bit RISC single chip microcontroller
(µC) which was developed by Atmel in 1996. The AVR was one of the first microcontroller
families to use on-chip flash memory for program storage, as opposed to One-Time
Programmable ROM, EPROM, or EEPROM used by other microcontrollers at the time.
ATmega16 is one of the basic family of AVR microcontroller. The Atmel ATmega16 is a
register-based architecture.
3.1.1 REDUCED INSTRUCTION SET COMPUTER:
A RISC processor is equipped with a complement of very simple and efficient basic
operations. The Atmel ATmega16 is equipped with 131 RISC-type instructions. Most can be
executed in a single clock cycle. The Atmel ATmega16 is equipped with 32 general purpose 8-
bit registers that aretightly coupled to the processor’s arithmetic logic unit within the CPU.
Also, the processor isdesigned following the Harvard Architecture format. The register-based
Harvard Architecture coupled with the RISC-based instruction set allows for fast and efficient
program execution and allows the processor to complete an assembly language instruction every
clock cycle. Atmel indicates the ATmega16 can execute 16 million instructions per second when
operating at a clock speed of 16 MHz.
3.1.2 ASSEMBLY LANGUAGE INSTRUCTION SET COMPUTER: An instruction set is a group of instructions a machine ‘‘understands’’ to execute. A
large number of instructions provide flexibility but require more complex hardware. Thus, an
instruction set is unique for a given hardware and cannot be used with another hardware
configuration. Atmel has equipped the ATmega16 with 131 different instructions.
We will program the Atmel ATmega16 using the C language. The C programming language
allows for direct control of microcontroller hardware at the register level while being portable to
other microcontrollers in the AVR line.
3.2 BLOCK DIAGRAM OF ATMEGA16:
11
Figure 3.2 Internal architecture of AVR ATmega 16
Courtesy: www.alldatasheets.com
ATmega16 has external connections for power supplies (VCC, GND, AVCC, and AREF),
an external time base (XTAL1 and XTAL2) input pins to drive its clocks, processor reset
(active low RESET), and four 8-bit ports (PA0-PA7, PC0-PC7,PB0-PB7, and PD0-PD7), which
are used to interact with the external world. These ports may be used as general purpose digital
input/output (I/O) ports or they may be used for the alternate functions. The ports are
12
interconnected with the ATmega16’s CPU and internal subsystems via an internal bus. The
ATmega16 also contains a timer subsystem, an analog-to-digital converter (ADC), an interrupt
subsystem, memory components, and a communication subsystem.
3.2.1 NON-VOLATILE AND DATA MEMORIES:
The ATmega16 is equipped with three main memory sections: flash electrically erasable
programmable read-only memory (EEPROM), static random access memory (SRAM), and byte
addressable EEPROM for data storage.
3.2.2 IN-SYSTEM PROGRAMMABLE FLASH EEPROM:
Bulk programmable flash EEPROM is used to store programs. It can be erased and
programmed as a single unit. Flash EEPROM is nonvolatile, meaning memory contents are
retained when microcontroller power is lost. The ATmega16 is equipped with 16K bytes of
onboard reprogrammable flash memory. This memory component is organized into 8K locations,
with 16 bits at each location. The flash EEPROM is in-system programmable. In-system
programmability means the microcontroller can be programmed while resident within a circuit.
It does not have to be removed from the circuit for programming. Instead, a host personal
computer (PC) connected via a cable to a microcontroller downloads the program to the
microcontroller. Alternately, the microcontroller can be programmed outside its resident circuit
using a flash programmer board.
3.2.3 BYTE ADDRESSABLE EEPROM:
Byte-addressable memory is used to permanently store and recall variables during
program execution. It is nonvolatile. It is especially useful for logging system malfunctions and
fault data during program execution. It is also useful for storing data that must be retained during
a power failure but might need to be changed periodically. Examples where this type of memory
is used are found in applications to store system parameters, electronic lock combinations, and
automatic garage door electronic unlock sequences. The ATmega16 is equipped with 512 bytes of
EEPROM.
3.2.4 STATIC RANDOM ACCESS MEMORY:
SRAM is volatile. That is, if the microcontroller loses power, the contents of SRAM
memory are lost. It can be written to and read from during program execution. The ATmega16 is
13
equipped with 1000 bytes (actually 1120) of SRAM. A small portion (96 locations) of the
SRAM is set aside for the general-purpose registers used by the CPU and also for the I/O and
peripheral subsystems aboard the microcontroller.
3.2.5 PROGRAMMABLE LOCK BITS:
To provide for memory security from tampering, the ATmega16 is equipped with six
memory lock bits. These lock bits are programmed using the Atmel STK500 programming board.
The lock bits may be configured for the following options:
• No memory lock features enabled.
• No further programming of memory is allowed using parallel or serial programming
techniques.
• No further programming or verification of memory is allowed using parallel or serial
programming techniques.
3.3 AVR FEATURES:
• High-performance, Low-power AVR® 8-bit Microcontroller
• Advanced RISC Architecture
– 131 Powerful Instructions – Most Single-clock Cycle Execution
– 32 x 8 General Purpose Working Registers
– Fully Static Operation
– Up to 16 MIPS Throughput at 16 MHz
– On-chip 2-cycle Multiplier
• Nonvolatile Program and Data Memories
– 16K Bytes of In-System Self-Programmable Flash
Endurance: 10,000 Write/Erase Cycles
– Optional Boot Code Section with Independent Lock Bits
In-System Programming by On-chip Boot Program
True Read-While-Write Operation
– 512 Bytes EEPROM
Endurance: 100,000 Write/Erase Cycles
– 1K Byte Internal SRAM
– Programming Lock for Software Security
• JTAG (IEEE std. 1149.1 Compliant) Interface
– Boundary-scan Capabilities According to the JTAG Standard
– Extensive On-chip Debug Support
14
– Programming of Flash, EEPROM, Fuses, and Lock Bits through the JTAG Interface
• Peripheral Features
– Two 8-bit Timer/Counters with Separate Prescalers and Compare Modes
– One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture
Mode
– Real Time Counter with Separate Oscillator
– Four PWM Channels
– 8-channel, 10-bit ADC
8 Single-ended Channels
7 Differential Channels in TQFP Package Only
2 Differential Channels with Programmable Gain at 1x, 10x, or 200x
– Byte-oriented Two-wire Serial Interface
– Programmable Serial USART
– Master/Slave SPI Serial Interface
– Programmable Watchdog Timer with Separate On-chip Oscillator
On-chip Analog Comparator
• Special Microcontroller Features
– Power-on Reset and Programmable Brown-out Detection
– Internal Calibrated RC Oscillator
– External and Internal Interrupt Sources
– Six Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, Standby
and Extended Standby
• I/O and Packages
– 32 Programmable I/O Lines
– 40-pin PDIP, 44-lead TQFP, and 44-pad MLF
• Operating Voltages
– 2.7 - 5.5V for ATmega16L
– 4.5 - 5.5V for ATmega16
• Speed Grades
– 0 - 8 MHz for ATmega16L
– 0 - 16 MHz for ATmega16L
3.4 PORT SYSTEM:
15
The Atmel ATmega16 is equipped with four 8-bit general-purpose, digital I/O ports
designated PORTA, PORTB, PORTC, and PORTD.
• Data Register (PORTx)---used to write output data to the port,
Data Direction Register (DDRx)---used to set a specific port pin to either output (1) or
input (0), and
• Input Pin Address (PINx)---used to read input data from the port
If selected for input, the pin may be selected for either an input pin or to operate in the
high-impedance (Hi-Z) mode. In Hi-Z mode, the input appears as high impedance to a particular
pin. If selected for output, the pin may be further configured for either logic low or logic high.
Port pins are usually configured at the beginning of a program for either input or output, and their
initial values are then set. Usually, all eight pins for a given port are configured simultaneously.
A code example is provided below to show how ports are configured. The data direction
register (DDRx) is first used to set the pins as either input or output, and then the data register
(PORTx) is used to set the initial value of the output port pins.
//***************************************************************
//initialize_ports: provides initial configuration for I/O ports
//***************************************************************
void initialize_ports(void)
{
DDRA=0xfc; //set PORTA[7:2] as output, PORTA[1:0]
//as input (1111_1100)
PORTA=0x03; //initialize PORTA[7:2] low, PORTA[1:0]
//current source
DDRB=0xa0; //PORTB[7:4] as output, set PORTB[3:0] as input
PORTB=0x00; //disable PORTB pull-up resistors
DDRC=0xff; //set PORTC as output
PORTC=0x00; //initialize low
DDRD=0xff; //set PORTD as output
PORTD=0x00; //initialize low
}To read the value from a port pin configured as input, the following code could be used.The
variable used to read the value from the input pins is declared as an unsigned char because both
the port and this variable type are 8 bits wide.
unsigned char new_PORTB; //new values of PORTB
:
16
:
new_PORTB = PINB; //read PORTB
3.5 PERIPHERAL FEATURES---INTERNAL SUBSYSTEMS:
3.5.1 TIME BASE:
The microcontroller is a complex synchronous state machine. It responds to program steps
in a sequential manner as dictated by a user-written program. The microcontroller sequences
through a predictable fetch--decode--execute sequence.
The speed at which a microcontroller sequences through these actions is controlled by a
precise time base called the clock. The clock source is routed throughout the microcontroller to
provide a time base for all peripheral subsystems. The ATmega16 may be clocked internally,
using a user-selectable resistor capacitor (RC) time base, or externally. The RC internal time base
is selected using programmable fuse bits.
3.5.2 TIMING SUBSYSTEM:
The ATmega16 is equipped with a complement of timers that allows the user to generate a
precision output signal, measure the characteristics (period, duty cycle, frequency) of an incoming
digital signal, or count external events. Specifically, the ATmega16 is equipped with two 8-bit
timer/counters and one 16-bit counter.
3.5.3 PULSE WIDTH MODULATION CHANNELS:
A pulse width modulated, or PWM, signal is characterized by a fixed frequency and a
varying duty cycle. Duty cycle is the percentage of time a repetitive signal is logic high during the
signal period. It may be formally expressed as
duty cycle (%)=(on time/period)× (100%).
The ATmega16 is equipped with four PWM channels. The PWM channels coupled with the
flexibility of dividing the time base down to different PWM subsystem clock source frequencies
allows the user to generate a wide variety of PWM signals, from relatively high-frequency, low-
duty cycle signals to relatively low-frequency, high-duty cycle signals.
PWMsignals are used in a wide variety of applications, including controlling the position
of a servo motor and controlling the speed of a DC motor.
3.5.4 SPEED GRADES:
17
The ATmega16 is available at two different speed grades. The ATmega16L operates
from 0 to 8MHz, whereas the ATmega16 operates from 0 to 16MHz. As previously discussed, the
operating speed of the microcontroller is set by the time base chosen for the processor. One might
believe that faster microcontroller operation is always better. This is not the case. The system
designer must determine the minimum practical speed of microcontroller operation for a given
application. The microcontroller’s power consumption is directly related to operating speed. That
is, the faster the operating speed of the microcontroller, the higher its power consumption. This
becomes especially critical in portable, battery-operated embedded systems applications.
3.6 ATMEGA16 PIN CONFIGURATION:
a) Atmel AVR ATmega16 Pinout Diagram: (a) 40-pin plastic DIP
Figure 3.6 PIN diagram of AVR ATmega 16 controller
Courtesy: www.google.com
VCC: Digital supply voltage.
GND: Ground.
Port A (PA7..PA0) :
Port A serves as the analog inputs to the A/D Converter. Port A also serves as an 8-bit bi-
directional I/O port, if the A/D Converter is not used. Port pins can provide internal pull-up
resistors (selected for each bit). The Port A output Buffers have symmetrical drive characteristics
18
with both high sink and source capability. When pins PA0 to PA7 are used as inputs and are
externally pulled low, they will source current if the internal pull-up resistors are activated. The
Port A pins are tri-stated when a reset condition becomes active, even if the clock is not running.
Port B (PB7..PB0):
Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each
bit). The Port B output buffers have symmetrical drive characteristics with both high sink and
source capability. As inputs, Port B pins that are externally pulled low will source current if the
pull-up resistors are activated. The Port B pins are tri-stated when a reset condition becomes
active, even if the clock is not running.
Port C (PC7..PC0):
Port C is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each
bit).The Port C output buffers has symmetrical drive characteristics with both high sink and
source capabilities. As inputs, Port C pins that are externally pulled low will source current if the
pull-up resistors are activated. The Port C pins are tri-stated when a reset condition becomes
active, even if the clock is not running. If the JTAG interface is enabled, the pull-up resistors on
pins PC5 (TDI), PC3 (TMS) and PC2 (TCK) will be activated even if a reset occurs.
Port D (PD7..PD0):
Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each
bit). The Port D output buffers have symmetrical drive characteristics with both high sink and
source capability.As inputs, Port D pins that are externally pulled low will source current if the
pull-up resistors are activated. The Port D pins are tri-stated when a reset condition becomes
active, even if the clock is not running.
RESET:
Reset Input. A low level on this pin for longer than the minimum pulse length will
generate a reset, even if the clock is not running.
XTAL1:
Input to the inverting Oscillator amplifier and input to the internal clock operating circuit.
XTAL2: Output from the inverting Oscillator amplifier.
AVCC: AVCC is the supply voltage pin for Port A and the A/D Converter. It should be
externally connected to VCC, even if the ADC is not used. If the ADC is used, it should be
connected to VCC through a low-pass filter.
AREF: AREF is the analog reference pin for the A/D Converter.
19
3.7 AVR DATA MEMORIES:
The AVR architecture has two main memory spaces, the Data Memory and the
Program Memory space. In addition, the ATmega16 features an EEPROM Memory for data
storage. All three mem- ory spaces are linear and regular.
3.7.1 IN-SYSTEM REPROGRAMMABLE FLASH PROGRAM MEMORY:
The ATmega16 contains 16K bytes On-chip In-System Reprogrammable Flash memory
for program storage. Since all AVR instructions are 16 or 32 bits wide, the Flash is orga- nized
as 8K x 16. For software security, the Flash Program memory space is divided into two sections,
Boot Program section and Application Program section.
The Flash memory has an endurance of at least 10,000 write/erase cycles. The
ATmega16 Program Counter (PC) is 13 bits wide, thus addressing the 8K program memory
locations. The operation of Boot Program section and associated Boot Lock bits for software
protection are described in detail in “Boot Loader Support – Read- While-Write Self-
Programming” on page 241. “Memory Programming” on page 254 con- tains a detailed
description on Flash data serial downloading using the SPI pins or the JTAG interface.
3.7.2 SRAM DATA MEMORY:
The direct addressing reaches the entire data space.The Indirect with Displacement mode
reaches 63 address locations from the base address given by the Y- or Z-register. When using
register indirect addressing modes with automatic pre-decrement and post- increment, the address
registers X, Y, and Z are decremented or incremented. The 32 general purpose working registers,
64 I/O Registers, and the 1024 bytes of internal data SRAM in the ATmega16 are all accessible
through all these addressing modes.
3.7.3 EEPROM DATA MEMORY:
The ATmega16 contains 512 bytes of data EEPROM memory. It is organized as a sep-rate
data space, in which single bytes can be read and written. The EEPROM has an endurance of at
least 100,000 write/erase cycles. The access between the EEPROM and the CPU is described in
the following, specifying the EEPROM Address Registers, the EEPROM Data Register, and the
EEPROM Control Register.
3.7.4 I/O MEMORY:
All ATmega16 I/Os and peripherals are placed in the I/O space. The I/O locations are
accessed by the IN and OUT instructions, transferring data between the 32 general pur- pose
working registers and the I/O space.
20
CHAPTER-4
SERIAL COMMUNICATION SYSTEM
4.1 SERIAL COMMUNICATIONS:
21
The ATmega16 is equipped with a host of different serial communication subsystems,
including the Universal Synchronous and Asynchronous Serial Receiver and Transmitter
(USART), the Serial Peripheral Interface (SPI), and the Two-Wire Serial Interface (TWI).
4.1.1 SERIAL USART:
The serial USART is used for full duplex (two-way) communication between a receiver
and transmitter. This is accomplished by equipping the ATmega16 with independent hardware for
the transmitter and receiver. The USART is typically used for asynchronous communication.
The ATmega16 USART is quite flexible. It has the capability to be set to a variety of data
Transmission rates known as the baud (bits per second) rate. The USART may also be set for data
bit widths of 5 to 9 bits with one or two stop bits. Furthermore, the ATmega16 is equipped with a
hardware-generated parity bit (even or odd) and parity check hardware at the receiver. A single
parity bit allows for the detection of a single bit error within a byte of data. The USART may also
be configured to operate in a synchronous mode.
4.1.2 SERIAL PERIPHERAL INTERFACE:
The ATmega16 SPI can also be used for two-way serial Communication between a
transmitter and a receiver. In the SPI system, the transmitter and receiver share a common clock
source. This requires an additional clock line between the transmitter and receiver but allows for
higher data transmission rates as compared with the USART.
4.1.3 TWO WIRE SERIAL INTERFACE:
The TWI subsystem allows the system designer to network a number of related devices
(microcontrollers, transducers, displays, memory storage, etc.) together into a system using a two-
wire interconnecting scheme. The TWI allows a maximum of 128 devices to be connected
together. Each device has its own unique address and may both transmit and receive over the two-
wire bus at frequencies up to 400 kHz. This allows the device to freely exchange information with
other devices in the network within a small area.
4.2 ASYNCHRONOUS VERSES SYNCHRONOUS SERIAL TRANSMISSION:
In serial communications, the transmitting and receiving device must be synchronized to
one another and use a common data rate and protocol. Synchronization allows both the transmitter
and receiver to be expecting data transmission/reception at the same time. There are two basic
methods of maintaining ‘‘sync’’ between the transmitter and receiver: asynchronous and
synchronous. In an asynchronous serial communication system, such as the USART aboard
theATmega16, framing bits are used at the beginning and end of a data byte. These framing bits
alert the receiver that an incoming data byte has arrived and also signals the completion of the
22
data byte reception. The data rate for an asynchronous serial system is typically much slower than
the synchronous
System, but it only requires a single wire between the transmitter and receiver.
A synchronous serial communication system maintains ‘‘sync’’ between the transmitter and
receiver by employing a common clock between the two devices. Data bits are sent and received
on the edge of the clock. This allows data transfer rates higher than with asynchronous techniques
but requires two lines, data and clock, to connect the receiver and transmitter.
4.2.1 BAUD RATE:
Data transmission rates are typically specified as a baud or bits per second rate. For
example, 9600 baud indicates data are being transferred at 9600 bits per second.
4.2.2 FULL DUPLEX:
Often, serial communication systems must both transmit and receive data. To do both
transmission and reception simultaneously requires separate hardware for transmission and
reception. A single duplex system has a single complement of hardware that must be switched
from transmission to reception configuration. A full duplex serial communication system has
separate hardware for Transmission and reception.
4.2.3 NON ZERO CODING FORMAT:
There are many different coding standards used within serial communications. The
important point is the transmitter and receiver must use a common coding standard so data may
be interpreted correctly at the receiving end. The Atmel ATmega16 [2] uses a nonreturn to zero
coding standard. In nonreturn to zero, coding logic 1 is signaled by a logic high during the entire
time slot allocated for a single bit, whereas a logic 0 is signaled by a logic low during the entire
time slot allocated for a single bit.
4.2.4 RS-232 COMMUNICATION PROTOCOL:
When serial transmission occurs over a long distance, additional techniques may be used
to ensure data integrity. Over long distances, logic levels degrade and may be corrupted by noise.
At the receiving end, it is difficult to discern logic high from a logic low. The RS-232 standard
has been around for some time. With the RS-232 standard (EIA-232), logic 1 is represented with
a −12-VDC level, whereas logic 0 is represented by a +12-VDC level. Chips are commonly
available (e.g., MAX232) that convert the 5- and 0-V output levels from a transmitter to RS-232-
Compatible levels and convert back to 5- and 0-V levels at the receiver.
4.3 USART CLOCK GENERATOR:
23
The USART Clock Generator provides the clock source for the USART system and sets
the baud rate for the USART. The baud rate is derived from the overall microcontroller clock
source. The overall system clock is divided by the USART baud rate registers UBRR [H: L] and
several additional dividers to set the baud rate. For the asynchronous normal mode (U2X bit = 0),
the baud rate is determined using the following expression:
Baud rate= (system clock frequency)/(2(UBRR + 1)), Where UBRR is the content of the
UBRRH and UBRRL registers (0--4095). Solving for UBRRyields UBRR= ((system clock
generator)/ (16 × baud rate))- 1
4.3.1 USART TRANSMITTER:
The USART transmitter consists of a Transmit Shift Register.The data to be transmitted are
loaded into the Transmit Shift Register via the USART I/O Data Register (UDR). The start and
stop framing bits are automatically appended to the data within the Transmit Shift Register. The
parity is automatically calculated and appended to the Transmit Shift Register. Data are then
shifted out of the Transmit Shift Register via the TxD pin a single bit at a time at the established
baud rate. The USART transmitter is equipped with two status flags: the USART Data Register
Empty (UDRE) and the transmit complete (TXC) flags. The UDRE flag sets when the transmit
buffer is empty, indicating it is ready to receive new data. This bit should be written to a zero
when writing the USART Control and Status Register A (UCSRA). The UDRE bit is cleared by
writing to the UDR. The TXC flag bit is set to logic 1 when the entire frame in the Transmit Shift
Register has been shifted out and there are no new data currently present in the transmit buffer.
The TXC bit may be reset by writing a logic 1 to it.
4.3.2 USART RECEIVER:
The USART Receiver is virtually identical to the USART Transmitter except for the
direction of the data flow, which is reversed. Data are received a single bit at a time via the RxD
pin at the established baud rate. The USART receiver is equipped with the receive complete
(RXC) flag. The RXC flag is logic 1 when unread data exist in the receive buffer.
24
4.3.3CIRCUIT DIAGRAM:
Figur 4.3.3 schamatic diagram of land rover
Courtesy:www.efy.com
25
CHAPTER-5
POWER SUPPLY
5.1 Introduction:
Any invention of latest technology cannot be activated without the source of power. So in
this fast moving world we deliberately need a proper power source which will be apt for a
particular requirement. All the electronic components starting from diode to IC’s only work with
a DC supply ranging from 5V to 12V.We are utilizing for the same, the cheapest and commonly
available energy source of 230V-50Hz and stepping down, rectifying, filtering and regulating the
voltage. . Microcontroller operates at +5v DC and also for other ICs and displays. A 220v ac to
12-0-12v transformer is used and for rectification, four diodes IN4007 are connected for
rectification of the step down ac supply. Filter capacitor of 1000Uf is used. It is regulated to +5v
using a regulator 7805. 0.1 UF capacitor is used for filtration of high frequency noise. The power
supply circuit is shown below.
5.2 DESCRIPTION:
5.2.1 Transformer:
A bridge rectifier coupled with a step down transformer is used for our design. The
voltage rating of transformer used is 0-12V and the current rating is 500mA. When AC voltage of
230V is applied across the primary winding an output AC voltage of 12V is obtained. One
alteration of input causes the top of transformer to be positive and the bottom negative. The next
alteration will temporarily cause the reverse.
5.2.2 Rectifier:
In the power supply unit, rectification is normally achieved using a solid state diode.
Diode has the property that will let the electron flow easily at one direction at proper
26
Figure5.2.2 Figure5.2.2 POWER SUPPLY CIRCIUT POWER SUPPLY CIRCIUT Courtesy:www.google.com
biasing condition. Bridge rectifiers of 4 diodes are used to achieve full wave rectification. Two
diodes will conduct during the negative cycle and the other two will conduct during the positive
half cycle.
5.2.3 Filtering unit:
Filter circuit which is usually a capacitor acts as a surge arrester always follows the
rectifier unit. This capacitor is also called as a decoupling capacitor or a bypass capacitor, is used
not only to short the ripple with frequency to ground but also leave the frequency of the DC to
appear at the output.
5.2.4 Regulators:
The voltage regulators play an important role in any power supply unit. The primary purpose
of a regulator is to aid the rectifier and filter circuit in providing a constant DC voltage to the
device. Power supplies without regulators have an inherent problem of changing DC voltage
values due to variations in the load or due to fluctuations in the AC line voltage. With a regulator
connected to DC output, the voltage can be maintained within a close tolerant region of the
desired output. IC 7805 and 7812 regulators are used in this project for providing a DC voltage of
+5V and +12V respectively.
5.2.5 Technical Details:
27
Transformer: 230/12 volts step down transformer, 1 ampere
Diodes : IN 4007
Voltage regulators : 78L Series 7812: The 7812 supplies 12 volts at 2 amp
maximum with an input of 13-25 volts
7805 : The 7805 supplies 5 volts at 1 amp maximum with an input of 7-25 volts
Electrolytic Capacitors : 100pF, 330pF and 100µF, power rating of 25V.
5.2.6 Features:
Gives a well regulated +12V and +5V output voltages
Built in overheating protection shuts down output when regulator IC gets too hot.
Very stable output voltages, reliable operation
The circuit has overload and thermal protection.
CHAPTER-6
28
DTMF DECODER
6.1 INTRODUCTION:
Dual-tone multi-frequency (DTMF) signaling is used for telephone signaling over the line
in the voice-frequency band to the call switching center. The version of DTMF used for telephone
tone dialing is known by the trademarked term Touch-Tone, and is standardized by ITU-T
Recommendation Q.23. Other multi-frequency systems are used for signaling internal to the
telephone network
6.2 HISTORY:
In the time preceding the development of DTMF, telephone systems employed a system
commonly referred to as pulse (Dial Pulse or DP in the USA) or loop disconnect (LD) signaling
to dial numbers, which functions by rapidly disconnecting and connecting the calling party's
telephone line, similar to flicking a light switch on and off. The repeated connection and
disconnection, as the dial spins, sounds like a series of clicks. The exchange equipment counts
those clicks or dial pulses to determine the called number. Loop disconnect range was restricted
by telegraphic distortion and other technical problems, and placing calls over longer distances
required either operator assistance (operators used an earlier kind of multi-frequency dial) or the
provision of subscriber trunk dialing equipment.
DTMF was developed at Bell Labs in order to allow dialing signals to dial long-distance
numbers, potentially over nonwire links such as microwave radio relay links or satellites. For a
few non crossbar offices, encoder/decoders were added that would convert the older pulse signals
into DTMF tones and play them down the line to the remote end office. At the remote site another
encoder/decoder could decode the tones and perform pulse dialing, for example Strowger
switches. It was as if you were connected directly to that end office, yet the signaling would work
over any sort of link. This idea of using the existing network for signaling as well as the message
is known as in-band signaling.
It was clear even in the late 1950s when DTMF was being developed that the future of
switching lay in electronic switches, as opposed to the electromechanical crossbar systems then in
use. Either switching system could use either dial system, but DTMF promised shorter holding
times, which was more important in the larger and more complex registers used in crossbar
systems. In this case pulse dialing made no sense at any point in the circuit, and plans were made
to roll DTMF out to end users as soon as possible. Tests of the system occurred in the early
29
1960s, where DTMF became known as Touch Tone. Though Touch Tone phones were already in
use in a few places, they were vigorously promoted at the 1964 New York World's Fair.
The Touch Tone system also introduced a standardized keypad layout. After testing 18
different layouts, they eventually chose the one familiar to us today, with 1 in the upper-left and 0
at the bottom. The adding-machine layout, with 1 in the lower-left was also tried, but at that time
few people used adding machines, and having the 1 at the "start" (in European language reading
order) led to fewer typing errors. In retrospect, many people consider that this was a mistake.
With the widespread introduction of computers and bank machines, the phone keyboard has
become "oddball", causing mistakes.
In another sense, DTMF was obsolete a decade after it was instituted, as FSK methods
with fewer frequencies became cheaper, faster and more reliable. However, the technical
complexities of digital filtering were more expensive to deal with than junking an adequate
system.
#, *, A, B, C, and D
The engineers had envisioned phones being used to access computers, and surveyed a
number of companies to see what they would need for this role. This led to the addition of the
number sign (#) and star (*) keys (also known as Humphries),[citation needed] as well as a group
of keys for menu selection: A, B, C and D. In the end, the lettered keys were dropped from most
phones, and it was many years before the Humphries became widely used for vertical service
codes such as *67 in the United States and Canada to suppress caller ID.
Public payphones that accept credit cards use these additional codes to send the information from
the magnetic strip.
The U.S. military also used the letters, relabeled, in their now defunct Autovon phone
system. Here they were used before dialing the phone in order to give some calls priority, cutting
in over existing calls if need be. The idea was to allow important traffic to get through every time.
The levels of priority available were Flash Override (A), Flash (B), Immediate (C), and Priority
(D), with Flash Override being the highest priority. Pressing one of these keys gave your call
priority, overriding other conversations on the network. Pressing C, Immediate, before dialing
would make the switch first look for any free lines, and if all lines were in use, it would
disconnect any non-priority calls, and then any priority calls. Flash Override will kick every other
call off the trunks between the origin and destination. Consequently, it is limited to the White
House Communications Agency. Precedence dialing is still done on the military phone networks,
30
but using number combinations (Example: Entering 93 before a number is a priority call) rather
than the separate tones.
Present-day uses of the A, B, C and D keys on telephone networks are few, and exclusive
to network control. For example, the A key is used on some networks to cycle through different
carriers at will (thereby listening in on calls). Their use is probably prohibited by most carriers.
The A, B, C and D tones are used in amateur radio phone patch and repeater operations to allow,
among other uses, control of the repeater while connected to an active phone line.
DTMF tones are also used by some cable television networks and radio networks to signal
the local cable company/network station to insert a local advertisement or station identification.
These tones were often heard during a station ID preceding a local ad inserts. Previously,
terrestrial television stations also used DTMF tones to shut off and turn on remote transmitters.
DTMF tones are also sometimes used in caller ID systems to transfer the caller ID
information, however in the USA only Bell 202 modulated FSK signaling is used to transfer the
data.
Keypad:
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 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 multifrequency. These tones are then decoded by the switching center to determine
which key was pressed.
DTMF keypad
Figur 6.2 DTMF keypad
courtesy:www.8051projects.net.com
6.3 MT 8870 DTMF decoder:
31
IC MT8870/KT3170 serves as DTMF decoder. This IC takes DTMF signal coming via
telephone line and converts that signal into respective BCD number. It uses same oscillator
frequency used in the remote section so same crystal oscillator with frequency of 3.85M Hz is
used in this IC.
Working of IC MT8870:
The MT-8870 is a full DTMF Receiver that integrates both band split filter and decoder
functions into a single 18-pin DIP. Its filter section uses switched capacitor technology for both
the high and low group filters and for dial tone rejection. Its 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 provision of an on-chip differential input amplifier, clock generator, and
latched tri-state interface bus. Minimal external components required include a low-cost 3.579545
MHz crystal, a timing resistor, and a timing capacitor. The MT-8870-02 can also inhibit the
decoding of fourth column digits.
MT-8870 operating functions include a band split filter that separates the high and low tones of
the received pair, and a digital decoder that verifies both the frequency and duration of the
received tones before passing the resulting 4-bit code to the output bus.
The low and high group tones are separated by applying the dual-tone signal to the inputs of two
6th order switched capacitor band pass filters with bandwidths that correspond to the bands
enclosing the low and high group tones.
Figure (F).Block diagram of IC MT8870
The filter also incorporates notches at 350 and 440 Hz, providing excellent dial tone
rejection. Each filter output is followed by a single-order switched capacitor section that smoothes
the signals prior to limiting. Signal limiting is performed by high gain comparators provided with
hysteresis to prevent detection of unwanted low-level signals and noise. The MT-8870 decoder
uses a digital counting technique to determine the frequencies of the limited tones and to verify
that they correspond to standard DTMF frequencies. When the detector recognizes the
simultaneous presence of two valid tones (known as signal condition), it raises the Early Steering
flag (ESt). Any subsequent loss of signal condition will cause Est. to fall. Before a decoded tone
pair is registered, the receiver checks for valid signal duration (referred to as character-
recognition-condition). This check is performed by an external RC time constant driven by ESt.
A short delay to allow the output latch to settle, the delayed steering output flag (StD) goes high,
signaling that a received tone pair has been registered. The contents of the
32
Figure 6.3 Internal architecture of MT8870 DTMF decoder Courtesy: www. alldasheets.com
output latch are made available on the 4-bit output bus by raising the three state control input
(OE) to logic high. Inhibit mode is enabled by a logic high input to pin 5 (INH). It inhibits the
detection of 1633 Hz. The output code will remain the same as the previous detected code. On the
M- 8870 models, this pin is tied to ground (logic low).The input arrangement of the MT-8870
provides a differential input operational amplifier as well as a bias source (VREF) to bias the
inputs at mid-rail. Provision is made for connection of a feedback resistor to the op-amp output
(GS) for gain adjustment. The internal clock circuit is completed with the addition of a standard
3.579545 MHz crystal. The input arrangement of the MT-8870 provides a differential input
operational amplifier as well as a bias source (VREF) to bias the inputs at mid-rail. Provision is
made for connection of a feedback resistor to the op-amp output (GS) for gain adjustment. The
internal clock circuit is completed with the addition of a standard 3.579545 MHz crystal.
6.4 DTMF decoder:
IC MT8870/KT3170 serves as DTMF decoder.
This IC takes DTMF signal coming via telephone line and converts that signal into respective
BCD number.
It uses same oscillator frequency used in the remote section so same crystal oscillator with
frequency of 3.85M Hz is used in this IC.
33
6.4.1 Working of IC MT8870:
The MT-8870 is a full DTMF Receiver that integrates both band split filter and decoder functions
into a single 18-pin DIP. Its filter section uses switched capacitor technology for both the high
and low group filters and for dial tone rejection. its decoder uses digital counting techniques to
detect and decode all 16 DTMF tone pairs into a 4-bit code. To reject common-mode noise
signals, a balanced differential amplifier input is used .The internal clock circuit is completed
with the addition of a standard 3.5795MHZ crystal oscillator The input arrangement of the MT-
8870 provides a differential input operational amplifier as well as a bias source (VREF) to bias
the inputs at mid-rail. Provision is made for connection of a feedback resistor to the op-amp
output (GS) for gain adjustment.
Frequency 1209HZ 1336HZ 1477HZ 1633HZ
697HZ 1 2 3 A
770HZ 4 5 6 B
852HZ 7 8 9 C
741HZ * 0 # D
Table 6.4.1 keypad frequency
6.5 DTMF data output: Table6.5 DTMF data output
Low group High group Digit D3 D2 D1 D0
697 1209 1 0 0 0 1
697 1336 2 0 0 1 0
697 1477 3 0 0 1 1
770 1209 4 0 1 0 0
770 1336 5 0 1 0 1
770 1477 6 0 1 1 0
852 1209 7 0 1 1 1
852 1336 8 1 0 0 0
852 1477 9 1 0 0 1
941 1209 0 1 0 1 0
941 1336 * 1 0 1 1
941 1477 # 1 1 0 0
697 1633 A 1 1 0 1
770 1633 B 1 1 1 0
852 1633 C 1 1 1 1
941 1633 D 0 0 0 0
34
CHAPTER-7
DC MOTORS
7.1 INTRODUCTION:
DC motors are widely used in industrial and consumer applications. In many cases,
absolute precision in movement is not an issue but precise speed control is. How ever there are
also applications that do require precise positioning. DC motors combined with feedback for
either position or speed are called Servo motors. As this feedback mechanism has an edge over
other closed loop systems when it comes to position control, we use DC motors in commissioning
the lift. Some more important features of DC motor that accentuates its implementation are
High output power relative to motor size and weight
High efficiency. Can approach 90% at light load conditions
High torque to inertia ratio. Can rapidly accelerate loads
Has reserve power and torque
Excellent speed control, Effective braking.
The last advantage is certainly subtle because, the motor though for short periods is used
frequently.
7.2 Types of DC Motors:
Depending upon the connection of the field circuit DC machines can be classified in to four
categories.
SHUNT WOUND
SERIES WOUND
COMPOUND WOUND
SEPARATELY EXITED
Considering the requirement of lift, we need high torque at low speeds as the elevator moves
vertically against gravity. So by observing our requirements, DC series motor becomes the best
choice for our application.
7.2.1 Working of DC Motor:
A brief account on the working of DC motor is described below. The DC motor has two
basic parts: the rotating part that is called the armature and the stationary part that includes coils
of wire called the field coils. The stationary part is also called the stator. The armature is made of
35
coils of wire wrapped around the core, and the core has an extended shaft that rotates on bearings.
The termination points are called the commutator, and this is where the brushes make electrical
contact to bring electrical current from the stationary part to the part rotating of the machine. As
the armature begins to move, the north pole of the armature comes closer to the south pole of the
field, and the south pole of the armature is coming closer to the north pole of the field. As the two
unlike poles near each other, they begin to attract. This attraction becomes stronger until the
North Pole moves directly in line with the field’s South Pole, and its South Pole moves directly in
line with field’s poles. When the opposite poles area at their strongest attraction, the armature will
be “locked up” and will resist further attempts to continue spinning. For the armature to continue
its rotation, the armature’s polarity must be switched. For this reason the armature must be a coil
and a set of commutator segments must be added to provide a means of making contact between
the rotating member and the stationary member. One commutator segment is provided for each
terminal of the magnetic coil. Since this armature has only one coil, it will have only two
terminals, so the commutator has two segments. Since the armature is now a coil of wire, it will
need DC current flowing through it to become magnetized. This presents another problem; since
the armature will be rotating, the DC voltage wires cannot be connected directly to the armature
coil. A stationary set of carbon brushes is used to make contact to the rotating armature. The
brushes ride on the commutator segments to make a contact so that current will flow through the
armature coil. This is a simple two pole motor that is used primarily for instructional purposes.
Since the motor has only two poles, the motor will operate rather roughly and not provide too
much torque. Additional field poles and armature poles must be added to the motor for it to
become useful for industry. Now as described earlier, the DC motor suits the lift applications, the
electrical working of the motor is given below.
7.2.2 DC Series Motor:
Where there is a wide variation in load or where the motor must start under a heavy load, series
motors have desirable features not found in shunt motors. The series wound motor is used where
high starting torque and varying speed is desired. The armature and the series field are connected
in series. With high armature and field currents, it has a very high starting torque and is well
suited for starting heavy loads.
36
Figur7.2.2 (a) DC MOTOR field poleFigur7.2.2 (a) DC MOTOR field pole Coutesy:www. google.com
Figur7.2.2 (b) DCMOTOR field windingFigur7.2.2 (b) DCMOTOR field winding
Courtesy:www.google.com
Notice that the series field is in series with the armature windings. When the motor is first started,
with the negligible effects of the counter EMF, current flow through the armature is high. Since
the armature and the series field are in series, the current in the armature is the same current
through the series winding.
37
Large current develops a very strong magnetic field and results in an extremely high torque,
Conversely, if the motor is operating at rated speed, the counter EMF will be very high, and the
current in the series field winding and armature is reduced proportionally .This means that the
series motor can develop a very high torque and respond to increase in loading (reductions in
armature RPM) rapidly. The series motor will continue to increase in speed as long as there is
more torque developed that is necessary to turn the load. This additional torque is called
acceleration torque.
When a series motor is heavily loaded, it slows and produces more torque. As the load is
removed, the motor increases in speed. If the load is suddenly removed from the series motor, the
accelerating torque is just enough to continue to increase the motor’s speed. The continuously
increasing speed can destroy motor.
7.2.3 Technical Specification:
Voltage: 12V DC
Speed : 30 rpm
Current:2 Amp
The motor is interfaced to the microcontroller through LM293D.
7.3 LM293D:
The L293D is an IC designed for driving individual’s loads, such as motors and solenoids
form logic signals. This IC is used for back emf protection and current amplification. The chip
has 4 push-pull channels, and each pair has an enabling input, and integral clamping (fly back)
diodes. Each channel can source or sink up to 600mA continuous current. A push-pull channel
consists of two transistors, a PNP and an NPN, in which the collectors and bases of the two
devices are connected. In this arrangement, when a logic-level signal is applied to common base,
one of the transistors will be saturated and the other cut-off. This arrangement allows the channel
to either source (push) or sink (pull) current from the common collector junction, hence the name
“push-pull” If two channels are used, a dc motor can be driven bi-directionally from the power
supply of single polarity. The L293D is a 4-channel push-pull driver chip with integral clamping
diodes. The chip needs +5V to operate and +Vs (the supply for the device to be driven by the
chip), where Vs must be between 5 and 36V (in this circuit Vs is +12V). The channels are
enabled by applying +5V to the enable 1 pin. If logic high is applied to pin2 (IN 1), pin3 (OUT 1)
will go high (to about 1.4V lower than Vs). If a logic low is applied to pin 2, pin 3 will go low (to
about 1.2V above ground). Pins 6 and 7 operate in like fashion.
38
Figure 7.3 PIN Diagram Of L293d IC Figure 7.3 PIN Diagram Of L293d IC Courtesy: www.google.com
Figure7.3 Internal architecture Of L293d IC Figure7.3 Internal architecture Of L293d IC
Courtesy:www.google.com
Pin 1 of the L293D is enable input for the channels 1 and 2. When pin 1 is taken to logic high, the
pair of the channels is “enabled”, meaning that they are made operational. Thus if a logic high is
39
applied to pin 2 (input 1), pin3 (output 1) will go high (to about 1.4V lower than Vs ) if a logic
low is applied to pin 2, pin 3 will go low (to about 1.2V above ground) when pin 1 is taken to
logic low, the two channels are “disabled” , which means that the outputs effectively disconnected
from the circuit.
Motor Operation Based On Driver
INPUT1/OUTPUT1 INPUT2/OUTPUT2 OPERATION
0 0 Motor will not move
1 0Motor moves in clockwise
Direction
0 1Motor moves in
anticlockwise Direction
1 1 Motor will not move
Table 7.3 L293d IC working table
In this way the DC motor is rotated in clockwise and anti clockwise direction so that the lift can
be moved from floor to floor in both directions.
7.3.1 Features:-
Output Current 1A per channel
Peak output current 2A per channel
Inhibit facility
High Noise Immunity
Separate Logic supply
Over –Temperature Protection
7.3.2Technical Details:-
Maximum Voltage Supply(VSS): 36V
Maximum Input Voltage(VC): 7V
Maximum Peak output current: 2A
Total Power Dissipation: 5W at 800C
Input Low Voltage: -0.3 to 1.5V
Input high voltage: 2.3 to 7V
Low Voltage Input Current :-10 µA
High Voltage Input current: 100 µA
40
CHAPTER-8
SOFTWARE
8.1 Software Configuration:
The Test bench software is provided below. The program contains the following sections:
• Comments
• Include Files: We have included the Image Craft ICCAVRinclude file for the ATmega16
(iom16v.h). This file provides the software link between the names of the ATmega16
hardware registers and the actual hardware locations. When a register is used by name in
the program, reference is made to the contents of that register.
• Function Prototypes
• Global Variables
• Main Program: We begin the main program by calling the function to initialize the ports
and then enter a continuous loop. Within the loop body, the ATmega16 monitors for a
status change on PORTB. When the user depresses one of the tact switches connected
to PORTB, a change of status is detected and the appropriate LED is illuminated on
PORTA.
• Function Definition
//*************************************************************
//file name: testbench.c
//function: provides test bench for ATMEL AVR ATmega16 controller
//target controller: ATMEL ATmega16
//
//ATMEL AVR ATmega16 Controller Pin Assignments
//Chip Port Function I/O Source/Dest Asserted Notes
//Pin 1 PB0 to active high RC debounced switch
//Pin 2 PB1 to active high RC debounced switch
//Pin 3 PB2 to active high RC debounced switch
//Pin 4 PB3 to active high RC debounced switch
//Pin 5 PB4 to active high RC debounced switch
//Pin 6 PB5 to active high RC debounced switch
//Pin 7 PB6 to active high RC debounced switch
//Pin 8 PB7 to active high RC debounced switch
//Pin 9 Reset
41
//Pin 10 VDD
//Pin 11 Gnd
//Pin 12 Resonator
//Pin 13 Resonator
//Pin 14 PD0 to tristate LED indicator
//Pin 15 PD1 to tristate LED indicator
//Pin 16 PD2 to tristate LED indicator
//Pin 17 PD3 to tristate LED indicator
//Pin 18 PD4 to tristate LED indicator
//Pin 19 PD5 to tristate LED indicator
//Pin 20 PD6 to tristate LED indicator
//Pin 21 PD7 to tristate LED indicator
//Pin 22 PC0
//Pin 23 PC1
//Pin 24 PC2
//Pin 25 PC3
//Pin 26 PC4
//Pin 27 PC5
//Pin 28 PC6
//Pin 29 PC7
//Pin 30 AVcc to VDD
//Pin 31 AGnd to Ground
//Pin 32 ARef to Vcc
//Pin 33 PA7
//Pin 34 PA6
//Pin 35 PA5
//Pin 36 PA4
//Pin 37 PA3
//Pin 38 PA2
//Pin 39 PA1
42
8.2 Programming the ATmega16:
Programming the ATmega16 requires several hardware and software tools. We briefly mention
required components here. Please refer to the manufacturer’s documentation for additional details.
Software tools: we use the Image Craft ICC AVR compiler. This is an excellent, user-friendly
compiler. There are other excellent compilers available. The compiler is used to translate the
source file (testbench.c) into machine language for loading into the ATmega16. We use Atmel’s
AVR Studio to load the machine code into the ATmega16
Hardware tools: We use Atmel’s STK500 AVR Flash MCU Starter Kit (STK500) for
Programming the ATmega16. The STK500 provides the interface hardware between the host PC
and the ATmega16 for machine code loading. The STK500 is equipped with a complement of
DIP sockets, which allows for programming all of the microcontrollers in the Atmel AVR line.
8.3 Programming Procedure:
In this section, we provide a step-by-step procedure to program the ATmega16 DIP using
theSTK500 AVR Flash MCU Starter Kit. It should be noted that theSTK500 will be used to
program the microcontroller, which will then be placed in the Testbenchcircuit.
1. Load AVR Studio
2. Ensure that the STK500 is powered down.
3. Connect the STK500
4. Insert the ATmega16 into the red 40-pin socket. Note the location of pin 1
5. Power up the STK500.
6. Start up AVR Studio on your PC.
7. Pop-up window ‘‘Welcome to AVR Studio’’ should appear. Close this window by clicking on
the ‘‘Cancel button.’’
8. Click on the ‘‘AVR icon.’’ It looks like the silhouette of an integrated circuit. It is on the
Second line of the toolbar about halfway across the screen.
9. This should bring up a STK500 pop-up window with six tabs (Program, Fuses, Lock bits,
Advanced, Board, and Auto). At the bottom of the Program tab window, verify that the
STK500 was auto detected. Troubleshoot as necessary to ensure STK500 was auto detected
by AVR Studio.
10. Set all tab settings:
43
{Program:
{Select device: ATmega16
{Programming mode: ISP, Erase Device Before Programming, VerifyDeviceAfter
Programming
{Flash: Input HEX files, Browse and find machine code file: yourfilename.hex
{ EEPROM: Input HEX file, Browse and find machine code file: your filename.
EEP
{Fuses: Set the following fuses
{Boot flash section size = 128
8.4 CODE:-
#include <mega16.h>
void main(void)
{
unsigned int k, h;
DDRA=0x00;
DDRD=0XFF;
while (1)
{
k =~PINA;
h=k
switch (h)
{
case 0x02:
{
PORTD=0x89; i.e forword ;
break;
}
case 0x08:
{
PORTD=0x86; i.e Backword ;
break;
44
}
case 0x04:
{
PORTD=0x85; i.e Left turn ;
break;
}
case 0x06:
{
PORTD=0x8A; i.e right turn ;
break;
}
case 0x05:
{
PORTD=0x00; i.e stop ;
break;
}
}
}
}
45
8.5 Flow Chart:
46
Start
Read the i/p from DTMF decoder (port 1)
If input = 2M1= FWDM2= FWD
Call Appropriate
Delay
If input = 8
If input = 5
If input = 4
If input = 6
M1= FWDM2= REV
M1= REVM2= FWD
M1= STOPM2= STOP
M1=REVM2= REV
Call Appropriate
Delay
Call Appropriate
Delay
Call Appropriate
Delay
Call Appropriate
Delay
CONCLUSION
The Project “CELL PHONE OPERATED LAND ROVER USING AVR
MICROCONTROLLER” is used to control the Robot in Remote areas also. Conventionally,
wireless-controlled robots use RF circuits, which have the drawbacks of limited working range,
limited frequency range and limited control. Use of a mobile phone for robotic control can
overcome these limitations. It provides the advantages of robust control, working range as large
as the coverage area of the service provider, no interference with other controllers and up to
twelve controls.
In this project, the robot is controlled by a mobile phone that makes a call to the mobile
phone attached to the robot. In the course of a call, if any button is pressed, a tone corresponding
to the button pressed is heard at the other end of the call. This tone is called ‘dual-tone multiple-
frequency’ (DTMF) tone. The robot perceives this DTMF tone with the help of the phone stacked
in the robot and operates. The proposed robo can further be extended by utilizing the 3G features
which can be used to monitor the robos action by simply making a call.
47
BIBLIOGRAPHY
Microcontroller Applications-2nd edition
Ajay Desmukh
Embedded systems architecture, programming and design-2nd edition
Tata McGraw hill publications Rajkamal
Website Referred :
www.mysunrise.ch/users/pfluery/avr- circuits.html
www.semiconductor.hitachi.com/products/pdf www.8051 projects.net.com www.google.com
48
Data sheets
49
50