You are on page 1of 108

INDEX

TOPICS Certificates Acknowledgement........

CHAPTE !" INT OD#CTION

!.! Introd$ction of t%e &ro'ect !.( Pro'ect o)er)iew... !.* T%esis

CHAPTE (" E+,EDDED S-STE+S

(.! Introd$ction to em.edded s/stems (.( Need of em.edded s/stems... (.* E0&lanation of em.edded s/stems... (.1 A&&lications of em.edded s/stems

CHAPTE *" HA D2A E DESC IPTION

*.! Introd$ction wit% .lock diagram *.( +icrocontroller. *.* eg$lated &ower s$&&l/... *.1 3ED indicator........ *.4 E/e .link sensor.... *.5 DC motor... *.6 Alco%ol sensor... 1

*.7 8oice mod$le.. *.9 ,$::er.

CHAPTE 1" SO;T2A E DESC IPTION

1.! E0&ress PC, 1.( PIC C Com&iler. 1.* Prote$s software

1.1 Proced$ral ste&s for com&ilation< sim$lation and d$m&ing..


CHAPTE 4" P O=ECT DESC IPTION

CHAPTE 5" AD8ANTA>ES< DISAD8ANTA>ES AND APP3ICATIONS

CHAPTE 6" ES#3TS< CONC3#SION< ;#T# E P OSPECTS

E;E ENCES

CHAPTE !" INT OD#CTION


!.! Introd$ction"

Now a day's every system is automated in order to face new challenges. In the present days Automated systems have less manual operations, flexibility, reliability and accurate. Due to this demand every field prefers automated control systems. Especially in the field of electronics automated systems are giving good performance. he main aim of this pro!ect is to alert the vehicle driver to avoid accidents when the driver was detected drowsy or by using Eye blin" sensor alcohol sensor. As this pro!ect uses the Eye blin" sensor, alcohol sensor technology, so that the vehicle driver and owner gets alerts as the vehicle speed is reduced and alerts through bu##er alarm system and also through voices using voice module. he pro!ect uses $Alcohol detector% itself indicates that whenever there is any alcoholic content has been detected using alcoholic sensor &'()* so that it will indicate through the bu##er. he system uses eye blin" sensor and reduces the vehicle speed and alerts through bu##er alarm system. In this pro!ect we are using the alcoholic sensor, eye blin" sensor that finds the alcoholic content and fed as input to the microcontroller. which forms the control unit of the pro!ect. his pro!ect ma"es use of a micro controller, which is programmed, with the help of embedded + instructions. his &icrocontroller is capable of communicating with input and output modules. he Eye blin" sensor, Alcohol ,ensor provides the information to the &icrocontroller -on board computer.. he controller is interfaced with /u##er, and voice module, and D+ &otor. !.( Pro'ect O)er)iew" An embedded system is a combination of software and hardware to perform a dedicated tas". ,ome of the main devices used in embedded products are &icroprocessors and &icrocontrollers.
3

his pro!ect is designed around a microcontroller

&icroprocessors are commonly referred to as general purpose processors as they simply accept the inputs, process it and give the output. In contrast, a microcontroller not only accepts the data as inputs but also manipulates it, interfaces the data with various devices, controls the data and thus finally gives the result. he pro!ect $Alco%ol Detection and E/e .link detection wit% )oice alerts and 8e%icle ?DC +otor@ Control S/stem% using 0I+123455A microcontroller is an exclusive pro!ect which is used to find the accident notification using 63 wireless technology and gives both visual and audible alerts. !.* T%esis" he thesis explains the implementation of $Alco%ol Detection and E/e .link detection wit% )oice alerts and 8e%icle ?DC +otor@ Control S/stem% using 0I+123455A microcontroller. he organi#ation of the thesis is explained here with7 C%a&ter ! 0resents introduction to the overall thesis and the overview of the pro!ect. In the pro!ect overview a brief introduction of eye blin" sensor, /u##er, A06 voice module, D+ motors, alcohol sensor and its applications are discussed. C%a&ter ( 0resents the topic embedded systems. It explains the about what is embedded systems,

need for embedded systems, explanation of it along with its applications. C%a&ter * 0resents the hardware description. It deals with the bloc" diagram of the pro!ect and

explains the purpose of each bloc". In the same chapter the explanation of microcontrollers, eye blin" sensor, /u##er, A06 voice module, D+ motors, power supplies, alcohol sensor, and Dc motors with driver are considered. C%a&ter 1 0resents the software description. It explains the implementation of the pro!ect using 0I+ + +ompiler software. C%a&ter 4 0resents the pro!ect description along with eye blin" sensor, /u##er, A06 voice module, D+ motors with driver, and alcohol sensor interfacing to microcontroller. C%a&ter 5 0resents the advantages, disadvantages and applications of the pro!ect. C%a&ter 6 0resents the results, conclusion and future scope of the pro!ect.
4

CHAPTE (" E+,EDDED S-STE+S


(.! Em.edded S/stems" An embedded system is a computer system designed to perform one or a few dedicated functions often with real(time computing constraints. It is embedded as part of a complete device often including hardware and mechanical parts. /y contrast, a general(purpose computer, such as a personal computer -0+., is designed to be flexible and to meet a wide range of end(user needs. Embedded systems control many devices in common use today. Embedded systems are controlled by one or more main processing cores that are typically either microcontrollers or digital signal processors -D,0.. he "ey characteristic, however, is being dedicated to handle a particular tas", which may re8uire very powerful processors. 3or example, air traffic control systems may usefully be viewed as embedded, even though they involve mainframe computers and dedicated regional and national networ"s between airports and radar sites. -Each radar probably includes one or more embedded systems of its own.. ,ince the embedded system is dedicated to specific tas"s, design engineers can optimi#e it to reduce the si#e and cost of the product and increase the reliability and performance. ,ome embedded systems are mass(produced, benefiting from economies of scale. 0hysically embedded systems range from portable devices such as digital watches and &0* players, to large stationary installations li"e traffic lights, factory controllers, or the systems controlling nuclear power plants. +omplexity varies from low, with a single microcontroller chip, to very high with multiple units, peripherals and networ"s mounted inside a large chassis or enclosure. In general, 9embedded system9 is not a strictly definable term, as most systems have some element of extensibility or programmability. 3or example, handheld computers share some elements with embedded systems such as the operating systems and microprocessors which power them, but they allow different applications to be loaded and peripherals to be connected. &oreover, even systems which don't expose programmability as a primary feature generally need to support software updates. :n a continuum from 9general purpose9 to 9embedded9, large application systems will have subcomponents at most points even if the system as a whole is 9designed to perform one or a few dedicated functions9, and is thus appropriate to call 9embedded9. A modern example of embedded system is shown in fig7 ;.1.
5

;ig (.!"A modern e0am&le of em.edded s/stem <abeled parts include microprocessor -=., 6A& -2., flash memory -5..Embedded systems programming is not li"e normal 0+ programming. In many ways, programming for an embedded system is li"e programming 0+ 1> years ago. he hardware for the system is usually chosen to ma"e the device as cheap as possible. ,pending an extra dollar a unit in order to ma"e things easier to program can cost millions. ?iring a programmer for an extra month is cheap in comparison. his means the programmer must ma"e do with slow processors and low memory, while at the same time battling a need for efficiency not seen in most 0+ applications. /elow is a list of issues specific to the embedded field. (.!.! Histor/" In the earliest years of computers in the 1@*)A=)s, computers were sometimes dedicated to a single tas", but were far too large and expensive for most "inds of tas"s performed by embedded computers of today. :ver time however, the concept of programmable controllers evolved from traditional electromechanical se8uencers, via solid state devices, to the use of computer technology. :ne of the first recogni#ably modern embedded systems was the Apollo Buidance +omputer, developed by +harles ,tar" Draper at the &I Instrumentation <aboratory. At the pro!ect's inception, the Apollo guidance computer was considered the ris"iest item in the Apollo pro!ect as it employed the then newly developed monolithic integrated circuits to reduce the si#e and weight. An
6

early mass(produced embedded system was the Autonetics D(15 guidance computer for the &inuteman missile, released in 1@21. It was built from transistor logic and had a hard dis" for main memory. Chen the &inuteman II went into production in 1@22, the D(15 was replaced with a new computer that was the first high(volume use of integrated circuits. (.!.( Tools" Embedded development ma"es up a small fraction of total programming. here's also a large number of embedded architectures, unli"e the 0+ world where 1 instruction set rules, and the Dnix world where there's only * or = ma!or ones. his means that the tools are more expensive. It also means that they're lowering featured, and less developed. :n a ma!or embedded pro!ect, at some point you will almost always find a compiler bug of some sort. Debugging tools are another issue. ,ince you can't always run general programs on your embedded processor, you can't always run a debugger on it. his ma"es fixing your program difficult. ,pecial hardware such as E AB ports can overcome this issue in part. ?owever, if you stop on a brea"point when your system is controlling real world hardware -such as a motor., permanent e8uipment damage can occur. As a result, people doing embedded programming 8uic"ly become masters at using serial I: channels and error message style debugging. (.!.* eso$rces" o save costs, embedded systems fre8uently have the cheapest processors that can do the !ob. his means your programs need to be written as efficiently as possible. Chen dealing with large data sets, issues li"e memory cache misses that never matter in 0+ programming can hurt you. <uc"ily, this won't happen too often( use reasonably efficient algorithms to start, and optimi#e only when necessary. :f course, normal profilers won't wor" well, due to the same reason debuggers don't wor" well. &emory is also an issue. 3or the same cost savings reasons, embedded systems usually have the least memory they can get away with. hat means their algorithms must be memory efficient -unli"e in 0+ programs, you will fre8uently sacrifice processor time for memory, rather than the reverse.. It also means you can't afford to lea" memory. Embedded applications generally use deterministic memory techni8ues and avoid the default 9new9 and 9malloc9 functions, so that lea"s can be found and eliminated more easily. :ther resources programmers expect may not even exist. 3or example, most embedded processors do not have hardware 30Ds -3loating(0oint 0rocessing Dnit.. hese resources either need to be emulated in software, or avoided altogether. (.!.1 eal Time Iss$es"
7

Embedded systems fre8uently control hardware, and must be able to respond to them in real time. 3ailure to do so could cause inaccuracy in measurements, or even damage hardware such as motors. his is made even more difficult by the lac" of resources available. Almost all embedded systems need to be able to prioriti#e some tas"s over others, and to be able to put offFs"ip low priority tas"s such as DI in favor of high priority tas"s li"e hardware control. (.( Need ;or Em.edded S/stems" he uses of embedded systems are virtually limitless, because every day new products are introduced to the mar"et that utili#es embedded computers in novel ways. In recent years, hardware such as microprocessors, microcontrollers, and 30BA chips have become much cheaper. ,o when implementing a new form of control, it's wiser to !ust buy the generic chip and write your own custom software for it. 0roducing a custom(made chip to handle a particular tas" or set of tas"s costs far more time and money. &any embedded computers even come with extensive libraries, so that 9writing your own software9 becomes a very trivial tas" indeed. 3rom an implementation viewpoint, there is a ma!or difference between a computer and an embedded system. Embedded systems are often re8uired to provide 6eal( ime response. he main elements that ma"e embedded systems uni8ue are its reliability and ease in debugging. (.(.! De.$gging" Embedded debugging may be performed at different levels, depending on the facilities available. 3rom simplest to most sophisticate they can be roughly grouped into the following areas7 Interactive resident debugging, using the simple shell provided by the embedded operating system -e.g. 3orth and /asic. External debugging using logging or serial port output to trace operation using either a monitor in flash or using a debug server li"e the 6emedy Debugger which even wor"s for heterogeneous multi core systems. An in(circuit debugger -I+D., a hardware device that connects to the microprocessor via a E AB or Nexus interface. his allows the operation of the microprocessor to be controlled externally, but is typically restricted to specific debugging capabilities in the processor. An in(circuit emulator replaces the microprocessor with a simulated e8uivalent, providing full control over all aspects of the microprocessor. A complete emulator provides a simulation of all aspects of the hardware, allowing all of it to be controlled and modified and allowing debugging on a normal 0+.
8

Dnless restricted to external debugging, the programmer can typically load and run software through the tools, view the code running in the processor, and start or stop its operation. he view of the code may be as assembly code or source(code. /ecause an embedded system is often composed of a wide variety of elements, the

debugging strategy may vary. 3or instance, debugging a software-and microprocessor. centric embedded system is different from debugging an embedded system where most of the processing is performed by peripherals -D,0, 30BA, co(processor.. An increasing number of embedded systems today use more than one single processor core. A common problem with multi(core development is the proper synchroni#ation of software execution. In such a case, the embedded system design may wish to chec" the data traffic on the busses between the processor cores, which re8uires very low( level debugging, at signalFbus level, with a logic analy#er, for instance. (.(.( elia.ilit/" Embedded systems often reside in machines that are expected to run continuously for years without errors and in some cases recover by themselves if an error occurs. unreliable mechanical moving parts such as dis" drives, switches or buttons are avoided. ,pecific reliability issues may include7 he system cannot safely be shut down for repair, or it is too inaccessible to repair. Examples include space systems, undersea cables, navigational beacons, bore(hole systems, and automobiles. he system must be "ept running for safety reasons. 9<imp modes9 are less tolerable. :ften bac"ups are selected by an operator. Examples include aircraft navigation, reactor control systems, safety(critical chemical factory controls, train signals, engines on single(engine aircraft. he system will lose large amounts of money when shut down7 elephone switches, factory controls, bridge and elevator controls, funds transfer and mar"et ma"ing, automated sales and service. A variety of techni8ues are used, sometimes in combination, to recover from errorsG both software bugs such as memory lea"s, and also soft errors in the hardware7 Catchdog timer that resets the computer unless the software periodically notifies the watchdog ,ubsystems with redundant spares that can be switched over to software 9limp modes9 that provide partial function
9

herefore the

software is usually developed and tested more carefully than that for personal computers, and

Designing with a rusted +omputing /ase - +/. architectureH2I ensures a highly secure J reliable system environment An Embedded ?ypervisor is able to provide secure encapsulation for any subsystem component, so that a compromised software component cannot interfere with other subsystems, or privileged(level system software. his encapsulation "eeps faults from his may also allow a propagating from one subsystem to another, improving reliability.

subsystem to be automatically shut down and restarted on fault detection. Immunity Aware 0rogramming

(.* E0&lanation of Em.edded S/stems" (.*.! Software Arc%itect$re" here are several different types of software architecture in common use. ,imple +ontrol <oop7

In this design, the software simply has a loop. he loop calls subroutines, each of which manages a part of the hardware or software. Interrupt +ontrolled ,ystem7

,ome embedded systems are predominantly interrupting controlled. his means that tas"s performed by the system are triggered by different "inds of events. An interrupt could be generated for example by a timer in a predefined fre8uency, or by a serial port controller receiving a byte. hese "inds of systems are used if event handlers need low latency and the event handlers are short and simple. Dsually these "inds of systems run a simple tas" in a main loop also, but this tas" is not very sensitive to unexpected delays. ,ometimes the interrupt handler will add longer tas"s to a 8ueue structure. <ater, after the interrupt handler has finished, these tas"s are executed by the main loop. his method brings the system close to a multitas"ing "ernel with discrete processes. +ooperative &ultitas"ing7

A non(preemptive multitas"ing system is very similar to the simple control loop scheme, except that the loop is hidden in an A0I. he programmer defines a series of tas"s, and each tas" gets its own environment to $run% in. Chen a tas" is idle, it calls an idle routine, usually called
10

$pause%, $wait%, $yield%, $nop% -stands for no operation., etc. he advantages and disadvantages are very similar to the control loop, except that adding new software is easier, by simply writing a new tas", or adding to the 8ueue(interpreter. 0rimitive &ultitas"ing7

In this type of system, a low(level piece of code switches between tas"s or threads based on a timer -connected to an interrupt.. his is the level at which the system is generally considered to have an 9operating system9 "ernel. Depending on how much functionality is re8uired, it introduces more or less of the complexities of managing multiple tas"s running conceptually in parallel. As any code can potentially damage the data of another tas" -except in larger systems using an &&D. programs must be carefully designed and tested, and access to shared data must be controlled by some synchroni#ation strategy, such as message 8ueues, semaphores or a non(bloc"ing synchroni#ation scheme. /ecause of these complexities, it is common for organi#ations to buy a real(time operating system, allowing the application programmers to concentrate on device functionality rather than operating system services, at least for large systemsK smaller systems often cannot afford the overhead associated with a generic real time system, due to limitations regarding memory si#e, performance, andFor battery life. &icro"ernels And Exo"ernels7 A micro"ernel is a logical step up from a real(time :,. he usual arrangement is that the operating system "ernel allocates memory and switches the +0D to different threads of execution. Dser mode processes implement ma!or functions such as file systems, networ" interfaces, etc. In general, micro"ernels succeed when the tas" switching and intertas" communication is fast, and fail when they are slow. Exo"ernels communicate efficiently by normal subroutine calls. he hardware and all the software in the system are available to, and extensible by application programmers. /ased on performance, functionality, re8uirement the embedded systems are divided into three categories7 (.*.( Stand Alone Em.edded S/stem"
11

hese systems ta"es the input in the form of electrical signals from transducers or commands from human beings such as pressing of a button etc.., process them and produces desired output. his entire process of ta"ing input, processing it and giving output is done in standalone mode. ,uch embedded systems comes under stand alone embedded systems Eg7 microwave oven, air conditioner etc.. (.*.* ealAtime em.edded s/stems" Embedded systems which are used to perform a specific tas" or operation in a specific time period those systems are called as real(time embedded systems. here are two types of real(time embedded systems. ?ard 6eal(time embedded systems7 hese embedded systems follow an absolute dead line time period i.e.., if the tas"ing is not done in a particular time period then there is a cause of damage to the entire e8uipment. Eg7 consider a system in which we have to open a valve within *) milliseconds. If this valve is not opened in *) ms this may cause damage to the entire e8uipment. ,o in such cases we use embedded systems for doing automatic operations. ,oft 6eal ime embedded systems7
hese embedded systems follow a relative dead line time period i.e.., if the tas" is not done in a particular time that will not cause damage to the e8uipment. Eg7 +onsider a L remote control system , if the remote control ta"es a few milliseconds delay it will not cause damage either to the L or to the remote control. hese systems which will not cause damage when they are not operated at considerable time period those systems comes under soft real(time embedded systems.

(.*.1 Network comm$nication em.edded s/stems" A wide range networ" interfacing communication is provided by using embedded systems. Eg7 +onsider a web camera that is connected to the computer with internet can be used to spread communication li"e sending pictures, images, videos etc.., to another computer with internet connection throughout anywhere in the world.
12

+onsider a web camera that is connected at the door loc". Chenever a person comes near the door, it captures the image of a person and sends to

the des"top of your computer which is connected to internet. his gives an alerting message with image on to the des"top of your computer, and then you can open the door loc" !ust by clic"ing the mouse. 3ig7 ;.; show the networ" communications in embedded systems.

;ig (.(" Network comm$nication em.edded s/stems (.*.4 Different t/&es of &rocessing $nits" he central processing unit -c.p.u. can be any one of the following microprocessor, microcontroller, digital signal processing. Among these &icrocontroller is of low cost processor and one of the main advantage of microcontrollers is, the components such as memory, serial communication interfaces, analog to digital converters etc.., all these are built on a single chip. he numbers of external components that are connected to it are very less according to the application. &icroprocessors are more powerful than microcontrollers. hey are used in ma!or applications with a number of tas"ing re8uirements. /ut the microprocessor re8uires many external components li"e memory, serial communication, hard dis", input output ports etc.., so the power consumption is also very high when compared to microcontrollers.

13

Digital signal processing is used mainly for the applications that particularly involved with processing of signals

(.1 APP3ICATIONS O; E+,EDDED S-STE+S" (.1.! Cons$mer a&&lications" At home we use a number of embedded systems which include microwave oven, remote control, vcd players, dvd players, camera etcM.

;ig(.*" A$tomatic coffee makes eB$i&ment (.1.( Office a$tomation" Ce use systems li"e fax machine, modem, printer etcM

;ig(.1" ;a0 mac%ine

;ig(.4" Printing mac%ine

(.1.*. Ind$strial a$tomation"

oday a lot of industries are using embedded systems for process control. In industries we design the embedded systems to perform a specific operation li"e monitoring temperature,
14

pressure, humidity ,voltage, current etc.., and basing on these monitored levels we do control other devices, we can send information to a centrali#ed monitoring station.

;ig(.5" o.ot In critical industries where human presence is avoided there we can use robots which are programmed to do a specific operation. (.1.4 Com&$ter networking" Embedded systems are used as bridges routers etc..

;ig(.6" Com&$ter networking

(.1.5 Tele comm$nications"


15

+ell phones, web cameras etc.

;ig(.7" Cell P%one

;ig(.9" 2e. camera

16

CHAPTE *" HA D2A E DESC IPTION


*.! Introd$ction7 In this chapter the bloc" diagram of the pro!ect and design aspect of independent modules are considered. /loc" diagram is shown in fig7 *.17

Drows/ Dri)er Detection And Alerts


eg$lated &ower s$&&l/

E/e ,link sensor Alco%ol Sensor


+icro controller

,$::er

8oice +od$le DC +otor Dri)er 3ED indicators DC +otor

eset

Cr/stal Oscillator

;I> *.!?i@"

,lock diagram of transmitter section of Alco%ol Detection and A$tomatic 8e%icle

?DC +otor@ Control S/stem .ased on e/e .link sensor wit% )oice alerts

T%e main .locks of t%is &ro'ect are"


17

1. &icro controller -123455A. ;. +rystal oscillator *. 6egulated power supply -60,. =. <ED Indicator >. Eye blin" sensor 2. D+ motor with driver 5. Alcohol sensor 4. A06 voce module @. /u##er *.( +icro controller"

;ig" *.( +icrocontrollers *.(.! Introd$ction to +icrocontrollers" +ircumstances that we find ourselves in today in the field of microcontrollers had their beginnings in the development of technology of integrated circuits. possible to store hundreds of thousands of transistors into one chip. his development has made it hat was a prere8uisite for

production of microprocessors, and the first computers were made by adding external peripherals such as memory, input(output lines, timers and other. 3urther increasing of the volume of the pac"age resulted in creation of integrated circuits. hese integrated circuits contained both processor and
18

peripherals. hat is how the first chip containing a microcomputer, or what would later be "nown as a microcontroller came about. &icroprocessors and microcontrollers are widely used in embedded systems products. &icrocontroller is a programmable device. A microcontroller has a +0D in addition to a fixed amount of 6A&, 6:&, IF: ports and a timer embedded all on a single chip. he fixed amount of on(chip 6:&, 6A& and number of IF: ports in microcontrollers ma"es them ideal for many applications in which cost and space are critical. he microcontroller used in this pro!ect is 0I+123455A. he 0I+ families of

microcontrollers are developed by &icrochip echnology Inc. +urrently they are some of the most popular microcontrollers, selling over 1;) million devices each year. here are basically four families of 0I+ microcontrollers7 0I+1;+NNN 1;F1=(bit program word 0I+ 12+>N 1;(bit program word 0I+12+NNN and 0I+123NNN 1=(bit program word 0I+15+NNN and 0I+14+NNN 12(bit program word he features, pin description of the microcontroller used are discussed in the following sections. *.(.( Descri&tion" Introduction to PIC Microcontrollers: 0I+ stands for 0eripheral Interface +ontroller given by &icrochip echnology to identify its single(chip microcontrollers. hese devices have been very successful in 4(bit microcontrollers. he main reason is that &icrochip echnology has continuously upgraded the device architecture and added needed peripherals to the microcontroller to suit customers' re8uirements. he development tools such as assembler and simulator are freely available on the internet at www.microchip.com Low - end PIC Architect res:

19

&icrochip 0I+ microcontrollers are available in various types. Chen 0I+ microcontroller &+D was first available from Beneral Instruments in early 1@4)'s, the microcontroller consisted of a simple processor executing 1;(bit wide instructions with basic IF: functions. hese devices are "nown as low(end architectures. hey have limited program memory and are meant for applications re8uiring simple interface functions and small program J data memories. ,ome of the low(end device numbers are 1;+>NN 12+>N 12+>)> Mid r!n"e PIC Architect res: &id range 0I+ architectures are built by upgrading low(end architectures with more number of peripherals, more number of registers and more dataFprogram memory. ,ome of the mid(range devices are 12+2N 12+5N 12345N 0rogram memory type is indicated by an alphabet. + O E06:&, 3 O 3lash, 6+ O &as" 6:& 0opularity of the 0I+ microcontrollers is due to the following factors. 1. ,peed7 ?arvard Architecture, 6I,+ architecture, 1 instruction cycle O = cloc" cycles. ;. Instruction set simplicity7 111 instructions for 4)>1.. *. 0ower(on(reset and brown(out reset. /rown(out(reset means when the power supply goes below a specified voltage -say =L., it causes 0I+ to resetK hence malfunction is avoided. A watch dog timer -user programmable. resets the processor if the softwareFprogram ever malfunctions and deviates from its normal operation. =. 0I+ microcontroller has four optional cloc" sources. he instruction set consists of !ust *> instructions -as opposed to

20

<ow power crystal &id range crystal ?igh range crystal 6+ oscillator -low cost..

>. 0rogrammable timers and on(chip AD+. 2. Dp to 1; independent interrupt sources. 5. 0owerful output pin control -;> mA -max.. current sourcing capability per pin.. 4. E06:&F: 0F6:&F3lash memory option. @. IF: port expansion capability. CP# Architect re: he +0D uses ?arvard architecture with separate 0rogram and Lariable -data. memory interface. his facilitates instruction fetch and the operation on dataFaccessing of variables simultaneously. Architecture of 0I+ microcontroller

;ig.*.*.Arc%itect$re of PIC microcontroller /asically, all 0I+ microcontrollers offer the following features7 6I,+ instruction set with around *> instructions P@ Digital IF: ports :n(chip timer with 4(bit prescaler. 0ower(on reset Catchdog timer 0ower saving ,<EE0 mode
21

Direct, indirect, and relative addressing modes External cloc" interface 6A& data memory E06:& -or : 0. program memory

0eripheral features" ?igh sin"Fsource current ;>mA imer)7 4(bit timerFcounter with 4(bit prescaler can be incremented during sleep via external crystalFcloc" imer;74(bit timerFcounter with 4(bit period register prescaler and post scalar. +apture, +ompare, 0C& -++0. module +apture is 12(bit, max resolution is 1;.>ns +ompare is 12(bit, max resolution is ;)) ns 0C& max, resolution is 1)(bit 4(bit > channel analog(to(digital converter ,ynchronous serial port -,,0. with ,0I -&asterF,lave. and -,lave.

,ome devices offer the following additional features7 Analogue input channels Analogue comparators Additional timer circuits EE06:& data memory 3lash EE06:& program memory External and timer interrupts In(circuit programming Internal oscillator D,A6 serial interface

22

*.(.* Pin diagram"

;ig.*.1.PIN DIA> A+ O; PIC!5;766 0ic12f455 is a =) pin microcontroller. It has > ports port A, port /, port +, port D, port E. All the pins of the ports are for interfacing input output devices. 0ort A7 It consists of 2 pins from A) to A> 0ort /7 It consists of 4 pins from /) to /5 0ort +7 It consists of 4 pins from +) to +5 0ort D7 It consists of 4 pins from D) to D5 0ort E7 It consists of * pins from E) to E;
23

he rest of the pins are mandatory pins these should not be used to connect inputFoutput devices. 0in 1 is &+<6 -master clear pin. pin also referred as reset pin. 0in 1*, 1= are used for crystal oscillator to connect to generate a fre8uency of about ;)&?#. 0in 11, 1; and*1, *; are used for voltage supply Ldd-Q.and Lss-(. 0I+ 123455A ,pecification7 6A& EE06:& 3lash 0rogram &emory :perating 3re8uency IF: port *24 bytes ;>2 bytes 4" words D+ to ;)&?# 0ort A,/,+,D,E his is the specification for 0I+123455A from &icrochip. A single microcontroller which is very brilliant and useful. Also this microcontroller is very easy to be assembled, program and also the price is very cheap. It cost less than 1) dollar. he good thing is that single unit can be purchased at that 1) dollar price. Dnli"e some other Integrated +ircuit that must be bought at a minimum order 8uantity such as 1))) units or ;))) units or else you wonRt be able to purchase it. :ne unit of 0I+123455A microcontroller can be programmed and erased so many times. ,ome said about 1) ))) times. If you are doing programming and downloading your code into the 0I+ ;) times a day that means you can do that for >)) days which is more than a yearS he erasing time is almost unnoticeable because once new program are loaded into the 0I+, the old program will automatically be erased immediately. During my time of Degree study, I did not use 0I+ but I use other type of microcontroller. I have to wait for about 1> to *) minutes to erase the EE06:& before I can load a new program and test the microcontroller. :ne day I can only modify my code and test it for less than 1) times. 1)x1> minutes O 1>) minutes.

24

A+" 0I+123455A already made with *24 bytes of 6andom Access &emory -6A&. inside it. Any temporary variable storage that we wrote in our program will be stored inside the 6A&. Dsing this microcontroller you donRt need to buy any external 6A&.

EEP O+" ;>2 bytes of EE06:& are available also inside this microcontroller. his is very useful to store information such as 0IN Number, ,erial Number and so on. Dsing EE06:& is very important because data stored inside EE06:& will be retained when power supply is turn off. 6A& did not store data permanently. Data inside 6A& is not retained when power supply is turn off. he si#e of program code that can be stored is about 4" words inside 0I+123455A 6:&. 1 word si#e is 1= bits. /y using the free version of the ++, + compiler only ;" words of program can be written and compiled. o write 4" words of + program you have to purchase the original ++, + compiler and it cost less than 5)) dollar. Cr/stal oscillator7 he crystal oscillator speed that can be connected to the 0I+ microcontroller range from D+ to ;)&h#. Dsing the ++, + compiler normally ;)&h# oscillator will be used and the price is very cheap. he ;) &?# crystal oscillator should be connected with about ;;p3 capacitor. 0lease refer to my circuit schematic. here are > inputFoutput ports on 0I+ microcontroller namely port A, port /, port +, port D and port E. Each port has different function. &ost of them can be used as IF: port.

3.3

E>#3ATED PO2E S#PP3-:


25

*.*.! Introd$ction" 0ower supply is a supply of electrical power. A device or system that supplies electrical or other types of energy to an output load or group of loads is called a power supply unit or 0,D. he term is most commonly applied to electrical energy supplies, less often to mechanical ones, and rarely to others. A power supply may include a power distribution system as well as primary or secondary sources of energy such as

+onversion of one form of electrical power to another desired form and voltage, typically involving converting A+ line voltage to a well(regulated lower(voltage D+ for electronic devices. <ow voltage, low power D+ power supply units are commonly integrated with the devices they supply, such as computers and household electronics.

/atteries. +hemical fuel cells and other forms of energy storage systems. ,olar power. Benerators or alternators.

*.*.( ,lock Diagram"

26

;ig *.*.( eg$lated Power S$&&l/ he basic circuit diagram of a regulated power supply -D+ :F0. with led connected as load is shown in fig7 *.*.*.

;ig *.*.* Circ$it diagram of eg$lated Power S$&&l/ wit% 3ed connection
27

he components mainly used in above figure are ;*)L A+ &AIN, 6AN,3:6&E6 /6IDBE 6E+ I3IE6-DI:DE,. +A0A+I :6 L:< ABE 6EBD<A :6-I+ 54)>. 6E,I, :6 <ED-<IB? E&I INB DI:DE.

he detailed explanation of each and every component mentioned above is as follows7 Transformation" he process of transforming energy from one device to another is called

transformation. 3or transforming energy we use transformers. Transformers" A transformer is a device that transfers electrical energy from one circuit to another through inductively coupled conductors without changing its fre8uency. A varying current in the first or primary winding creates a varying magnetic flux in the transformer's core, and thus a varying magnetic field through the secondary winding. induction. If a load is connected to the secondary, an electric current will flow in the secondary winding and electrical energy will be transferred from the primary circuit through the transformer to the load. his field is made up from lines of force and has the same shape as a bar magnet. If the current is increased, the lines of force move outwards from the coil. If the current is reduced, the lines of force move inwards. If another coil is placed ad!acent to the first coil then, as the field moves out or in, the moving lines of force will 9cut9 the turns of the second coil. As it does this, a voltage is induced in the second coil. Cith the >) ?# A+ mains supply, this will happen >) times a second. his is called &D DA< INDD+ I:N and forms the basis of the transformer.
28

his varying magnetic field induces a

varying electromotive force -E&3. or 9voltage9 in the secondary winding. his effect is called mutual

he input coil is called the 06I&A6T CINDINBK the output coil is the ,E+:NDA6T CINDINB. 3ig7 *.*.= shows step(down transformer.

;ig *.*.1" Ste&ADown Transformer he voltage induced in the secondary is determined by the D6N, 6A I:.

3or example, if the secondary has half the primary turnsK the secondary will have half the primary voltage. Another example is if the primary has >))) turns and the secondary has >)) turns, then the turnRs ratio is 1)71. If the primary voltage is ;=) volts then the secondary voltage will be x 1) smaller O ;= volts. Assuming a perfect transformer, the power provided by the primary must e8ual the power ta"en by a load on the secondary. If a ;=(watt lamp is connected across a ;= volt secondary, then the primary must supply ;= watts. o aid magnetic coupling between primary and secondary, the coils are wound on a metal +:6E. ,ince the primary would induce power, called EDDT +D66EN ,, into this core, the core is <A&INA ED. his means that it is made up from metal sheets insulated from each other. ransformers to wor" at higher fre8uencies have an iron dust core or no core at all. Note that the transformer only wor"s on A+, which has a constantly changing current and moving field. D+ has a steady current and therefore a steady field and there would be no induction.
29

,ome transformers have an electrostatic screen between primary and secondary. his is to prevent some types of interference being fed from the e8uipment down into the mains supply, or in the other direction. ransformers are sometimes used for I&0EDAN+E &A +?INB. Ce can use the transformers as step up or step down. Ste& #& transformer" In case of step up transformer, primary windings are every less compared to secondary winding. /ecause of having more turns secondary winding accepts more energy, and it releases more voltage at the output side. Ste& down transformer" Incase of step down transformer, 0rimary winding induces more flux than the secondary winding, and secondary winding is having less number of turns because of that it accepts less number of flux, and releases less amount of voltage. ,atter/ &ower s$&&l/" A battery is a type of linear power supply that offers benefits that traditional line( operated power supplies lac"7 mobility, portability and reliability. A battery consists of multiple electrochemical cells connected to provide the voltage desired. 3ig7 *.*.> shows ?i(Catt @L battery

;ig *.*.4" HiA2att 98 ,atter/ he most commonly used dry(cell battery is the carbon(#inc dry cell battery. Dry(cell batteries are made by stac"ing a carbon plate, a layer of electrolyte paste, and a #inc plate alternately
30

until the desired total voltage is achieved. he most common dry(cell batteries have one of the following voltages7 1.>, *, 2, @, ;;.>, =>, and @). During the discharge of a carbon(#inc battery, the #inc metal is converted to a #inc salt in the electrolyte, and magnesium dioxide is reduced at the carbon electrode. hese actions establish a voltage of approximately 1.> L. he lead(acid storage battery may be used. his battery is rechargeableK it consists of lead and leadFdioxide electrodes which are immersed in sulfuric acid. Chen fully charged, this type of battery has a ;.)2(;.1= L potential -A 1; volt car battery uses 2 cells in series.. During discharge, the lead is converted to lead sulfate and the sulfuric acid is converted to water. Chen the battery is charging, the lead sulfate is converted bac" to lead and lead dioxide A nic"el(cadmium battery has become more popular in recent years. his battery cell is completely sealed and rechargeable. he electrolyte is not involved in the electrode reaction, ma"ing the voltage constant over the span of the batteries long service life. During the charging process, nic"el oxide is oxidi#ed to its higher oxidation state and cadmium oxide is reduced. he nic"el(cadmium batteries have many benefits. hey can be stored both charged and uncharged. hey have a long service life, high current availabilities, constant voltage, and the ability to be recharged. 3ig7 *.*.2 shows pencil battery of 1.>L.

;ig *.*.5" Pencil ,atter/ of !.48 ECTI;ICATION" he process of converting an alternating current to a pulsating direct current is called as rectification. 3or rectification purpose we use rectifiers. ectifiers" A rectifier is an electrical device that converts alternating current -A+. to direct current -D+., a process "nown as rectification. 6ectifiers have many uses including as components of power
31

supplies and as detectors of radio signals. 6ectifiers may be made of solid(state diodes, vacuum tube diodes, mercury arc valves, and other components. A device that it can perform the opposite function -converting D+ to A+. is "nown as an inverter. Chen only one diode is used to rectify A+ -by bloc"ing the negative or positive portion of the waveform., the difference between the term diode and the term rectifier is merely one of usage, i.e., the term rectifier describes a diode that is being used to convert A+ to D+. Almost all rectifiers comprise a number of diodes in a specific arrangement for more efficiently converting A+ to D+ than is possible with only one diode. /efore the development of silicon semiconductor rectifiers, vacuum tube diodes and copper -I. oxide or selenium rectifier stac"s were used. ,ridge f$ll wa)e rectifier" he /ridge rectifier circuit is shown in fig7*.4, which converts an ac voltage to dc voltage using both half cycles of the input ac voltage. he /ridge rectifier circuit is shown in the figure. he circuit has four diodes connected to form a bridge. he ac input voltage is applied to the diagonally opposite ends of the bridge. he load resistance is connected between the other two ends of the bridge. 3or the positive half cycle of the input ac voltage, diodes D1 and D* conduct, whereas diodes D; and D= remain in the :33 state. he conducting diodes will be in series with the load resistance 6< and hence the load current flows through 6<. 3or the negative half cycle of the input ac voltage, diodes D; and D= conduct whereas, D1 and D* remain :33. he conducting diodes D; and D= will be in series with the load resistance 6< and hence the current flows through 6< in the same direction as in the previous half cycle. hus a bi(directional wave is converted into a unidirectional wave. Input :utput

32

;ig *.*.6" ,ridge rectifier" a f$llAwa)e rectifier $sing 1 diodes D,!C6" Now (a (days /ridge rectifier is available in I+ with a number of D/1)5. In our pro!ect we are using an I+ in place of bridge rectifier. he picture of D/ 1)5 is shown in fig7 *.*.4. ;eat$res" Bood for automation insertion ,urge overload rating ( *) amperes pea" Ideal for printed circuit board 6eliable low cost construction utili#ing molded Blass passivated device 0olarity symbols molded on body &ounting position7 Any Ceight7 1.) gram

33

;ig *.*.7" D,!C6 ;iltration" he process of converting a pulsating direct current to a pure direct current using filters is called as filtration. ;ilters" Electronic filters are electronic circuits, which perform signal(processing functions, specifically to remove unwanted fre8uency components from the signal, to enhance wanted ones. Introd$ction to Ca&acitors" he +apacitor or sometimes referred to as a +ondenser is a passive device, and one which stores energy in the form of an electrostatic field which produces a potential -static voltage. across its plates. In its basic form a capacitor consists of two parallel conductive plates that are not connected but are electrically separated either by air or by an insulating material called the Dielectric. Chen a voltage is applied to these plates, a current flows charging up the plates with electrons giving one plate a positive charge and the other plate an e8ual and opposite negative charge this flow of electrons to the plates is "nown as the +harging +urrent and continues to flow until the voltage across the plates -and hence the capacitor. is e8ual to the applied voltage Lcc. At this point the capacitor is said to be fully charged and this is illustrated below. he construction of capacitor and an electrolytic capacitor are shown in figures *.*.@ and *.*.1) respectively.

34

;ig *.*.9"Constr$ction Of a Ca&acitor Dnits of +apacitance7 &icrofarad -U3. 1U3 O 1F1,))),))) O ).)))))1 O 1)(2 3

;ig *.*.!C"Electrol/tic Ca&aticor

Nanofarad -n3. 1n3 O 1F1,))),))),))) O ).))))))))1 O 1)(@ 3 0ico farad -p3. 1p3 O 1F1,))),))),))),))) O ).)))))))))))1 O 1)(1; 3 O&eration of Ca&acitor" hin" of water flowing through a pipe. If we imagine a capacitor as being a storage tan" with an inlet and an outlet pipe, it is possible to show approximately how an electronic capacitor wor"s. 3irst, let's consider the case of a 9coupling capacitor9 where the capacitor is used to connect a signal from one part of a circuit to another but without allowing any direct current to flow.

If the current flow is alternating between #ero and a maximum, our 9storage tan"9 capacitor will allow the current waves to pass through.
35

?owever, if there is a steady current, only the initial short burst will flow until the 9floating ball valve9 closes and stops further flow.

,o a coupling capacitor allows 9alternating current9 to pass through because the ball valve doesn't get a chance to close as the waves go up and down. ?owever, a steady current 8uic"ly fills the tan" so that all flow stops. A capacitor will pass alternating current but -apart from an initial surge. it will not pass d.c.

Chere a capacitor is used to decouple a circuit, the effect is to 9smooth out ripples9. Any ripples, waves or pulses of current are passed to ground while d.c. 3lows smoothly.

eg$lation" he process of converting a varying voltage to a constant regulated voltage is called as regulation. 3or the process of regulation we use voltage regulators.

8oltage eg$lator" A voltage regulator -also called a VregulatorR. with only three terminals appears to be a simple device, but it is in fact a very complex integrated circuit. It converts a varying input voltage into a constant VregulatedR output voltage. Loltage 6egulators are available in a variety of outputs li"e
36

>L, 2L, @L, 1;L and 1>L. he <&54NN series of voltage regulators are designed for positive input. 3or applications re8uiring negative input, the <&5@NN series is used. Dsing a pair of Vvoltage( dividerR resistors can increase the output voltage of a regulator circuit. It is not possible to obtain a voltage lower than the stated rating. Tou cannot use a 1;L regulator to ma"e a >L power supply. Loltage regulators are very robust. hese can withstand over( current draw due to short circuits and also over(heating. In both cases, the regulator will cut off before any damage occurs. he only way to destroy a regulator is to apply reverse voltage to its input. 6everse polarity destroys the regulator almost instantly. 3ig7 *.*.11 shows voltage regulator.

;ig *.*.!!" 8oltage eg$lator esistors" A resistor is a two(terminal electronic component that produces a voltage across its terminals that is proportional to the electric current passing through it in accordance with :hm's law7
V $ IR

6esistors are elements of electrical networ"s and electronic circuits and are ubi8uitous in most electronic e8uipment. 0ractical resistors can be made of various compounds and films, as well as resistance wire -wire made of a high(resistivity alloy, such as nic"elFchrome.. he primary characteristics of a resistor are the resistance, the tolerance, maximum wor"ing voltage and the power rating. :ther characteristics include temperature coefficient, noise, and inductance. <ess well("nown is critical resistance, the value below which power dissipation limits the maximum permitted current flow, and above which the limit is applied voltage. +ritical resistance is determined by the design, materials and dimensions of the resistor.
37

6esistors can be made to control the flow of current, to wor" as Loltage dividers, to dissipate power and it can shape electrical waves when used in combination of other components. /asic unit is ohms. T%eor/ of o&eration" O%mDs law" he behavior of an ideal resistor is dictated by the relationship specified in :hm's law7 L O I6 :hm's law states that the voltage -L. across a resistor is proportional to the current -I. through it where the constant of proportionality is the resistance -6.. Power dissi&ation" he power dissipated by a resistor -or the e8uivalent resistance of a resistor networ". is calculated using the following7

;ig *.*.!(" esistor *.1. 3ED"


38

;ig *.*.!*" Color ,ands In esistor

A light(emitting diode -<ED. is a semiconductor light source. <EDRs are used as indicator lamps in many devices, and are increasingly used for lighting. Introduced as a practical electronic component in 1@2;, early <EDRs emitted low(intensity red light, but modern versions are available across the visible, ultraviolet and infrared wavelengths, with very high brightness. internal structure and parts of a led are shown in figures *.=.1 and *.=.; respectively. he

;ig *.1.!" Inside a 3ED

;ig *.1.(" Parts of a 3ED

2orking" he structure of the <ED light is completely different than that of the light bulb. Ama#ingly, the <ED has a simple and strong structure. he light(emitting semiconductor material is what determines the <ED's color. he <ED is based on the semiconductor diode. Chen a diode is forward biased -switched on., electrons are able to recombine with holes within the device, releasing energy in the form of photons. his effect is called electroluminescence and the color of the light -corresponding to the energy of the photon. is determined by the energy gap of the semiconductor. An <ED is usually small in area -less than 1 mm;., and integrated optical components are used to shape its radiation pattern and assist in reflection. <EDRs present many advantages over incandescent light sources including lower energy consumption, longer lifetime, improved robustness, smaller si#e, faster switching, and greater durability and reliability. ?owever, they are relatively expensive and re8uire more precise current and
39

heat management than traditional light sources. +urrent <ED products for general lighting are more expensive to buy than fluorescent lamp sources of comparable output. hey also en!oy use in applications as diverse as replacements for traditional light sources in automotive lighting -particularly indicators. and in traffic signals. he compact si#e of <EDRs has allowed new text and video displays and sensors to be developed, while their high switching rates are useful in advanced communications technology. he electrical symbol and polarities of led are shown in fig7 *.=.*.

;ig *.1.*" Electrical S/m.ol E Polarities of 3ED <ED lights have a variety of advantages over other light sources7 ?igh(levels of brightness and intensity ?igh(efficiency <ow(voltage and current re8uirements <ow radiated heat ?igh reliability -resistant to shoc" and vibration. No DL 6ays <ong source life +an be easily controlled and programmed

40

Applications of <ED fall into three ma!or categories7

Lisual signal application where the light goes more or less directly from the <ED to the human eye, to convey a message or meaning. Illumination where <ED light is reflected from ob!ect to give visual response of these ob!ects. Benerate light for measuring and interacting with processes that do not involve the human visual system.

*.4 E/e,link Sensor


his Eye /lin" sensor is I6 based , . he Lariation Across the eye will vary as per eye blin" . If the eye is closed means the output is high otherwise output is low. his to "now the eye is closing or opening position. his output is give to logic circuit to indicate the alarm. his can be used for pro!ect involves controlling accident due to unconscious through Eye blin".

,enses eye blin" using I6 sensor, comparator and potentiometer. <ocation of iris is detected by one I6 sensor and output is given to one comparator. Lin71;L W Lout7 ) to >L W Iout75>mA W ,ensor7 I6 W ,ensitivity ad!ustment7 0otentiometer W 0osition of iris detected by I6 W /lin"ing of eye is exactly using comparators.
41

+omparator W 0otentiometer W I6 sensor

Infrared transmitter is one type of <ED which emits infrared rays generally called as I6 ransmitter. ,imilarly I6 6eceiver is used to receive the I6 rays transmitted by the I6 transmitter. :ne important point is both I6 transmitter and receiver should be placed straight line to each other. he transmitted signal is given to I6 transmitter whenever the signal is high, the I6 transmitter <ED is conducting it passes the I6 rays to the receiver. he I6 receiver is connected with comparator. he comparator is constructed with <& *>4 operational amplifier. In the comparator circuit the reference voltage is given to inverting input terminal. he non inverting input terminal is connected I6 receiver. Chen interrupt the I6 rays between the I6 transmitter and receiver, the I6 receiver is not conducting. ,o the comparator non inverting input terminal voltage is higher then inverting input. Now the comparator output is in the range of Q>L. his voltage is given to microcontroller or 0+ and led so led will glow.
42

Chen I6 transmitter passes the rays to receiver, the I6 receiver is conducting due to that non inverting input voltage is lower than inverting input. Now the comparator output is BND so the output is given to microcontroller or 0+. intruder detector etc. his circuit is mainly used to for counting application,

he eye(blin" sensor wor"s by illuminating the eye and eyelid area with infrared light, then monitoring the changes in the reflected light using a phototransistor and differentiator circuit. respect 3EA D 6E, ETE Instant +ompact Cor"ing Loltage Q>L output /<INX digital signal indication for directly+onnecting by to <ED microcontroller ,i#e D+ to the he eye. exact functionality depends greatly on the positioning and aiming of the emitter and detector with

A00<I+A I:N Digital Eye /lin" monitor for Lehicle Accident prevention J .,uitable for real time driving applications. ,0E+I3I+A I:N :perating :perating :utput Eye D,INB
43

Loltage Data /lin" Indicated by

7Q>L +urrent <evel <ED and

D+ 7 :utput < ?igh

regulated 71))mA <evel 0ulse ,EN,:6

+onnect regulated D+ power supply of > Lolts. /lac" wire is Bround, Next middle wire is /rown which is output and 6ed wire is positive supply. hese wires are also mar"ed on 0+/. o test sensor you only need power the sensor by connect two wires Q>L and BND. Tou can leave the output wire as it is. Chen Eye closed, <ED is off J the output is at )L.0ut Eye blin" sensor glass on the face within 1>mm distance, and you can view the <ED blin"ing on each Eye blin". he output is active high for Eye close and can be given directly to microcontroller for interfacing applications. ETE >L )L -?igh. -<ow. Y Y <ED <ED /<INX :N :33 Chen when Eye Eye is is :D 0D close. open.

nother nice approach wor"s by illuminating the eye andFor eyelid area with infrared light, then monitoring the changes in the reflected light using a phototransistor.

he exact functionality depends greatly on the positioning and aiming of the emitter and detector with respect to the eye.

44

his

is

an

scheme

used

in

this paper to

detect

the

eye

blin"

of

rabbit7

45

hese

are

the

"ind

of

visuali#ations

used

in

scientific

approaches7

46

9Dn"nown 0leasures9 cover, wich could be a fantastic way of visuali#e this "ind of data7

in front of it.

47

*.5 D.C. +otor"


A dc motor uses electrical energy to produce mechanical energy, very typically through the interaction of magnetic fields and current(carrying conductors. producing electrical energy from mechanical energy, is he reverse process, accomplished by

an alternator, generator or dynamo. &any types of electric motors can be run as generators, and vice versa. he input of a D+ motor is currentFvoltage and its output is tor8ue -speed..

;ig *.!9" DC +otor he D+ motor has two basic parts7 the rotating part that is called the armature and the stationary part that includes coils of wire called the field coils. he stationary part is also called the stator. 3igure shows a picture of a typical D+ motor, 3igure shows a picture of a D+ armature, and 3ig shows a picture of a typical stator. 3rom the picture you can see the armature is made of coils of wire wrapped around the core, and the core has an extended shaft that rotates on bearings. Tou should also notice that the ends of each coil of wire on the armature are terminated at one end of the armature. he termination points are called the commutator, and this is where the brushes ma"e electrical contact to bring electrical current from the stationary part to the rotating part of the machine.

O&eration"
48

he D+ motor you will find in modem industrial applications operates very similarly to the simple D+ motor described earlier in this chapter. 3igure 1;(@ shows an electrical diagram of a simple D+ motor. Notice that the D+ voltage is applied directly to the field winding and the brushes. he armature and the field are both shown as a coil of wire. In later diagrams, a field resistor will be added in series with the field to control the motor speed. Chen voltage is applied to the motor, current begins to flow through the field coil from the negative terminal to the positive terminal. his sets up a strong magnetic field in the field winding. +urrent also begins to flow through the brushes into a commutator segment and then through an armature coil. he current continues to flow through the coil bac" to the brush that is attached to other end of the coil and returns to the D+ power source. he current flowing in the armature coil sets up a strong magnetic field in the armature.

;ig *.(C" Sim&le electrical diagram of DC motor

;ig *.(!" O&eration of a DC +otor

49

he magnetic field in the armature and field coil causes the armature to begin to rotate. his occurs by the unli"e magnetic poles attracting each other and the li"e magnetic poles repelling each other. As the armature begins to rotate, the commutator segments will also begin to move under the brushes. As an individual commutator segment moves under the brush connected to positive voltage, it will become positive, and when it moves under a brush connected to negative voltage it will become negative. In this way, the commutator segments continually change polarity from positive to negative. ,ince the commutator segments are connected to the ends of the wires that ma"e up the field winding in the armature, it causes the magnetic field in the armature to change polarity continually from north pole to south pole. he commutator segments and brushes are aligned in such a way that the switch in polarity of the armature coincides with the location of the armature's magnetic field and the field winding's magnetic field. he switching action is timed so that the armature will not loc" up magnetically with the field. Instead the magnetic fields tend to build on each other and provide additional tor8ue to "eep the motor shaft rotating. Chen the voltage is de(energi#ed to the motor, the magnetic fields in the armature and the field winding will 8uic"ly diminish and the armature shaft's speed will begin to drop to #ero. If voltage is applied to the motor again, the magnetic fields will strengthen and the armature will begin to rotate again.

T/&es of DC motors" 1. D+ ,hunt &otor, ;. D+ ,eries &otor, *. D+ <ong ,hunt &otor -+ompound. =. D+ ,hort ,hunt &otor -+ompound.

50

he rotational energy that you get from any motor is usually the battle between two magnetic fields chasing each other. he D+ motor has magnetic poles and an armature, to which D+ electricity is fed, he &agnetic 0oles are electromagnets, and when they are energi#ed, they produce a strong magnetic field around them, and the armature which is given power with a commutator, constantly repels the poles, and therefore rotates. !. T%e DC S%$nt +otor" In a ; pole D+ &otor, the armature will have two separate sets of windings, connected to a commutator at the end of the shaft that are in constant touch with carbon brushes. he brushes are static, and the commutator rotate and as the portions of the commutator touching the respective positive or negative polarity brush will energi#e the respective part of the armature with the respective polarity. It is usually arranged in such a way that the armature and the poles are always repelling. he general idea of a D+ &otor is, the stronger the 3ield +urrent, the stronger the magnetic field, and faster the rotation of the armature. Chen the armature revolves between the poles, the magnetic field of the poles induce power in the armature conductors, and some electricity is generated in the armature, which is called bac" emf, and it acts as a resistance for the armature. Benerally an armature has resistance of less than 1 :hm, and powering it with heavy voltages of Direct +urrent could result in immediate short circuits. his bac" emf helps us there. Chen an armature is loaded on a D+ ,hunt &otor, the speed naturally reduces, and therefore the bac" emf reduces, which allows more armatures current to flow. his results in more armature field, and therefore it results in tor8ue.

3ig7 Diagram of D+ shunt motor Chen a D+ ,hunt &otor is overloaded, if the armature becomes too slow, the reduction of the bac" emf could cause the motor to burn due to heavy current flow thru the armature.
51

he poles and armature are excited separately, and parallel, therefore it is called a ,hunt &otor. (. T%e DC Series +otor"

3ig7 Diagram of D+ series motor A D+ ,eries &otor has its field coil in series with the armature. herefore any amount of power

drawn by the armature will be passed thru the field. As a result you cannot start a ,eries D+ &otor without any load attached to it. It will either run uncontrollably in full speed, or it will stop.

3ig7 Diagram of D+ series motor graph representation Chen the load is increased then its efficiency increases with respect to the load applied. ,o these are on Electric rains and elevators. S&ecifications

D+ supply7 = to 1;L
52

60&7 *)) at 1;L otal length7 =2mm &otor diameter7 *2mm &otor length7 ;>mm /rush type7 0recious metal Bear head diameter7 *5mm Bear head length7 ;1mm :utput shaft7 +entred ,haft diameter7 2mm ,haft length7 ;;mm Bear assembly7 ,pur &otor weight7 1)>gms

Ce generally use *))60& +entre ,haft Economy ,eries D+ &otor which is high 8uality low cost D+ geared motor. It has steel gears and pinions to ensure longer life and better wear and tear properties. he gears are fixed on hardened steel spindles polished to a mirror finish. he output shaft rotates in a plastic bushing. he whole assembly is covered with a plastic ring. Bearbox is sealed and lubricated with lithium grease and re8uire no maintenance. he motor is screwed to the gear box from inside. Although motor gives *)) 60& at 1;L but motor runs smoothly from =L to 1;L and gives wide range of 60&, and tor8ue. ables below gives fairly good idea of the motorRs performance in terms of 60& and no load current as a function of voltage and stall tor8ue, stall current as a function of voltage. *. DC Com&o$nd +otor"

53

A compound of ,eries and ,hunt excitation for the fields is done in a +ompound D+ &otor. his gives the best of both series and shunt motors. /etter tor8ue as in a series motor, while the possibility to start the motor with no load.

3ig7 Diagram of D+ compound motor Above is the diagram of a long shunt motor, while in a short shunt, the shunt coil will be connected after the serial coil. A +ompound motor can be run as a shunt motor without connecting the serial coil at all but not vice versa.

54

DC +otor Dri)er"
he <;@* and <;@*D are 8uadruple high(current half(? drivers. he <;@* is designed to provide bidirectional drive currents of up to 1 A at voltages from =.> L to *2 L. he <;@*D is designed to provide bidirectional drive currents of up to 2))(mA at voltages from =.> L to *2 L. /oth devices are designed to drive inductive loads such as relays, solenoids, dc and bipolar stepping motors, as well as other high(currentFhigh(voltage loads in positive(supply applications. All inputs are < compatible. Each output is a complete totem(pole drive circuit, with a Darlington transistor sin" and a pseudo(Darlington source. Drivers are enabled in pairs, with drivers 1 and ; enabled by 1,;EN and drivers * and = enabled by *,=EN.Chen an enable input is high, the associated drivers are enabled and their outputs are active and in phase with their inputs. Chen the enable input is low, those drivers are disabled and their outputs are off and in the high(impedance state. Cith the proper data inputs, each pair of drivers forms a full(? -or bridge. reversible drive suitable for solenoid or motor applications. :n the <;@*, external high(speed output clamp diodes should be used for inductive transient suppression. A L++1 terminal, separate from L++;, is provided for the logic inputs to minimi#e device power dissipation. he <;@*and <;@*D are characteri#ed for operation from )Z+ to 5)Z+.

;ig *.((" 3(9*D IC Pin Diagram of 3(9*D motor dri)er7

55

;ig *.(*" 3(9*D &in diagram

;ig *.(1" Internal str$ct$re of 3(9*D.

;eat$res of 3(9*D"
56

2))mA :utput current capability per channel 1.;A 0ea" output current -non repetitive. per channel Enable facility :ver temperature protection <ogical $)%input voltage up to 1.> v ?igh noise immunity Internal clamp diodes

A&&lications of DC +otors" 1. Electric rain7 A "ind of D+ motor called the D+ ,eries &otor is used in Electric rains. he D+ ,eries &otors have the property to deliver more power when they are loaded more. ,o the more the people get on a train, the more powerful the train becomes. ;. Elevators7 he best bidirectional motors are D+ motors. hey are used in elevators. +ompound D+ &otors are used for this application. *. 0+ 3ans, +D 6:& Drives, and ?ard Drives7 All these things need motors, very miniature motors, with great precision. A+ motors can never imagine any application in these places. =. ,tarter &otors in Automobiles7 An automobile battery supplies D+, so a D+ motor is best suited here. Also, you cannot start an engine with a small si#ed A+ motor, >. Electrical &achines <ab in +olleges.

*.6 Alco%ol detector Sensor


*.6.! Introd$ction" Alco%ol detector sensors need to be calibrated and periodically chec"ed to ensure sensor accuracy and system integrity. &'*)*A is semiconductor sensor is for Alcohol detection. It has good sensitivity and fast response to alcohol, suitable for portable alcohol detector.
57

Tou could get of &'*)*A, it reflects change from voltage change on fixed or ad!ustable relations between resistance and gas load resistance. Normally, it will ta"e several concentration, resistance of the sensor minutes preheating for sensor enter into stable reduce when gas concentration increases wor"ing after electrifiedK or you could give ;.;[).;L high voltage for >(1)secs before test, which ma"e sensor easily stable *.6.( 2orking &roced$re" Indium in :xide -I :7 In;:* Q 15\ ,n:;. thin films grown on alumina substrate at 2=4 X temperatures using direct evaporation method with two gold pads deposited on the top for electrical contacts were exposed to ethanol vapors -;))A;>)) ppm.. his sensor when exposed to alcohol the resistance varies this input is captured and given to micro controller for further process. It is important to install stationary sensors in locations where the calibration can be performed easily. he intervals between calibrations can be different from sensor to sensor. Benerally, the manufacturer of the sensor will recommend a time interval between calibrations. ?owever, it is good general practice to chec" the sensor more closely during the first *) days after installation. During this period, it is possible to observe how well the sensor is adapting to its new environment. Also, factors that were not accounted for in the design of the system might surface and can affect the sensorRs performance. If the sensor functions properly for *) continuous days, this provides a good degree of confidence about the installation. Any possible problems can be identified and corrected during this time. Experience indicates that a sensor surviving *) days after the initial installation will have a good chance of performing its function for the duration expected. &ost problemsGsuch as an inappropriate sensor location, interference from other Alcohol detectors, or the loss of sensitivityGwill surface during this time.

58

;ig *.6.(.Alco%ol detector sensor &'*)*A is semiconductor sensor is for Alcohol detection, it has good sensitivity and fast response to alcohol, suitable for portable alcohol detector.

;ig *.4.*Config$ration fig$re of Alco%ol detector sensor *.6.( Descri&tion" ,ensing element of the semiconductor sensor is a micro(ball, heater and metal electrode are inside, and the sensing element is installed in anti(explosion double 1)) mesh metal case. During the first *) days, the sensor should be chec"ed wee"ly. Afterward, a maintenance schedule, ?a#ardous Alcohol detector &onitors including calibration intervals, should be established. Normally, a monthly calibration is ade8uate to ensure the effectiveness and sensibility of each sensorK this monthly chec"
59

will also afford you the opportunity to maintain the systemRs accuracy. he method and procedure for calibrating the sensors should be established immediately. he calibration procedure should be simple, straightforward, and easily executed by regular personnel. +alibration here is simply a safety chec", unli"e laboratory analy#ers that re8uire a high degree of accuracy. 3or area air 8uality and safety Alcohol detector monitors, the re8uirements need to be simple, repeatable, and economical. he procedure should be consistent and traceable. he calibration will be performed in the field where sensors are installed so it can occur in any type environment. +alibration of the Alcohol detector sensor involves two steps. 3irst the $#ero% must be set and then the $span% must be calibrated.
he sensing material in B, Alcohol detector sensors is metal oxide, most typically ,n: ;. Chen a metal oxide +rystal such as ,n:; is heated at a certain high temperature in air, oxygen is adsorbed on the crystal surface with a negative charge. hen donor electrons in the crystal surface are transferred to the adsorbed oxygen, resulting in leaving positive charges in a space charge layer. hus, surface potential is formed to serve as a potential barrier against electron flow. Inside the sensor, electric current flows through the con!unction parts -grain boundary. of ,n: ; micro crystals. At grain boundaries, adsorbed oxygen forms a potential barrier which prevents carriers from moving freely. he electrical resistance of the sensor is attributed to this potential barrier. In the presence of a deoxidi#ing Alcohol detector, the surface density of the negatively charged oxygen decreases, so the barrier height in the grain boundary is reduced. he reduced barrier height decreases sensor resistance. ,ensor resistance will drop very 8uic"ly when exposed to Alcohol detector, and when removed from Alcohol detector its resistance will recover to its original value after a short time. he speed of response and reversibility will vary according to the model of sensor and the Alcohol detector involved.

*.6.* ;ollowing conditions m$st .e &ro%i.ited 1.1 Exposed to organic silicon steam :rganic silicon steam cause sensors invalid, sensors must be avoid exposing to silicon bond, fixature, silicon latex, putty or plastic contain silicon environment 1.; ?igh +orrosive gas If the sensors exposed to high concentration corrosive gas -such as ?;,#, ,:N+l;?+l etc., it will not only result in corrosion of sensors structure, also it cause sincere sensitivity attenuation. 1.* Al"ali, Al"ali metals salt, halogen pollution he sensors performance will be changed badly if sensors be sprayed polluted by al"ali metals salt especially brine, or be exposed to halogen such as fluorin. 1.= ouch water ,ensitivity of the sensors will be reduced when spattered or dipped in water.
60

1.> 3ree#ing Do avoid icing on sensorR surface, otherwise sensor would lose sensitivity. 1.2 Applied voltage higher Applied voltage on sensor should not be higher than stipulated value, otherwise it cause down(line or heater damaged, and bring on sensorsR sensitivity characteristic changed badly. 1.5 Loltage on wrong pins 3or 2 pins sensor, if apply voltage on 1* pins or =2 pins, it will ma"e lead bro"en, and without signal when apply on ;= pins *.6.1 ;ollowing conditions m$st .e a)oided ;.1 Cater +ondensation Indoor conditions, slight water condensation will effect sensors performance lightly. ?owever, if water condensation on sensors surface and "eep a certain period, sensorR sensitivity will be decreased. ;.; Dsed in high gas concentration No matter the sensor is electrified or not, if long time placed in high gas concentration, if will affect sensors characteristic. ;.* <ong time storage he sensors resistance produce reversible drift if itRs stored for long time without electrify, this drift is related with storage conditions. ,ensors should be stored in airproof without silicon gel bag with clean air. 3or the sensors with long time storage but no electrify, they need long aging time for stability before using. ;.= <ong time exposed to adverse environment No matter the sensors electrified or not, if exposed to adverse environment for long time, such as high humidity, high temperature, or high pollution etc, it will effect the sensors performance badly. ;.> Libration +ontinual vibration will result in sensors down(lead response then repture. In transportation or assembling line, pneumatic screwdriverFultrasonic welding machine can lead this vibration. ;.2 +oncussion If sensors meet strong concussion, it may lead its lead wire disconnected. ;.5 Dsage 3or sensor, handmade welding is optimal way. If use wave crest welding should meet the conditions7 ;.5.1 ,oldering flux7 6osin soldering flux contains least chlorine ;.5.; ,peed7 1(; &eterF &inute
61

;.5.* Carm(up temperature1))[;) ;.5.= Celding temperature;>)[1) ;.5.> 1 time pass wave crest welding machine If disobey the above using terms, sensors sensitivity will be reduced. *.6.4 Ad)antages" ] ?igh sensitivity ] 3ast response and resume ] <ong life and low cost ] &ini ,i#e

*.!C AP **A* 8OICE +OD#3E Introd$ction

oday's consumers demand the best in audioFvoice. audioFvoice experience.

hey want crystal(clear sound wherever

they are in whatever format they want to use. A0<D, delivers the technology to enhance a listener's

he a06**A series are powerful audio processor along with high performance audio analog(to( digital converters -AD+s. and digital(to(analog converters -DA+s.. he a06**A series are a fully integrated solution offering high performance and unparalleled integration with analog input, digital processing and analog output functionality. he a06**A series incorporates all the functionality re8uired to perform demanding audioFvoice applications. ?igh 8uality audioFvoice systems with lower bill(of(material costs can be implemented with the a06**A series because of its integrated analog data converters and full suite of 8uality( enhancing features such as sample(rate converter. he a06**A series +1.) is specially designed for simple +0D interface, user can record or playbac" up to 1);= voices by > IF: s only. his mode built in one complete memory(management system.
62

he control side doesn't need to be burdened complicated memory distribution problems and it only needs to be through a simple instruction to proceed the audioFvoice recording J playbac" so it largely shorten the developing time. &eanwhile, +hip provides the power(management system too. Dsers can let the chip enter power( down mode when unused. It can effectively reduce electric current consuming to 1>uA and increase the using time in any pro!ects powered by batteries. he a06**A series are powerful audio processor along with high performance audio analog(to( digital converters -AD+s. and digital(to(analog converters -DA+s.. he a06**A series are a fully integrated solution offering high performance and unparalleled integration with analog input, digital processing and analog output functionality. he a06**A series incorporates all the 3unctionality re8uired performing demanding audioFvoice applications. ?igh 8uality audioFvoice systems with lower bill(of(material costs can be implemented with the a06**A series because of its integrated analog data converters and full suite of 8uality(enhancing features such as sample(rate converter. he a06**A series +;.) is specially designed for simple "ey trigger, user can record and playbac" the message averagely for 1, ;, = or 4 voice message-s. by switch, It is suitable in simple interface or need to limit the length of single message, e.g. toys, leave messages system, answering machine etc. &eanwhile, this mode provides the power(management system. Dsers can let the chip enter power( down mode when unused. It can effectively reduce electric current consuming to 1>uA and increase the using time in any pro!ects powered by batteries. PIN CON;I># ATION

63

PIN DESC IPTION

0in Names

T0E

Description

LDD0 LDD LDDA LDD<

0ositive power supply.

64

L,,0 L,,< L,,A

0ower ground.

L<D:

Internal <D: output.

L+:6E

0ositive power supply for core.

L6E3

6eference voltage.

L+&

+ommon mode voltage.

6osc

IN0D

:scillator resistor input.

6, /

IN0D

6eset. -<ow active.

,6, /

IN0D

,ystem reset, pull(down a resistor to the L,,<.

&I+Q &I+(

IN0D

&icrophone differential input.

&I+B

:D 0D

&icrophone ground.
65

L:D ; L:D 1

:D 0D

0C& output to drive spea"er directly.

F6E+

IN0D

6ecord &ode. -<ow active.

&)

IN0D

&essage().

&1

IN0D

&essage(1.

&;

IN0D

&essage(;.

&* &= &> &2 F &,E<)

IN0D IN0D IN0D IN0D

&essage(* &essage(= &essage(> &essage(2, &essage select ).

&5 F &,E<1

IN0D

&essage(5, &essage select 1.

CONNECTION DIA> A+

66

SE IA3 CO++AND

he a06**A1F a06**A;F a06**A series +1.) is specially designed for simple +0D interface. +hip
67

is controlled by command sent to it from the host +0D. he F+, pin is used to select chip. he ,+X and ,DI pin are used to input command word into the chip while ,D: and /D,T as output from the chip to the host +0D for feedbac" response.

+ommand input into the chip contains 12(bit data and lists the command format J summari#es the Available commands as below7

EC he 6E+ command is used to start record the voice to the specified voice number. In the 6E+ command, the bit(1> ^ bit(1) is ))1))) in binary, and the bit(@ ^ bit() is the voice number in binary. Dp to 1);= voice numbers user can specify. After the 6E+ command sent, the F/D,T pin will be drove low and playbac" $beep% tone to indicate the record operation starting. During the record operating, the F/D,T pin will "eep driving low, and any command except , :0 will be ignored. he record operation will continue until users send , :0 command or full of memory, the F/D,T pin will be released and playbac" 9beep9 tone ; times to indicate the record operation finished. If the specified voice number already exist voice data or the memory is full, the F/D,T pin will not drive to low and execute 6E+ operating. Dser can use the DE<E E command to clear specified voice number before 6E+ command.

68

P3Ahe 0<AT command is used to start playbac" the voice in the specified voice number. In the 0<AT command, the bit(1> ^ bit(1) is ))11)) in binary, and the bit(@ ^ bit() is the voice number in binary. Dp to 1);= voice numbers user can specify. After the 0<AT command sent, the F/D,T pin will be drove low to indicate the playbac" operation starting. During the playbac" operating, the F/D,T pin will "eep drive low, and any command except , :0 will be ignored. he playbac" operation will continue until users send , :0 command or end of voice, the F/D,T pin will be released to indicate the record operation finished. If the specified voice number is empty, it will not drive F/D,T to low and playbac". operation. he , :0 command is used to stop current

After the , :0 command sent, the F/D,T pin will be released to indicate end of the current operation. he , :0 command is effective only in playing or vb recording.

DE3ETE he DE<E E command is used to delete the voice in the specified voice number. In the DE<E E command, the bit(1> ^ bit(1) is )))1)) in binary, and the bit(@ ^ bit() is the voice number in binary. Dp to 1);= voice numbers user can specify. After the DE<E E command sent, the F/D,T pin will be drove low to indicate the delete operation starting. Chen delete operation is finished, the F/D,T pin will be released. he memory
69

space in the specified voice number will be release after delete operation, user can get more free space by delete unused voice.

PDN he 0DN command is used to enter the power(down mode. After the 0DN command sent, the F/D,T pin will be drove low to indicate the power(down :peration starting. Chen chip is in the power(down mode, the F/D,T pin will be released. During chip in the sleep mode, the current consumption is reduced to I0DN and any command except 0D0 will be ignored.

P#P he 0D0 command is used to power up from sleep mode

After the 0D0 command sent, the F/D,T pin will be drove low to indicate the power up operation starting. Chen chip is in the idle mode, the F/D,T pin will be released. Dser can execute 6E+, 0<AT or DE<E E, or other command in idle mode.

70

;O +AT

he 3:6&A command is used to restore memory to factory state. After the 3:6&A command sent, the F/D,T pin will be drove low to indicate the format operation starting. Chen format operation is finished, the F/D,T pin will be released. All of the voice in the memory will be clear after execute format operation

8OICE INP#T he a06**A series supported single channel voice input by microphone or line(in. he following fig. showed circuit for different input methods7 microphone, line(in and mixture of both.

71

ESET A06**A series can enter standby mode when 6, / pin drive to low. During chip in the standby mode, the current consumption is reduced to I,/ and any operation will be stopped, user also can not execute any new operate in this mode. he standby mode will continue until 6, / pin goes to high, chip will be started to initial, and playbac" 9beep9 tone to indicate enter idele mode. Dser can get less current consumption by control 6, / pin especially in some application which concern standby current.

+ESSA>E +ODE In fixed 1F ;F =F 4 message mode -+;.)., user can divide the memory averagely for 1, ;, = or 4 message-s.. he message mode will be applied after chip reset by the &,E<) and &,E<1 pin. 0lease note the message should be recorded and played in same message mode, we +AN N: guarantee the message is complete after message mode changed. 3or example, user recorded 4 messages in the 4( message mode, those messages can be played in 4(message mode only. If user changed to 1, ; or = message mode, system will discard those messages. _4(&essage &ode he memory will be divided to 4 messages averagely when both &,E<) and &,E<1 pin float after chip reset.

72

=(&essage &ode he memory will be divided to = messages averagely when &,E<) pin connected to L,, and &,E<1 pin float after chip reset.

;(&essage &ode
73

he memory will be divided to ; messages averagely when &,E<1 pin connected to L,, and &,E<) pin float after chip reset.

1(&essage &ode he memory will be for 1 message when both &,E<) and &,E<1 pin connected to L,, after chip reset.

74

ECO D +ESSA>E During the F6E+ pin drove to LI<, chip in the record mode. Chen the message pin -&), &1, &; M &5. drove to LI< in record mode, the chip will playbac" $beep% tone and message record starting. he message record will continue until message pin released or full of this message, and the chip will playbac" $beep% tone ; times to indicate the message record finished. If the message already exist and user record again, the old oneRs message will be replaced. he following fig. showed a typical record circuit for 4(message mode. Ce connected a slide( switch between F6E+ pin and L,,, and connected 4 tact(switches between &) ^ &5 pin and L,,. Chen the slide(switch fixed in L,, side and any tact(switch will be pressed, chip will start message record and until the user releases the tact(switch. Note7 After reset, F6E+ and &) to &5 pin will be pull(up to LDD by internal resistor.

P3A-,ACF +ESSA>E During the F6E+ pin drove to LI?, chip in the playbac" mode. Chen the message pin -&), &1, &; M &5. drove from LI? to LI< in playbac" mode, the message playbac" starting.
75

he message playbac" will continue until message pin drove from LI? to LI< again or end of this message. he following fig. showed a typical playbac" circuit for 4(message mode. Ce connected a slide(switch between F6E+ and L,,, and connected 4 tact(switches between &) ^ &5 and L,,.

Chen the slide(switch fixed in float side and any tact(switch will be pressed, chip will start message playbac" and until the user pressed the tact(switch again or end of message. Note7 After reset, F6E+ and &) to &5 pin will be pull(up to LDD by internal resistor.

;EAT# ES" ,ingle +hip, ?igh 'uality AudioFLoice 6ecording J 0laybac" ,olution _No External I+s 6e8uired &inimum External +omponents _Dser 3riendly, Easy to Dse :peration 0rogramming J Development ,ystems Not 6e8uired 15)F *=)F 24) sec. Loice 6ecording <ength in a06**A1Fa06**A;Fa06**A* _0owerful 12(/its Digital Audio 0rocessor. Nonvolatile 3lash &emory echnology _No /attery /ac"up 6e8uired _External 6eset pin. _0owerful 0ower &anagement Dnit _Lery <ow ,tandby +urrent7 1uA _<ow 0ower(Down +urrent7 1>uA _,upports 0ower(Down &ode for 0ower ,aving _/uilt(in Audio(6ecording &icrophone Amplifier _No External :0A&0 or /E 6e8uired _Easy to 0+/ layout _+onfigurable analog interface _Differential(ended &I+ pre(amp for <ow Noise _?igh 'uality <ine 6eceiver _?igh 'uality Analog to Digital and 0C& module
76

_6esolution up to 12(bits _Dp o &aximum 1);= Loice ,ections controlled through > pins only _/uilt(in &emory(&anagement ,ystem

*.!( *.6 ,$::er /asically, the sound source of a pie#oelectric sound component is a pie#oelectric diaphragm. A pie#oelectric diaphragm consists of a pie#oelectric ceramic plate which has electrodes on both sides and a metal plate -brass or stainless steel, etc... A pie#oelectric ceramic plate is attached to a metal plate with adhesives. Applying D.+. voltage between electrodes of a pie#oelectric diaphragm causes mechanical distortion due to the pie#oelectric effect. 3or a misshaped pie#oelectric element, the distortion of the pie#oelectric element expands in a radial direction. And the pie#oelectric diaphragm bends toward the direction. direction he metal plate bonded to the pie#oelectric element does not expand. +onversely, when the pie#oelectric element shrin"s, the pie#oelectric diaphragm bends in the hus, when A+ voltage is applied across electrodes, the bending is repeated, producing sound waves in the air. o interface a bu##er the standard transistor interfacing circuit is used. Note that if a different power supply is used for the bu##er, the )L rails of each power supply must be connected to provide a common reference. If a battery is used as the power supply, it is worth remembering that pie#o sounders draw much less current than bu##ers. /u##ers also !ust have one VtoneR, whereas a pie#o sounder is able to create sounds of many different tones. o switch on bu##er (high 1 o switch off bu##er (low 1

Notice -?andling. In Dsing ,elf Drive &ethod

77

1. Chen the pie#oelectric bu##er is set to produce intermittent sounds, sound may be heard continuously even when the self drive circuit is turned :N F :33 at the 9N9 point shown in 3ig. @. his is because of the failure of turning off the feedbac" voltage. ;. /uild a circuit of the pie#oelectric sounder exactly as per the recommended circuit shown in the catalog. ?fe of the transistor and circuit constants are designed to ensure stable oscillation of the pie#oelectric sounder. *. Design switching which ensures direct power switching. =. he self drive circuit is already contained in the pie#oelectric bu##er. ,o there is no need to prepare another circuit to drive the pie#oelectric bu##er. >. 6ated voltage -*.) to ;)Ldc. must be maintained. 0roducts which can operate with voltage higher than ;)Ldc are also available. 2. Do not place resistors in series with the power source, as this may cause abnormal oscillation. If a resistor is essential to ad!ust sound pressure, place a capacitor -about 1U3. in parallel with the pie#o bu##er. 5. Do not close the sound emitting hole on the front side of casing. 4. +arefully install the pie#o bu##er so that no obstacle is placed within 1>mm from the sound release hole on the front side of the casing.

78

3ig7 0icture of bu##er

CHAPTE 1" SO;T2A E DESC IPTION

his pro!ect is implemented using following softwareRs7


79

Express 0+/ A for designing circuit 0I+ + compiler ( for compilation part 0roteus 5 -Embedded +. A for simulation part

1.! E0&ress PC," /readboards are great for prototyping e8uipment as it allows great flexibility to modify a design when neededK however the final product of a pro!ect, ideally should have a neat 0+/, few cables, and survive a sha"e test. Not only is a proper 0+/ neater but it is also more durable as there are no cables which can yan" loose. Express 0+/ is a software tool to design 0+/s specifically for manufacture by the company Express 0+/ -no other 0+/ ma"er accepts Express 0+/ files.. It is very easy to use, but it does have several limitations. It can be li"ened to more of a toy then a professional +AD program. It has a poor part library -which we can wor" around. It cannot import or export files in different formats It cannot be used to ma"e prepare boards for DIT production Express 0+/ has been used to design many 0+/s -some layered and with surface(mount parts. 0rint out 0+/ patterns and use the toner transfer method with an Etch 6esistant 0en to ma"e boards. ?owever, Express 0+/ does not have a nice print layout. ?ere is the procedure to design in Express 0+/ and clean up the patterns so they print nicely. 1.!.! Pre&aring E0&ress PC, for ;irst #se" Express 0+/ comes with a less then exciting list of parts. ,o before any pro!ect is started head over to Audio logic and grab the additional parts by morsel, ppl, and tangent, and extract them into your Express 0+/ directory. At this point start the program and get ready to setup the wor"space to suit your style.

80

+lic" Liew (` :ptions. In this menu, setup the units for $mm% or $in% depending on how you thin", and clic" $see through the top copper layer% at the bottom. he standard color scheme of red and green is generally used but it is not as pleasing as red and blue. 1.!.( T%e Interface" Chen a pro!ect is first started you will be greeted with a yellow outline. his yellow outline is the dimension of the 0+/. ypically after positioning of parts and traces, move them to their final position and then crop the 0+/ to the correct si#e. ?owever, in designing a board with a certain si#e constraint, crop the 0+/ to the correct si#e before starting. 3ig7 =.1 show the toolbar in which the each button has the following functions7

;ig 1.!" Tool .ar necessar/ for t%e interface he select tool7 It is fairly obvious what this does. It allows you to move bottom copper layer, and rotate buttons. he #oom to selection tool7 does !ust that. he place pad7 button allows you to place small soldier pads which are useful for board connections or if a part is not in the part library but the part dimensions are available. Chen this tool is selected the top toolbar will give you a large selection of round holes, s8uare holes and surface mount pads. he place component7 tool allows you to select a component from the top toolbar and then by clic"ing in the wor"space places that component in the orientation chosen using the buttons next to the component list. he components can always be rotated afterwards with the select tool if the orientation is wrong. he place trace7 tool allows you to place a solid trace on the board of varying thic"nesses. he top toolbar allows you to select the top or bottom layer to place the trace on.
81

and manipulate

parts. Chen this tool is selected the top toolbar will show buttons to move traces to the top F

he Insert +orner in trace7 button does exactly what it says. Chen this tool is selected, clic"ing on a trace will insert a corner which can be moved to route around components and other traces.

he remove a trace button is not very important since the delete "ey will achieve the same result.

1.!.* Design Considerations" /efore starting a pro!ect there are several ways to design a 0+/ and one must be chosen to suit the pro!ectRs needs. ,ingle sided, or double sideda Chen ma"ing a 0+/ you have the option of ma"ing a single sided board, or a double sided board. ,ingle sided boards are cheaper to produce and easier to etch, but much harder to design for large pro!ects. If a lot of parts are being used in a small space it may be difficult to ma"e a single sided board without !umper over traces with a cable. Chile thereRs technically nothing wrong with this, it should be avoided if the signal travelling over the traces is sensitive -e.g. audio signals.. A double sided board is more expensive to produce professionally, more difficult to etch on a DIT board, but ma"es the layout of components a lot smaller and easier. It should be noted that if a trace is running on the top layer, chec" with the components to ma"e sure you can get to its pins with a soldering iron. <arge capacitors, relays, and similar parts which donRt have axial leads can N: have traces on top unless boards are plated professionally. Bround(plane or other special purposes for one side Chen using a double sided board you must consider which traces should be on what side of the board. Benerally, put power traces on the top of the board, !umping only to the bottom if a part cannot be soldiered onto the top plane -li"e a relay., and vice( versa. ,ome pro!ects li"e power supplies or amps can benefit from having a solid plane to use for ground. In power supplies this can reduce noise, and in amps it minimi#es the distance between parts and their ground connections, and "eeps the ground signal as simple as possible. ?owever,
82

care must be ta"en with stubborn chips such as the

0A21;) amplifier from

I.

he

0A21;)

datasheet specifies not to run a ground plane under the pins or signal traces of this chip as the capacitance generated could effect performance negatively. 1.( PIC Com&iler" 0I+ compiler is software used where the machine language code is written and compiled. After compilation, the machine source code is converted into hex code which is to be dumped into the microcontroller for further processing. 0I+ compiler also supports + language code. ItRs important that you "now + language for microcontroller which is commonly "nown as Embedded +. As we are going to use 0I+ +ompiler, hence we also call it 0I+ +. he 0+/, 0+&, and 0+? are separate compilers. 0+/ is for 1;(bit opcodes, 0+& is for 1=(bitopcodes, and 0+? is for 12(bit opcode 0I+ microcontrollers. Due to many similarities, all three compilers are covered in this reference manual. 3eatures and limitations that apply to only specific microcontrollers are indicated within. hese compilers are specifically designed to meet the uni8ue needs of the 0I+ microcontroller. his allows developers to 8uic"ly design applications software in a more readable, high(level language. Chen compared to a more traditional + compiler, 0+/, 0+&, and 0+? have some limitations. As an example of the limitations, function recursion is not allowed. his is due to the fact that the 0I+ has no stac" to push variables onto, and also because of the way the compilers optimi#e the code. he compilers can efficiently implement normal + constructs, inputFoutput operations, and bit twiddling operations. All normal + data types are supported along with pointers to constant arrays, fixed point decimal, and arrays of bits. 0I+ + is not much different from a normal + program. If you "now assembly, writing a + program is not a crisis. In 0I+, we will have a main function, in which all your application specific wor" will be defined. In case of embedded +, you do not have any operating system running in there. ,o you have to ma"e sure that your program or main file should never exit. his can be done with the help of simple while -1. or for -KK. loop as they are going to run infinitely. Ce have to add header file for controller you are using, otherwise you will not be able to access registers related to peripherals. binclude c1235;.h` FF header file for 0I+ 1235;GG

83

1.* Prote$s" 0roteus is software which accepts only hex files. :nce the machine code is converted into hex code, that hex code has to be dumped into the microcontroller and this is done by the 0roteus. 0roteus is a programmer which itself contains a microcontroller in it other than the one which is to be programmed. his microcontroller has a program in it written in such a way that it accepts the hex file from the pic compiler and dumps this hex file into the microcontroller which is to be programmed. As the 0roteus programmer re8uires power supply to be operated, this power supply is given from the power supply circuit designed and connected to the microcontroller in proteus. he program which is to be dumped in to the microcontroller is edited in proteus and is compiled and executed to chec" any errors and hence after the successful compilation of the program the program is dumped in to the microcontroller using a dumper. 1.1 Proced$ral ste&s for com&ilation< sim$lation and d$m&ing7 1.1.! Com&ilation and sim$lation ste&s" 3or 0I+ microcontroller, 0I+ + compiler is used for compilation. steps are as follows7 :pen 0I+ + compiler. Tou will be prompted to choose a name for the new pro!ect, so create a separate folder where all the files of your pro!ect will be stored, choose a name and clic" save. he compilation

84

;ig 1.!" Pict$re of o&ening a new file $sing PIC C com&iler

+lic" 0ro!ect< New, and something the box named ' ext1' is where your code should be written later. Now you have to clic" '3ile, ,ave as' and choose a file name for your source code ending with the letter '.c'. Tou can name as 'pro!ect.c' for example and clic" save. hen you have to add this file to your pro!ect wor".

85

;ig 1.(" Pict$re of com&iling a new file $sing PIC C com&iler

;ig 1.*" Pict$re of com&iling a &ro'ect.c file $sing PIC C com&iler

86

Tou can then start to write the source code in the window titled 'pro!ect.c' then before testing your source codeK you have to compile your source code, and correct eventual syntax errors.

;ig 1.1" Pict$re of c%ecking errors and warnings $sing PIC C com&iler

/y clic"ing on compile option .hex file is generated automatically. his is how we compile a program for chec"ing errors and hence the compiled program is saved in the file where we initiated the program.

87

;ig 1.4" Pict$re of .%e0 file e0isting $sing PIC C com&iler

After compilation, next step is simulation. ?ere first circuit is designed in Express 0+/ using 0roteus 5 software and then simulation ta"es place followed by dumping. he simulation steps are as follows7 :pen 0roteus 5 and clic" on I,1,2. Now it displays 0+/ where circuit is designed using microcontroller. components are re8uired. ,o clic" on component option. 1). Now clic" on letter RpR, then under that select 0I+123455A ,other components related to the pro!ect and clic" :X. he 0I+ 1235; will be called your $ ' arget device, which is the final destination of your source code. o design circuit

88

1.1.( D$m&ing ste&s" he steps involved in dumping the program edited in proteus 5 to microcontroller are shown below7 1. Initially before connecting the program dumper to the microcontroller "it the window is appeared as shown below.

;ig 1.5" Pict$re of &rogram d$m&er window

;. ,elect ools option and clic" on +hec" +ommunication for establishing a connection as shown in below window
89

;ig 1.6" Pict$re of c%ecking comm$nications .efore d$m&ing &rogram into microcontroller

*. After connecting the dumper properly to the microcontroller "it the window is appeared as shown below.

90

;ig 1.7" Pict$re after connecting t%e d$m&er to microcontroller


91

=. Again by selecting the ools option and clic"ing on +hec" +ommunication the microcontroller gets recogni#ed by the dumper and hence the window is as shown below.

92

;ig 1.9" Pict$re of d$m&er recognition to microcontroller

93

>. Import the program which is V.hexR file from the saved location by selecting 3ile option and clic"ing on VImport ?exR as shown in below window.

94

95

;ig 1.!C" Pict$re of &rogram im&orting into t%e microcontroller

2. After clic"ing on VImport ?exR option we need to browse the location of our program and clic" the
Vprog.hexR and clic" on VopenR for dumping the program into the microcontroller.

96

;ig 1.!!" Pict$re of &rogram .rowsing w%ic% is to .e d$m&ed

5. After the successful dumping of program the window is as shown below.

97

;ig 1.!(" Pict$re after &rogram d$m&ed into t%e microcontroller


98

CHAPTE 4" P O=ECT DESC IPTION


In this chapter, schematic diagram and interfacing of 0I+123455A microcontroller with each module is considered.

99

;ig 4.!" sc%ematic diagram of Alco%ol and e/e .link detection and a$tomatic control s/stem wit% )oice alerts he above schematic diagram of Alco%ol and e/e .link detection and a$tomatic control s/stem wit% )oice alerts explains the interfacing section of each component with micro controller and 63. +rystal oscillator connected to 1*th and 1=th pins of micro controller and regulated power supply is also connected to micro controller and <EDRs also connected to micro controller through resistors. he detailed explanation of each module interfacing with microcontroller is as follows7

4.( Interfacing cr/stal oscillator and reset .$tton wit% micro controller" 3ig >.;7 explains crystal oscillator and reset button which are connected to micro controller. he two pins of oscillator are connected to the 1*th and 1=th pins of micro controllerK the purpose of external crystal oscillator is to speed up the execution part of instructions per cycle and here the crystal oscillator having ;) &?# fre8uency. he 1st pin of the microcontroller is referred as &+<6 ie.., master clear pin or reset input pin is connected to reset button or power(on(reset.

100

;ig 4.(" cr/stal oscillator and reset in&$t interfacing wit% micro controller

CHAPTE 5" AD8ANTA>ES AND DISAD8ANTA>ES

Ad)antages"

1. ?igh sensitivity alcohol sensor ;. Dsage of eye blin" sensor for drowsiness detection
101

*. Loice alerts through A06 voice module. =. Automatic speed control of vehicle to avoid accidents >. 3ast response 2. Cide detection range 5. ,table performance and long life 4. ,imple drive circuit @. Efficient and low cost design. 1). <ow power consumption. 11. Easily operable.

Disad)antages" 1. his system supports only inside the vehicle. ;. Interfacing of eye blin" sensor with microcontroller is highly sensitive

A&&lications" his system can be implemented in vehicles in real time to avoid accidents

CHAPTE 6" ES#3TS


6.! es$lt" he pro!ect $ Alco%ol and E/e .link Detection and A$tomatic 8e%icle ?DC +otor@ Control S/stem wit% )oice alerts % was designed such that to avoid accidents for drun"en people and drowsy people and alerts the through voice alerts.
102

6.( Concl$sion" Integrating features of all the hardware components used have been developed in it. 0resence of every module has been reasoned out and placed carefully, thus contributing to the best wor"ing of the unit. ,econdly, using highly advanced I+Rs with the help of growing technology, the pro!ect has been successfully implemented. tested. !.* ;$t$re Sco&e" :ur pro!ect $Alco%ol and E/e .link Detection and A$tomatic 8e%icle ?DC +otor@ Control S/stem wit% )oice alerts% is mainly intended to control the vehicle -D+ motor. using when on alcohol detection and drowsiness of driver was detected. he pro!ect uses $Alcohol detector% itself indicates that whenever there is any alcoholic content has been detected using alcoholic sensor &'()* so that it will indicate through the bu##er. he system uses eye blin" sensor and reduces the vehicle speed and alerts through bu##er alarm system. In this pro!ect we are using the alcoholic sensor, eye blin" sensor that finds the alcoholic content and fed as input to the microcontroller. which forms the control unit of the pro!ect. his pro!ect ma"es use of a micro controller, which is programmed, with the help of embedded + instructions. his &icrocontroller is capable of communicating with input and output modules. he Eye blin" sensor, Alcohol ,ensor provides the information to the &icrocontroller -on board computer.. he controller is interfaced with /u##er, and voice module, and D+ &otor. he main drawbac" of this system is that the vehicle speed can be controlled but not intimated to the people related to the person about the status. and sleepy while driving the vehicle. he pro!ect can be extended by using B,& modem which can send the ,&, alerts o the concerned people when the driver was detected alcoholic his pro!ect is designed around a microcontroller hus the pro!ect has been successfully designed and

E;E ENCES
103

he sites which were used while doing this pro!ect7 1. www.wi"ipedia.com ;. www.allaboutcircuits.com *. www.microchip.com =. www.howstuffwor"s.com

,ooks referred"

1. 6a! "amal A&icrocontrollers Architecture, 0rogramming, Interfacing and ,ystem Design. ;. &a#idi and &a#idi AEmbedded ,ystems. *. 0+/ Design utorial ADavid.<.Eones. =. 0I+ &icrocontroller &anual A &icrochip.. >. Embedded + A&ichael.E.0ont.

APPENDIX
Program Code" he program code which is dumped in the microcontroller of our pro!ect is shown below. binclude c123455A.h` FF&icrocontroller Dsed binclude clcd.h` binclude cdcPmotor.h`
104

binclude ceyeblin".h` binclude calcohol.h` binclude capr.h` FFvoice player buse delay-cloc"O;)&. void main-. d int alcoholK int blin"PsensedK lcdPinit-.K lcdPputc-'ef'.K lcdPgotoxy-1,1.K printf-lcdPputc,9 Drowsy Driver9.K lcdPgotoxy-1,;.K printf-lcdPputc,9Detection JAlert9.K playPvoice-4.K FF0lay welcome message outputPhigh-0INPD*.K FF/u##er outputPhigh-0INPD;.K FF<ED delayPms->)).K outputPlow-0INPD*.K outputPlow-0INPD;.K delayPms->)).K outputPhigh-0INPD;.K delayPms->)).K outputPlow-0INPD;.K while-1. d eyePblin"Psensed O isPeyePblin"Psensed-.K
105

FF operating +loc" free8uency

if-blin"Psensed OO 1. d lcdPputc-'ef'.K lcdPgotoxy-1,1.K printf-lcdPputc,9Eye /lin" ,ensor9.K lcdPgotoxy-1,;.K printf-lcdPputc,9 playPvoice-1.K outputPhigh-0INPD*.K FF/u##er outputPhigh-0INPD;.K FFflasher &1P,peed-4).K FFreduce 0C& speed by 4)\ &;P,peed-4).K FFreduce 0C& speed by 4)\ delayPms-;))).K &1P,peed->).K FFreduce 0C& speed by >)\ &;P,peed->).K FFreduce 0C& speed by >)\ delayPms-;))).K &1P,peed-*).K FFreduce 0C& speed by *)\ &;P,peed-*).K FFreduce 0C& speed by *)\ delayPms-;))).K &1P,peed-1).K FFreduce 0C& speed by 1)\ &;P,peed-1).K FFreduce 0C& speed by 1)\ delayPms-;))).K &1P,peed-).K FFreduce 0C& speed by )\ -stop. &;P,peed-).K FFreduce 0C& speed by )\ -stop. while-1.K f alcohol O getPalcoholPsensorPvalue-.K if-alcohol OO 1.
106

Alert9.K

d lcdPputc-'ef'.K lcdPgotoxy-1,1.K printf-lcdPputc,9 Alcohol ,ensor9.K lcdPgotoxy-1,;.K printf-lcdPputc,9 playPvoice-;.K outputPhigh-0INPD*.K FF/u##er outputPhigh-0INPD;.K FFflasher &1P,peed-4).K FFreduce 0C& speed by 4)\ &;P,peed-4).K FFreduce 0C& speed by 4)\ delayPms-;))).K &1P,peed->).K FFreduce 0C& speed by >)\ &;P,peed->).K FFreduce 0C& speed by >)\ delayPms-;))).K &1P,peed-*).K FFreduce 0C& speed by *)\ &;P,peed-*).K FFreduce 0C& speed by *)\ delayPms-;))).K &1P,peed-1).K FFreduce 0C& speed by 1)\ &;P,peed-1).K FFreduce 0C& speed by 1)\ delayPms-;))).K &1P,peed-).K FFreduce 0C& speed by )\ -stop. &;P,peed-).K FFreduce 0C& speed by )\ -stop. while-1.K f f f Alert9.K

107

You might also like