You are on page 1of 48

OBSTACLE DETECTION BASED ROBOT USING IR SENSORS

A Mini Project report submitted in Partial fulfillment of the requirements For the award of degree of BACHELOR OF TECHNOLOGY In ELECTRONICS AND COMMUNICATION ENGINEERING By Under the esteemed guidance of Prof. M.V.H.BHASKARA MURTHY M.Tech (Ph.D) Department of E.C.E

S.RAMAKRISHNA SAI (08MP1A0450) L.HARISANKAR (08MP1A0433)

V.CH.PAVAN KUMAR PATNAIK (08MP1A0457) P.GANESH (08MP1A0439)

1

SRI VAISHNAVI COLLEGE OF ENGINEERING SINGUPURAM, SRIKAKULAM, ANDHRA PRADESH. DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING 2011

CERTIFICATE

This is to certify that the mini project work entitled ³OBSTACLE DETECTION BASED ROBOT USING IR SENSORS´, is a bonafide work done by S.RAMAKRISHNA SAI, V.CH.PAVAN KUMAR PATNAIK, L.HARISANKAR, P.GANESH submitted in partial fulfilment of the requirements for the award of the degree of BACHELOR OF TECHNOLOGY in ELECTRONICS AND COMMUNICATION ENGINEERING.

UNDERGUIDENCE M.V.H.BHASKARA MURTHY

HEAD OF THE DEPARTMENT, E.C.E M.V.H.BHASKARA MURTHY

2

ACKNOWLEDGEMENT This report would be incomplete without the mention of those who have directly or indirectly helped us during the tenure of this project. We would like to thank Dr.L.S.SASTRY, Principal, SRI VAISHNAVI COLLEGE OF ENGINEERING for having permitted us to take up this project. We would also like to express our deepest sense of gratitude towards Prof.M.V.H.BHASKARA MURTHY, Head of the Department, Electronics and communication Engineering, Sri Vaishnavi College of Engineering and Sri

T.MANIKYALA RAO, the Project coordinator, E.C.E Department, Sri Vaishnavi College of Engineering for their invaluable help during this project. Their guidance has been instrumental and has proved to be of immense help at every stage of the project. We would like to thank our guide Sri M.V.H.BHASKARA MURTHY , Head of the Department, Electronics and communication Engineering, Sri Vaishnavi College of Engineering for constantly monitoring our progress and suggesting improvements at various stages in the project We would like to thank all the other staff members of Electronics and communication Engineering Department, Sri Vaishnavi College of Engineering for Co-operating with us all through the period of project. Lastly, we would like to thank everyone who has been involved in the progress of the project, whose contributions, have added a lot of value.

3

ABSTRACT
In robotics, obstacle avoidance is the task of satisfying some control objective subject to non-intersection or non-collision position of constraints. Normally obstacle avoidance is considered to be distinct from path planning in that one is usually implemented as a reactive control which a controller will then guide a robot along. Whenever robot senses any obstacle automatically diverts its position to left/right and follows the path. Robot consists of two motors, which control the side pair wheels of each and help in moving forward and backward direction. It senses the object with help of obstacle sensor. IR pair is used for detecting the obstacle. In this project we develop a robot such that it will be moving according to path assigned to it if at all there is any obstacle in between then the robot stops and change its direction. This sort of project is very much useful in the industries where the automated supervision is required. Hardware specification are Regulated power supply, AVR Series Micro controller, IR sensor, DC Motor. Software tools are WINAVR to compile the source file and generate the hexadecimal code, AVR Studio 4.18. This robot can be applied at the toys where children will play. ROBOT can be used for the army application by fixing a cam to it. We can apply number of IR pairs for the safe direction control. This project is considered to be the key link to the 3rd generation of robotics.

4

10 Figure 2.2 Block diagram of Embedded System Basic Layout of Microcontroller Block Diagram of Microcontroller-ATMEGA8 Architecture of ATMEGA8 Pin Diagram of ATMEGA8 A simple 5V DC Regulated Power Supply System Step down transformer Dc Motor Parts of Dc motor Basic Commutator A Simple Electric Motor DC Motor Rotations vs.LIST OF FIGURES Figure number Name BLOCK DIAGRAM OF THE PROJECT Figure1.11 Figure 2.4 Figure 2.9 Figure 2.1 Figure 2.3 Figure 2.12 Figure 3.2 Figure 2.7 Figure 2.5 Figure 2.2 Figure 2.6 Figure 2. Polarity Obstacle Sensor Circuit Diagram of Obstacle Sensor Electromagnetic Spectrum A radio frequency energy wave superimposed upon an infrared energy wave Page number 5 .1 Figure 3.1 Figure 1.8 Figure 2.

5 Working of Dc Motor 2.1.3.2.4 Regulator Unit 2.5.2 Rectifier Unit 2.2.3.2 Power Supply 2.2 Examples of Embedded Systems 1.6 Advantages and Disadvantages 6 .3.1 Features 2.1 Synchronous Serial Transmission 1.5 The UART: What it is and how it works 1.5.1 Introduction 1.3.3 Microcontrollers and Microprocessors 1.3 Filter 2.5 Pin Description 2.3 Principle 2.3 Motors 2.3 Architecture 2.2 Asynchronous Serial Transmission Chapter2.3.1.1.4 Construction 2.1 Step down Transformer 2.4 Typical Microcontroller Architecture and Features 1.3.4 Pin Diagram 2.1 Definition 2.2.1. Hardware 2.1.2 Dc Motor 2. Embedded Systems 1.2.2 AVR Description 2.1 Microcontroller (ATMEGA8) 2.Contents Chapter1.

Code Chapter6.4 Obstacle Sensor 2.1 Introduction 4. Future Aspects and Conclusion 7. Applications and Result 6.2.4.4 AVRISP2 3.1 Compiler 3. Software (AVR STUDIO) 3. Infrared Technology 4.4.1 Applications 6.4.7 Security 4.5 IR Disadvantages 4.1 Future Aspects 7.2 Result Chapter7.6 Health Risks 4.3 WINAVR 3.1 Features Chapter4.4.4 IR Advantages 4.2 Why AVR? 3.2 Wireless Communication 4.3 Applications Chapter3.3.1 Circuit of Obstacle Sensor 2.1 Introduction 3.3 Infrared Technology 4.8 Importance of Standards Chapter5.2 Conclusion References 7 .2 Features 2.

