project report for ir based robot

113
A PROJECT REPORT ON PROTOTYPE OF A PICK & PLACE ROBO REMOTELY CONTROLLED BY HAND HELD TRANSMITTER WITH METAL DETECTOR Submitted in partial fulfillment of the requirements For the award of the degree BACHELOR OF ENGINEERING IN ____________________________________ENGINEERING SUBMITTED BY -------------------- (--------------) --------------------- (---------------) --------------------- (---------------) DEPARTMENT OF _______________________ ENGINEERING __________COLLEGE OF ENGINEERING AFFILIATED TO ___________ UNIVERSITY 1

Upload: saswatoffshore

Post on 14-Nov-2015

9 views

Category:

Documents


3 download

DESCRIPTION

this is a project report for IR based remote controlled robo which detects metal and give signals.

TRANSCRIPT

A PROJECT REPORT ONPROTOTYPE OF A PICK & PLACE ROBO REMOTELY CONTROLLED BY HAND HELD TRANSMITTER WITH METAL DETECTORSubmitted in partial fulfillment of the requirementsFor the award of the degreeBACHELOR OF ENGINEERINGIN____________________________________ENGINEERING

SUBMITTED BY

-------------------- (--------------) --------------------- (---------------) --------------------- (---------------)

DEPARTMENT OF _______________________ ENGINEERING__________COLLEGE OF ENGINEERINGAFFILIATED TO ___________ UNIVERSITY

CERTIFICATE

This is to certify that the dissertation work entitled PROTOTYPE OF A PICK & PLACE ROBO REMOTELY CONTROLLED BY HAND HELD TRANSMITTER WITH METAL DETECTOR is the work done by ____________________________ submitted in partial fulfillment for the award of BACHELOR OF TECHNOLOGY (B.Tech) in Mechanical Engineering from NMIET College of Engineering affiliated to BPUT , Odisha .

________________ ____________(Head of the department, ECE) (Assistant Professor)

EXTERNAL EXAMINER

70

ACKNOWLEDGEMENT

The satisfaction and euphoria that accompany the successful completion of any task would be incomplete without the mentioning of the people whose constant guidance and encouragement made it possible. We take pleasure in presenting before you, our project, which is result of studied blend of both research and knowledge.

We express our earnest gratitude to our internal guide, Assistant Professor ______________, Department of ECE, our project guide, for his constant support, encouragement and guidance. We are grateful for his cooperation and his valuable suggestions.

Finally, we express our gratitude to all other members who are involved either directly or indirectly for the completion of this project.

DECLARATION

We, the undersigned, declare that the project entitled PROTOTYPE OF A PICK & PLACE ROBO REMOTELY CONTROLLED BY HAND HELD TRANSMITTER WITH METAL DETECTOR, being submitted in partial fulfillment for the award of Bachelor of Engineering Degree in MECHANICAL Engineering, affiliated to _________ University, is the work carried out by us.

__________ _________ _________ __________ _________ _________

CONTENTS PAGE NO.1. ABSTRACT 102. INTRODUCTION TO EMBEDDED SYSTEMS 13 3. BLOCK DIAGRAM EXPLANATION4. HARDWARE REQUIREMENTS 4.1 VOLTAGE REGULATOR (LM7805)19 4.2 MICROCONTROLLER (AT89S52/C51)22 4.3 PUSH BUTTONS 4.4 L293D 4.5 DC MOTOR 4.6 RF TRANSRECEVIER 4.7 BC547 4.8 LED 4.9 1N4007 4.10 RESISTOR 4.11 CAPACITOR 4.12 RELAY5. SOFTWARE REQUIREMENTS565.1 IDE575.2 CONCEPT OF COMPILER575.3 CONCEPT OF CROSS COMPILER585.4 WIN AVR CROSS COMPILER5.5 AVR STUDIO CROSS COMPILER59 5.6 EMBEDDED C 6. SCHEMATIC DIAGRAM66 6.1 DESCRIPTION677. CODING759.1 COMPILER769.2 SOURCE CODE8410. HARDWARE TESTING 8810.1 CONTINUITY TEST8810.2 POWER ON TEST8911. APPLICATION 6912. CONCLUSION 9313. BIBLIOGRAPHY 94

LIST OF FIGURES PAGE NO.

2(a) EMBEDDED DESIGN CALLS 192(b) V DIAGRAM 193 BLOCK DIAGRAM OF THE PROJECT 4.1 A TYPICAL TRANSFORMER 264.2(a) BLOCK DIAGRAM OF VOLTAGE REGULATOR 4.2(c) RATING OF VOLTAGE REGULATOR4.2(c) PERFORMANCE CHARACTERISTICS OF VOLTAGE REGULATOR 214.5(a) BLOCK DIAGRAM OF AT89S52 244.5(b) PIN DIAGRAM OF AT89S52 254.5(c) OSCILLATOR CONNECTIONS 294.5(d) EXTERNAL CLOCK DRIVE CONFIG. 304.6(a) PIN DIAGRAM OF TEMPERATURE SENSOR (DS1621)4.6(b) BLOCK DIAGRAM OF DS1621 4.7(a) PUSH ON BUTTON 514.7(b) TABLE FOR TYPES OF PUSH BUTTONS4.8 L293D PIN DIAGRAM6 SCHEMATIC DIAGRAM7 LAYOUT DIAGRAM1. ABSTRACT

As ourprojectdeals with RF controlled robot. This robot is prototype for the Path Finder. This robot is controlled by a RF remote. This can be moved forward and reverse direction using geared motors of 60RPM. Also this robot can take sharp turnings towards left and right directions. In ourprojectuses AT89S52 MCU as its controller. A high sensitive induction type metal detector is designed using colpitts oscillator principle and fixed to this robot. Also a wireless camera with voice is interfaced to the kit. When the robot is moving on a surface, the system produces a beep sound when metal is detected. This beep sound will be transmitted to remote place. Simultaneously the images around the robot will be transmitted to remote place. User can monitor the images and metal detection alarms on Television.The RF modules used here are STT-433 MHz Transmitter, STR-433 MHz Receiver, HT12E Encoder and HT12D RF Decoder. The three switches are interfaced to the RF transmitter through RF Encoder. The encoder continuously readsthe statusof the switches, passes the data to the RF transmitter and the transmitter transmits the data. Thisprojectuses 9V battery. Thisprojectis much useful for mines detection and surveillance applications.

Introduction

A Robot is a mechatronic device which also includes resourcefulness or autonomy. A device with autonomy does its thing "on its own" without a human directly guiding it moment-by-moment. Some authors would contend that all mechatronic devices are robots, and that this book's restriction on robot entails only specialized software.Robotics can be described as the current pinnacle of technical development. Robotics is a confluence science using the continuing advancements of mechanical engineering, material science, sensor fabrication, manufacturing techniques, and advanced algorithms. The study and practice of robotics will expose a dabbler or professional to hundreds of different avenues of study. For some, the romanticism of robotics brings forth an almost magical curiosity of the world leading to creation of amazing machines. A journey of a lifetime awaits in robotics.Robotics can be defined as the science or study of the technology primarily associated with the design, fabrication, theory, and application of robots. While other fields contribute themathematics, the techniques, and the components, robotics creates the magical end product. The practical applications of robots drive development of robotics and drive advancements in other sciences in turn. Crafters and researchers in robotics study more than just robotics.Robot Control using RF is an exclusiveprojectwhere the direction of the movement of Robot can be changed using wireless technologies. The Robot will be placed different from that of from where it is controlled. Thisprojectcan also be carried out using wiring processes. But the main disadvantage when we go for wiring is that, data transmission and reception may not be perfect and the data may be lost if the wiring is not done properly. Thus, the Robot movement is controlled using wireless concept in thisproject. In thisproject, the Robot movement is controlled by giving commands from PC and this information will be passed to the Robot in a wireless fashion.

2.INTRODUCTION TO EMBEDDED SYSTEMS

