Integration of Electronic Speed Governor With RFID Technology For Speed Limiting
Integration of Electronic Speed Governor With RFID Technology For Speed Limiting
Integration of Electronic Speed Governor With RFID Technology For Speed Limiting
The main aim of this project is to present a conceptual model of a microprocessor based variable electronic speed governor that can be implemented to control the speed of any vehicle depending on the local speed limit. The circuit is cost effective, efficient and easy to implement on already existing vehicles. Every city, town or a village, can be marked and divided into individual zones. The division depends upon the area under which the business, residential, and industrial regions come. The central business district being a very busy traffic zone demands the least speed limit, with the residential and industrial zones having lesser traffic densities, the speed limits will vary accordingly. Any city or town can be divided into physical zones which are classified according to different speed ranges. A transmitter is placed at all exit and entry points of the interface of any two zones that transmits a message signal at carrier frequency, indicating the upper limit value of the zones speed range into which the vehicle is entering at that moment, to the receiver which gives the message as an input to a preprogrammed ARM 7 Microprocessor embedded within the automobile which compares the speed of the vehicle measured by a sensor at the maximum allowable speed and automatically regulates the speed of the vehicle. The speed of the vehicle can be varied by varying the duty cycle of the pulse input. The entire system is a low cost variable electronic speed governor, small in size and easy to assemble onto an existing vehicle without disturbing its present arrangement. The output of project would be that speed of vehicle is reduced by 25% in zone1 and 50% in zone 2.
Input section:
The input section consists of aRFID module and non-contact type tachometer. This Tachometer uses Non-contact IR Tachometer for measuring the speed of the shaft. This circuit sends signal HIGH or LOW pulses to the processor.
Processing section:
In this section we use arm 7 microprocessor for processing the input. We have three separate programs each for zone detection,speed calculation, speed display on LCD, error detection and error correction via servo motor.
Output section:
The output is given to change the throttle valve position. This is done with the help of a servo motor which is in turn connected to the valve. The arm7 calculates the error and sends the appropriate error correction signal to the servo motor. Then the servo motor rotates and in turn rotates the throttle valve thereby gear transmission system.
Firstly most School Zone signs should have flashing lights, especially in hot zones, can have these flashing lights as well because some drivers do not pay attention if there are no flashing lights. The speed limit in hot zones should be reduced, especially if they keep occurring so reducing the speed limit from 60km to 50km or even 40km if need be can be an option.
Secondly, more sensory input needs to occur to get drivers attention like a loud warning bell or beeping noise and a loud recorded voice on speakers before entering a certain area or hot zone, for example You are about to enter a hot zone, please reduce speed immediately, maintain control of the vehicle and secure seat belts.
Thirdly, more speed humps in certain areas and hot zones. This works well in general, and for those who disobey the speed humps, it can be annoying and cause possible damage to a car. After understood all the related concepts, innovation of previous system is designed. Then, the circuit of zone section and vehicle is designed. After all the designing process is done, the circuit design is tested on test board.. After the test is satisfied, the circuit is fabricated. Lastly, the prototype is tested and measured.
15. On-chip integrated oscillator operates with an external crystal from 1 MHz to 25 MHz.
3.1.3.2 Pipeline
In ARM 7, a 3 stage pipeline is used. A 3 stage pipeline is the simplest form of that does not suffer from the problems such as read before write. In a pipeline, when one instruction is executed, second instruction is decoded and third instruction will be fetched. This is executed in a single cycle. pipeline
Fig: 3.4 Data Registers- R0-R15 In addition there are 2 status registers CPSR - Current program status register, status of current execution is stored. CPSR contains a number of flags which report and control the operation of ARM7 CPU. SPSR - Saved program status register, includes status of program as well as processor.
10
3.1.3.6 Features
1. 2. 3. 4. 5. ARM Prime cell vectored interrupt controller 32 interrupt request inputs 16 vectored IRQ interrupts 16 priority levels dynamically assigned to interrupt requests Software interrupt generation.
3.1.3.7 Description
1. Fast Interrupt request have the highest priority. If more than one request is assigned to FIQ, the VIC ORs the requests to produce the FIQ signal to the ARM processor. 2. The fastest possible FIQ latency is achieved when only one request is classified as FIQ, because then the FIQ service routine can simply start dealing with that device. 3. But if more than one request is assigned to the FIQ class, the FIQ service routine can read a word from the VIC that identifies which FIQ source(s) is (are) requesting an interrupt. 4. Vectored IRQs have the middle priority, but only 16 of the 32 requests can be assigned to this category. 5. Any of the 32 requests can be assigned to any of the 16 vectored IRQ slots, among which slot 0 has the highest priority and slot 15 has the lowest. 6. Non-vectored IRQs have the lowest priority. 7. The victors the requests from all the vectored and non-vectored IRQs to produce the i. IRQ signal to the ARM processor. The IRQ service routine can start by reading a register from the VIC and jumping there. If any of the vectored IRQs are requesting, the VIC provides the address of the highest-priority requesting IRQs service routine, otherwise it ii. Provides the address of a default routine that is shared by all the non-vectored IRQs.
11
8. The default routine can read another VIC register to see what IRQs are active. 9. All registers in the VIC are word registers. Byte and halfword reads and write are not supported. 10. Additional information on the Vectored Interrupt Controller is available in the ARM i. PrimeCell Vectored Interrupt Controller (PL190) documentation.
12
Increasingly, embedded systems developers and system-on-chip designers select specific microprocessor cores and a family of tools, libraries, and off-the-shelf components to quickly develop new microprocessor-based products and applications. ARM is one of the major options available for embedded system developer. Over the last few years, the ARM architecture has become the most pervasive 32-bit architecture in the world, with wide range of ICs available from various IC manufacturers. ARM processors are embedded in products ranging from cell/mobile phones to automotive braking systems. A worldwide community of ARM partners and third-party vendors has developed among semiconductor and product design companies, including hardware engineers, system designers, and software developers. ARM7 is one of the widely used micro-controller family in embedded system application. This section is humble effort for explaining basic features of ARM-7. ARM is a family of instruction set architectures for computer processors based on a reduced instruction set computing (RISC) architecture developed by British company ARM Holdings. A RISC-based computer design approach means ARM processors require significantly fewer transistors than typical processors in average computers. This approach reduces costs, heat and power use. These are desirable traits for light, portable, battery-powered devicesincluding smartphones, laptops, tablet and notepad computers), and other embedded systems. A simpler design facilitates more efficient multi-core CPUs and higher core counts at lower cost, providing higher processing power and improved energy efficiency for servers and supercomputers.
13
8 to 40 kB of on-chip static RAM and 32 to 512 kB of on-chip flash program memory.128 bit wide interface/accelerator enables high speed 60 MHz operation. In-System/In-Application Programming (ISP/IAP) via on-chip boot-loader software. Single flash sector or full chip erase in 400 ms and programming of 256 bytes in 1ms. Embedded ICE RT and Embedded Trace interfaces offer real-time debugging with the on-chip Real Monitor software and high speed tracing of instruction execution. USB 2.0 Full Speed compliant Device Controller with 2 kB of endpoint RAM. In addition, the LPC2146/8 provides 8 kB of on-chip RAM accessible to USB by DMA. One or two (LPC2141/2 vs. LPC2144/6/8) 10-bit A/D converters provide a total of 6/14analog inputs, with conversion times as low as 2.44 us per channel. Single 10-bit D/A converter provides variable analog output. Two 32-bit timers/external event counters (with four capture and four compare channels each), PWM unit (six outputs) and watchdog. Low power real-time clock with independent power and dedicated 32 kHz clock input. Multiple serial interfaces including two UARTs (16C550), two Fast I2C-bus(400 kbit/s), SPI and SSP with buffering and variable data length capabilities. Vectored interrupt controller with configurable priorities and vector addresses. Up to 45 of 5 V tolerant fast general purpose I/O pins in a tiny LQFP64 package. Up to nine edge or level sensitive external interrupt pins available. On-chip integrated oscillator operates with an external crystal in range from 1 MHz to30 MHz and with an external oscillator up to 50 MHz. Power saving modes include Idle and Power-down.
14
Individual enable/disable of peripheral functions as well as peripheral clock scaling for additional power optimization. Processor wake-up from Power-down mode via external interrupt, USB, Brown-Out Detect (BOD) or Real-Time Clock (RTC).
15
LPC2148 need minimum below listed hardware to work properly. 1. Power Supply 2. Crystal Oscillator 3. Reset Circuit 4. RTC crystal oscillator 5. UART
1. Power Supply
LPC2148 works on 3.3 V power supply. LM 117 can be used for generating 3.3 V supply. However, basic peripherals like LCD, ULN 2003 (Motor Driver IC) etc. works on 5V. So AC mains supply is converted into 5V using below mentioned circuit and after that LM 117 is used to convert 5V into 3.3V.
Transformer:It is used to step down 230V AC to 9V AC supply and provides isolation between power grids and circuit. Rectifier: It is used to convert AC supply into DC.
16
Filter:It is used to reduce ripple factor of DC output available from rectifier end. Regulator:It is used to regulate DC supply output. Circuit for this is as shown below.
Here, Regulator IC 7805 is used to provide fix 5V dc supply. Now we can use LM 117 for generating 3.3V supply from 5V using below circuit.
2. Reset Circuit
Reset button is essential in a system to avoid programming pitfalls and sometimes to manually bring back the system to the initialization mode. Circuit diagram for reset is as shown below. MCP 130T is a special IC used for providing stable RESET signal to LPC 2148.
17
3. Oscillator Circuit
Oscillations, the heartbeat, are provided using a crystal and are necessary for the system to work.
18
The value of capacitors C20 & C21 depends upon the frequency of crystal Y3. General circuit and its equivalent circuit is as shown below.
We can also use external oscillator for providing system clock. Circuit for this application is as given below.
19
5. UART
LPC 2148 has inbuilt ISP which means we can program it within the system using serial communication on COM0. It has also COM1 for serial communication. MAX 232/233 IC must be used for voltage logic conversion. Related connections are as given below. A Universal asynchronous receiver/transmitter, abbreviated UART is a piece of computer hardware that translates data between parallel and serial forms. The universal designation indicates that the data format and transmission speeds are configurable. The electric signalling levels and methods (such as differential signalling etc.) are handled by a driver circuit external to the UART. A UART is usually an individual (or part of an)
20
integrated circuit used for serial communications over a computer or peripheral device serial port. UARTs are now commonly included in microcontrollers.
21
Features
10 bit successive approximation analog to digital converter (one in LPC2141/2 and two in LPC2144/6/8). Input multiplexing among 6 or 8 pins (ADC0 and ADC1). Power-down mode. Burst conversion mode for single or multiple inputs. Optional conversion on transition on input pin or Timer Match signal. Global Start command for both converters (LPC2144/6/8 only).
22
3.3.2 Description
On, and optionally when it is off. It uses little power in Power-down mode. On the LPC2141/2/4/6/8, the RTC can be clocked by a separate 32.768 KHz oscillator, or by a programmable pre scale divider based on the VPB clock. Also, the RTC is powered by its, which can be connected to a battery or to the same 3.3 V supply used by the rest of the device.
23
Inexpensive -Arduino boards are relatively inexpensive compared to other microcontroller platforms. The least expensive version of the Arduino module can be assembled by hand.
Cross-platform - The Arduino software runs on Windows, Macintosh OSX, and Linux operating systems. Most microcontroller systems are limited to Windows.
Simple, clear programming environment - The Arduino programming environment is easy-to-use for beginners, yet flexible enough for advanced users to take advantage of as
24
well. For teachers, it's conveniently based on the Processing programming environment, so students learning to program in that environment will be familiar with the look and feel of Arduino.
Open source and extensible software- The Arduino software is published as open source tools, available for extension by experienced programmers. The language can be expanded through C++ libraries, and people wanting to understand the technical details can make the leap from Arduino to the AVR C programming language on which it's based. Similarly, you can add AVR-C code directly into your Arduino programs if you want to.
Open
source
and
extensible
hardware
The
Arduino
is
based
on
Atmel's ATMEGA8 and ATMEGA168microcontrollers. The plans for the modules are published under a Creative Commons license, so experienced circuit designers can make their own version of the module, extending it and improving it. Even relatively inexperienced users can build the breadboard version of the module in order to understand how it works and save money.
ARDUINO IMAGE:
25
4.3 ARDUINO LIBRARY: Arduino library is a library which consists of various commands and syntaxes of various functions used to implement our desired program. 4.3.1. ARDUINO COMMANDS for LCD programming: 1. setup(): The setup() function is called when a sketch starts. Use it to initialize variables, pin modes, start using libraries, etc. The setup function will only run once, after each powerup or reset of the Arduino board. 2. pinmode(): Configures the specified pin to behave either as an input or anoutput.As of Arduino 1.0.1, it is possible to enable the internal pullup resistors with the mode INPUT_PULLUP. Additionally, the INPUT mode explicitly disables the internal pullups. Syn ta x: pinMode(pin, mode) Par a met e rs : pin: the number of the pin whose mode you wish to set mode: INPUT, OUTPUT, or INPUT_PULLUP. Re t ur ns : None
26
3. digitalWrite() De s cr i pti on Writes a HIGH or a LOW value to a digital pin. If the pin has been configured as an OUTPUT with pinMode(), its voltage will be set to the corresponding value: 5V for HIGH, 0V (ground) for LOW. If the pin is configured as an INPUT, writing a HIGH value with digitalWrite() will enable an internal 20K pull up resistor. Writing LOW will disable the pullup. The pullup resistor is enough to light an LED dimly, so if LEDs appear to work, but very dimly, this is a likely cause. The remedy is to set the pin to an output with the pinMode() function. Syn ta x: digitalWrite(pin, value) Par a met e rs pin: the pin number value: HIGH or LOW Re t ur ns none
4. digitalRead():
De s cr i pti on Reads the value from a specified digital pin, either HIGH or LOW. Syn ta x: digitalRead(pin) Par a met e rs : pin: the number of the digital pin you want to read (int)
27
Re t ur ns HIGH or LOW
4. delay() De s cr i pti on Pauses the program for the amount of time (in milliseconds) specified as parameter. Syn ta x delay(ms) Par a met e rs ms: the number of milliseconds to pause (unsigned long) Re t ur ns Nothing
4.4.ATMEGA 8 MICROCONTROLLER
Atmega 8 is a high performance, low power Atmel AVR 8-bit microcontroller generally used along with arduino boot-loader in automatic controlled products and devices. It is available in 28-pin DIP and TQFP.
assigned for that. In many projects, this module is extensively used for PC-Micro controller communication. Analog Comparator: A comparator module is integrated in the IC that provides comparison facility between two voltages connected to the two inputs of the Analog comparator via External pins attached to the micro controller. Analog to Digital Converter: Inbuilt analog to digital converter can convert an analog input signal into digital data of 10bit resolution. For most of the low end application, this much resolution is enough. 32 8 General Purpose Working Registers are available.
Pin diagram
29
GND
Ground. Zero reference digital voltage supply.
PC6/RESET
If RSTDISBL Fuse programmed, PC6 then serves as a pin I / O but with different characteristics. PC0 to PC5. If Fuse RSTDISBL not programmed, then serves as input Reset PC6. LOW signal on this pin with a minimum width of 1.5 microseconds will bring the microcontroller into reset condition, although the clock is not running.
30
or sink. When used as an input, the pull-pin low externally will emit a current if the pull-up resistor is activated it. PORTD pins will be in the condition of the tri-state when RESET is active, although the clock is not running.
RESET
Reset input pin. LOW signal on this pin with a minimum width of 1.5 microseconds will bring the microcontroller into reset condition, although the clock is not running. Signal with a width of less than 1.5 microseconds does not guarantee a Reset condition.
AVCC
AVCC is the supply voltage pin for the ADC, PC3 .. PC0, and ADC7 .. ADC6. This pin should be connected to VCC, even if the ADC is not used. If the ADC is used, AVCC should be connected to VCC through a low-pass filter to reduce noise.
Aref
Analog Reference pin for the ADC.
ADC7 .. ADC6
ADC analog input. There is only on ATmega8 with TQFP and QFP packages / MLF.
31
32
5.1.INTRODUCTION
RFID is not a new technology and has passed through many decades of use in military, airline, library, security, healthcare,sports, animal farms and other areas. Industries use RFID forvarious applications such as personal/vehicle access control,departmental store security, equipment tracking, baggage, fast-food establishments, logistics, etc. The enhancement in RFIDtechnology has brought advantages that are related to resourceoptimization, increased efficiency within business processes,and enhanced customer care, overall improvements in businessoperations and healthcare. RFID stands for Radio Frequency Identification and is aterm that describes a system of identification. RFID is based on storing and remotely retrieving information or data as it consists of RFID tag, RFID reader and backend Database. RFID tags store unique identification information of objects and communicate the tags so as toallow remote retrieval of their ID. RFID technology depends on the communication between the RFID tags and RFID readers. The range of the reader is dependent upon its operational frequency. Usually the readers have their own software running on their ROM and also, communicate with other software to manipulate these unique identified tags. Basically, the application which manipulates tag deduction information for the end user, communicates with the RFID reader to get the tag information through antennas. Many researchers have addressed issues that are related to RFID reliability and capability. RFID is continuing to become popular because it increases efficiency and provides better service to stakeholder. RFID technology has been realized as a performance differentiator for a variety of commercial applications, but its capability is yet to be fully utilized.
handling. Other applications includes automatic toll payments, departmental access control in large buildings, personal and vehicle control in a particular area, security of items which shouldnt leave the area, equipment tracking in engineering firms, etc.
Figure 5.1 shows RFID evolution over the past few decades.
The first RFID application was the "Identification Friend or Foe" system (IFF) and it was used by the British in the Second World War. Transponders were placed into fighter planes andtanks, and reading units could query them to decide whether to attack. Successors of this technology are stillused in armies around the world.The first commercial RFID application was the "Electronic Article Surveillance" (EAS). It was developed inthe seventies as a theft prevention system. It was based on tags that can store a single bit. That bit was readwhen the customer left the store and the system would sound alarm when the bit was not unset. In theend-seventies RFID tags made its way into the agriculture for example for animal tagging.In the eighties RFID technology got a boost when Norway and several US states decided to uses RFID for toll collection on roads. In addition to toll
34
collection the following decade brought a vast number ofnew applications, such as ski passes, gasoline cards, money cards, etc.In 1999 the MIT was founded. Its task was to develop a global standard for item-leveltagging. The Auto-ID was closed in 2003 after completing the work on the Electronic Product Code (EPC).At the same time the newly founded continues the work.The probably first paper related to RFID technology was the landmark paper by Harry Stockman,"Communication by Means of Reflected Power" in October 1948. The first patent on RFID was issued in1973 for a passive radio transponder with memory.
frequency requency range (between 50 tags to 200 tags) and the protocol ol used. In this connection the reader can perform certain operations on the tags such as reading the tags identifier identifi number and writing data into a tag. tag
Fig 5.2 A typical RFID System The reader performs these thes operations one by one on each tag. A typical RFID system s work cycle can be seen in figure 5.2.
Tag (attached with an object, unique identification). Antenna (tag detector, creates magnetic field). Reader (receiver of tag information, manipulator). Communication infrastructure (enable reader/RFID to work through IT infrastructure).
5.5. Tags:
Tags contain microchips that store the uniqueidentification (ID) of each object. The ID is a serialnumber stored in the RFID memory. The chip is made up of integrated circuit and embedded in a silicon chip.RFID memory chip can be permanent or changeabledepending on the read/write characteristics. Read-onlyand rewrite circuits are different as read-only tag containsfixed data and cannot be changed without re-programelectronically. On the other hand, re-write tags can beprogrammed through the reader at any time without anylimit. RFID tags can be different sizes and shapes depending on the application and the environment atwhich it will be used. A variety of materials areintegrated on these tags. For example, in the case of thecredit cards, small plastic pieces are stuck on variousobjects,
37
and the labels. Labels are also embedded in avariety of objects such as documents, cloths,manufacturingmaterials etc.
RFID tags can also be classified by their capabilitiessuch as read and write data.
Fig. 5.5 RFID tags classifications There are three types of tags: the passive, semi-activeand active. Semi-active tags have a combination of activeand passive tags characteristics. So, mainly two types oftags (active
38
and passive) are being used by industry and most of the RFID system. The essentialcharacteristics of RFID tags are their function to theRFID system. This is based on their range, frequency,memory, security, type of data and other characteristics. These characteristics are core for RFID performance anddiffer in usefulness/support to the RFID system operations. While considering thesecharacteristics, figure 5.6 compares the active and passivetags.
Thefollowing are the commonly used frequencies: Microwave : Works on 2.45 GHz, it has good reader rate even faster than UHF tags. Althoughat this frequency the reading rate results are notthe same on wet surfaces and near metals, thefrequency produce better results in applicationssuch as vehicle tracking (in and out withbarriers), with approximately 1 meter of tags read range. Ultra High Frequency: Works within a range of 860-930 MHz, it can identify large numbers oftags at one time with quick multiple read rate at agiven time. So, it has a considerable goodreading speed. It has the same limitation asMicrowave when is applied on wet surface andnear metal. However, it is faster than highfrequency data transfer with a reading range of 3 meters. High Frequency: Works on 13.56MHz and has less than one meter reading range but isinexpensive and useful for access control, itemsidentifications on sales points etc, as it can implanted inside thin things such as paper. Low Frequency: Works on 125 kHz, it has approximately half a meter reading range andmostly used for short reading range applicationssuch as shops, manufacturing factories, inventory.
readers. Readers are electronic devices which can beused as standalone or be integrated with other devicesand the following components/hardware into it.
Advantages:
High speed Multipurpose and many format Reduce man-power High accuracy Complex duplication Multiple reading (tags)
Disadvantages:
Interference High cost signal problem
41
42
Pin No 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Function Ground (0V) Supply voltage; 5V (4.7V 5.3V) Contrast adjustment; through a variable resistor Selects command register when low; and data register when high Low to write to the register; High to read from the register Sends data to data pins when a high to low pulse is given
Name Ground Vcc VEE Register Select Read/write Enable DB0 DB1 DB2
Led+ Led-
43
Fig 7.1 working of DC motor In real life, though, DC motors will always have more than two poles (three is a very common number). In particular, this avoids "dead spots" in the commutator. You can imagine how with our example two-pole motor, if the rotor is exactly at the middle of its rotation (perfectly aligned with the field magnets), it will get "stuck" there. Meanwhile,
44
with a two-pole motor, there is a moment where the commutator shorts out the power supply (i.e., both brushes touch both commutator contacts simultaneously). This would be bad for the power supply, waste energy, and damage motor components as well. Yet another disadvantage of such a simple motor is that it would exhibit a high amount of torque "ripple" (the amount of torque it could produce is cyclic with the position of the rotor).
7.2.Features
100 RPM 12V DC motors with Gearbox 3000 RPM base motor 6mm shaft diameter with internal hole 125 gm weight Same size motor available in various rpm No-load current = 60 mA (Max), Load current = 300 mA(Max)
45
7.3.2 Stator
The stationary part is the stator, usually has either windings or permanent magnets. The stator is the stationary part of the motors electromagnetic circuit. The stator core is made up of many thin metal sheets, called laminations. Laminations are used to reduce energy loses that would result if a solid core were used.
7.3.3.Air gap
In between the rotor and stator is the air gap. The air gap has important effects, and is generally as small as possible, as a large gap has a strong negative effect on the performance of an electric motor.
7.3.4.Winding
Windings are wires that are laid in coils, usually wrapped around a laminated soft iron magnetic core so as to form magnetic poles when energized with current. Electric machines come in two basic magnet field pole configurations: salientpole machine and nonsalient-pole machine. In the salient-pole machine the pole's magnetic
field is produced by a winding wound around the pole below the pole face. In the nonsalient-pole, or distributed field, or round-rotor, machine, the winding is distributed in pole face slots. A shaded-pole motor has a winding around part of the pole that delays the phase of the magnetic field for that pole.Some motors have conductors which consist of thicker metal, such as bars or sheets of metal, usually copper, although sometimes aluminum is used. These are usually powered by electromagnetic induction.
7.3.5 Commutator
Fig.7.3 Commutator
46
A commutator is a mechanism used to switch the input of certain AC and DC machines consisting of slip ring segments insulated from each other and from the electric motor's shaft. The motor's armature current is supplied through the stationary brushes in contact with the revolving commutator, which causes required current reversal and applies power to the machine in an optimal manner as the rotor rotates from pole to pole. In absence of such current reversal, the motor would brake to a stop. In light of significant advances in the past few decades due to improved technologies in electronic controller, sensorless control, induction motor, and permanent magnet motor fields,
electromechanically commutated motors are increasingly being displaced by externally commutated induction and permanent magnet motors.
47
The motor is paired with some type of encoder to provide position and speed feedback. In the simplest case, only the position is measured. The measured position of the output is compared to the command position, the external input to the controller. If the output position differs from that required, an error signal is generated which then causes the motor to rotate in either direction, as needed to bring the output shaft to the appropriate position. As the positions approach, the error signal reduces to zero and the motor stops. The very simplest servomotors use position-only sensing via
a potentiometer and bang-bang control of their motor; the motor always rotates at full speed (or is stopped). This type of servomotor is not widely used in industrial motion control, but it forms the basis of the simple and cheap servos used for radio-controlled models. More sophisticated servomotors measure both the position and also the speed of the output shaft. They may also control the speed of their motor, rather than always running at full speed. Both of these enhancements, usually in combination with a PID control algorithm, allow the servomotor to be brought to its commanded position more quickly and more precisely, with less overshooting.
48
Turning on Switches A and D makes the motor rotate clockwise Turning on Switches B and C makes the motor rotate anti-clockwise Turning on Switches A and B will stop the motor (Brakes) Turning off all the switches gives the motor a free wheel drive
49
Supply voltage can be as large as 36 Volts. This means you do not have to worry much about voltage regulation. L293D has an enable facility which helps you enable the IC output pins. If an enable pin is set to logic high, then state of the inputs match the state of the outputs. If you pull this low, then the outputs will be turned off regardless of the input states] The datasheet also mentions an "over temperature protection" built into the IC. This means an internal sensor senses its internal temperature and stops driving the motors if the temperature crosses a set point Another major feature of L293D is its internal clamp diodes. This fly-back diode helps protect the driver IC from voltage spikes that occur when the motor coil is turned on and off (mostly when turned off) Output current capability is limited to 600mA per channel with peak output current limited to 1.2A (non-repetitive). This means you cannot drive bigger motors with this IC. However, most small motors used in hobby robotics should work. This integrated circuit not only drives DC motors, but can also be used to drive relay solenoids, stepper motors etc.
50
Pin1 and Pin9 are "Enable" pins. They should be connected to +5V for the drivers to function. If they pulled low (GND), then the outputs will be turned off regardless of the input states, stopping the motors. If you have two spare pins in your microcontroller, connect these pins to the microcontroller, or just connect them to regulated positive 5 Volts. Pin4, Pin5, Pin12 and Pin13 are ground pins which should ideally be connected to microcontroller's ground. Pin2, Pin7, Pin10 and Pin15 are logic input pins. These are control pins which should be connected to microcontroller pins. Pin2 and Pin7 control the first motor (left); Pin10 and Pin15 control the second motor(right). Pin3, Pin6, Pin11, and Pin14 are output pins. Tie Pin3 and Pin6 to the first motor, Pin11 and Pin14 to second motor Pin16 powers the IC and it should be connected to regulated +5Volts Pin8 powers the two motors and should be connected to positive lead of a secondary battery. As per the datasheet, supply voltage can be as high as 36 Volts.
51
Suppose you need to control the left motor which is connected to Pin3 and Pin6 .As mentioned above, we require three pins to control this motor - Pin1, Pin2 and Pin7. Here is the truth table representing the functionality of this motor driver.
52
CHAPTER-9 TACHOMETER
9.1. Definition:
A tachometer is nothing but a simple electronic digital transducer. Normally, it is used for measuring the speed of a rotating shaft. The number of revolutions per minute (rpm) is valuable information for understanding any rotational system. For example, you can also measure the speed of fans you use.
53
Digital Tachometer
Has a LCD or LED readout Memory is provided for storage
9.4.2. PARTS :
The various parts we used for construction of tachometer are described below: 1.ArduinoUno
54
2.16x2LCD 3.Breadboard 4.5kohm Trimpot 5.Jumper Wire 6.SIPs 7.2x 2n2222 NPN Transistors 8.Infrared LED 9.Phototransistor 10. 10 ohm Resistor 11.100 kilo ohm Resistor 12.15 kilo ohm Resistor 13.Computer Fan 14.Servo motor
The parts used in this project are all listed out above, but the more interesting and necessary parts are listed out below with a little more detail to describe their function.
ARDUINO UNO: This is the Arduino board that we will be using to process the IR break-beam pulses that tell us when the CPU fan has moved. The Arduino will use these pulses along with a timer to figure out what the current RPM of the fan is.
16x2 LCD: After the Arduino has figured out what the current RPM is, it will be displayed on this LCD so that it's obvious to the user. 5 KILO OHM TRIMPOT: This trimpot will be used for setting the contrast of the 16x2 LCD. It's gives an analog output varying from +5v to 0, which the LCD translates to a brightness setting.
55
IR EMITTER DIODE AND PHOTO TRANSISTOR: The photo transistor turns on whenever intense Infrared light shines on it. So whenever the IR LED is on and shining, it keeps the phototransistor biased 'on', 'on' but if the IR LED is blocked, by...for example a fan blade, the phototransistor is biased 'off'. 2n2222 NPN Transistors: These transistors will mainly be used as level shifters to ensure the pulses output from the IR break-beam beam to the Arduino come in the form of +0v to +5v and nothing in inbetween. Schematic overview of the Tachometer:
The break-beam beam circuit's signal goes to the digital input on the Arduino. This will interrupt the Arduino so it can count that a pulse has just been registered and the tachometer is reading data.
56
CHAPTER-10 INTERFACING
10.1. DEFINITION
An interface is the point of interaction with software, or computer hardware, or with peripheral devices such as a computer monitor or a keyboard. Some computer interfaces such as a touchscreen can send and receive data, while others such as a mouse or microphone, can only send data.
57
16x2 LCD: This is the 128 Macrocell CPLD that we'll be using to output the digital PWM signal to control the 10 LED bar fading-in and fading out.
Fig 10.2 16x2 LCD display 5kTrimpot: We will use this LED bar to output both the exact 8-bit value that is converted from analog to digital. A resistor network will be connected up to the LED bar to limit the amount of current flowing through.
58
Fig 10.3 Trimpot Breadboard: Since the cplddev board is built on protoboard, we need to use sockets, SIPs and wire wrap to connect everything together.
Fig 10.4 breaboard SIPs: SIPs are used to hold all the ICs in place and to make a large connection for the motors on top of the board. Additionally SIPs are perfect for wire wrapping everything together.
59
Schematic Overview: Since this is purely an output system, we only need to look at the straight forward interface from Arduino UNO to LCD. As you can see below, the connections are mostly pin to pin with no funny business.
Schematic Specifics: 16x2 LCD Interface 3 control pins and 8 data pins are connected from the Arduino to the LCD. These are what will tell the LCD what to do and when.
Trimpot Contrast Control The contrast control uses an analog voltage to tell the LCD how dark or bright the contrast should be. Using a trimpot here allows for easy adjusting.
60
Program for Static LCD Display: #include <LiquidCrystal.h> LiquidCrystallcd(7, 8, 9, 10, 11, 12); //Initialize LCD void setup() { // set up the LCD's number of columns and rows: lcd.begin(16, 2); // Print a message to the LCD. lcd.print("Current RPM:"); } void loop() { while(1){ //Slow Down The LCD delay(400); //Clear The Bottom Row lcd.setCursor(0, 1); lcd.print(" ");
61
10.3.Interface between tachometer and Arduino: Parts: 1.Arduino UNO 2.16x2 LCD 3.Breadboard 4.5k Trimpot 5.Jumper Wire 6.SIPs 7.2x 2n2222 NPN Transistor 8.Infrared LED 9.Phototransistor 10.10 Resistor 11.100k Resistor 12.15k or 16k Resistor 13.Computer Fan Parts List Details: The parts used in this project are all listed out above, but the more interesting and necessary parts are listed out below with a little more detail to describe their function. IR Emitter Diode and Phototransistor The photo transistor turns on whenever intense Infrared light shines on it. So whenever the IR LED is on and shining, it keeps the phototransistor biased 'on', but if the IR LED is blocked, by...for example a CPU fan blade, the phototransistor is biased 'off'.
62
Fig 10.7 IR receiver 2n2222 NPN Transistors: These transistors will mainly be used as level shifters to ensure the pulses output from the IR break-beam to the Arduino come in the form of +0v to +5v and nothing inbetween.
Schematic Overview: The circuit diagram for this project is a little more complicated.The LCD interface is simplified to have only 2 control lines and 4 data lines. Then the tachometer IR breakbeam circuit is added on the side to make things a little more complex.
63
Schematic Specific: 16x2 LCD Interface 2 control pins and 4 data pins are connected from the Arduino to the LCD. These are what will tell the LCD what to do and when.
IR Break-Beam Circuit The break-beam circuit's signal goes to the digital input pin #2 on the Arduino. This will interrupt the Arduino so it can count that a pulse has just been registered and the tachometer is reading data.
64
The program for rpm count: volatile float time = 0; volatile float time_last = 0; volatileintrpm_array[5] = {0,0,0,0,0}; void setup() { //Digital Pin 2 Set As An Interrupt attachInterrupt(0, fan_interrupt, FALLING); } void loop() { int rpm = 0; if(time > 0) { //5 Sample Moving Average To Smooth Out The Data rpm_array[0] = rpm_array[1];
65
rpm_array[1] = rpm_array[2]; rpm_array[2] = rpm_array[3]; rpm_array[3] = rpm_array[4]; rpm_array[4] = 60*(1000000/(time*8)); //Last 5 Average RPM Counts Eqauls.... rpm = (rpm_array[0] + rpm_array[1] + rpm_array[2] + rpm_array[3] + rpm_array[4]) / 5; } voidfan_interrupt() { time = (micros() - time_last); time_last = micros(); }
66
67
binary code required for the application. Because of the high degree of flexibility required from the tools, there are many options that can be set to configure the tools to operate in a specific manner. It would be tedious to have to set these options up every time the application is being built; therefore they are stored in a project file. Loading the project file into KEIL informs KEIL which source files are required, where they are, and how to configure the tools in the correct way. KEIL can then execute each tool with the correct options. It is also possible to create new projects in KEIL. Source files are added to the project and the tool options are set as required. The project can then be saved to preserve the settings.
11.1.2 Simulator/Debugger
The simulator/ debugger in KEIL can perform a very detailed simulation of a micro controller along with external signals. It is possible to view the precise execution time of a single assembly instruction, or a single line of C code, all the way up to the entire application, simply by entering the crystal frequency. A window can be opened for each peripheral on the device, showing the state of the peripheral. This enables quick trouble shooting of mis-configured peripherals. Breakpoints may be set on either assembly instructions or lines of C code, and execution may be stepped through one instruction or C line at a time. The contents of all the memory areas may be viewed along with ability to find specific variables. In addition the registers may be viewed allowing a detailed view of what the microcontroller is doing at any point in time. The vehicle section and zone section programs are given in appendix.
68
of compiling and uploading programs to the board with a single click. A program or code written for Arduino is called a "sketch".
Writing Sketches
Software written using Arduino are called sketches. These sketches are written in the text editor. Sketches are saved with the file extension .ino. It has features for cutting/pasting and for searching/replacing text. The message area gives feedback while saving and exporting and also displays errors. The console displays text output by the Arduino environment including complete error messages and other information. The bottom right-hand corner of the window displays the current board and serial port. The toolbar buttons allow you to verify and upload programs, create, open, and save sketches, and open the serial monitor. Arduino programs are written in C or C++. The Arduino IDE comes with a software library called "Wiring" from the original Wiring project, which makes many common input/output operations much easier. Users only need define two functions to make a runnable cyclic executive program:
setup(): a function
run once at the start of a program that can initialize settings loop(): a function called repeatedly until the board powers off.
Serial Monitor:
The tool called serial monitor helps one to view the data coming from the arduino board using the in-built serial monitoring interface. It is the most effective communication method available with a microcontroller. The serial port of the microcontroller provides the easiest way by which the user and the microcontroller can write their data in the same medium and both can read each others data. When the serial port of the microcontroller is connected to the PC and the incoming and outgoing data is monitored using software and displayed in a window, it forms the simplest text user interface (TUI) setup for the microcontroller. Serial communication is a very useful debugging tool in the code development process.
69
11.3 Fritzing:
Fritzing is the sophisticated new electronics application with the funny name. It is a powerful tool for making schematics, prototyping circuits, and designing printed circuit boards. This software allows the designer / artist / researcher / hobbyist to document their Arduino-based based prototype and create a PCB layout for manufacturing.
Three Views
Fritzing can show your project in three views. The default is the Breadboard view Breadboard View: Breadboard oard view is a brilliant simulation that comes with a giant library of parts organized by brand name and model, so you can drag and drop your exact parts into your diagram. If the parts you want are not in the library, then you can use the Parts Designer t to create them.
70
Schematic View: Studying the schematics is a great way to learn to read them. Reading the schematics is essential to hack electronics because schematics are product documentation and they tell you everything about the hardware.
71
The Printed ed Circuit Board (PCB) view: The breadboard view is a main feature of this software. It helps in designing the PCB for the prototype created in the above steps. The final design can then be exported for manufacturing of the PCB. It also has a great auto routing routing feature which helps beginners in designing.
Fig 11.2 The Printed Circuit Board (PCB) view Any change you make in any of these views is automatically updated in the other views.
72
73
FUTURESCOPE
Further development of the project can be done in two ways:
74
CONCLUSION
The Integration of RFID Technology with Electronic Governors for speed limiting was achieved successfully. . The implementation of this system into every automobile will solve the problems of traffic congestion, loss life in everyday road accidents and property damage and will also supplementing law enforcement agencies in high speed pursuits. Initial trials of the model can be first implemented for heavy diesel vehicles of public and private institutions like schools, colleges, mass transport buses. The results will naturally help to enforce the system to all vehicles.
75
REFERENCES
1. Telaprolu, Microcontroller based automation of variable electronic speed governor, Vehicular Electronics and Safety (ICVES), 2009 2. Sushant R. Burje, Prof. S.A. Kulkarni and N.B. Dhande, Design and Development of Microcontroller Based Electronic Speed Governor for Automotive Engine, International Journal of Engineering and Science ,Vol. 1, Issue 5 (October 2012), PP 26-33 3. R.S. Khurmi, J.K. Gupta, Theory of machines, S-Chand, 2005 4. Micheal Margolis, Arduino Cookbook, SPD, 2012 5. A.K. Sawhney, Puneet Sawhney, A Course In Electrical And Electronic Measurements And Instrumentation, Dhanpat Rai Publications, 2012 6. David Seal, ARMv7-M Architecture Reference Manual, Addison-Wesley, Second Edition, ISBN-13: 978-0201737196
76
//Update The Rpm Count lcd.setCursor(0, 1); lcd.print(rpm); } volatile float time = 0; volatile float time_last = 0; volatileintrpm_array[5] = {0,0,0,0,0}; void setup()
77
{ //Digital Pin 2 Set As An Interrupt attachInterrupt(0, fan_interrupt, FALLING); } void loop() { int rpm = 0; if(time > 0) { //5 Sample Moving Average To Smooth Out The Data rpm_array[0] = rpm_array[1]; rpm_array[1] = rpm_array[2]; rpm_array[2] = rpm_array[3]; rpm_array[3] = rpm_array[4]; rpm_array[4] = 60*(1000000/(time*8)); //Last 5 Average RPM Counts Eqauls.... rpm = (rpm_array[0] + rpm_array[1] + rpm_array[2] + rpm_array[3] + rpm_array[4]) / 5; } voidfan_interrupt() { time = (micros() - time_last); time_last = micros(); }
78
APPENDIX-2
/* Target: SPEED CONTROL ROBOT */ // Hedar Files #include <lpc214x.h> #include "MAD/DELAY.H" #include "MAD/LCD.H" #include "MAD/UART.H" // Port Variables #define PLOCK 0x00000400 #define PWMPRESCALE 60 //60 PCLK cycles to increment TC by 1 i.e 1 Micro-second // Function Declarations void initPWM(void); void initClocks(void); void setupPLL0(void); void feedSeq(void); void connectPLL0(void); #define EN1 0x00000004 unsigned char temp[15]; unsigned inti=0; void serial(void) __irq { temp[i]=uart1_rx(); i++; VICVectAddr= 0x00000000; }
79
void uart1_interrupt(void) {
VICVectCntl0 = 0x20|7; VICVectAddr0 = (unsigned) serial; VICIntEnable = 0x00000080; U1IER } // Main Function int main(void) { //initClocks(); //Initialize CPU and Peripheral Clocks @ 60Mhz initPWM(); //Initialize PWM = 0x01;
lcd_init(); lcd_cmd(0x85); lcd_string("WELCOME"); delay(1000); uart1_init(); delay(1000); uart1_interrupt(); delay(1000); lcd_cmd(1); lcd_string("PORT OPENED"); delay(1000); lcd_cmd(1); lcd_string("RUNNING AT"); lcd_cmd(0xC0);
80
lcd_string(" NORMAL SPEED"); i=0; IODIR0|=EN1; //Also by default all pins are configured as Inputs after MCU Reset. card1:
IOSET0|=EN1; PWMMR1 = 10000; PWMMR2 = 5000; PWMMR3 = 0; PWMMR5 = 10000; //T-ON=25% , Hence 25% Bright PWMLER = ((1<<1)|(1<<2)|(1<<3)|(1<<5)); //Update Latch Enable bit for PWMMR1 if(i==0) goto card1; while(i<12); temp[i]='\0'; lcd_cmd(0xC0); lcd_string(temp); delay(5000); lcd_cmd(1); lcd_string("SCHOOL ZONE"); delay(5000); lcd_cmd(1); lcd_string("RUNNING AT "); lcd_cmd(0xC0); lcd_string("75% DUTY CYCLE"); i=0;
81
card2: IOSET0|=EN1; PWMMR1 = 7500; PWMMR2 = 7500; PWMMR3 = 0; PWMMR5 = 10000; //T-ON=25% , Hence 25% Bright PWMLER = ((1<<1)|(1<<2)|(1<<3)|(1<<5)); //Update Latch Enable bit for PWMMR1 //return 0; //normally this wont execute ever
if(i==0) goto card2; while(i<12); temp[i]='\0'; lcd_cmd(1); lcd_string(temp); delay(5000); lcd_cmd(1); lcd_string("SCHOOL ZONE"); lcd_cmd(0xC0); lcd_string(" CROSSED"); delay(5000); i=0; next1: IOSET0|=EN1; PWMMR1 = 10000; PWMMR2 = 5000; PWMMR3 = 0; PWMMR5 = 10000; //T-ON=25% , Hence 25% Bright
82
PWMLER = ((1<<1)|(1<<2)|(1<<3)|(1<<5)); //Update Latch Enable bit for PWMMR1 if(i==0) goto next1; while(i<12); temp[i]='\0'; lcd_cmd(1); lcd_string(temp); delay(5000); lcd_cmd(1); lcd_string("HOSPITAL ZONE"); delay(5000); lcd_cmd(1); lcd_string("RUNNING AT "); lcd_cmd(0xC0); lcd_string("50% DUTY CYCLE"); i=0;
card3: IOSET0|=EN1; PWMMR1 = 5000; PWMMR2 = 5000; PWMMR3 = 0; PWMMR5 = 10000; //T-ON=25% , Hence 25% Bright PWMLER = ((1<<1)|(1<<2)|(1<<3)|(1<<5)); //Update Latch Enable bit for PWMMR1 //return 0; //normally this wont execute ever
if(i==0)
83
goto card3; while(i<12); temp[i]='\0'; lcd_cmd(1); lcd_string(temp); delay(5000); lcd_cmd(1); lcd_string("HOSPITAL ZONE"); lcd_cmd(0xC0); lcd_string(" CROSSED"); delay(5000); i=0; next2: IOSET0|=EN1; PWMMR1 = 10000; PWMMR2 = 5000; PWMMR3 = 0; PWMMR5 = 10000; //T-ON=25% , Hence 25% Bright PWMLER = ((1<<1)|(1<<2)|(1<<3)|(1<<5)); //Update Latch Enable bit for PWMMR1 goto next2; }
void initPWM(void) { PINSEL0 = 0x0005800A; // Select PWM1, PWM2, PWM3 output for Pin0.0 PINSEL1 = 0x00000400; // Select PWM5 output for Pin0.0 PWMPCR = 0x0; //Select Single Edge PWM - by default its single Edged so this line can be removed
84
PWMPR = PWMPRESCALE-1; // 1 micro-second resolution PWMMR0 = 10000; // 10ms period duration PWMMR1 = 2500; // 2.5ms - pulse duration i.e width (Brigtness level) PWMMR2 = 2500; PWMMR3 = 2500; PWMMR5 = 2500; PWMMCR = (1<<1); // Reset PWMTC on PWMMR0 match PWMLER = ((1<<1)|(1<<2)|(1<<3)|(1<<5))| (1<<0); // update MR0 and MR1 PWMPCR = (1<<9)|(1<<10)|(1<<11)|(1<<13); // enable PWM output PWMTCR = (1<<1) ; //Reset PWM TC & PR //Now , the final moment - enable everything PWMTCR = (1<<0) | (1<<3); // enable counters and PWM Mode //PWM Generation goes active now - LED must be 25% Bright after boot!! //Now you can get the PWM output at Pin P0.0, P0.1, P0.7, P0.21! }
void initClocks(void) { setupPLL0(); feedSeq(); //sequence for locking PLL to desired freq. connectPLL0(); feedSeq(); //sequence for connecting the PLL as system clock
VPBDIV = 0x01; // PCLK is same as CCLK i.e 60Mhz //Using PLL settings as shown in : http://www.ocfreaks.com/lpc214x-pll-tutorial-forcpu-and-peripheral-clock/ //PLL0 Now configured!
85
} //---------PLL Related Functions :--------------void setupPLL0(void) { //Note : Assuming 12Mhz Xtal is connected to LPC2148.
PLL0CON = 0x01; // PPLE=1 & PPLC=0 so it will be enabled // but not connected after FEED sequence PLL0CFG = 0x24; // set the multipler to 5 (i.e actually 4) // i.e 12x5 = 60 Mhz (M - 1 = 4)!!! // Set P=2 since we want FCCO in range!!! // So , Assign PSEL =01 in PLL0CFG as per the table. } void feedSeq(void) { PLL0FEED = 0xAA; PLL0FEED = 0x55; }
void connectPLL0(void) { // check whether PLL has locked on to the desired freq by reading the lock bit // in the PPL0STAT register while( !( PLL0STAT & PLOCK )); // now enable(again) and connect PLL0CON = 0x03; }
86