As the transmitter part travel IR rays from to receiver here also transmitter send the data receiver but these IR pair are places beside each other. BLOCK DIAGRAM: POWER SUPPLY: Power supply can be broken down into a series of blocks. Transformers work only with AC 8 . each of which performs a particular function. a sensor subsystem having a defined relationship with respect to the housing and aimed at the surface for detecting the surface. Obstacle sensors are nothing but the IR pair. and a circuit in communication with the detector for redirecting the robot when the surface does not occupy the region to avoid obstacles. the sensor subsystem including: an optical emitter which emits a directed beam having a defined field of emission. The transformer is 230v AC supply. and a photon detector having a defined field of view which intersects the field of emission of the emitter at a finite region. So whenever the obstacle sensor found an obstacle in between its way the IR rays reflects in a certain angle.Introduction A robot obstacle detection system comprising: a robot housing which navigates with respect to a surface.

e. OBSTACLE SENSOR: The obstacle senor is used avoiding the robot from the clash to any external devices or any obstacle which comes in its way.and here we are using step down transformer because to step down high voltage AC mains to low voltage AC (i. Here we use the dc motor as it has the principle of the speed controlling. In regulator to set DC output to a fixed voltage. DC MOTOR: Motors are used for the movement of the robot. 9 . This transformer is fed into rectifier. This is used to control all the operations of a circuit to get the accurate result. 230v to12v). In bridge rectifier there are several ways of connecting diodes to make a rectifier to convert AC to DC and it is most important and it produces full-wave with varying DC so that we go for smoothing capacitor it smooth the DC from varying greatly to a small ripple. By using regulator we can eliminate the ripple. Here we are using the IR communications the transmitter and the receiver parts. MICRO CONTROLLER: Here we are using ATMEGA8 microcontroller. The transmitter produces the IR rays and they are received by the receiver section.. The micro controller we use is of the 28 pins and of 3 ports.

Mobile phones or handheld computers share some elements with embedded systems. In terms of complexity embedded systems run with a single microcontroller chip to very complex with multiple units. the embedded systems range from portable devices such as digital watches and MP3 players to large stationary installations like traffic lights.1 Introduction An embedded system is a special-purpose computer system designed to perform a dedicated function. C. Peripherals: These are the external devices connected Processor: It is an IC which is used to perform some task Processors are classified into four types like: 1. such as the operating systems and microprocessors which power them but are not truly embedded systems themselves because they tend to be more general purpose allowing different applications to be loaded and peripherals to be connected. Digital Signal Processor (DSP) 10 . Since the system is dedicated to specific tasks. peripherals and networks mounted inside a large chassis or enclosure. Micro Processor (µp) 2. Physically.Chapter 1 Embedded Systems 1. Memory: It is used to store data or address. As the embedded system is the combination of both software and hardware .. Peripherals. Micro controller (µc) 3. and Memory. and Hardware deals with Processors. An embedded system performs one or few pre-defined tasks usually with very specific requirements and often includes task-specific hardware and mechanical parts not usually found in a general-purpose computer.Software deals with the languages like WINAVR. design engineers can optimize it by reducing the size and cost of the product. factory controllers or the systems controlling nuclear power plants. and VB etc.