What is embedded system?An Embedded System is a combination of computer hardware and software, and perhaps additional mechanical or other parts, designed to perform a specific function. An embedded system is a microcontroller-based, software driven, reliable, real-time control system, autonomous, or human or network interactive, operating on diverse physical variables and in diverse environments and sold into a competitive and cost conscious market.An embedded system is not a computer system that is used primarily for processing, not a software system on PC or UNIX, not a traditional business or scientific application. High-end embedded & lower end embedded systems. High-end embedded system - Generally 32, 64 Bit Controllers used with OS. Examples Personal Digital Assistant and Mobile phones etc .Lower end embedded systems - Generally 8,16 Bit Controllers used with an minimal operating systems and hardware layout designed for the specific purpose.

SYSTEM DESIGN CALLS:

Figure 2(a): Embedded system design calls

EMBEDDED SYSTEM DESIGN CYCLE

Figure:2(b) V Diagram

Characteristics of Embedded System1. An embedded system is any computer system hidden inside a product other than a computer.1. They will encounter a number of difficulties when writing embedded system software in addition to those we encounter when we write applications.1. Throughput Our system may need to handle a lot of data in a short period of time.1. ResponseOur system may need to react to events quickly1. TestabilitySetting up equipment to test embedded software can be difficult.1. DebugabilityWithout a screen or a keyboard, finding out what the software is doing wrong (other than not working) is a troublesome problem.0. Reliability embedded systems must be able to handle any situation without human intervention.0. Memory space Memory is limited on embedded systems, and you must make the software and the data fit into whatever memory exists.0. Program installation you will need special tools to get your software into embedded systems.0. Power consumption Portable systems must run on battery power, and the software in these systems must conserve power.0. Processor hogs computing that requires large amounts of CPU time can complicate the response problem.0. Cost Reducing the cost of the hardware is a concern in many embedded system projects; software often operates on hardware that is barely adequate for the job.1. Embedded systems have a microprocessor/ microcontroller and a memory. Some have a serial port or a network connection. They usually do not have keyboards, screens or disk drives.

APPLICATIONS1) Military and aerospace embedded software applications2) Communication Applications3) Industrial automation and process control software4) Mastering the complexity of applications.5) Reduction of product design time.6) Real time processing of ever increasing amounts of data.7) Intelligent, autonomous sensors.

CLASSIFICATION1. Real Time Systems.1. RTS is one which has to respond to events within a specified deadline.1. A right answer after the dead line is a wrong answer.

RTS CLASSIFICATION1. Hard Real Time Systems1. Soft Real Time SystemHARD REAL TIME SYSTEM "Hard" real-time systems have very narrow response time. Example: Nuclear power system, Cardiac pacemaker.

SOFT REAL TIME SYSTEM "Soft" real-time systems have reduced constrains on "lateness" but still must operate very quickly and repeatable. Example: Railway reservation system takes a few extra seconds the data remains valid.

3 PROJECT BLOCK DIAGRAM

Fig 3: project block diagram

4 HARDWARE REQUIREMENTS

HARDWARE COMPONENTS:

1. VOLTAGE REGULATOR (LM 7805)2. MICROCONTROLLER (ATMEGA16)3. PUSH BUTTONS4. DC MOTOR 5. L293D6. RF MODULE7. BC5478. LED9. 1N400710. RESISTORS11. CAPACITORS12. RELAY

4.1 VOLTAGE REGULATOR 7805Features Output Current up to 1A. Output Voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24V. Thermal Overload Protection. Short Circuit Protection. Output Transistor Safe Operating Area Protection.

DescriptionThe LM78XX/LM78XXA series of three-terminal positive regulators are available in the TO-220/D-PAK package and with several fixed output voltages, making them useful in a Wide range of applications. Each type employs internal current limiting, thermal shutdown and safe operating area protection, making it essentially indestructible. If adequate heat sinking is provided, they can deliver over 1A output Current. Although designed primarily as fixed voltage regulators, these devices can be used with external components to obtain adjustable voltages and currents.

Internal Block Diagram

FIG 4.1(a): BLOCK DIAGRAM OF VOLTAGE REGULATORAbsolute Maximum Ratings

TABLE 4.1(b): RATINGS OF THE VOLTAGE REGULATOR

4.2 MICROCONTROLLER A microcontroller often serves as the brain of a mechatronic system. Like a mini, self contained computer, it can be programmed to interact with both the hardware of the system and the user. Even the most basic microcontroller can perform simple math operations, control digital outputs, and monitor digital inputs. As the computer industry has evolved, so has the technology associated with microcontrollers. Newer microcontrollers are much faster, have more memory, and have a host of input and output features that dwarf the ability of earlier models. Most modern controllers have analog-to-digital converters, high-speed timers and counters, interrupt capabilities, outputs that can be pulse-width modulated, serial communication ports, etc.

The high-performance, low-power Atmel 8-bit AVR RISC-based microcontroller combines 16KB of programmable flash memory, 1KB SRAM, 512B EEPROM, an 8-channel 10-bit A/D converter, and a JTAG interface for on-chip debugging. The device supports throughput of 16 MIPS at 16 MHz and operates between 4.5-5.5 volts. By executing instructions in a single clock cycle, the device achieves throughputs approaching 1 MIPS per MHz, balancing power consumption and processing speed. Key Parameters

ParameterValueFlash (Kbytes):16 KbytesPin Count:40 Max. Operating Frequency:16 MHzCPU:8-bit AVR # of Touch Channels:16 Hardware QTouch Acquisition:No Max I/O Pins:32 Ext Interrupts:3 USB Speed:No USB Interface:No

Pin No.Pin nameDescriptionAlternate Function

1(XCK/T0) PB0I/O PORTB, Pin 0T0: Timer0 External Counter Input.XCK : USART External Clock I/O

2(T1) PB1I/O PORTB, Pin 1T1:Timer1 External Counter Input

3(INT2/AIN0) PB2I/O PORTB, Pin 2AIN0: Analog Comparator Positive I/PINT2: External Interrupt 2 Input

4(OC0/AIN1) PB3I/O PORTB, Pin 3AIN1: Analog Comparator Negative I/POC0 : Timer0 Output Compare Match Output

5(SS) PB4I/O PORTB, Pin 4In System Programmer (ISP)Serial Peripheral Interface (SPI)

6(MOSI) PB5I/O PORTB, Pin 5

7(MISO) PB6I/O PORTB, Pin 6

8(SCK) PB7I/O PORTB, Pin 7

9RESETReset Pin, Active Low Reset

10VccVcc = +5V

11GNDGROUND

12XTAL2Output to Inverting Oscillator Amplifier

13XTAL1Input to Inverting Oscillator Amplifier

14(RXD) PD0I/O PORTD, Pin 0USART Serial Communication Interface

15(TXD) PD1I/O PORTD, Pin 1

16(INT0) PD2I/O PORTD, Pin 2External Interrupt INT0

17(INT1) PD3I/O PORTD, Pin 3External Interrupt INT1

18(OC1B) PD4I/O PORTD, Pin 4PWM Channel Outputs

19(OC1A) PD5I/O PORTD, Pin 5

20(ICP) PD6I/O PORTD, Pin 6Timer/Counter1 Input Capture Pin

21PD7 (OC2)I/O PORTD, Pin 7Timer/Counter2 Output Compare Match Output

22PC0 (SCL)I/O PORTC, Pin 0TWI Interface

23PC1 (SDA)I/O PORTC, Pin 1

24PC2 (TCK)I/O PORTC, Pin 2JTAG Interface

25PC3 (TMS)I/O PORTC, Pin 3

26PC4 (TDO)I/O PORTC, Pin 4

27PC5 (TDI)I/O PORTC, Pin 5

28PC6 (TOSC1)I/O PORTC, Pin 6Timer Oscillator Pin 1

29PC7 (TOSC2)I/O PORTC, Pin 7Timer Oscillator Pin 2

30AVccVoltage Supply = Vcc for ADC

31GNDGROUND

32AREFAnalog Reference Pin for ADC

33PA7 (ADC7)I/O PORTA, Pin 7ADC Channel 7

34PA6 (ADC6)I/O PORTA, Pin 6ADC Channel 6

35PA5 (ADC5)I/O PORTA, Pin 5ADC Channel 5

36PA4 (ADC4)I/O PORTA, Pin 4ADC Channel 4

