2947_new

Upload: avinash-ranjan

Post on 14-Apr-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 2947_new

    1/57

    1

    PROJECT REPORT

    On

    VEHICLE SPEED CONTROL USING R.F. TECHNOLOGY

    Submitted in partial fulfillment of the requirementsFor the award of the degree of

    MASTER OF TECHNOLOGY

    in

    COMMUNICATION SYSTEMS

    OF

    SRM INSTITUTE OF SCIENCE AND TECHNOLOGY

    (DEEMED UNIVERSITY)

    by

    A.S. SURYA PRAKASH

    Reg No: 15704017

    Under the guidance of

    Ms.S.T.AARTHY, M.E.,

    (Lecturer, Department of Electronics and Communication Engineering)

    JUNE 2006

  • 7/30/2019 2947_new

    2/57

    DEPARTME

    NT OF

    ELECTRONICS AND

    COMMUNICATION

    ENGINEERING

    S.R.M.ENGINEERING

    COLLEGES.R.M. Nagar, Kattankulathur,Kancheepuram District 603 203.

  • 7/30/2019 2947_new

    3/57

    2

    CHAPTER I

    1.1 INTRODUCTION

    Intelligent instruments are used in every part of our lives. It wont take muchtime to realize that most of our tasks are being done by Electronics. They will perform

    one of the most complicated tasks that a person does in a day, that of driving a vehicle.

    As the days of manned driving are getting extremely numbered, so are those of

    traffic jams, dangerous and rough drivers and more importantly, accidents. According to

    Mr. Willie D. Jones in the IEEE SPECTRUM magazine (September 2001), a person dies

    in a car crash every second. Automation of the driving control of two-wheelers is one of

    the most vital needs of the hour. This technology can very well implement what was

    absent before, controlled lane driving.

    Considering the hazards of driving and their more pronounced effect on two

    wheelers our VEHICLE CONTROL SYSTEM is exactly what is required. These systems

    have been implemented in France, Japan & U.S.A. by many companies, but only for cars

    and mass transport networks. In those systems, the acceleration and brake controls are

    left to the driver while the micro-processor simply handles the steering and the collision

    detection mechanism. This system is superior in the sense that majority of the tasks

    related to driving are automated. The driver just has to sit back and enjoy the ride.

  • 7/30/2019 2947_new

    4/57

    3

    1.2 SYSTEM MODEL

    This is the basic system model of Smart Display and Control.

    Zone

    Status

    Vehicle Speed Control &

    Monitoring Unit

    Transmitting UnitDisplay

    School TransmittUnit

    LCDZone erSpeed 433.92Limit MHz

  • 7/30/2019 2947_new

    5/57

    30KM

    U Turn Transmitt MicrocontrReceiverAnnun

    ciSpeed er oller Unit433.92 ateLimit 433.92 MHz Buzzer40KM MHz

    Motor Unit SpeedControl

    Valve

    FIGURE 1.1: SYSTEM BLOCKDIAGRAM

    There are various blocks. The two major blocks are listed below

    Zone status transmitting unit.

    Vehicle speed control and monitoring unit.

  • 7/30/2019 2947_new

    6/57

    4

    1.2.1 Zone status transmitting unit

    This unit is fixed in sign boards at different locations. This gives the zone

    information. There are various zone information like

    1 School zone.

    2 U turn zone.

    3 High way zone.

    4 So on.

    Speed of the vehicle is controlled automatically according to the zone where the

    vehicle is located. Signal is transmitted from sign board at a frequency range of

    433.92 MHz

    1.2.2 Vehicle speed control and monitoring unit

    This unit is fixed in any vehicle. This unit receives the signal transmitted from

    the zone status transmitting unit. This unit consists of various blocks as mentioned

    below

    1 Receiver unit

    2 Transmitter unit

    3 Micro controller unit

    4 Display unit (LCD)

    5 Annunciate buzzer

    6 Motor unit

    7 Speed control valve

    The various hardware devices and its functions are mentioned in forthcoming

    chapters.

  • 7/30/2019 2947_new

    7/57

    5

    CHAPTER II

    SOFTWARE & HARDWARE MODULE DESCRIPTION

    2.1 RF Module (Radio Frequency)

    Radio Frequency, any frequency within the electromagnetic spectrum

    associated with radio wave propagation. When an RF current is supplied to an antenna,

    an electromagnetic field is created that then is able to propagate through space. Many

    wireless technologies are based on RF field propagation.

    (A) RECEIVERMODULE (B) TRANSMITTERMODULE

    FIGURE 2.1

    Radio Frequency 10 KHz to 300 GHz frequency range that can be used for

    wireless communication Radio Frequency. Also used generally to refer to the radio signal

    generated by the system transmitter, or to energy present from other sources that may be

  • 7/30/2019 2947_new

    8/57

    picked up by a wireless receiver. There are various application of RF (Radio Frequency).

    1 Wireless mouse, keyboard.

    2 Wireless data communication.

    3 Alarm and security systems.

    4 Home Automation, Remote control.

  • 7/30/2019 2947_new

    9/57

    6

    1 Automotive Telemetry.

    2 Intelligent sports equipment.

    3 Handheld terminals, Data loggers.

    4 Industrial telemetry and tele-communications.

    5 In-building environmental monitoring and control.

    6 High-end security and fire alarms.

    2.1.1 Transmitter

    The TWS-434 extremely small, and are excellent for applications requiring short-

    range RF remote controls. The transmitter module is only 1/3 the size of a standard

    postage stamp, and can easily be placed inside a small plastic enclosure.

    TWS-434: The transmitter output is up to

    approximately 400 foot (open area)

    outdoors. foot, and will go through most

    walls.

  • 7/30/2019 2947_new

    10/57

  • 7/30/2019 2947_new

    11/57

    8mW at 433.92MHz with a range of Indoors, the range is approximately 200

    F

    T

    The

    TWS-434

    transmitter

    accepts both

    linear and

    digital

    inputs, can

    operate from

    1.5 to 12

    Volts-DC, and makes

    building a miniature hand-

    held RF transmitter very

    easy. The TWS-434 is

    approximately 1/3 the size of

    a standard postage stamp.

  • 7/30/2019 2947_new

    12/57

    7

    FIGURE : 2.3 TWS-434 TRANSMITTERPIN DIAGRAM

  • 7/30/2019 2947_new

    13/57

    FIGURE : 2.4 TRANSMITTER-ENCODER(HT12E) INTERFACE CIRCUIT

    2.1.2 Receiver

  • 7/30/2019 2947_new

    14/57

    8

    RWS-434: The receiver also operates at 433.92MHz, and has a sensitivity of

    3uV. The RWS-434 receiver operates from 4.5 to 5.5 volts-DC, and has both linear and

    digital outputs.

    FIGURE 2.5 : RECEIVERPIN OUT DIAGRAM

    2.1.3 Receiver application circuit

  • 7/30/2019 2947_new

    15/57

    FIGURE: 2.6 RECEIVER-DECODER(HT12D) INTERFACE CIRCUIT

    2.2 Antennas- WIRE WHIP

    The WC418 is made of 26 gauge

    carbon steel music wire that can be soldered

    to a PC board. This antenna has a plastic

    coated tip for safety and is 6.8 inches long,

    allowing

    .1 inch for insertion in a terminal or PC

    board.

  • 7/30/2019 2947_new

    16/57

    9

    FIGURE 2.7 : ANTENNA

    2.2.1 Antenna

    The following should help in achieving optimum antenna performance:

    1 Proximity to objects such a users hand or body, or metal objects will cause an

    antenna to detune. For this reason the antenna shaft and tip should be positioned

    as far away from such objects as possible.

    2 Optimum performance will be obtained from a 1/4 or 1/2 wave straight whip

    mounted at a right angle to the ground plane. A 1/4 wave antenna for 418 MHz is

    6.7 inches long.

    3 In many antenna designs, particularly 1/4 wave whips, the ground plane acts as a

    counterpoise, forming in essence, a 1/2 wave dipole. Adequate ground plane area

    will give maximum performance. As a general rule the ground plane to be used as

    counterpoise should have a surface area equal to or greater than the overall length

    of the 1/4 wave radiating element (2.6 X 2.6 inches for a 6.7 inch long antenna).

    4 Remove the antenna as far as possible from potential interference sources. Place

  • 7/30/2019 2947_new

    17/57

    adequate ground plane under all potential sources of noise.

  • 7/30/2019 2947_new

    18/57

    1

    0

    2.2 ATMEL AT89C51 Microcontroller

    The AT89C51 is a low power, high performance CMOS 8-bit microcontroller

    with 4Kbytes of Flash programmable and erasable read only memory (PEROM). This

    device is compatible with the industry standard 8051 instruction set and pinout. The on-

    chip Flash allows the program memory to be quickly reprogrammed using a nonvolatile

    memory programmer such as the PG302 (with the ADT87 adapter).By combining an

    industry standard 8-bit CPU with Flash on a monolithic chip.

    2.3.1 AT89C51 Microcontroller Pinout diagram

    The AT89C51 is a powerful microcontroller which provides a highly flexible and

    cost effective solution to many embedded control applications.

  • 7/30/2019 2947_new

    19/57

    FIGURE 2.8 : AT89C51 PINOUT.

  • 7/30/2019 2947_new

    20/57

    11

    The 8951 provides the following features:

    1~ 4 Kbytes of Flash

    2~ 128 bytes of RAM

    3~ 32 I/O lines4~ two16-bit timer/counters

    5~ Five vector, two-level interrupt architecture

    6~ full duplex serial port

    7~ On chip oscillator and clock circuitry

    In addition, the AT89C51 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 (PDM) saves the RAM contents but

    freezes the oscillator disabling all other chip functions until the next hardware reset.

    2.3.2 AT89C51 layout

  • 7/30/2019 2947_new

    21/57

    1

    2

  • 7/30/2019 2947_new

    22/57

    FIGURE 2.9 : BLOCKDIAGRAM OF AT89C51

    Figure 2.9 is the layout of AT89C51 Microcontroller. Pin details are discussed in

    chapter 2.3.3.

    2.3.3 Pin description

    VCC

  • 7/30/2019 2947_new

    23/57

    1

    3

    Supply voltage

    GND

    Ground

    Port 0

    Port 0 is dual-function in that it in some designs port 0s I/O lines are available to

    the developer to access external devices while in other designs it is used to access

    external memory. If the circuit requires external RAM or ROM, the microcontroller will

    automatically use port 0 to clock in/out the 8-bit data word as well as the low 8 bits of the

    address in response to a MOVX instruction and port 0 I/O lines may be used for otherfunctions as long as external RAM isnt being accessed at the same time. If the circuit

    requires external code memory, the microcontroller will automatically use the port 0 I/O

    lines to access each instruction that is to be executed.

    In this case, port 0 cannot be utilized for other purposes since the state of the I/O

    lines are constantly being modified to access external code memory. Note that there are

    no pull-up resistors on port 0, so it may be necessary to include your own pull-up

    resistors depending on the characteristics of the parts you will be driving via port 0.

    Port 1

    Port 1 consists of 8 I/O lines that you may use exclusively to interface to external

    parts. Unlike port 0, typical derivatives do not use port 1 for any functions themselves.

    Port 1 is commonly used to interface to external hardware such as LCDs, keypads, and

    other devices. With 8052 derivatives, two bits of port 1 are optionally used as described

    for extended timer 2 functions. These two lines are not assigned these special functions

    on 8051s since 8051s dont have a timer 2. Further, these lines can still be used for your

    own purposes if you dont need these features of timer 2.

    P1.0 (T2): If T2CON.1 is set (C/T2), then timer 2 will be incremented whenever

    there is a 1-0 transition on this line. With C/T2 set, P1.0 is the clock source for timer 2.

  • 7/30/2019 2947_new

    24/57

    1

    4

    P1.1 (T2EX): If timer 2 is in auto-reload mode and T2CON.3 (EXEN2) is set, a 1-0

    transition on this line will cause timer 2 to be reloaded with the auto-reload value. This

    will also cause the T2CON.6 (EXF2) external flag to be set, which may cause an interrupt

    if so enabled.

    Port 2

    Like port 0, port 2 is dual-function. In some circuit designs it is available for

    accessing devices while in others it is used to address external RAM or external code

    memory. When the MOVX @DPTR instruction is used, port 2 is used to output the high

    byte of the memory address that is to be accessed.

    In these cases, port 2 may be used to access other devices as long as the devices

    are not being accessed at the same time a MOVX instruction is using port 2 to address

    external RAM. If the circuit requires external code memory, the microcontroller will

    automatically use the port 2 I/O lines to access each instruction that is to be executed. In

    this case, port 2 cannot be utilized for other purposes since the state of the I/O lines are

    constantly being modified to access external code memory.

    Port 3

    Port 3 consists entirely of dual-function I/O lines. While the developer may

    access all these lines from their software by reading/writing to the P3 SFR, each pin has a

    pre-defined function that the microcontroller handles automatically when configured to

    do so and/or when necessary. P3.0 (RXD): The UART/serial port uses P3.0 as the receive

    line. In circuit designs that will be using the microcontrollers internal serial port, this is

    the line into which serial data will be clocked. Note that when interfacing an 8052 to anRS-232 port that you may not connect this line directly to the RS-232 pin; rather, you

    must pass it through a part such as the MAX232 to obtain the correct voltage levels. This

    pin is available for any use the developer may assign it if the circuit has no need to

    receive data via the integrated serial port.

  • 7/30/2019 2947_new

    25/57

    1

    5

    P3.1 (TXD): The UART/serial port uses P3.1 as the transmit line. In circuit

    designs that will be using the microcontrollers internal serial port, this is the line that the

    microcontroller will clock out all data which is written to the SBUF SFR. Note that when

    interfacing an 8052 to an RS-232 port that you may not connect this line directly to the

    RS-232 pin; rather, you must pass it through a part such as the MAX232 to obtain the

    correct voltage levels. This pin is available for any use the developer may assign it if the

    circuit has no need to transmit data via the integrated serial port.

    P3.2 (-INT0): When so configured, this line is used to trigger an External 0

    Interrupt. This may either be low-level triggered or may be triggered on a 1-0 transition.

    This pin is available for any use the developer may assign it if the circuit does not need totrigger an external 0 interrupt.

    P3.3 (-INT1): When so configured, this line is used to trigger an External 1

    Interrupt. This may either be low-level triggered or may be triggered on a 1-0 transition.

    This pin is available for any use the developer may assign it if the circuit does not need to

    trigger an external 1 interrupt.

    P3.4 (T0): When so configured, this line is used as the clock source for timer 0.

    Timer 0 will be incremented either every instruction cycle that T0 is high or every time

    there is a 1-0 transition on this line, depending on how the timer is configured. This pin is

    available for any use the developer may assign it if the circuit does not to control timer 0

    externally.

    P3.5 (T1): When so configured, this line is used as the clock source for timer 1.

    Timer 1 will be incremented either every instruction cycle that T1 is high or every time

    there is a 1-0 transition on this line, depending on how the timer is configured. Please see

    the chapter on timers for details. This pin is available for any use the developer may

    assign it if the circuit does not to control timer 1 externally.

  • 7/30/2019 2947_new

    26/57

    1

    6

    P3.6 (-WR): This is external memory write strobe line. This line will be asserted

    low by the microcontroller whenever a MOVX instruction writes to external RAM. This

    line should be connected to the RAMs write (-W) line. This pin is available for any use

    the developer may assign it if the circuit does not write to external RAM using MOVX.

    P3.7 (-RD): This is external memory write strobe line. This line will be asserted

    low by the microcontroller whenever a MOVX instruction writes to external RAM. This

    line should be connected to the RAMs write (-W) line. This pin is available for any use

    the developer may assign it if the circuit does not read from external RAM using MOVX.

    OSCILLATOR INPUTS (XTAL1, XTAL2)

    The 8052 is typically driven by a crystal connected to pins 18 (XTAL2)

    and 19 (XTAL1). Common crystal frequencies are 11.0592 MHz as well as 12 MHz,

    although many newer derivatives are capable of accepting frequencies as high as 40

    MHz. While a crystal is the normal clock source, this isnt necessarily the case. A TTL

    clock source may also be attached to XTAL1 and XTAL2 to provide the

    microcontrollers clock.

    RESET LINE (RST)

    Pin 9 is the master reset line for the microcontroller. When this pin is brought

    high for two instruction cycles, the microcontroller is effectively reset. SFRs, including

    the I/O ports, are restored to their default conditions and the program counter will be reset

    to 0000h. Keep in mind that Internal RAM is not affected by a reset. The microcontroller

    will begin executing code at 0000h when pin 9 returns to a low state.

  • 7/30/2019 2947_new

    27/57

    1

    7

    The reset line is often connected to a reset button/switch that the user may press

    to reset the circuit. It is also common to connect the reset line to a watchdog IC or a

    supervisor IC (such as MAX707). The latter is highly recommended for commercial and

    professional designs since traditional resistor-capacitor networks attached to the reset

    line, while often sufficient for students or hobbyists are not terribly reliable.

    ADDRESS LATCH ENABLE (ALE)

    The ALE at pin 30 is an output-only pin that is controlled entirely by the

    microcontroller and allows the microcontroller to multiplex the low-byte of a memory

    address and the 8-bit data itself on port 0. This is because, while the high-byte of thememory address is sent on port 2, port 0 is used both to send the low byte of the memory

    address and the data itself. This is accomplished by placing the low-byte of the address

    on port 0, exerting ALE high to latch the low-byte of the address into a latch IC (such as

    the 74HC573), and then placing the 8 data-bits on port 0. In this way the 8052 is able to

    output a 16-bit address and an 8-bit data word with 16 I/O lines instead of 24.

    The ALE line is used in this fashion both for accessing external RAM with MOVX

    @DPTR as well as for accessing instructions in external code memory. When your

    program is executed from external code memory, ALE will pulse at a rate of 1/6th that of

    the oscillator frequency. Thus if the oscillator is operating at 11.0592 MHz, ALE will

    pulse at a rate of 1,843,200 times per second. The only exception is when the MOVX

    instruction is executed one ALE pulse is missed in lieu of a pulse on WR or RD.

    PROGRAM STORE ENABLE (PSEN)

    The Program Store Enable (PSEN)

    line at pin 29 is exerted low automatically

    by the microcontroller whenever it accesses

    external code memory. This line should be

    attached to the Output Enable (OE) pin of

    the EPROM that contains your code

    memory.

  • 7/30/2019 2947_new

    28/57

    1

    8

    PSEN will not be exerted by the microcontroller and will remain in a high state if the

    program is being executed from internal code memory.

    EXTERNAL ACCESS (EA)

    The External Access (EA) line at pin 31 is used to determine whether the 8052

    will execute your program from external code memory or from internal code memory. If

    EA is tied high (connected to +5V) then the microcontroller will execute the program it

    finds in internal/on-chip code memory. If EA is tied low (to ground) then it will attempt

    to execute the program it finds in the attached external code memory EPROM. Of course,

    the EPROM must be properly connected for the microcontroller to be able to access the

    program in external code memory.

    Port Pins Alternate Functions

    P3.0 RXD(serial input port)

    P3.1 TXD(serial output port)

    P3.2 INT0(external interrupt o)

    P3.3 INT1(external interrupt 1)

    P3.4 T0(timer 0 external input)

    P3.5 T1(timer 1 external input)

    P3.6WR(external data memory writestrobe)

    P3.7 RD(external data memory read strobe)

    TABLE 2.1 : ALTERNATE FUNCTIONS OF I/O PORT 3

  • 7/30/2019 2947_new

    29/57

    1

    9

    2.4 Display Unit

    The LCD Module can easily be used with an 8051 microcontroller such as the

    AT89C51 included with the microcontroller beginner kit. The LCD Module comes with a

    16 pin connector.A type of display, usually numerical, used in electronic equipment. Dark

    characters are formed on a lighter background. Requires external back lighting to be

    visible under low-light conditions.

    One of the most popular output devices for embedded electronics is LCD. The

    LCD interface has become very simple. This is due to the availability modules for LCDs.

    The LCD along with necessary controller (LCD Controller) and mounting facility is

    made available in the module itself. The LCD controller takes care of everything

    necessary for the LCD. We communicate with the LCD controller with the help of a

    command set provided by the manufacturer.

    2.4.1 Liquid Crystal Display (LCD)

    Liquid Crystal Display is a type of display used especially in small portable electronic

    devices. This can be plugged into the breadboard as shown in figure 2.10.

  • 7/30/2019 2947_new

    30/57

    2

    0

    FIGURE 2.10 : LCD MODULE.

    The pins on the 16 pin connector of the LCD Module are defined in table 2.2. Thetable 2.2 also shows how to connect each pin to the AT89C51 microcontroller. To

    connect the LCD Module to a standard 40 pin AT89C51, use the pin names listed next

    page to find the correct pin number on the AT89C51 microcontroller.

    Connected to which Pin No of

    LCD Pin No Pin Detail AT89C51 Microcontroller

    1 Data line 6,18 (port 1.6)

    2 Data line 1,13 (port 1.1)

    3 Power (VDC) 5 vdc

    4Not

    Connected

    5 Display Adjust

    6 Data line 7,19 (port 1.7)

    7 Data line 2,14 (port 1.2)

    8 Ground

  • 7/30/2019 2947_new

    31/57

    9Not

    Connected

    10 Data line 3,15 (port 1.3)

    11 LCD Enable 8 (port3.4)

    12 Data line 4,16 (port 1.4)

    13 Data line

    0,1

    2 (port1.0)

    14 LCD R/W 6 (port3.2)

  • 7/30/2019 2947_new

    32/57

    2

    1

    15 Data line 5,17 (port1.5)

    16 LCD Reset 7 (port3.3)

    TABLE 2.2 : CONNECTION DETAILS FORDISPLAY CONTROL

    The basic AT89C51 configuration is shown in figure 2.11. Build this circuit and

    then you will be ready to add the LCD Module.

  • 7/30/2019 2947_new

    33/57

    FIGURE 2.11 : LCD INTERFACE WITH AT89C51 CIRCUIT

    In the above figure 2.11, LCD pins can be interfaced with corresponding

    Microcontroller pins as listed in table 2.2.

    2.5 Annunciate Buzzer

    The first step is to build the circuit.

    This design is intended for use with an

    Atmel 2051 programmable microcontroller

    (a 20 pin version of the 8951

    microcontroller). An

  • 7/30/2019 2947_new

    34/57

    2

    2

    8951 or 8052 can be substituted for the 2051 if the connections are made to the

    appropriate pins on those chips.

    2.5.1 Annunciate Buzzer circuit layout

    Vcc = 5V and Gnd = 0V

  • 7/30/2019 2947_new

    35/57

    FIGURE 2.12 : BUZZER CIRCUIT

    The basic process of compiling a program written in assembly language and then

    programming the resulting file into the microcontroller was covered in the first

    microcontroller tutorial. This project uses the same code as the first program. To start, we

    just make a minor change to the original assembly language program, ledtest.asm.

    Replace the line at the bottom that says ACALL DELAYHS with ACALL DELAYMS.

  • 7/30/2019 2947_new

    36/57

  • 7/30/2019 2947_new

    37/57

    FIGURE 2.13 : PULSE SIGNAL TO BUZZER.

  • 7/30/2019 2947_new

    38/57

    2

    4

    Lets start by determining what frequency the sounds.asm program is creating.

    First lets look at the DELAYMS routine. We need to figure out how long this routine

    lasts. By just looking at the code, we can figure out that it goes through a loop 255 times.

    Each time through the loop it does 3 commands. The first two commands each take 12

    clock cycles and the 3rd command (CJNE) takes 24 clock cycles. (You can find this out

    by looking for information on the commands in 2051arch.pdf). So each loop takes 48

    clock cycles. To translate this into time, we need to look at the clock speed of the

    microcontroller.

    An 11.0592 MHz crystal is used. This means the clock is running at a frequency

    of 11,059,200 cycles per second. (MHz is Megahertz which is million cycles per second).

    Each cycle takes 1/11,059,200 seconds = 0.00000009 seconds. So each loop takes 48 *

    0.00000009 = 0.00000434 seconds. And 255 loops takes 255*0.00000434 = 0.001106771

    seconds which is slightly longer than 1 millisecond (1 millisecond = 0.001 seconds). If

    we wanted to get closer to exactly 1ms we could change the loop so that it only repeats

    230 times rather than 255.

    So, the program makes the output go from 0 to 5 volts, and then waits 1ms, then

    goes from 5 volts to 0 volts, then waits 1 ms and that makes one cycle. So one cycle takes

    about 2 ms (This is called the period). To convert that to frequency, divide 1 cycle by 2

    ms (1/0.002 = 500). Then you get 500 cycles per second. Or to be exact using the

    numbers above, one cycle takes 2.213542 ms for a frequency of 451.76 Hz.

    So, to get an exact frequency, you can start with the frequency and work

    backwards. Say you want to make 440 Hz, which is a musical, A note. To find the period,

    divide 1 by 440. This gives you the period equal to 0.002272727 seconds. Then divide

    this by 2 to find out how long each delay must be (there will be 2 delays per cycle).

    Each delay should be 0.001136364. Then find out how many microcontroller

    clock cycles this is by dividing by 0.00000009. This equals 12626 cycles (after dropping

    the decimal part). Using our loop that takes 48 cycles, this would be about 263 loops

  • 7/30/2019 2947_new

    39/57

    2

    5

    (12626 / 48 = 263). We can only go up to 255 loops so then we can either make our loop

    take more time, or add in an extra DELAY routine that adds in the extra 8 loops. The

    easiest solution is to make our loop longer. We can add in an extra 12 cycles per loop by

    putting in a NOP (no operation) command. Then each loop is 60 cycles and we need

    about 210 loops (12626 / 60 = 210). The resulting code is shown in sound440.asm. That

    will not be exactly 440 Hz because we had to round off in some places (you can't do

    210.43 loops but 210 is close.

    To figure out exactly what frequency that we made, we can do the same as we did

    above with the DELAYMS routine. Each loop is 0.00000009 * 60 = 0.0000054 seconds.

    Each DELAYMS takes 210 * 0.0000054 = 0.001134 seconds. With 2 delays per cyclethis is a period of 0.002268. In terms of frequency, 1/0.002268 = 440.9 cycles per second

    which is close to 440.

    Note: To really be exactly right on the frequency you are making, you need to include the

    time in each cycle for the other commands, CPL, ACALL and RET, and the commands in

    the DELAYMS loop, MOV and RET. These add an extra 96 clock cycles each time

    through. Since it takes 2 times through to make a cycle on the output that is an extra 192

    cycles. This equals 192 * 0.00000009 = 0.00001728 seconds. So the period is actually

    0.002268 + 0.00001728 = 0.00228528 and the frequency is actually 437.6 M Hz. So this

    extra time must be considered if you are trying to get a very precise frequency.

    Note: You are limited in how close you can get to an exact frequency by the

    microcontroller clock speed. The faster the clock is, the more accurate you can be. For

    example, with an 11.0592 MHz clock where each cycle is 0.00000009 seconds, the

    closest you can get to 440 Hz is 440.0788621 Hz. This is found by 1/440 = 0.002272727seconds and 0.002272727 / 0.00000009 = 25253 cycles (must round to closest whole

    number because you can't have part of a cycle). Since the shortest commands take 12

    clock cycles, then you won't be able to write a routine that takes exactly 25253 cycles. It

    has to be some multiple of 12. The closest multiple of 12 is 25248. Then 25248 *

    0.00000009 = 0.00227232 seconds and 1 / 0.00227232 = 440.0788621 Hz.

  • 7/30/2019 2947_new

    40/57

    2

    6

    If you have a faster microcontroller clock speed you can be more accurate. For example,

    with a 24 MHz clock (The fastest you can use with a 2051 microcontroller) then you can

    get 440.0440044 Hz. Also, if you use a clock that gives you a different period you may be

    able to get exactly 440 Hz. For example, if you have a microcontroller clock that is

    22,440,002.69 MHz then you can get much closer to 440 Hz, but you have to find a

    crystal that runs at that exact speed, and there probably is not one. The parts for this kit

    are included in Microcontroller Beginner Kit.

    2.6 DC Servo Motor

    DC servomotors have

    an output shaft that can be positioned by

    sending a coded signal to the motor. As the

    input to the motor changes, the angular

  • 7/30/2019 2947_new

    41/57

    2

    7

    position of the output shaft changes as well. Servomotors are generally small and

    powerful for their size, and easy to control. Common types of DC servomotors include

    brushless or gear motor types.

    FIGURE 2.14 : DC SERVOMOTOR

    Important performance specifications to consider when searching for DC

    servomotors include shaft speed, terminal voltage, continuous current, continuous torque,

    and continuous output power. The shaft speed is the No-load rotational speed of output

    shaft at rated terminal voltage. The terminal voltage is the design DC motor voltage.

    Continuous current is the maximum rated current that can be supplied to the motor

    windings without overheating.

    The continuous torque is the output torque capability of the motor under constant

    running conditions. Continuous output power is the mechanical power provided by the

    motor output. Motor construction choices for DC servomotors include permanent magnet,

    shunt wound, series wound, compound wound, disc armature, and coreless or slot less. A

    permanent magnet motor is a motor with permanent magnets embedded into the rotor

    assembly.

    The rotor aligns itself with the rotating magnetic field of the stator windings. PM

  • 7/30/2019 2947_new

    42/57

    motors exhibit constant speed with varying load (zero slip) and provide relatively high

    torque, good efficiency, and lower current draw than comparable synchronous motors.

  • 7/30/2019 2947_new

    43/57

    2

    8

    Shunt wound motors exhibit minimum speed variation through load range and

    can be configured for constant horsepower over an adjustable speed range. Frequent

    applications include machine tools, fans, and blowers. Series wound motors exhibit high

    starting torques for permanently attached loads. Frequently used in heavy industrial

    applications.

    Compound wound motors are designed with both a series and shunt field

    winding. They are often used where the primary load requirement is heavy starting

    torque, and adjustable speed is not required. They can exhibit speed variation from

    noload to full-load. Applications include elevators, hoists, and industrial shop equipment.

    Disc armatures are flat, pancake-shaped rotors that are driven by an axially, rather thanradially, aligned magnetic field.

    The thin construction of these armatures can result in low inertia with resulting

    high acceleration. Coreless and slotless motors incorporate a cylindrical winding that is

    physically outside of a set of permanent magnets. The winding is not held by a slotted

    iron cage but is laminated together. In a slotless motor, the magnets attached to the rotor

    rotate, while in a coreless motor, the windings rotate around the permanent magnet stator.

    Commutation choices include brush or brushless. Brush motors have the

    armature windings on the rotor. The magnetic fields are commutated via direct contact of

    brushes with the rotor commutator. Brushless motors have their armature windings on the

    stator and the field on the rotor. They rely on internal noncontact sensing devices to

    activate external commutating electronics.

    The motor configuration in DC servomotors includes motor only or gearmotor.

    Gear motors include units with single integral gearheads, or replaceable / interchangeablegearhead options. Gearing choices, if applicable to the DC servomotor include spur,

    planetary, harmonic, worm, and bevel. The gearbox ratio of input to output speed is also

    important to consider.

  • 7/30/2019 2947_new

    44/57

    2

    9

    Gearbox efficiency is the percentage of power or torque that is transferred

    through the gearbox. Shaft options for DC servomotors include in-line, offset or parallel,

    right angle, single-ended, double-ended or hollow. Feedback for the motor can be integral

    encoder, integral resolver, or integral tachometer.

    Other important parameters to consider when specifying DC servomotors include

    housing and enclosure features such as the design units, motor shape, diameter or width,

    housing length, NEMA frame size, enclosure options and special or extreme

    environments the motor might need to operate in. Common features include integral

    driver electronics, integral brake, integral clutch, and integral brake or clutch

    combination.

    Important environmental parameters to consider include operating temperature,

    shock rating, and vibration rating.

    DC motors are most commonly used in variable speed and torque applications.

    They include brushless and gear motors, as well as servomotors. Learn more about DC

    Motors

    DC servomotors are generally small and powerful for their size, and easy to

    control. Common types of DC servomotors include brushless or gear motors.

    Motor controllers receive supply voltages and provide signals to motor drives

    that are interfaced to motors. They include a power supply, amplifier, user interface, and

    position control circuitry.

    2.6.1 About Linear Motors

    Linear motors generate force only

    in the direction of travel. A linear motor

    applies thrust directly to a load, and does not

    require any intermediate mechanism to

  • 7/30/2019 2947_new

    45/57

    3

    0

    convert rotary motion into linear motion. Linear motors are capable of extremely high

    speeds, quick acceleration, and accurate positioning.

    Choices for linear motors include moving coil, moving magnet, AC switched

    reluctance design, AC synchronous design, AC induction or traction design, linear

    stepping design, DC brushed design, and DC brushless design. In a moving coil design

    the coil moves and the magnet is fixed, such as an audio speaker. In a moving magnet

    design the magnet moves and the coil is fixed. AC synchronous motors are a class of

    motors that operate at constant speed up to full load. The rotor speed is equal to the speed

    of the rotating magnetic field of the stator; there is no slip.

    Reluctance and permanent magnet are the two major types of synchronous

    motors. Synchronous linear motors are often used where the exact speed of a motor must

    be maintained. AC induction or traction design motors are a class of motors that derives

    its name from the fact that current is induced into the rotor windings without any physical

    connection with the stator windings (which are directly connected to an AC power

    supply); adaptable to many different environments and capable of providing considerable

    power as well as variable speed control.

    Typically there is "slip," or loss of exact speed tracking with induction motors.

    Typically rolled flat version of rotary AC induction motors. Stepper motors use a

    magnetic field to move a rotor in small angular steps or fractions of steps. Stepper motors

    provide precise positioning and ease of use, especially in low acceleration or static load

    applications. Brush motors have the armature windings on the rotor. The magnetic fields

    are commutated via direct contact of brushes with the rotor commutator.

    Brushless linear motors have their armature windings on the stator and the fieldon the rotor. They rely on internal noncontact sensing devices to activate external

    commutating electronics. Important specifications to consider include rated continuous

    thrust force, peak force, maximum speed, maximum acceleration, nominal stator length,

    slider or carriage travel, slide or carriage width, and slider or carriage length.

  • 7/30/2019 2947_new

    46/57

    3

    1

    The rated continuous thrust force is the maximum rated current that can be

    supplied to the motor windings without overheating. The peak force is the maximum

    force of the linear motor. The nominal stator length is the length of the fixed magnet or

    coil. The slider or carriage travel is the range of travel of the moving coil or magnet. The

    slider or carriage width and length are the dimensions of the moving coil or magnet.

    Important electrical properties to consider when specifying linear motors include

    continuous current, rated current per phase, motor force constant, and number of leads.

    The rated current per phase is the maximum rated current per phase or winding for a

    stepper motor. The number of leads specifies unipolar = 6 leads, bi-polar = 4. Mechanical

    properties to consider for linear motors include design units, linear stepper resolution, andmaximum coil temperature. For the linear stepper resolution the Units are typically in

    'distance per step' or 'steps per unit distance'.

    Common features include forced air-cooling, water-cooling, balanced design,

    integral position feedback, and modular stator. Important environmental parameters to

    consider for linear motors include operating temperature, maximum shock, and maximum

    vibration.

    2.6.2 SERVO Motor Interfacing

  • 7/30/2019 2947_new

    47/57

    VDD

    8951

    Invertin

    g

    BuffersPort

    Pins

    SERVO

    MOTO

    R

    A

    A

    B

    B

  • 7/30/2019 2947_new

    48/57

    3

    2

    FIGURE 2.15 : SERVO MOTOR INTERFACE WITH AT89C51

    2.7 Transmit and Receive Data

    2.7.1 Generating Data

    The TWS-434 modules do not incorporate internal encoding. If you want to

    send simple control or status signals such as button presses or switch closures, consider

    using an encoder and decoder IC set that takes care of all encoding, error checking, and

    decoding functions. These chips are made by Motorola and Holtek. They are an excellent

    way to implement basic wireless transmission control.

    2.7.2 Receiver Data Output

    Zero volt to Vcc data output is available on pins. This output is normally used to

    drive a digital decoder IC or a microprocessor which is performing the data decoding.

    The receivers output will only transition when valid data is present. In instances when no

    carrier is present the output will remain low.

    2.7.3 Decoding Data

    The RWS-434 modules do not incorporate internal decoding. If you want to

    receive Simple control or status signals such as button presses or switch closures, you can

    use the encoder and decoder IC set described above. Decoders with momentary and

    latched outputs are available.

  • 7/30/2019 2947_new

    49/57

  • 7/30/2019 2947_new

    50/57

    3

    4

    40 20

    VCC GND

    VCCC4 0.1uF

    U2R2 VCC

    P1_0 1

    P1.0 P0.0/AD0

    39

    P0_0 2 1

    P1_1 2

    38

    P0_1 3

    P1.1 P0.1/AD1P1_

    2 3

    3

    7

    P0

    _2 4P1.2 P0.2/AD2P1_3 4

    36

    P0_3 5

    P1.3 P0.3/AD3P1_4 5

    35

    P0_4 6

    SIP9 1k

    P1.4 P0.4/AD4P1_5 6

    34

    P0_5 7

    P1.5 P0.5/AD5P1_6 7

    33

    P0_6 8

    P1.6 P0.6/AD6P1_7 8

    32

    P0_7 9

    P1.7 P0.7/AD7C

    C5

    1

    0

    31

    P3.0/RXD EA/VPP

  • 7/30/2019 2947_new

    51/57

    11

    30

    VCC

    P3.1/TXD

    ALE/PROG1

    229P3.2/INT

    O PSEN

    SW0

    13 P3.3/INT

    114

    P3_5

    P3.4/TO15

    P2.7/A15

    28

    10uF P3.5/T1P3_6

    16

    27RST P3.6/WR P2.6/A14

    P3_7

    17

    26

    P3.7/RD P2.5/A13 2

    5P2.4/A12

    24

    P2_3P2.3/A11

    23

    R3 9

    P2.2/A10P2_2

    22

    RST P2.1/A9P2_1

    8K218

    21

    XTAL2 P2.0/A8P2_01

    911.0592MHz XTAL1

    X1

    AT89C51C6C733PF

    33PF

    FIGURE 2.16 : AT89C51 MICROCONTROLLER CIRCUIT SCHEMATIC.

    The circuit schematic of AT89C51 microcontroller is shown figure 2.16. Detail

    explanation of various I/O ports, oscillator input (XTAL1, XTAL2), reset line (RST),

    address latch enable (ALE), program store enable (PSEN) and External access (EA) is

    mentioned in section 2.3.3.

    2.9.2 Display Part

  • 7/30/2019 2947_new

    52/57

    3

    5

    VCC

    R

    19

    1

    25K

    3

  • 7/30/2019 2947_new

    53/57

    P3_5

    P3_6P3_7P1_0P1_1P1_2P1_3P1_4P1_5P1_6P1_7

    VCC

    F

    AT89C51

    i

    g

    u

    2.

    9.

    3

    Al

    arm

    P

    ar

    P0_7

    FIGURE

    BUZZER

    INTERFA

  • 7/30/2019 2947_new

    54/57

    3

    6

    The circuit schematic of alarm or buzzer part is shown in figure-19. Buzzer is on

    whenever vehicle enters particular zone in order to alert the driver. Hearing that buzzer

    driver can take precautionary steps to drive safely.

    2.9.4 Speed control Block

    K4

    K3 +9V 4+9V 4 3

    3HW_1

    5

    NS_1

    5 88 6

    6 D5 7D4 7 1 2 1

    1 2 1 2

    1N4007

    21k

    1N4007

    15V

    1 5VP0_3R7 2

    Q4

    P0_2R6 2 Q3 3BC547

    1k

    3BC547

    K1+9V 4 K2

    3

    +9V 4

    5 SZ_1 3UT_18 5

    6 8D2 7 6

    1 2 1D3 7

    2 1 2 1

    1N4007 21 5V 1N4007P0_0R4 2 Q1 1 5V

    3BC547 P0_1R5 2 Q2

    1k1k

    3BC547

    FIGURE 2.19 : VARIOUS ZONAL CIRCUIT SCHEMATIC.

    Figure 2.19 consists of four zones (as mentioned) speed control circuit schematic. So

    whenever vehicle travel in particular zone corresponding voltage is regulated in the DC

    Servomotor in turn speed is maintained to that particular zonal limit.

  • 7/30/2019 2947_new

    55/57

    2.10 Relay Module

    Electromechanical relays are devices that complete or interrupt a circuit by

    physically moving electrical contacts into contact with each other.

  • 7/30/2019 2947_new

    56/57

  • 7/30/2019 2947_new

    57/57

    PDF to Wor

    http://pdfonline.blogspot.com/http://pdfonline.blogspot.com/