Everything needed for those functions is custom designed into specific chips. Most will have custom operating systems or variations of existing operating systems (e.1 Block diagram of Embedded System 1. and entertainment systems. It is specifically designed to run the front-panel controls and all the timing and electronics of the oven. including engine controls. Examples of embedded systems are chips that monitor automobile functions. Network managers will need to manage more and more embedded systems devices. active suspension systems. It's easy to picture nearly every electronic device as having an embedded system. environmental systems.g. and even coffee brewers will benefit in some way 11 . o o o Processor Peripherals memory Figure1. antilock brakes.. All of these have a need to connect with other devices. air bags. ranging from printers to scanners. Another example is a chip for a microwave oven. either directly or through a wireless or directconnect network. refrigerators. No external operating system is required. to cell phones. washing machines.. security systems.4. Microsoft Windows CE).2 Examples of Embedded Systems An embedded system typically has a specialized function with programs stored on ROM. For example. to handheld computing devices. Application Specific Integrated Circuits (ASIC) Embedded System Software Hardware o o o WINAVR C VB Etc.

so embedded systems support Ethernet. 1. in contrast to a general-purpose microprocessor (the kind used in a PC).from embedded systems. If the weather station is connected to the Internet. The chips contain HTTP and HTML functions.4 Typical Microcontroller Architecture and Features The basic internal designs of microcontrollers are pretty similar. In this sense. Bluetooth (wireless). A critical feature of an embedded system is its ability to communicate. so that the transistors of its logic circuits would fit onto a single part. The microprocessor was born by reducing the word size of the CPU from 32 bits to 4 bits. 12 . infrared. Figu 1. This information can be pushed or pulled. In the pull scenario. users or network devices access the weather station to read the latest information. It is a type of microprocessor emphasizing self-sufficiency and cost-effectiveness. 1.2. In fact. many embedded systems are basically Web servers on a chip. A weather station on top of a building may employ an embedded system that gathers information from external sensors. A microprocessor is a programmable digital electronic component that incorporates the functions of a central processing unit (CPU) on a single semi conducting integrated circuit (IC). All components are connected via an internal bus and are all integrated on one chip. the weather station is acting as a mini-Web server. will provide information to anyone that accesses the IP address. embedded system. it may have its own IP address and. In the push scenario. The modules are connected to the outside world via I/O pins. or other technologies.3 Microcontrollers and Microprocessors A microcontroller (or MCU) is a computer-on-a-chip. or handheld device. ideally. One or more microprocessors typically serve as the CPU in a computer system. and custom applications appropriate for the environment in which the chip will be used. the block re diagram of a typical microcontroller. the data is automatically sent to devices that have requested it.

or count events. Digital I/O: Parallel digital I/O ports are one of the main features of microcontrollers.). which can be used to drive motors or for safe breaking (antilock brake system. Processor Core: The CPU of the controller. . which can be used to timestamp events. they help to conserve power. and the registers (stack pointer.2 Basic Layout of Microcontroller The following list contains the modules typically found in a microcontroller. register file . Memory: The memory is sometimes split into program memory and data memory.Figure 1. the control unit. The number of I/O pins varies from 3-4 to over 90. Timer/Counter: Most controllers have at least one and more likely 2-3 Timer/Counters. program counter. You can find a more detailed description of these components in later sections. Furthermore the PWM output in conjunction with an external filter be used to realize a cheap digital/analog converter. a DMA controller handles data transfers between peripheral components and the memory. measure intervals. ABS). 13 . Many controllers also contain PWM (pulse width modulation) outputs. In conjunction with sleep modes. It contains the arithmetic logic unit. Interrupt Controller: Interrupts are useful for interrupting the normal program flow in case of (important) external or internal events. depending on the controller family and the controller type. accumulator register. In larger controllers. .

5. and synchronous communication can be more costly if extra wiring and circuits are required to share a clock signal between the sender and receiver. 14 . if there is no data available at a given instant to transmit. At the destination. the microcontroller includes digital/analog converters. In some cases. The analog module also generally features an analog comparator. The UART takes bytes of data and transmits the individual bits in a sequential fashion. a fill character must be sent instead so that data is always being transmitted. In most forms of serial Synchronous communication. Depending on the modes that are supported by the hardware. terminals and other devices. 1. a second UART re-assembles the bits into complete bytes. Serial transmission is commonly used with modems and for non-networked communication between computers. which differ in the number of channels (2-16) and their resolution (8-12 bits).1 Synchronous Serial Transmission Synchronous serial transmission requires that the sender and receiver share a clock with one another. Both forms are described below. or that the sender provide a strobe or other timing signal so that the receiver knows when to ³read´ the next bit of the data. Some common acronyms are: UART Universal Asynchronous Receiver/Transmitter USART Universal Synchronous-Asynchronous Receiver/Transmitter 1.Analog I/O: Apart from a few small controllers. Synchronous communication is usually more efficient because only data bits are transmitted between sender and receiver.5 The UART: What it is and how it works The Universal Asynchronous Receiver/Transmitter (UART) controller is the key component of the serial communications subsystem of a computer. most microcontrollers have integrated analog/digital converters. There are two primary forms of serial transmission: Synchronous and Asynchronous. the name of the communication sub-system will usually include A if it supports Asynchronous communications and S if it supports Synchronous communications.

This mode is described here for comparison purposes only. (This requirement was set in the days of mechanical teleprinters and is easily met by modern electronic equipment. Printers and fixed disk devices are not normally serial devices because most fixed disk interface standards send an entire word of data for each clock or strobe signal by using a separate wire for each bit of the word. These two clocks must be accurate enough to not have the frequency drift by more than 10% during the transmission of the remaining bits in the word. In the PC industry. For example. The Start Bit is used to alert the receiver that a word of data is about to be sent. When 15 . the receiver will examine the signal to determine if it is a 1 or a 0 after one second has passed. Each bit in the transmission is transmitted for exactly the same amount of time as all of the other bits. then it will wait two seconds and then examine the value of the next bit.2 Asynchronous Serial Transmission Asynchronous transmission allows data to be transmitted without the sender having to send a clock signal to the receiver. The sender only knows when the clock says to begin transmitting the next bit of the word. The standard serial communications hardware in the PC does not support Synchronous operations. the individual bits of the word of data are sent with the Least Significant Bit (LSB) being sent first. Instead.5. if it takes two seconds to send each bit. When a word is given to the UART for Asynchronous transmissions. these are known as Parallel devices. 1.A form of Synchronous transmission is used with printers and fixed disk devices in that the data is sent on one set of wires while a clock or strobe is sent on a different wire. and to force the clock in the receiver into synchronization with the clock in the transmitter.) After the Start bit. a bit called the "Start Bit" is added to the beginning of each word that is to be transmitted. the sender and receiver must agree on timing parameters in advance and special bits are added to each word which is used to synchronize the sending and receiving units. The sender does not know when the receiver has ³looked´ at the value of the bit. and the receiver ³looks´ at the wire at approximately halfway through the period assigned to each bit to determine if the bit is a 1 or a 0. and so on.

If another word is ready for transmission. Parity and Stop bits. it may check for the Parity Bits (both sender and receiver must agree on whether a Parity Bit is to be used). Regardless of whether the data was received correctly or not. If the sender and receiver are configured identically. the transmission line can be idle. the transmitter may add a Parity Bit that the transmitter generates. or that the signal was interrupted. and then the receiver looks for a Stop Bit. The usual cause of a Framing Error is that the sender and receiver clocks were not running at the same speed.the entire data word has been sent. the UART automatically discards the Start. if there is no data to transmit. If the Stop Bit does not appear when it is supposed to. these bits are not passed to the host. the UART considers the entire word to be garbled and will report a Framing Error to the host processor when the data word is read. When the receiver has received all of the bits in the data word. the Start Bit for the new word can be sent as soon as the Stop Bit for the previous word has been sent because asynchronous data is ³self synchronizing´. The Parity Bit may be used by the receiver to perform simple error checking. Then at least one Stop Bit is sent by the transmitter. 16 .

000 Flash/100.The microcontroller is concerned with the rapid movment of bits within the chip. 17 .The microcontroller can function as a computer with the addition of no external digital parts.1.  High Endurance Non-volatile Memory segments.  Advanced RISC Architecture y 130 Powerful Instructions ± Most Single-clock Cycle Execution ± 32 x 8 General Purpose Working Registers y y Fully Static Operation Up to 16 MIPS Throughput at 16 MHz ± On-chip 2-cycle Multiplier. 2. Low-power AVR 8-bit Microcontroller.Chapter 2 Hardware Hardware Modules: The Hardware modules of this project: y y y y Microcontroller Power Supply unit Motors Obstacle Sensor 2.000 EEPROM ± Data retention: 20 years at 85°C/100 years at 25°C y Optional Boot Code Section with Independent Lock Bits In-System Programming by On-chip Boot Program. y True Read-While-Write Operation. The microprocessor is concerned with rapid movment of code and data from external addresses to the chip.1 Microcontroller (Atmega8): Microprocessors and microcontrollers step from basic idea.1K Byte Internal SRAM y Write/Erase Cycles: 10.1 Features:  High-performance. y 8K Bytes of In-System Self-programmable Flash program memory ± 512 Bytes EEPROM .Most microprocessors have many operational codes (opcodes) for moving data from external memory to the CPU.

6 mA Idle Mode: 1. and Capture Mode y y y Real Time Counter with Separate Oscillator ± Three PWM Channels 8-channel ADC in TQFP and QFN/MLF package 6-channel ADC in PDIP package Six Channels10-bit Accuracy Byte-oriented Two-wire Serial Interface ± Programmable Serial USART y Programmable Watchdog Timer with Separate On-chip Oscillator ± On-chip Analog Comparator  Special Microcontroller Features y Power-on Reset and Programmable Brown-out Detection ± Internal Calibrated RC Oscillator y y External and Internal Interrupt Sources Five Sleep Modes: Idle.5V (ATmega8L) 4.  Peripheral Features.5 µA 18 . 32-lead TQFP.5-5. 3V. 25 C y y y Active: 3.5.7 .0 mA Power-down Mode: 0. and 32-pad QFN/MLF  Operating Voltages y 2. y One 16-bit Timer/Counter with Separate Prescaler. Compare Mode. and Standby  I/O and Packages y y 23 Programmable I/O Lines 28-lead PDIP.5V (ATmega8)  Power Consumption at 4 MHz. ADC Noise Reduction.y Programming Lock for Software Security. Power-save. Powerdown.

The resulting architecture is more code efficient while achieving throughputs up to ten times faster than conventional CISC microcontrollers. The ATmega8 AVR is supported with a full suite of program and system development tools.R Description: The AVR core combines a rich instruction set with 32 general purpose working registers. allowing two independent registers to be accessed in one single instruction executed in one clock cycle. BLOCK DIAGRAM: Figure 2. In-Circuit Emulators.1.2 A. program debugger/simulators. macro assemblers. and evaluation kits. The Flash Program memory can be reprogrammed In -System through an SPI serial interface by a conventional non-volatile memory programmer or by an On-chip boot program running on the AVR core. including C compilers.2. By combining an 8-bit RISC CPU with In-System SelfProgrammable Flash on a monolithic chip. All the 32 registers are directly connected to the Arithmetic Logic Unit (ALU). The device is manufactured using Atmel¶s high density non-volatile memory technology.V.1 Block Diagram of Microcontroller-ATMEGA8 19 . the Atmel ATmega8 is a powerful microcontroller that provides a highly-flexible and cost-effective solution to many embedded control applications.

3 Archi cture: Fi ure 2.1.2 Archit ct re of ATM A8 20 .2.

6). ADC . it should be connected to VCC through a low-pass filter. and ADC (7.4 Pi i ram: Fi ure 2.5 Pi Descri ti VCC GND AREF ADC7. AR is the analog reference pin for the A/D Converter In the TQFP and QFN/M F package.4) use digital suppl voltage.3 Pi Di ram of ATM 2. It should be externall connected to VCC. Note that Port C (5.6 serve as analog inputs to the A/D converter These pins are powered from the analog suppl and serve as 10-bit ADC channel AVCC AVCC is the suppl voltage pin for the A/D Converter. If the ADC is used.1.6 A8 Di ital suppl voltage. VCC. RE ET It is input. A low level on this pin for longer than minimum pulse 21 . even if the ADC is not used.0).. Port C (3.1. Ground.2.

The Port B pins are tri-stated when a reset condition becomes active.PC0) PC6/RESET Port D (PD7. The Port C output buffers have symmetrical drive characteristics with both high sink and source capability.PD0) 2. PC6 is used as an I/O pin Port C output buffers have symmetrical drive characteristics with both high sink and source Port C (PC5.generates input. The Port C pins are tri-stated when a reset condition becomes active. Port C pins that are externally pulled low will source current if the pull-up resistors are activated.PB0) on the clock selection fuse settings. Port B output buffers have symmetrical drive characteristics with both high sink and source capability.4 A simple 5V DC Regulated Power Supply System 22 . As inputs. Port B pins that are externally pulled low will source current if the pullup resistors are activated.. Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit).. even if the clock is not running . Port C is a 7-bit bi-directional I/O port with internal pull-up resistors (selected for each bit).Depending Port B (PB7.2 POWER SUPPLY: Power supply block consists of following units: y y y y Step down transformer Bridge rectifier circuit Filter Voltage regulators Figure 2. even if the clock is not running If the RSTDISBL Fuse is programmed.. As inputs. PB6 can be used as input to the XTAL1/XTAL2/TOSC1/TOS2 inverting.

To reduce or step down the voltage. Both conduction paths cause current to flow in the same direction through the load resister. both with individual diodes wired as shown and with single component bridges where the diode bridge is wired internally. The outputs from the secondary coil which is centre tapped are the ac values of 0v and 12v. This design can be used to rectify single phase A. the other set is reverse biased and effectively eliminated from the circuit. there is a forward path through the diode bridge. For both positive and negative swings of the transformer.C.1 Step Down Transformer: The step-down transformer is used to step down the supply voltage of 230v ac from mains to lower values as the various IC¶s used in this project require reduced voltages. it is known as a bridge rectifier. A bridge rectifier makes use of four diodes in a bridge arrangement to achieve full wave rectification. The diagram describes a diodebridge design known as a full wave rectifier. The transformer consists of primary and secondary coils. when no transformer centre tap is available. the transformer is designed to contain less number of turns in its secondary core.C) output.2 Rectifier Unit: A bridge rectifier is an arrangement of four diodes connected in a circuit. That provides the polarity of output voltage of any polarity of the input voltage.5 Step down transformer 2.C) input into direct current (D. The conversion of these ac values to dc values is done using the full wave rectifier. While one set of diodes is forward biased. Figure 2.2.2.2. 23 . for conversion of alternating current (A. This is a widely used configuration. When used in its most common application. accomplishing full-wave rectification.

an electric motor that is driven by alternating current  Synchronous motor. This filter is fixed before the regulator.2.3.2.3 Filter: Capacitors are used as filters. So it allows only ac voltage and does not allow the dc voltage.2.4 Regulator unit: Regulator regulates the output voltage to a specific value. The primary action performed by capacitor is charging and discharging. not an engine. and to avoid this regulators are used. the dc voltage also changes. 2. It charges in positive half cycle of the ac voltage and it will discharge in negative half cycle. 2. it usually refers to either an electrical motor or an internal combustion engine. an alternating current motor distinguished by a rotor spinning with coils passing magnets at the same rate as the alternating current and resulting magnetic field which drives it  Induction motor.3 Motors 2.1 DEFINITION: Motor is a device that creates motion. The output voltage is maintained irrespective of the fluctuations in the input dc voltage. a machine that converts electricity into a mechanical motion o AC motor. an internally commutated electric motor designed to be run from a direct current power source  Brushless DC motor. a type of asynchronous alternating current motor where power is supplied to the rotating device by means of electromagnetic induction o DC motor. an electric motor that runs on direct current electricity  Brushed DC electric motor. Whenever there are any ac voltage fluctuations. also called a squirrel-cage motor. The ripples from the dc voltages are removed and pure dc voltage is obtained. a synchronous electric motor which is powered by direct current electricity and has an electronically controlled 24 . It may also refer to: y Electric motor.

a type of electric motor based on the attraction and repulsion of electric charge o Servo motor. We can control a DC motor easily with microcontrollers. for example move your robot. instead of a mechanical commutation system based on brushes o Electrostatic motor. stop it or make it go either in clockwise or anti clock wise direction.3. commonly used in robotics. a torque acts on the coil which rotates it continuously. an electric motor that operates a servo.commutation system. We can also control its speed but it will be covered in latter tutorial.3 Principle When a rectangular coil carrying current is placed in a magnetic field.2 DC Motor A DC motor is an electromechanical device that converts electrical energy into mechanical energy that can be used to do many useful works. The design of the brushed DC motor is quite simple. So it is essential to know how to control a DC motor effectively with a MCU. 2. When connected with power supply the shaft rotates. You can reverse the direction of rotation by reversing the polarity of input.6 Dc Motor Motor gives power to your MCU. Figure 2. It has two wires or pins. 25 .3. DC motors comes in various ratings like 6V and 12V. Means power to do physical works. When the coil rotates. the shaft attached to it also rotates and thus it is able to do mechanical work. We can start it. y y Permanent magnets Electro-magnetic windings 2.

C. field magnet(s). rotor (a.. as well as two or more permanent magnet pole pieces. and brushes. This coil wound on the soft iron core forms the armature. Commutator is a copper ring split into two parts C1 and C2. The above diagram shows a common motor layout -. In most common DC motors the external magnetic field is produced by high-strength permanent magnets.Every DC motor has six basic parts -. The coil is mounted on an axle and is placed between the cylindrical concave poles of a magnet.axle. The two ends of the coil are soldered to these rings.4 Construction: Figure 2.7 Parts of Dc motor Parts of a DC Motor: Armature A D. stator. The rotor consists of windings (generally on a core).3.with the rotor inside the stator (field) magnets. The stator is the stationary part of the motor -. They rotate along with the coil. The split rings are insulated from each other and mounted on the axle of the motor. Commutator rings are connected to a battery. Commutator A commutator is used to reverse the direction of flow of current. armature). the windings being electrically connected to the commutator. The wires from the battery are not connected to the rings but to the brushes which are in contact with the rings.a.this includes the motor casing.k. 26 . motor consists of a rectangular coil made of insulated copper wire wound on a soft iron core. commutator. 2. The rotor (together with the axle and attached commutator) rotates with respect to the stator.

2. source. a magnetic field is generated around the armature. The carbon brushes are connected to a D.8 Basic Commutator Brushes: Two small strips of carbon. Figure 2. The left side of the armature is pushed away from the left magnet and drawn towards the right causing rotation.9 A Simple Electric Motor 27 .5 Working of a DC Motor When the coil is powered. and the split rings rotate between the brushes.3.C.Figure 2. known as brushes press slightly against the two split rings.

When the coil turns through 900.terminal source on the same power source. We can call them as positive terminal and negative terminal. we say that when the + wire is connected to + terminal on a power source. the brushes lose contact with the commutator and the current stops flowing through the coil. y 28 . Direction of Rotation A DC Motor has two wires. the motor rotates clockwise (if you are looking towards the motor shaft).wire is connected to the . On a motor. you can always connect in such a fashion that you get the direction that you want on a per polarity basis. Notice this is just an arbitrary selection and that some motor manufacturers could easily choose the opposing convention. and the .10 DC Motor Rotation vs Polarity Facts: y DC Motor rotation has nothing to do with the voltage magnitude or the current magnitude flowing through the motor. DC Motor rotation does have to do with the voltage polarity and the direction of the current flow. Figure 2. then the motor rotates counter clockwise. If you reverse the wire polarities so that each wire is connected to the opposing power supply terminal. As long as you know what rotation you get with one polarity. although these are pretty much arbitrary names (unlike a battery where these polarities are vital and not to be mixed!).

Because Back EMF is directly proportional to speed making Back EMF = 0. 2. Stopping the motor is not as harsh as starting.6Advantages and Disadvantages: Advantages: y y y y Easy to understand design Easy to control speed Easy to control torque Simple. the motor will first act as an inductor because current cannot change abruptly in an inductor. but the truth of the matter is that this is one of the instances in which you will see the highest currents flowing into the motor. The reason why the motor stops so fast is because as a short is applied to the motor terminals.3.4 OBSTACLE SENSOR Figure 2.11 Obstacle Sensor 29 . cheap drive design Disadvantages: y y y y y Expensive to produce Can't reliably control at lowest speeds Physically larger High maintenance Dust 2. Since you have an inductance whose energy storage capacity is basically empty.Motor Start and Stop: Starting a motor is a very hazardous moment for the system. the Back EMF is shorted.

I will make single Led/Phototransistor sensors for front left and front right. This is a reversing sensor to prevent him reversing into anything and as such will cover a wide area. The transistor allows the processor to turn the LEDs on or off. You should probably have hfe of at least 200-300. Note: That the phototransistors are slightly forward of the blue LEDs. Unfortunately the low input impedance of many A/D converters will act like a small resistor in parallel with the 1M resistor and dramatically reduce the output to the processor. You could use only one but I wanted to cover a wider area so my transistors will point in slightly different directions. If either one detects IR it will allow more current to flow. It has a range of about 10-15cm (4-6 inches) with my hand as the object being detected. Next we have two phototransistors in parallel with a 1M resistor in series. In conjunction with the 1K and 10K resistors it amplifies the signal so that the analog input on the processor gets a nice strong signal. 2. This helps stop stray light from the LEDs being detected.This sensor is a short range obstacle detector with no dead zone. It has a reasonably narrow detection area which can be increased using the dual version. This will allow him to avoid crashing into obstacles when his rangefinder/object tracker is looking elsewhere. This has the advantage that you can flex the leds and transistors outward to cover a large area.4. Since volts=current x resistance. 30 . even a small increase in current will create a reasonable increase in voltage across the 1M resistor. This is necessary to tell the difference between the ambient IR from daylight and indoor lighting and the reflected light from the LEDs that indicates the presence of an object.1 Circuit of obstacle sensors: Starting from the left you can see two IR LEDs with a resistor and transistor in series. This is where our BC549 transistor comes in to save the day. The BC549 is not too critical and it has hfe of 490 when measured with a multimeter. This setup works like a first LDR but with IR. Range can also be increased by increasing the power to the IR LEDs or adding more IR LEDs The photo below shows my test setup with some IR LED's (dark blue) as a light source and two phototransistors in parallel for the receiver.

4.2 Features y y y y y y y Modulated IR transmitter Ambient light protected IR receiver 3 pin easy interface connectors Bus powered module Indicator LED Up to 12 inch range for white object Can differentiate between dark and light colors.3 Applications y y y y Proximity Sensor Obstacle Detector Sensor Line Follower Sensor Wall Follower Sensor 31 .12 Circuit Diagram of Obstacle Sensor 2.Figure 2.4. 2.

the program will start up in source level mode. In addition to source level execution of both C and Assembly programs. The key window in AVR Studio is the Source window. In addition. In order to execute a program using AVR Studio. the user can have an unlimited number of code breakpoints.1 Introduction: AVR Studio is a Development Tool for the AT90S Series of AVR micro controllers. place the cursor on a statement and execute until that statement is reached.e. The Source window displays the code currently being executed on the execution target (i. it must first be compiled with IAR Systems' C Compiler or assembled with Atmel's AVR Assembler to generate an object file which can be read by AVR Studio. This manual describes the how to install and use AVR Studio. It enables the user to fully control execution of programs on the AT90S In-Circuit Emulator or on the built-in AVR Instruction Set Simulator. the Source window is automatically created. By default. it is assumed that execution is done on source level. The user can execute the program. the Emulator or the Simulator).Chapter 3 Software AVR STUDIO 3. stop the execution. AVR Studio runs under Microsoft Windows95 and Microsoft Windows NT. step out of functions. single step through the code either by tracing into or stepping over functions. AVR Studio can also view and execute programs on a disassembly level. The Status bar indicates whether the execution target is the AVR In-Circuit Emulator or the built-in Instruction Set Simulator. AVR Studio supports source level execution of Assembly programs assembled with the Atmel Corporation's AVR Assembler and C programs compiled with IAR Systems¶ ICCA90 C Compiler for the AVR microcontrollers. both on source level and on disassembly level. and the text marker is always placed on the next statement to be executed. and reset the execution target. AVR Studio enables execution of AVR programs on an AVR In-Circuit Emulator or the built-in AVR Instruction Set Simulator. The user can toggle between source and disassembly mode when execution of the program is stopped. When an object file is opened. and 32 . so if source information exists. All necessary execution commands are available in AVR Studio.

4. Memory windows: Displays the contents of the Program Memory. These parameters can be modified when the execution is stopped. 3. In addition.2 Why AVR? As microprocessors evolved.every breakpoint can be defined as enabled or disabled. including Program Counter. devices increased in complexity with new hardware and new instructions to accomplish new tasks. the user can watch the values of for instance variables in a C program. Some of the devices have so many instructions that it becomes difficult to figure out the most efficient way to do anything that isn¶t built into the hardware. 5. Then somebody figured that if they designed a very simple core processor that only did a few things but did them very fast and efficiently. The breakpoints are remembered between sessions. Thus was born the RISC. In the Watch window. The memories can be viewed as hexadecimal values or as ASCII characters. I/O Memory or EEPROM Memory. Peripheral windows: Displays the contents of the status registers associated with the different peripheral devices: ‡ EEPROM Registers ‡ I/O Ports ‡ Timers etc. 3. Reduced Instruction Set Computers. These microprocessors became known as CISC or Complex Instruction Set Computers. Processor window: Displays vital information about the execution target. The Source window gives information about the control flow of the program. The registers can be modified when the execution is stopped. they could make a much cheaper and easier to program computer. The memory contents can be modified when the execution is stopped. Watch window: Displays the values of defined symbols. Stack Pointer. 2. Message window: Displays messages from AVR Studio to the user 6. Register window: Displays the contents of the register file. The available windows are: 1. Status Register and Cycle Counter. AVR Studio offers a number of other windows which enables the user to have full control of the status of every element in the execution target. Complex is often an understatement. some of the CISCs that I¶ve worked with have mind-numbingly complex instruction sets. 33 . Data Memory.

3 of avr-gcc. avr-gcc. When referring to the version. WinAVR is a suite of executable. For instance. these tools include avr-gcc (the command line compiler). 34 . instead of calling a divide instruction in a CISC device. avr-libc (the compiler library that is essential for avrgcc). These tools are all compiled for Microsoft Windows and put together with a nice installer program. avr-as (the assembler).3 WINAVR WINAVR is not just one tool.3 as some people call it. avr-gdb (the de-bugger). For example WinAVR 20030424. you would have to do a series of subtractions to accomplish a division using a RISC device. It includes the GNU GCC compiler for C and C++. In fact they worked with C compiler designers from IAR to help them with the hardware design to help optimize it for C programming. 3. However. a RISC device. For example currently WinAVR includes version 3. it is not WinAVR 3. which is discussed later. avrdude (the programming interface). like many other software names. I have come to believe that the AVR.The downside was that you had to write additional assembly language software to do all the things that the CISC computer had built in. you are most of the time referring to the version of the compiler. to refer to which release you are using that is done by date. The folks that designed the AVR as a RISC architecture and instruction set while keeping C programming language in mind. Although I¶ll admit that CISC versus RISC¶ and C versus assembly language¶ arguments often seem more like religious warfare than logical discourse. It is instead a set of tools. The 20030424 is a date code. open source software development tools for the Atmel AVR series of RISC microprocessors hosted on the Windows platform. programmers notepad (editor) and a few others. and is completely irrelevant when you program with C since the complier generates the assembly code for you. This disadvantage¶ was offset by price and speed. avarice (JTAG ICE interface). programmed in C is the best way to microcontroller salvation (halleluiah brother).

Also. and can be configured for multiple different languages (front-ends). or GCC.1 Compiler The compiler in WinAVR is the GNU Compiler Collection. 3. The compiler itself is called cc1. is built to execute on the Windows platform. and is configured to compile C.3.exe for C.4 AVRISP2: The AVRISP2 combined with AVR studio can program all AVR 8-bir RISC microcontrollers with ISP interface.exe for C++. Avr-gcc is just a "driver" program only.exe. the preprocessor cpp. The actual set of component programs called is usually derived from the suffix of each source code file being processed.WinAVR is a collection of executable software development tools for the Atmel AVR processor hosted on Windows. 35 . or C++. or cc1plus. This compiler is incredibly flexible and can be hosted on many platforms. The GCC included in WinAVR is targeted for the AVR processor. it can target many different processors / operating systems (back-ends). These software development tools include: y y y y y y y y y y y y Compilers Assembler Linker Librarian File converter Other file utilities C Library Programmer software Debugger In-Circuit Emulator software Editor / IDE Many support utilities 3.exe will usually automatically be prepended with the target name: avr-cpp.

1 Features y y y y y y y y y AVR studio compatible(avr studio 4.0 compliant(full speed.3.4. does not require external power supply Target interface protection Short-circuit protection 36 .2 or later) Supports all AVR devices with ISP interface Programs both flash and EEPROM Supports fuses and lock bit programming Adjustable programming speed(50Hz to 8MHz sck frequency)\ USB2. 12 Mbps) Powered from USB.

VCRs and CD players. and talking signs. The electromagnetic spectrum classifies electromagnetic energy according to frequency or wavelength (both described below). Already comm only used in remote control of TVs. One of the most familiar sources of electromagnetic radiation is the sun. infrared technology is also being used and developed for remote control of environmental control systems. infrared or other wireless technology can provide an alternate. light bulbs and microwaves. increasingly present in mainstream applications. as the term implies. For individuals using augmentative and alternative communication (AAC) devices. also referred to as electromagnetic radiation. such as x-rays. As shown in Figure 1. the electromagnetic spectrum ranges from energy waves having extremely low frequency (ELF) to energy waves having much higher frequency.1 Introduction: As next-generation electronic information systems evolve.2 Wireless Communication: Wireless communication. Infrared technology. it is critical that all people have access to the information available via these systems. more portable. Examples of developing and future information systems include interactive television.Chapter 4 Infrared Technology 4. 4. more independent means of accessing computers and other electronic information systems. allows information to be exchanged between two devices without the use of wire or cable. Information is being transmitted and received using electromagnetic energy. 37 . personal computers. holds great potential for enabling people with a variety of disabilities to access a growing list of information resources. touch screen-based information kiosks. other common sources include TV and radio signals. and advanced Internet programs.

(Exponential powers of 10 are abbreviated as 10exp.3 Infrared Technology: Infrared radiation is the region of the electromagnetic spe ctrum between microwaves and visible light.) 10 Hert : extremely low frequency or ELF. an LED transmits the infrared signal as bursts of non-visible light. 10exp5 Hert : AM radio. Conversely. the infrared wave is higher frequency and therefore shorter wavelength than the radio wave. Some familiar allocated frequency bands are labelled on the spectrum. As is expected based on the electromagnetic spectrum. Approximate locations are as follows. 10exp18 Hert : X-rays. In infrared communication. At the receiving end a photodiode or photoreceptor detects and captures the light pulses.Fi ure 3.] 4. 38 . 10exp16 Hert : Ultraviolet (frequency range is above the visible light spectrum). A hori ontal bar represents a range of frequencies from 10 Hert (cycles per second) to 10 to the 18th power Hert . and illustrates the two different energy wavelengths. the radio wave is lower frequency and therefore longer wavelength than the infrared wave. which are then processed to retrieve the information they contain. 10exp16 Hert : Infrared (frequency range is be low the visible light spectrum). 10exp8 Hert : FM radio.1 Electromagnetic Spectrum In Figure 8. 10exp16 Hert : Visible Light. Figure 9 depicts an infrared energy wave and a radio energy wave.

telephones. 1. Some common applications of infrared technology are listed below. Simple circuitry: no special or proprietary hardware is required. ] Infrared technology is highlighted because of it increasing presence in mainstream s applications. Low circuitry costs: $2-$5 for the entire coding/decoding circuitry. Emergency response systems 5. personal digtal i assistants. The infrared energy wave completes nearly 5 and a half cycles in the time that the radio frequency wave completes 2 cycles. Car locking systems 3. can be incorporated into the integrated circuit of a product 4. Home security systems 4. Computers.2 A radio frequency energy wave superimposed upon an infrared energy wave The above illustrates the inverse relationship between frequency and wavelength. and its advantages over other forms of wireless communication. Environmental control systems 6. Augmentative communication devices 2. 3. Headphones 4. Higher security: directionality of the beam helps ensure that data isn't leaked or spilled to nearby devices as it's transmitted 39 .Figure 3. its current and potential usage in disability -related applications. 2. Low power requirements: therefore ideal for laptops.4 IR Advantages: 1.