37PA3 (ADC3)I/O PORTA, Pin 3ADC Channel 3

38PA2 (ADC2)I/O PORTA, Pin 2ADC Channel 2

39PA1 (ADC1)I/O PORTA, Pin 1ADC Channel 1

40PA0 (ADC0)I/O PORTA, Pin 0ADC Channel 0

4.3 PUSH BUTTONS A push-button (also spelled pushbutton) or simply button is a simple switch mechanism for controlling some aspect of a machine or a process. Buttons are typically made out of hard material, usually plastic or metal. The surface is usually flat or shaped to accommodate the human finger or hand, so as to be easily depressed or pushed. Buttons are most often biased switches, though even many un-biased buttons (due to their physical nature) require a spring to return to their un-pushed state. Different people use different terms for the "pushing" of the button, such as press, depress, mash, and punch.

Uses:In industrial and commercial applications push buttons can be linked together by a mechanical linkage so that the act of pushing one button causes the other button to be released. In this way, a stop button can "force" a start button to be released. This method of linkage is used in simple manual operations in which the machine or process have no electrical circuits for control.Pushbuttons are often color-coded to associate them with their function so that the operator will not push the wrong button in error. Commonly used colors are red for stopping the machine or process and green for starting the machine or process.Red pushbuttons can also have large heads (mushroom shaped) for easy operation and to facilitate the stopping of a machine. These pushbuttons are called emergency stop buttons and are mandated by the electrical code in many jurisdictions for increased safety. This large mushroom shape can also be found in buttons for use with operators who need to wear gloves for their work and could not actuate a regular flush-mounted push button. As an aid for operators and users in industrial or commercial applications, a pilot light is commonly added to draw the attention of the user and to provide feedback if the button is pushed. Typically this light is included into the center of the pushbutton and a lens replaces the pushbutton hard center disk. The source of the energy to illuminate the light is not directly tied to the contacts on the back of the pushbutton but to the action the pushbutton controls. In this way a start button when pushed will cause the process or machine operation to be started and a secondary contact designed into the operation or process will close to turn on the pilot light and signify the action of pushing the button caused the resultant process or action to start.In popular culture, the phrase "the button" refers to a (usually fictional) button that a military or government leader could press to launch nuclear weapons.Push to ON button:

Fig 4.3(a): push on buttonInitially the two contacts of the button are open. When the button is pressed they become connected. This makes the switching operation using the push button. 4.4 MOTOR DRIVER (L293D)

Features: Wide supply-voltage range: 4.5V to 36V Separate input- logic supply Internal ESD protection Thermal shutdown High-Noise-Immunity input Functional Replacements for SGS L293 and SGS L293D Output current 1A per channel (600 mA for L293D) Peak output current 2 A per channel (1.2 A for L293D) Output clamp diodes for Inductive Transient Suppression(L293D)

DESCRIPTION:L293D is a dual H-bridge motor driver integrated circuit (IC). Motor drivers act as current amplifiers since they take a low-current control signal and provide a higher-current signal. This higher current signal is used to drive the motors.L293D contains two inbuilt H-bridge driver circuits. In its common mode of operation, two DC motors can be driven simultaneously, both in forward and reverse direction. The motor operations of two motors can be controlled by input logic at pins 2 & 7 and 10 & 15. Input logic 00 or 11 will stop the corresponding motor. Logic 01 and 10 will rotate it in clockwise and anticlockwise directions, respectively.

Enable pins 1 and 9 (corresponding to the two motors) must be high for motors to start operating. When an enable input is high, the associated driver gets enabled. As a result, the outputs become active and work in phase with their inputs. Similarly, when the enable input is low, that driver is disabled, and their outputs are off and in the high-impedance state.

Block diagram:

FIG: BLOCK DIAGRAM OF L293D

Pin Diagram:

Pin description:

4.5 DC MOTORA DC motor is an electric motor that runs on direct current (DC) electricity. In any electric motor, operation is based on simple electromagnetism. A current-carrying conductor generates a magnetic field; when this is then placed in an external magnetic field, it will experience a force proportional to the current in the conductor, and to the strength of the external magnetic field. As you are well aware of from playing with magnets as a kid, opposite (North and South) polarities attract, while like polarities (North and North, South and South) repel. The internal configuration of a DC motor is designed to harness the magnetic interaction between a current-carrying conductor and an external magnetic field to generate rotational motion.Let's start by looking at a simple 2-pole DC electric motor (here red represents a magnet or winding with a "North" polarization, while green represents a magnet or winding with a "South" polarization).

Fig.4.5(c) DC motorEvery DC motor has six basic parts -- axle, rotor (a.k.a., armature), stator, commutator, field magnet(s), and brushes. In most common DC motors, the external magnetic field is produced by high-strength permanent magnets1. The stator is the stationary part of the motor -- this includes the motor casing, as well as two or more permanent magnet pole pieces. The rotor rotates with respect to the stator. The rotor consists of windings (generally on a core), the windings being electrically connected to the commutator. The above diagram shows a common motor layout -- with the rotor inside the stator (field) magnets.The geometry of the brushes, commutator contacts, and rotor windings are such that when power is applied, the polarities of the energized winding and the stator magnet(s) are misaligned, and the rotor will rotate until it is almost aligned with the stator's field magnets. As the rotor reaches alignment, the brushes move to the next commutator contacts, and energize the next winding. Given our example two-pole motor, the rotation reverses the direction of current through the rotor winding, leading to a "flip" of the rotor's magnetic field, driving it to continue rotating.

In real life, though, DC motors will always have more than two poles (three is a very common number). In particular, this avoids "dead spots" in the commutator. You can imagine how with our example two-pole motor, if the rotor is exactly at the middle of its rotation (perfectly aligned with the field magnets), it will get "stuck" there. Meanwhile, with a two-pole motor, there is a moment where the commutator shorts out the power supply (i.e., both brushes touch both commutator contacts simultaneously). This would be bad for the power supply, waste energy, and damage motor components as well. Yet another disadvantage of such a simple motor is that it would exhibit a high amount of torque "ripple". So since most small DC motors are of a three-pole design, let's tinker with the workings of one via an interactive animation.

You'll notice a few things from this -- namely, one pole is fully energized at a time (but two others are "partially" energized). As each brush transitions from one commutator contact to the next, one coil's field will rapidly collapse, as the next coil's field will rapidly charge up (this occurs within a few microsecond). We'll see more about the effects of this later, but in the meantime you can see that this is a direct result of the coil windings' series wiring.

4.6 Encoder

Figure 3.6 Encoder

Features Operating voltage 2.4V~5V for the HT12A 2.4V~12V for the HT12E Low power and high noise immunity CMOStechnology Low standby current: 0.1A (typ.) atVDD=5V HT12A with a 38kHz carrier for infrared transmission medium Minimum transmission word Four words for the HT12E One word for the HT12A Built-in oscillator needs only 5% resistor Data code has positive polarity Minimal external components HT12A/E: 18-pin DIP/20-pin SOP package

General Description

The 212 encoders are a series of CMOS LSIs for remote control system applications. They are capable of encoding information which consists of N address bits and 12_N data bits. Each address/ data input can be set to one of the two logic states. The programmed addresses/data are transmitted together with the header bits via an RF or an infrared transmission medium upon receipt of a trigger signal. Block Diagram

Figure 3.7 Block diagram of encoder

Functional Description

Operation

The 2^12 series of encoders begin a 4-word transmission cycle upon receipt of a transmission enable (TE for the HT12E or D8~D11 for the HT12A, active low). This cycle will repeat itself as long as the transmission enable (TE or D8~D11) is held low. Once the transmission enable returns high the encoder output completes its final cycle and then stops.

Address/data programming (preset)

The status of each address/data pin can be individually pre-set to logic highor low. If a transmission- enable signal is applied, the encoder scans and transmits the status of the 12 bits of address/ data serially in the order A0 to AD11 for the HT12E encoder and A0 to D11 for the HT12A encoder. During information transmission these bits are transmitted with a preceding synchronization bit. If the trigger signal is not applied, the chip enters the standby mode and consumes a reduced current of less than 1_A for a supply voltage of 5V. Usual applications preset the address pins with individual security codes using DIP switches or PCB wiring, while the data is selected by push buttons or electronic switches.