5. dust. can block transmission 3. Light. 2. High noise immunity: not as likely to have interference from signals from other devices 4. walls. rain.5 IR Disadvantages: 1. there are no confirmed health risks or scientific dangers from infrared or radio frequency. fog. Blocked by common materials: people. In terms of wireless technology. the air. Point-to-point lasers which can cause burns or blindness. In scientific terms. Unfortunately body cannot detect the presence of a strong magnetic field. able to see each other) to communicate 2. Speed: data rate transmission is lower than typical wired transmission 4.6 Health Risks: Any time electric current travels through a wire. except for potential shocks. human body can act as an antenna. Few international regulatory constraints: IrDA (Infrared Data Association) functional devices will ideally be usable by international travellers. when conditions are right human body may have experienced a small "tingle" of electric current from a poorly grounded electric appliance. weather sensitive: direct sunlight. 40 . Prolonged microwave exposure which has been linked to cancer and leukaemia. no matter where they may be 6. Short range: performance drops off with longer distances 4. etc. pollution can affect transmission 5. Line of sight: transmitters and receivers must be almost directly aligned (i. Human body also has permeability almost equal to air. thus allowing a magnetic field to easily enter the body. as it has a higher conductivity for electricity than air. Therefore. As long as these currents are very small there isn't much danger from electric fields. It is important to remember that electromagnetic fields are found everywhere that electricity is in use.e. it produces an electromagnetic field. plants. or runs an appliance. which could potentially do much more harm. While researchers have not established an ironclad link between the exposure to electromagnetic fields and ailments such as leukemia. . the circumstantial evidence concerns many people. with two known exceptions: 1.

making it much easier to transmit a message.Therefore. Any AAC device programmed to use the GIDEI protocol can access any PC or Macintosh running the DOS. These dangers.7 Security: Electromagnetic frequencies currently have little legal status for protection and as such. Data encryption standards (DES) are also being quickly developed for the exchange of information over the Internet. A possible solution to security issues will likely be some form of data encryption. Windows. most health concerns related to electromagnetic fields are due to electricity in day-to-day use. Radio frequency can penetrate walls. One final example demonstrating the importance of standards is the relationship of augmentative alternative communication (AAC) devices to the General Input Device Emulating Interface (GIDEI) standard. what might be considered an advantage to one method for transmission could turn out to be a disadvantage for security? For example. As presented earlier in the advantages and disadvantages of infrared versus radio frequency transmission. 4.00. 41 .8 Importance of Standards: Several of the wireless devices demonstrated during the presentation have benefited to some degree from standardization. because infrared is line-of-sight it has less transmission range but is also more difficult to intercept when compared to radio frequency. For example. 4. The strength of the electromagnetic field (EMF) decreases as the square of the distance from the field source. As a result these devices are now numerous and inexpensive. a universal IR remote was once priced at roughly $100. can be freely intercepted by motivated individuals. are already in the home and work place. such as computer monitors and TVs.The X10 devices that were demonstrated in the presentation not only rely on but have benefited from the 60 HZ AC standard which applies to most of North America. and the addition of wireless technology should not be seen as an exceptional risk. if any. or Macintosh version of Serial Keys. and many of these same DES will be applied to wireless technology. but also more susceptible to tapping.

It can used for the army application we can add a cam to it.1 Applications: y y y Obstacle sensing robot can be applied at the toys where small children will play. We can apply number of IR pairs for the safe direction control of the robot. 6. y To that it was verified in all directions for obstacle detection. 42 .Chapter 6 Applications and Result 6.2 Result: y The obstacle detection by the robot using IR is done according to the specifications.

‡ Our ROBOT successfully implements line tracking and range detection and obstacle avoidance. 7.1 Future Aspects: y y y We can extend this project with wireless technology by IR (or) RF (or) ZIGBEE. ‡ 43 . Hence it can be further used in Automobiles and industrial automation. We can use the DTMF receiver by using the mobile phone.2 Conclusion: The mini project is ³obstacle detection and the avoidance robot´ ‡ Using all the above adaptive control processes which are able to traverse a given route autonomously negotiating difficult obstacles while protecting it from collisions. This robot can be used for pick and place the required object by giving directions to the robot but IR pair should be replaced depending upon the application.Chapter 7 Future Aspects and Conclusion 7.

DDRB = 0xFF.h" #include <stdio.h> #include <util/delay. FILE *stream). //MISO line i/p. _FDEV_SETUP_WRITE). UDRE). stream). UDR = c. FILE *stream) { if (c == '\n') uart_putchar('\r'.h" #include "adc_routines. } void port_init(void) { PORTB = 0xEF. static int uart_putchar(char c.Appendix #define F_CPU 8000000UL #include <avr/io.h> #include "UART_routines. loop_until_bit_is_set(UCSRA. 44 .h> static int uart_putchar(char c. //freq 8 MHz static FILE mystdout = FDEV_SETUP_STREAM(uart_putchar. NULL.h> #include <avr/interrupt. return 0.h> #include <avr/pgmspace. rest o/p PORTC = 0x00.

DDRC = 0x00. //timer interrupt sources //all peripherals are now initialized } 45 . UCSRC = (1 << URSEL) | 0x06. PORTD = 0x00. GICR = 0x00. } //UART0 initialize // desired baud rate: 19200 // actual: baud rate:19231 (0. MCUCR = 0x00. TIMSK = 0x00. UBRRL = 0x33. DDRD = 0xFE. //set baud rate lo UBRRH = 0x00. uart0_init(). } //call this routine to initialize all peripherals void init_devices(void) { cli(). adc_init( ). //set baud rate hi UCSRB = 0x18. port_init().2%) // char size: 8 bit // parity: Disabled void uart0_init(void) { UCSRB = 0x00. //disable while setting baud rate UCSRA = 0x00.

b=(temp )*100. world!\n"). temp =(result*4. a=(temp )*100. printf("a"). a= Adc_Read(1).50)/1024 . temp =(b*4.b . while(1) { result= Adc_Read(0). int result. printf("result"). printf("voltage2 %d\n\r". temp =(a*4. stdout = &mystdout.50)/1024 .int main(void) { //unsigned char data.a). } else if(a>=250) { PORTB=0b000000100.50)/1024 . result=(temp )*100. 46 . b= Adc_Read(2).result). printf("voltage0 %d\n\r". printf("Hello. printf("voltage1 %d\n\r". if(result>=250) { PORTB=0b00000001. init_devices().b).a. float temp.

_delay_ms(1000).} else if(b>=250) { PORTB=0b00001010. } } 47 . PORTB=0b00000001. } else { PORTB=0b00000101. printf("b"). printf("c"). } _delay_ms(1000).

net/abhi230789/obstacle-avoiding-robot 48 .References ‡ ‡ http://www.com/Threadcollision-control-robot#ixzz1S5rehGql obstacle-avoider-and- ‡ http://www.slideshare.com/avr http://www.seminarprojects.atmel.