Decoder used in the RF communicationFigure 3.8 Decoder

Features Operating voltage: 2.4V~12V Low power and high noise immunity CMOSTechnology Capable of decoding 12 bits of information Binary address setting Received codes are checked 3 times Address/Data number combination HT12D: 8 address bits and 4 data bits HT12F: 12 address bits only Built-in oscillator needs only 5% resistor Valid transmission indicator Easy interface with an RF or an infraredtransmission medium Minimal external components

BLOCK DIAGRAMFigure 3.9 Circuit diagram of power supply circuit

General Description

The 2^12 decoders are a series of CMOS LSIs for remote control system applications. They are paired with Holtek_s 2^12 series of encoders. For proper operation, a pair of encoder/decoder with the same number of addresses and data format should be chosen. The decoders receive serial addresses and data from a programmed 2^12 series of encoders that are transmitted by a carrier using an RF or an IR transmission medium. They compare the serial input data three times continuously with their loca addresses. If no error or unmatched codes are found, the input data codes are decoded and then transferred to the output pins. The VT pin also goes high to indicate a valid transmission. The 2^12 series of decoders are capable of decoding informations that consist of N bits of address and 12_N bits of data. Of this series, the HT12D is arranged to provide 8 address bits and 4 data bits, and HT12F is used to decode 12 bits of address information.

Functional Description

Operation

The 2^12 series of decoders provides various combinations of addresses and data pins in different packages so as to pair with the 2^12 series of encoders. The decoders receive data that are transmitted by an encoder and interpret the first N bits of code period as addresses and the last 12_N bits as data, where N is the address code number. A signal on the DIN pin activates the oscillator which in turn decodes the incoming address and data. The decoders will then check the received address three times continuously. If the received address codes all match the contents of the decoder local address, the 12_N bits of data are decoded to activate the output pins and the VT pin is set high to indicate a valid transmission. This will last unless the address code is incorrect or no signal is received. The output of the VT pin is high only when the transmission is valid. Otherwise it is always low.

Output type

Of the 2^12 series of decoders, the HT12F has no data output pin but its VT pin can be used as a momentary data output. The HT12D, on the other hand, provides 4 latch type data pins whose data remain unchanged until new data are received.

RF Module Interfacing:

The TWS-434 and RWS-434 are extremely small, and are excellent for applications requiring short-range RF remote controls. The transmitter module is only 1/3 the size of a standard postage stamp, and can easily be placed inside a small plastic enclosure.TWS-434:The transmitter output is up to 8mW at 433.92MHz with a range of approximately 400 foot (open area) outdoors. Indoors, the range is approximately 200 foot, and will go through most walls..The TWS-434 transmitter accepts both linear and digital inputs, can operate from 1.5 to 12 Volts-DC, and makes building a miniature hand-held RF transmitter very easy. The TWS-434 is approximately the size of a standard postage stamp.TWS-434 Pin DiagramSample Transmitter Application CircuitRWS-434:The receiver also operates at 433.92MHz, and has a sensitivity of 3uV. The RWS-434 receiver operates from 4.5 to 5.5 volts-DC, and has both linear and digital outputs.

RWS-434 Pin DiagramNote: For maximum range, the recommended antenna should be approximately 35cm long. To convert from centimeters to inches multiply by 0.3937. For 35cm, the length in inches will be approximately 35cm x 0.3937 = 13.7795 inches long. We tested these modules using a 14, solid, 24 gauge hobby type wire, and reached a range of over 400 foot. Your results may vary depending on your surroundings.4.7 BC547TECHNICAL SPECIFICATIONS:

The BC547 transistor is an NPN Epitaxial Silicon Transistor. The BC547 transistor is a general-purpose transistor in small plastic packages. It is used in general-purpose switching and amplification BC847/BC547 series 45 V, 100 mA NPN general-purpose transistors.

BC 547 TRANSISTOR PINOUTS

We know that the transistor is a "CURRENT" operated device and that a large current (Ic) flows freely through the device between the collector and the emitter terminals. However, this only happens when a small biasing current (Ib) is flowing into the base terminal of the transistor thus allowing the base to act as a sort of current control input. The ratio of these two currents (Ic/Ib) is called the DC Current Gain of the device and is given the symbol of hfe or nowadays Beta, (). Beta has no units as it is a ratio. Also, the current gain from the emitter to the collector terminal, Ic/Ie, is called Alpha, (), and is a function of the transistor itself. As the emitter current Ie is the product of a very small base current to a very large collector current the value of this parameter is very close to unity, and for a typical low-power signal transistor this value ranges from about 0.950 to 0.999.

An NPN Transistor Configuration

4.8 LEDA light-emitting diode (LED) is a semiconductor light source. LEDs are used as indicator lamps in many devices, and are increasingly used for lighting. When a light-emitting diode is forward biased (switched on), electrons are able to recombine with holes within the device, releasing energy in the form of photons. This 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 LED is often small in area (less than 1mm2), and integrated optical components may be used to shape its radiation pattern. LEDs present many advantages over incandescent light sources including lower energy consumption, longer lifetime, improved robustness, smaller size, faster switching, and greater durability and reliability. Types of LEDS Fig 4.11(a): Types of LED

Light-emitting diodes are used in applications as diverse as replacements for aviation lighting, automotive lighting as well as in traffic signals. The compact size, the possibility of narrow bandwidth, switching speed, and extreme reliability of LEDs has allowed new text and video displays and sensors to be developed, while their high switching rates are also useful in advanced communications technology.Electronic Symbol:

Fig 4.11(b): symbol of LED

4.9 1N4007

Diodes are used to convert AC into DC these are used as half wave rectifier or full wave rectifier. Three points must he kept in mind while using any type of diode. 1. Maximum forward current capacity 2. Maximum reverse voltage capacity 3. Maximum forward voltage capacity

Fig: 1N4007 diodesThe number and voltage capacity of some of the important diodes available in the market are as follows: Diodes of number IN4001, IN4002, IN4003, IN4004, IN4005, IN4006 and IN4007 have maximum reverse bias voltage capacity of 50V and maximum forward current capacity of 1 Amp. Diode of same capacities can be used in place of one another. Besides this diode of more capacity can be used in place of diode of low capacity but diode of low capacity cannot be used in place of diode of high capacity. For example, in place of IN4002; IN4001 or IN4007 can be used but IN4001 or IN4002 cannot be used in place of IN4007.The diode BY125made by company BEL is equivalent of diode from IN4001 to IN4003. BY 126 is equivalent to diodes IN4004 to 4006 and BY 127 is equivalent to diode IN4007.

Fig:PN Junction diode

PN JUNCTION OPERATIONNow that you are familiar with P- and N-type materials, how these materials are joined together to form a diode, and the function of the diode, let us continue our discussion with the operation of the PN junction. But before we can understand how the PN junction works, we must first consider current flow in the materials that make up the junction and what happens initially within the junction when these two materials are joined together.Current Flow in the N-Type Material Conduction in the N-type semiconductor, or crystal, is similar to conduction in a copper wire. That is, with voltage applied across the material, electrons will move through the crystal just as current would flow in a copper wire. This is shown in figure 1-15. The positive potential of the battery will attract the free electrons in the crystal. These electrons will leave the crystal and flow into the positive terminal of the battery. As an electron leaves the crystal, an electron from the negative terminal of the battery will enter the crystal, thus completing the current path. Therefore, the majority current carriers in the N-type material (electrons) are repelled by the negative side of the battery and move through the crystal toward the positive side of the battery.

Current Flow in the P-Type Material Current flow through the P-type material is illustrated. Conduction in the P material is by positive holes, instead of negative electrons. A hole moves from the positive terminal of the P material to the negative terminal. Electrons from the external circuit enter the negative terminal of the material and fill holes in the vicinity of this terminal. At the positive terminal, electrons are removed from the covalent bonds, thus creating new holes. This process continues as the steady stream of holes (hole current) moves toward the negative terminal

4.10 RESISTORSA resistor is a two-terminal electronic component designed to oppose an electric current by producing a voltage drop between its terminals in proportion to the current, that is, in accordance with Ohm's law: V = IR Resistors are used as part of electrical networks and electronic circuits. They are extremely commonplace in most electronic equipment. Practical resistors can be made of various compounds and films, as well as resistance wire (wire made of a high-resistivity alloy, such as nickel/chrome).

The primary characteristics of resistors are their resistance and the power they can dissipate. Other characteristics include temperature coefficient, noise, and inductance. Less well-known is critical resistance, the value below which power dissipation limits the maximum permitted current flow, and above which the limit is applied voltage. Critical resistance depends upon the materials constituting the resistor as well as its physical dimensions; it's determined by design.Resistors can be integrated into hybrid and printed circuits, as well as integrated circuits. Size, and position of leads (or terminals) are relevant to equipment designers; resistors must be physically large enough not to overheat when dissipating their power.A resistor is a two-terminal passive electronic component which implements electrical resistance as a circuit element. When a voltage V is applied across the terminals of a resistor, a current I will flow through the resistor in direct proportion to that voltage. The reciprocal of the constant of proportionality is known as the resistance R, since, with a given voltage V, a larger value of R further "resists" the flow of current I as given by Ohm's law:

Resistors are common elements of electrical networks and electronic circuits and are ubiquitous in most electronic equipment. Practical resistors can be made of various compounds and films, as well as resistance wire (wire made of a high-resistivity alloy, such as nickel-chrome). Resistors are also implemented within integrated circuits, particularly analog devices, and can also be integrated into hybrid and printed circuits.The electrical functionality of a resistor is specified by its resistance: common commercial resistors are manufactured over a range of more than 9 orders of magnitude. When specifying that resistance in an electronic design, the required precision of the resistance may require attention to the manufacturing tolerance of the chosen resistor, according to its specific application. The temperature coefficient of the resistance may also be of concern in some precision applications. Practical resistors are also specified as having a maximum power rating which must exceed the anticipated power dissipation of that resistor in a particular circuit: this is mainly of concern in power electronics applications. Resistors with higher power ratings are physically larger and may require heat sinking. In a high voltage circuit, attention must sometimes be paid to the rated maximum working voltage of the resistor.The series inductance of a practical resistor causes its behavior to depart from ohms law; this specification can be important in some high-frequency applications for smaller values of resistance. In a low-noise amplifier or pre-amp the noise characteristics of a resistor may be an issue. The unwanted inductance, excess noise, and temperature coefficient are mainly dependent on the technology used in manufacturing the resistor. They are not normally specified individually for a particular family of resistors manufactured using a particular technology.[1] A family of discrete resistors is also characterized according to its form factor, that is, the size of the device and position of its leads (or terminals) which is relevant in the practical manufacturing of circuits using them.

UnitsThe ohm (symbol: ) is the SI unit of electrical resistance, named after Georg Simon Ohm. An ohm is equivalent to a volt per ampere. Since resistors are specified and manufactured over a very large range of values, the derived units of milliohm (1 m = 103 ), kilohm (1 k = 103 ), and megohm (1 M = 106 ) are also in common usage.The reciprocal of resistance R is called conductance G = 1/R and is measured in Siemens (SI unit), sometimes referred to as a mho. Thus a Siemens is the reciprocal of an ohm: S = 1. Although the concept of conductance is often used in circuit analysis, practical resistors are always specified in terms of their resistance (ohms) rather than conductance.

4.11 CAPACITORSA capacitor or condenser is a passive electronic component consisting of a pair of conductors separated by a dielectric. When a voltage potential difference exists between the conductors, an electric field is present in the dielectric. This field stores energy and produces a mechanical force between the plates. The effect is greatest between wide, flat, parallel, narrowly separated conductors.

An ideal capacitor is characterized by a single constant value, capacitance, which is measured in farads. This is the ratio of the electric charge on each conductor to the potential difference between them. In practice, the dielectric between the plates passes a small amount of leakage current. The conductors and leads introduce an equivalent series resistance and the dielectric has an electric field strength limit resulting in a breakdown voltage.The properties of capacitors in a circuit may determine the resonant frequency and quality factor of a resonant circuit, power dissipation and operating frequency in a digital logic circuit, energy capacity in a high-power system, and many other important aspects.A capacitor (formerly known as condenser) is a device for storing electric charge. The forms of practical capacitors vary widely, but all contain at least two conductors separated by a non-conductor. Capacitors used as parts of electrical systems, for example, consist of metal foils separated by a layer of insulating film.Capacitors are widely used in electronic circuits for blocking direct current while allowing alternating current to pass, in filter networks, for smoothing the output of power supplies, in the resonant circuits that tune radios to particular frequencies and for many other purposes.A capacitor is a passive electronic component consisting of a pair of conductors separated by a dielectric (insulator). When there is a potential difference (voltage) across the conductors, a static electric field develops in the dielectric that stores energy and produces a mechanical force between the conductors. An ideal capacitor is characterized by a single constant value, capacitance, measured in farads. This is the ratio of the electric charge on each conductor to the potential difference between them.The capacitance is greatest when there is a narrow separation between large areas of conductor, hence capacitor conductors are often called "plates", referring to an early means of construction. In practice the dielectric between the plates passes a small amount of leakage current and also has an electric field strength limit, resulting in a breakdown voltage, while the conductors and leads introduce an undesired inductance and resistance.

Theory of operationMain article: Capacitance

Charge separation in a parallel-plate capacitor causes an internal electric field. A dielectric (orange) reduces the field and increases the capacitance.

A simple demonstration of a parallel-plate capacitorA capacitor consists of two conductors separated by a non-conductive region[8]. The non-conductive region is called the dielectric or sometimes the dielectric medium. In simpler terms, the dielectric is just an electrical insulator. Examples of dielectric mediums are glass, air, paper, vacuum, and even a semiconductor depletion region chemically identical to the conductors. A capacitor is assumed to be self-contained and isolated, with no net electric charge and no influence from any external electric field. The conductors thus hold equal and opposite charges on their facing surfaces,[9] and the dielectric develops an electric field. In SI units, a capacitance of one farad means that one coulomb of charge on each conductor causes a voltage of one volt across the device.[10]The capacitor is a reasonably general model for electric fields within electric circuits. An ideal capacitor is wholly characterized by a constant capacitance C, defined as the ratio of charge Q on each conductor to the voltage V between them:[8]

Sometimes charge build-up affects the capacitor mechanically, causing its capacitance to vary. In this case, capacitance is defined in terms of incremental changes:

Energy storageWork must be done by an external influence to "move" charge between the conductors in a capacitor. When the external influence is removed the charge separation persists in the electric field and energy is stored to be released when the charge is allowed to return to its equilibrium position. The work done in establishing the electric field, and hence the amount of energy stored, is given by:[11]

Current-voltage relationThe current i(t) through any component in an electric circuit is defined as the rate of flow of a charge q(t) passing through it, but actual charges, electrons, cannot pass through the dielectric layer of a capacitor, rather an electron accumulates on the negative plate for each one that leaves the positive plate, resulting in an electron depletion and consequent positive charge on one electrode that is equal and opposite to the accumulated negative charge on the other. Thus the charge on the electrodes is equal to the integral of the current as well as proportional to the voltage as discussed above. As with any anti derivative, a constant of integration is added to represent the initial voltage v (t0). This is the integral form of the capacitor equation,[12].Taking the derivative of this, and multiplying by C, yields the derivative form,[13].The dual of the capacitor is the inductor, which stores energy in the magnetic field rather than the electric field. Its current-voltage relation is obtained by exchanging current and voltage in the capacitor equations and replacing C with the inductance L.4.12 RELAYA relay is an electrically operated switch. Many relays use an electromagnet to operate a switching mechanism mechanically, but other operating principles are also used. Relays are used where it is necessary to control a circuit by a low-power signal (with complete electrical isolation between control and controlled circuits), or where several circuits must be controlled by one signal.

A relay is an electrically operated switch. Current flowing through the coil of the relay creates a magnetic field which attracts a lever and changes the switch contacts. The coil current can be on or off so relays have two switch positions and most have double throw (changeover) switch contacts as shown in the diagram. Fig 4.8 Relay showing coil and switch contacts

Relays allow one circuit to switch a second circuit which can be completely separate from the first. For example a low voltage battery circuit can use a relay to switch a 230V AC mains circuit. There is no electrical connection inside the relay between the two circuits; the link is magnetic and mechanical.

The coil of a relay passes a relatively large current, typically 30mA for a 12V relay, but it can be as much as 100mA for relays designed to operate from lower voltages. Most ICs (chips) cannot provide this current and a transistor is usually used to amplify the small IC current to the larger value required for the relay coil. The maximum output current for the popular 555 timer IC is 200mA so these devices can supply relay coils directly without amplification.

Relays are usually SPDT or DPDT but they can have many more sets of switch contacts, for example relays with 4 sets of changeover contacts are readily available. For further information about switch contacts and the terms used to describe them please see the page on switches.

Most relays are designed for PCB mounting but you can solder wires directly to the pins providing you take care to avoid melting the plastic case of the relay.

The supplier's catalogue should show you the relay's connections. The coil will be obvious and it may be connected either way round. Relay coils produce brief high voltage 'spikes' when they are switched off and this can destroy transistors and ICs in the circuit. To prevent damage you must connect a protection diode across the relay coil.

The figure shows a relay with its coil and switch contacts. You can see a lever on the left being attracted by magnetism when the coil is switched on. This lever moves the switch contacts.

There is one set of contacts (SPDT) in the foreground and another behind them, making the relay DPDT. The relay's switch connections are usually labelled COM, NC and NO: COM = Common, always connect to this; it is the moving part of the switch. NC = Normally Closed, COM is connected to this when the relay coil is off. NO = Normally Open, COM is connected to this when the relay coil is on.

Applications of relays

Relays are used to and for:

Control a high-voltage circuit with a low-voltage signal, as in some types of modems or audio amplifiers. Control a high-current circuit with a low-current signal, as in the starter solenoid of an automobile. Detect and isolate faults on transmission and distribution lines by opening and closing circuit breakers.Time delay functions. Relays can be modified to delay opening or delay closing a set of contacts. A very short (a fraction of a second) delay would use a copper disk between the armature and moving blade assembly. Current flowing in the disk maintains magnetic field for a short time, lengthening release time. For a slightly longer (up to a minute) delay, a dashpot is used. A dashpot is a piston filled with fluid that is allowed to escape slowly. The time period can be varied by increasing or decreasing the flow rate. For longer time periods, a mechanical clockwork timer is installed.

5. SOFTWARE REQUIREMENTS9.1 COMPILERA simplest MCU system may look like below

The program it is executing is like this (In C language).The MCU contains a flash memory where it stores its program (it is like a hard disk to it). The flash memory can be easily erased and a new program can burned. This makes them very flexible. MCUs can be programmed few thousand times before they die.

A SMALL NOTE ABOUT DELAY

C has inbuilt libraries which contain many pre-built functions. One such function is Delay, which introduces a time delay at a particular step. To invoke it in your program, you need to add the following line at the beginning of your code: #include ;

Thereafter, it can be used in the program by adding the following line:

delay_ms(X);

Where X is the time delay you wish to introduce at that particular step in milliseconds.

A SAMPLE PROGRAM #include ; void main() { SetPortDirection(); while(1) { PORTA=0b00000001; delay_ms(500); PORTA=0b00000000; delay_ms(500); } } PORTS A MCU has some ports. Ports are PINs on the MCU that can be turned on and off by program. On means 5V and off means 0V or GND .This behavior is for OUTPUT mode. They can also be put in INPUT mode. In INPUT mode they can read what is the signal level on them (only on and off).If voltage is more than a threshold voltage (usually half the supply) it is reported as ON(1) otherwise OFF(0).This is how MCU control everything .Majority of the PINs of a MCU are PORT so you can hookup lots of gizmos to it !!!They are named PORTA ,PORTB ,PORTC ,PORTD etc .They are of one byte which means 8 Bitts all bits of them are connected to external pins and are available outside the chip. In smaller chips only some of the eight bits are available. Setting PORTB=0b00000001 will set PORTB's zeroth bit high that is 5V while remaining PINs will be low (GND). To write a binary number in c prefix it with 0b ex 0b00001000. It is decimal 8 not 1000!!

What the above program does: STEP 1 SetPortDirection(); This Function Makes the PORTB as OUTPUT. Its implementation detail is not shown.

STEP 2 PORTB=0b00000001; makes the 0th bit high, switching off the L.E.D. because other end of LED is connected to VCC (i.e. Supply voltage 5V). Note that the 0 in 0b is a zero, not an oh.

STEP 3 delay_ms(500); Halts the MCU for 0.5 Sec

STEP 4 PORTB=0b00000000; Switches on the LED

STEP 5 delay_ms(500); STEP 2 to 5 are within an infinite while loop so it runs till MCU is powered. The program is compiled, and burned into the chip and power is turned on and woillaaaa that LED is blinking once every second. Although the given program doesn't do something very important and can be done without a MCU and in a cheap manner, but it introduce you to microcontroller programming .Doing this with MCU has some advantages also. You can change the way LED blinks by simply writing a new program without touching the hardware part. You can also connect 8 LEDs to all 8 PINs of the PORTB, write a nice program them to light them in various pattern and you have a deluxe decorating lights!!! Which you can't make easily without MCU. So you have seen that major functioning of a MCU project is made in software and hardware part is simple and small. So you have learned the basics of MCUs and their use. BASIC DIGITAL I/O Digital IO is the most fundamental of connecting a MCU to the external world. The interfacing is done through PORT. A PORT is a point where data internal to the MCU chip comes out. They are present in form of PINS of the IC. Most of the Pins (32 out of 40) are dedicated to this function and other pins are used for Power supply, clock sources etc. Once introduced to the concept of Ports the next task is to learn how to use these Ports to get Input from a port and to Output to a Port. IO is usually done by controlling the values of certain registers associated with these PORTs. A register is a variable (usually 8 bit) whose value can be changed and read from within your program just like you do for any other variable. Therefore IO is done in a very simple fashion simply by altering or reading the values of certain variables. There are 32 pins available for IO (8 pins per Port) and each pin can be set to either take input (voltage high or low) or to output a digital value (0 or 1). In order to control which pin should do input and which should do output, there is a register called DDR (Data Direction Register), whose value tells the microprocessor which is to be set to input and which to output. For example , to set Pin no 0, 2, 3, 7 of Port A to input and other pins of PORT A to output, the command would be: DDRA=0b01110010; Here DDRA means the DDR register of PORT A. 0b means that we are entering the number in binary. The sequence of 0s and 1s indicate which pin is to be input and which is to output. A 0 means input and 1 means output. We could equivalently write: DDRA=114; (decimal equivalent of 01001110). Next comes how to read/write data from/to these pins. For this task there are two registers, PORT and PIN. PIN (Port Input) is the register that reads the input from the pin. For example in order to read the value of pin number 3 of port A into a variable x, the command would be: x=PINA.3; or equivalently x=PINA&0b00001000;.where the & is binary AND. x would be 0 if PINA.3 is set to low otherwise it would be a non zero value. You can only read from a PIN register, you cannot write into it. PORT is the register that is used to output values. For example to output 1 on pin no 5 of Port D, you would say PORTD.5=1; or PORTD=PORTD|0b00100000 after setting pin 5 of port D to output. Here Boolean algebra is used and the reader is supposed to be familiar with such concepts of ANDing and ORing bits. To summarize, IO is done through PORTS and each PORT is associated with 3 registers for IO.

A SAMPLE PROGRAM Suppose that you have a LED and a switch. Now you want that when you press the switch the LED is switched OFF, otherwise it is ON. Also suppose that you have made proper connection of the mcu, that is provided power connections (GND on the GND terminals-11 & 31, and Vcc on 10 and 30 and also on RESET . Then your next task is to connect the output of your switch to appropriate pin, say connect it to Pin 0 of Port C, and connect LED to, say Pin 2 of Port C. Then the Programme to do the above mentioned task will be: #include ; DDRC=0b00000100 //it is a good practice to set unused pins to input. While (1) { If(PINC.0==1) { PORTC.2=0; delay_ms(100); } else { PORTC.2=1; delay_ms(100); } }

WinAVR

There are several ways that you can write, compile, and download a program to the ATmega16 microcontroller. There are many different text editors, compilers, and utilities available for many different languages (C, BASIC, assembly language, etc.). Some of these are free of charge, and some require a licensing fee to use them. In this class, we will use a freeware package of software tools named WinAVR (pronounced, whenever). WinAVR consists of a suite of executable, open source software development tools for the Atmel AVR series of RISC microprocessors hosted on the Windows platform. It includes the GNU GCC compiler for C and C++, which is sometimes referred to as avr-gcc. Traditionally, the microcontroller in embedded systems was programmed directly using assembly language. Assembly language uses only the basic instruction set for a particular microcontroller. While this can produce fast, efficient code, it is limited in that every processor type has its own instruction set. Therefore it is not a practical language to learn unless you are doing a project that is dedicated to a specific microcontroller or has a real need for precise timing and/or memory use. The C language, on the other hand, is commonly used in industry and can be applied over many different platforms. By learning this one language, you will be able to program almost any microcontroller, provided that you have a compiler that can translate C code into assembly language for your controller. The Gnu-C compiler is an open-source, freeware, C compiler that forms the basis for compilers that generate code for many different microcontrollers and various operating systems, such as Windows and UNIX.

GETTING STARTED WITH CODEVISIONAVR CodeVisionAVR (CVAVR) is the C-program language compiler that shall be used to program the MCU. CVAVR is a highly versatile software which offers High Performance ANSI C Compiler, Integrated Development Environment, Automatic Program Generator and In-System Programmer for the Atmel AVR family of microcontrollers. After installing and setting up CVAVR, a typical screen with a program open looks like this:

CREATING A NEW PROJECT:

Open up CodeVisionAVR on your PC. Click on the New Project icon to create a new project.

When the Create New File dialog box pops up, click Project then OK.

A dialog box titled Confirm will pop up asking if you would like to use CodeWizardAVR. This is a helpful tool which will help you automatically generate the proper code depending on your MCU. Select Yes. The following window will open:

Select the appropriate Microcontroller and its appropriate frequency. Now, click on the Ports tab to determine how the I/O ports are to be initialized for the target system:

The default setting is to have the ports for all the target systems to be inputs. You can also change other settings in this window such as Timers, etc. These topics shall be covered in the following tutorials. By selecting the File -> Generate, Save and Exit option, the CodeWizard will generate a skeleton C program with the appropriate Port initializations. Many Save File prompts shall open these are the project files generated by the wizard. Save them with appropriate names.

Now, type your code in the source code window. Once youre done with the creation of the source code, you can make the project by clicking on the Assemble button.

A dialog box appears. Make sure that the message says No errors, otherwise, go back to your code and fix the errors.

If there are no errors in the compilation, it is time to program the chip.

PROGRAMMING THE MCU USING AVR STUDIO

Now that the program is ready, it is time to put it on the chip. This is accomplished by a software known as AVR Studio: Start AVR Studio. It will immediately ask you to start a new project. Click on Cancel. In AVR Studio, select menu Tools | Program AVR | Connect. In the Select AVR Programmer dialog box, choose STK500 or AVRISP as the platform and Auto as Port. Then click button Connect.

Depending on the version of your AVR Studio, a message about firmware may appear. For now, this message can be discarded by clicking button Cancel. In the STK500 dialog box that appears, select the generated hex file as Input Hex File. Then, click the button Program to download the HEX file to the AVR chip.

The program will now run on the microcontroller.

.

5.15 EMBEDDED C Use of embedded processors in passenger cars, mobile phones, medical equipment, aerospace systems and defense systems is widespread, and even everyday domestic appliances such as dish washers, televisions, washing machines and video recorders now include at least one such device. Because most embedded projects have severe cost constraints, they tend to use low-cost processors like the 8051 family of devices considered in this book. These popular chips have very limited resources available most such devices have around 256 bytes (not megabytes!) of RAM, and the available processor power is around 1000 times less than that of a desktop processor. As a result, developing embedded software presents significant new challenges, even for experienced desktop programmers. If you have some programming experience - in C, C++ or Java - then this book and its accompanying CD will help make your move to the embedded world as quick and painless as possible.

6.SCHEMATIC DIAGRAM

Fig 6: SCHEMATIC DIAGRAM

6.1 DESCRIPTIONPOWER SUPPLY

This project uses a 12V battery for power supply. A voltage regulator 7805 is used to get the constant 5V DC supply. One LED is connected of this 5V point in series with a resistor of 330 to the ground i.e., negative voltage to indicate 5V power supply availability.

STANDARD CONNECTIONS TO MICRO CONTROLLER

ATMEL series of 8051 family of micro controllers need certain standard connections. The actual number of the Micro controller could be 89C51 , 89C52, 89S51, 89S52, as regards to 20 pin configuration a number of 89C2051. The 4 set of I/O ports are used based on the project requirement. Every micro controller requires a timing reference for its internal program execution therefore an oscillator needs to be functional with a desired frequency to obtain the timing reference as t =1/f. A crystal ranging from 2 to 20 MHz is required to be used at its pin number 18 and 19 for the oscillator. Typically 11.0592 MHz crystal is used in general for most of the circuits. Crystal provides the reference frequency only and it is not a crystal oscillator as miss understood by many but it oscillates at 11.0592MHz. Two small value ceramic capacitors of 33pF each is used as a standard connection for the crystal as shown in the circuit diagram.

RESETPin no 9 is provided with an RESET arrangement by a combination of an electrolytic capacitor and a register forming RC time constant. At the time of switch on, the capacitor gets charged, after charging it behaves as a full short circuit from the positive to the pin number 9. After the capacitor gets fully charged the current stops flowing and pin number 9 is pulled down by a 10k resistor to the ground. This arrangement of reset pin 9 going high initially and then to logic 0 i.e., low helps the program execution to start from the beginning. In absence of this the program execution could have taken place habitually anywhere from the program cycle. A pushbutton switch is connected across the capacitor so that at any given time as desired it can be pressed that discharges the capacitor and while released the capacitor starts charging again and then pin number 9 goes to high and then back to low, to enable the program execution from the beginning. This operation of high to low of the reset pin takes place in fraction of a second as decided by the time constant R and C.For example: A 10F capacitor and a 10k resistor would render a 100ms time to pin number 9 from logic high to low, there after the pin number 9 remains low.

L293D MOTOR DRIVER

L293D has 2 set of arrangements where one set has input 1, input 2, output 1 and output 2 and other set has input 3, input 4, output 3 and output 4, according to block diagram if pin no 2 & 7 are high then pin no 3 & 6 are also high.If enable 1 and pin number 2 are high leaving pin number 7 as low then the motor rotates in forward direction.If enable 2 and pin number 10 are high leaving pin number 15 as low then the motor rotates in forward direction.If enable 1 and pin number 2 are low leaving pin number 7 as high then the motor rotates in reverse direction.If enable 2 and pin number 15 are high leaving pin number 10 as low then the motor rotates in forward direction.

OPERATION EXPLANATION

Connections:The output of the power supply which is 5v is connected to 40 pin of MC and GND is connected to its 20th pin. Pin 2.0 of port 2 of microcontroller is connected to transistor BC547 that drives the load. Pin 2.2 of port 2 of MC is connected to pin 9 i.e., EN2 of motor driver L293D. Pin 2.4 of port 2 of Microcontroller is connected to pin 10 i.e., IN3 of L293D. Pin 2.5 of port 2 of MC is connected to pin 7 i.e., IN2 of L293D. Pin 2.6 of port 2 of MC is connected to pin 2 i.e., IN1 of L293D. Pin 2.7 of port 2 of MC is connected to pin 1 i.e., EN1 of L293D. Pin 3.0 of port 3 of MC is given to pin 3 of TSOP 1738. Pin no 14 and 11 of L293D are connected to dc motor 1. Pin 3 and 6 of L293D are connected to dc motor 2. Pin 0 of L293D is given 12v and pin 16 of L293D is given 5v. Pin no 4, 5, 13, 12 of L293D are given to GND.

Working:Conventional T.V. remotes output infra red codes. A standard TV remote that delivers infrared codes at 38 KHz is thus received by the TSOP receiver feeding a 14 bit data so emitted from the remote to the controller through receiver. The program is so returned that it recognizes the corresponding 14 bit data relating to a particular number being pressed at the remote.

The program is so returned i.e., while executed it sends commands to the motor driver IC as per its requirement for running the motor for the movement of the robot as explained in the subject above in L293D. the TV remote button 1 is for left, 3 is for right, 2 is forward, 5 is for backward and 0 is for stop.

9.CODING

9.1 PROGRAM CODE

VAR1equ r7 ;Temporary VariableTEMPequ 10H ;Temp variableCOUNTequ 11H ;CountADDRequ 12H ;Device addressCMDequ 13H ;CommandFLIPbit 00H ;Flip bitTOGbit 01H ;Temp bit for flipIRequ P3.0 ;IR Receiver connected to this pinEN1equ P2.7 ;Switch 1 connected hereEN2equ P2.2 ;Switch 2 connected hereIN1equ P2.6 ;Switch 3 connected hereIN2equ P2.5 ;Switch 4 connected hereIN3equ P2.4 ;Switch 5 connected hereIN4equ P2.3 ;Switch 6 connected herefan equ P2.0SWportequ P2 ;Port at which switches are connectedorg 00H;Start of progmov SWport,#00H ;switch all relays off!mov sp,#50H;Stack pointer initializationclr TOG;Clear temp bitmain:jnb IR,$;Wait for first bitmov VAR1,#255 ;3.024mS delaydjnz VAR1,$mov VAR1,#255djnz VAR1,$mov VAR1,#123djnz VAR1,$mov VAR1,#255djnz VAR1,$mov VAR1,#25djnz VAR1,$mov VAR1,#11djnz VAR1,$mov c,IR;Read Flip bitmov FLIP,cclr Amov COUNT,#5 ;Count for addressfadd:mov VAR1,#25 ;1.728mS delay for each bitdjnz VAR1,$mov VAR1,#32djnz VAR1,$mov VAR1,#25djnz VAR1,$mov VAR1,#4djnz VAR1,$mov c,IRrrc adjnz COUNT,faddmov ADDR,A;Save the addressclr amov COUNT,#6 ;Count for Commandfcmd:mov VAR1,#115 ;1.728mS Delay for each bitdjnz VAR1,$mov VAR1,#55djnz VAR1,$mov VAR1,#23djnz VAR1,$mov VAR1,#4djnz VAR1,$mov c,IRrlc adjnz COUNT,fcmdmov TEMP,CMD ;Save the old commandmov CMD,a;Save the new commandmov a,ADDR;Cheack for valid addresscjne a,#00,nvalidmov a,TEMPcjne a,CMD,valid;Check for valid commandnvalid:ljmp mainvalid:;Key press checkclr amov c,FLIPrrc amov TEMP,aclr amov c,TOGrrc acjne a,TEMP,valid1sjmp nvalidvalid1:mov c,FLIPmov TOG,cmov a,CMDclr ccjne a,#2,skip1;Check for SW1clr EN1;clear the enable1setb EN2;set enable2setb IN1; set input1 clr IN2; set input2clr IN3; set input3 clr IN4; set input4

ljmp mainisset1:ljmp mainskip1:cjne a,#5,skip2;Check for SW2clr EN1;stop the motorsclr EN2clr IN1 clr IN2clr IN3 clr IN4

ljmp main

skip2:cjne a,#8,skip3;Check for SW3setb EN1; for right directionclr EN2clr IN1 setb IN2clr IN3 setb IN4

ljmp main

skip3:cjne a,#4,skip4;Check for SW4setb EN1; for backword directionsetb EN2clr IN1 setb IN2setb IN3 clr IN4

ljmp mainskip4:cjne a,#6,skip5;Check for SW5setb EN1;for left directionsetb EN2setb IN1 clr IN2clr IN3 setb IN4ljmp main

skip5:cjne a,#1,skip6;Check for SW5clr fan

ljmp mainskip6:cjne a,#7,skip7;Check for SW5clr fan

ljmp mainskip7:cjne a,#0CH,exit;Check for all switchesmov SWport,#00Hljmp mainexit:ljmp main

END;End of program

10.HARDWARE TESTING

10.1 CONTINUITY TEST:

In electronics, a continuity test is the checking of an electric circuit to see if current flows (that it is in fact a complete circuit). A continuity test is performed by placing a small voltage (wired in series with an LED or noise-producing component such as a piezoelectric speaker) across the chosen path. If electron flow is inhibited by broken conductors, damaged components, or excessive resistance, the circuit is "open".

Devices that can be used to perform continuity tests include multi meters which measure current and specialized continuity testers which are cheaper, more basic devices, generally with a simple light bulb that lights up when current flows.An important application is the continuity test of a bundle of wires so as to find the two ends belonging to a particular one of these wires; there will be a negligible resistance between the "right" ends, and only between the "right" ends.

This test is the performed just after the hardware soldering and configuration has been completed. This test aims at finding any electrical open paths in the circuit after the soldering. Many a times, the electrical continuity in the circuit is lost due to improper soldering, wrong and rough handling of the PCB, improper usage of the soldering iron, component failures and presence of bugs in the circuit diagram. We use a multi meter to perform this test. We keep the multi meter in buzzer mode and connect the ground terminal of the multi meter to the ground. We connect both the terminals across the path that needs to be checked. If there is continuation then you will hear the beep sound.

10.2 POWER ON TEST:

This test is performed to check whether the voltage at different terminals is according to the requirement or not. We take a multi meter and put it in voltage mode. First of all check the voltage across the battery terminal whether it is fully charged or not, the battery used in this project is 12V, so touch the red terminal of battery with red probe of multi meter and touch black terminal of battery with black probe of multi meter, if 12V is being displayed on multi meter screen then we can proceed for next steps.

Now that the power supply is available, no IC should be inserted in the base, first apply power and check whether proper voltage is reaching at vcc and gnd pins of each IC base or not. If proper voltages appear at the supply pins of IC bases then insert IC and check the required output.

Now we have to check whether the LEDs are in working condition or not, Red LED or IR LED or Photo diode has got one longer leg and one shorter leg. Longer leg is positive terminal of LED and shorter leg is negative terminal.Now keep the multi meter in buzzer mode or continuity mode and touch red probe of multi meter to the longer leg of LED and black probe of multi meter to the shorter leg of LED, if LED glows in such case that means its working. Now solder Red LED into PCB, remember longer leg of LED should be inserted into positive marking on PCB and shorter leg should be inserted into other hole of LED marking on PCB. Now after soldering LED with a series resistor apply battery voltage to the board and see whether the LED is glowing or not.

The black LED is photodiode and white LED is IR diode even these components have got longer leg and shorter leg, insert longer leg into +ve marking hole on PCB and insert shorter leg into other hole of LED marking on PCB .

11. Application These robots are used in detecting landmines. Robots are used for in detecting the minerals present in the ground. These robots are used for detecting the bombs. These can be used in construction industry for locating steel bars present in concrete. They are used in airports and building security to detect the weapons.

12.CONCLUSION

From the design and analysis of the above project we conclude that ROBOTICS is one of the best means of future advancement in any field of science. Use several wireless technologies is empowering the designing and use of ROBOTS in a better way. Our prototype design could be interfaced with more advanced wireless technologies like GSM, GPS, Zigbee etc to enhance its capabilities to be used in more critical situations.

13.BIBLIOGRAPHYTEXT BOOKS REFERED:1. The AVR Microcontroller and Embedded systems by Muhammad Ali Mazidi and Janice Gillispie Mazidi , Pearson Education.2. ATMEGA16Data Sheets.

WEBSITES www.atmel.com www.beyondlogic.org www.wikipedia.org www.howstuffworks.com www.alldatasheets.com