robo gyan.pdf

74
7/30/2019 Robo Gyan.pdf http://slidepdf.com/reader/full/robo-gyanpdf 1/74  ROBOGYAN STUDY MATERIAL FOR CERTIFICATE TRAINING ON EMBEDDED SYSTEMS AND ROBOTICS THE INFORMATION CONTAINED IN THIS BOOK HAS BEEN COMPILED FROM VARIOUS SOURCES FOR CLASSROOM DISCUSSIONS ONLY. WE ACKNOWLEDGE RESPECTIVE SOURCES. NOT FOR SALE. www.roboticwares.com LEARNICS 

Upload: sudhanshu-jaiswal

Post on 14-Apr-2018

232 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 1/74

ROBOGYAN

STUDY MATERIAL FOR CERTIFICATE TRAINING ON EMBEDDED SYSTEMS AND ROBOTICS

THE INFORMATION CONTAINED IN THIS BOOK HAS BEEN COMPILED FROM VARIOUS SOURCES

FOR CLASSROOM DISCUSSIONS ONLY. WE ACKNOWLEDGE RESPECTIVE SOURCES.

NOT FOR SALE.

www.roboticwares.com

LEARNICS

Page 2: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 2/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

PUBLISHED BY KUSHAL NAHATA ON BEHALF OF ROBOTICWARES PVT. LTD.

COPYRIGHT 2009 ROBOTICWARES PVT LTD

PRINTED AT-

3rd

REVISED EDITION: 2010; 5000 COPIES

Page 3: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 3/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

Gratitude

The RoboticWares publication department while working on this book drew their inspiration

from the great visionaries like Dr A P J Abdul Kalam, Ratan Tata and A Samanta who have

played an instrumental role in putting India on the path of economic, social, and technical

development. We intend to keep up the good work done by them and contribute in making

India a true technology giant that will help us in accomplishment of VISION 2020.

Page 4: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 4/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

The Third Edition 2010

This book is basically the result of 4000 hours of teaching the material to engineering students.

Some of the "students" have also been faculty and post-docs. I am very grateful to them for their patience and tolerance as it progressed from crude notes to its present form. The materialowes its existence to many conversations and collaborations.

The topic of "Robotics" has become more than a technical subject to me. As a trainer, I see thedistinction in the different reactions of my students to the material, and more importantly, the

approach. Hence this book seems very appropriately located. There is no need to elaborate

further on this theme here, since it has been woven into the fabric of the book. It has deeper

implications for the future of Robotics Technology. The subject matter of this book dwells onhow that can be done. If this point is understood, a world of constructive engineering research

lies in front of anyone willing to take it seriously. I hope enough students see this to make it

happen. If this book contributes in any small way to that future progress, it will have served its purpose.

The material in the book is written for persons at a number of levels. Much of it is introductory

for an engineer, but serves to link various engineering principles. For that reason, it needs to bestudied with some care. To the average student, much of it will be easy going and hopefully

quite rewarding too if mastered.

I would be remiss if I failed to thank Mr. Gautam Kumar who suffered through my initial few

successes and many failures while doing his research with me. He was gracious enough to

forgive me for the many times I had initially rejected what turned out to be some of the most

crucial ideas now used in the design and development of Embedded Systems. Among manyothers, I wish to thank Mr. Gaurav Srivastava and Mr. Ashutosh Kumar for significant

contributions. Particular gratitude is due to the people who have made the computer work

possible. My thanks to the editorial and publishing staff of RoboticWares for their patience withme. I kept them waiting much longer than I care to mention, partially because of some the part

of university life we all wish we could find a way to do away with and partially because I am

always very unrealistic about the magnitude of the tasks to which I commit myself.

This list is incomplete and I apologize to anyone I omitted. One omission cannot be permitted,

however. I owe a special note of thanks to so many colleagues who, for various reasons, were(and may still be) skeptical of the approach. Without that skepticism and close scrutiny, there

would be far more weaknesses and errors in this and related works. Those who know me knowthat I love a good argument, often to the point of becoming very excited. I hope that trait is

never construed as a lack of appreciation for opposition to one of my pet ideas. For that reason,this acknowledgement to those who were willing to try to get me to see... is especially heartfelt.

We are a very special community in that without the dialectic; we would be so much less that

we are. I hope we never lose that quality. In the same spirit, I hope this book provokes somestrong reactions, positive and negative!

Page 5: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 5/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

Preface to the Second Edition

In this revised edition, opportunity has been taken to update completely all information as

there have been changes in our methodology of teaching Robotics in a more practical oriented

and application based manner.

This popular book has become a standard book of reference not only for students but also for

teachers and research fellows.

This edition of the book consists of new chapters, each of them thoroughly revised and

enlarged to meet the requirement. The present edition meets the needs of robotic enthusiasts

from the various backgrounds.

The complete material has been newly organized and strengthened.

Many of our colleagues and friends helped us by giving their valuable suggestions on the

structure and content of this text, which were instrumental in improving the quality and

presentation of this book in this new edition. We wish to express our profound gratitude and

appreciation to all of them.

We are also thankful to our trainees for their high appreciation, acceptance and use of the

book.

Critical views and suggestions for improving the contents would be warmly welcomed.

Publication Team

Page 6: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 6/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

SESSION 1

Resistance:

A resistor is a two-terminal electronic component that produces a voltage across

its terminals that is proportional to the electric current through it in accordance with

Ohm's law:

V = IR

Fig 1.1 Colour coding of resistance (Fixed Resistor)

Types of resistance:

Basically resistors are of two types, fixed resistor and Variable resistor.

Fixed Resistors: - This short of resistors has fixed value of resistance. Like 220Ω, 10KΩ.

(e.g.: as shown above.)

Variable Resistors: - Resistors having variable value of the resistance by maintaining

some physical changes comes under this category. This is also known as potentiometer or

Page 7: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 7/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

pot or preset.

Fig 1.2 Variable Resistor (PRESET)

Capacitor:

A capacitor is used to store charge. Like resistors there is fixed as well as variable

capacitor also. But we mostly use fixed capacitor in robotics; variable capacitors are

mainly used in analog communication. There are capacitors with no polarity and polarity.

Ceramic and Mica capacitors available are of no-polarity, but electrolytic capacitors are of

polarity. There is a variation in their symbols also.

Fig 1.3 Different type of capacitors and their symbols.DIODES:

Diodes are two terminal devices which conduct electricity in one direction. Current flows

from anode to cathode when the diode is forward biased. In a normal forward biased

diode, energy is dissipated as heat in the junction, but in LED's energy dissipated as visible

light. In robotics we use normal diodes as freewheeling diodes or to make power supply.

LED's are of two types - IR led and normal LED. IR LED emits Infra Red radiations while

normal LED emits visible light. So first talk about a normal diode. Mostly we us 1N4001 or

Page 8: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 8/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

1N4007 as freewheeling diodes for motors or relays, used in H-bridge also.

Fig 1.4 Symbol of a diode.

ZENER DIODE:

A zener diode works in reverse biased region. In reverse biased it gives fixed output

voltage.

Fig 1.5 Symol for zener diode.

Transistor:

When we talk of transistor in robotics, we talk about the cut off and saturation region

only, while in your course you study transistor in active region. So here I am talking about

transistor as a switch. When we say transistor as a switch, we talk of cut off or not

because the typical cut off voltage is around .5V and the saturation voltage (vbe) is around

.8V. There

is regions between them. Let's start with transistor to glow an LED.

Fig 1.6 Transisor Circuit to glow an led

Connect this circuit and see. Connect multimeter at the base of the transistor and see thevoltage. In this circuit we can see that Ve=Vbe. For the transistor to be switched ON

Ve=.5V. Vary the potentiometer to make Vbe=.5V, you can see that LED starts glowing (but

it is less brightness). Vary the potentiometer to make Vbe to around .8V; you can see that

the LED brightness increases. This is because when Vbe=.5V it starts with cut off and

when Vbe=.7V in active and Vbe=.8V it become saturation region. Transistor is a current

controlled device. In active region Ic=hfe Ib and in saturation region Ic>hfeIb. That is why

the brightness of the LED changes.

Page 9: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 9/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

SESSION 2

OPAMP (IC741, LM324):

As the name implies it is an operational amplifier. It performs mathematical operations

like addition, subtraction, log, antilog etc. The main reason for OPAMPS used over

transistors is that transistor can only amplify AC while OPAMPS can amplify AC and DC.

You can get good amplifier gain in OPAMPS. The most commonly used OPAMPS are 741

and 324. IC741 is used in close loop configuration and LM324 in open loop configuration.

i.e LM324 mainly used as comparator while 741 for amplification, addition etc.

COMPARATOR (LM324):

Comparator is a digital IC. The difference between the analog IC and digital IC is that in

digital IC the output has only two states, while in analog IC it has more than two states.

IC7404, it has two states LOGIC HIGH and LOGIC LOW, IC555 is also digital IC. IC741 is an

analog IC because it has output voltage vary from -12v to 12V.

Comparator has only two states +vcc or –vcc. But LM324 we normally apply Vcc=5V and -

vcc=0. So output will have only 5V and 0V. But LM324 output LOGIC HIGH will be

aroundVcc-1.5V and LOGIC LOW around .2V. So if you use Vcc=5V then LOGIC HIGH=3.5V

and LOGIC LOW=0V. But LOGIC HIGH for a digital circuit is a voltage greater than 2.4V and

LOGIC LOW is less than .8V

Fig 2.1 Symbol of OPAMP

Above figure shows the general circuit diagram of a general comparator. If V1>V2 then

Vout=+Vcc and if V1<V2 then Vout=-Vcc. Suppose if V1=V2, then output will be +vcc or -

vcc

theoretically. But practically no such condition exist, because an operational amplifier has

a gain of 10^6, so there is no condition exist.

Page 10: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 10/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

Fig 2.2 Pin Configuration of LM324

Application Circuit for Comparator:

Fig 2.3 Circuit of LM324

Why Comparator is preferred over Power Transistor?

In robotics we require only two levels, active HIGH or active LOW that exist in

comparator, but in power transistor there is regions between cut off and saturation, so

that output varies with the input voltage at the base. Second thing is that power transistor

is a current controlled device. But we always require voltage comparison, so we prefer

comparator. But comparator outputs cannot be connected directly to the relay or motors.

IC741

We mostly use IC 741 as amplifier, adder, subtraction, adder cum subtraction. I am not

giving more explanation because you can easily get circuit in internet or normal classtexts. See the circuits of amplifier, adder, and subtraction.

Page 11: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 11/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

Fig 2.4 Pin configuration of IC741

Why LM324 is preferred over IC741?

1.If you use IC741 as comparator with Vcc=5V and -Vee=0 then for HIGH=4.5V and

LOW=1.52, so in both condition transistor will be saturated, so in order to use IC741 as a

comparator better apply -15,+15.

2. When LM324 is used with Vcc=5V then HIGH=3.6V(but this is the logic high

for digital circuit) and LOW=0. So this will be better, you won't be able to get

HIGH=5V.

SESSION 3

Power Supply: We use battery as power-supply for the robots. There are several types of

battery. Some of them are:-

Page 12: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 12/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

Fig 3.1 Chart description for types of batteries.

Nickel Cadmium

Most popular and widely available

Cheap

Easy to build a charger

Low energy density

Fig 3.2 Nickel Cadmium battery.

Nickel Metal Hydride

30%-40% more energy

density

than Ni-Cd.

Slightly more expensive

Charger is tricky to build

Fig 3.3 Nickel Metal Hydride battery.

Lithium ion

Very high density

Light weight

Small size

Expensive

Very sensitive to rough use

i.e., dangerous!

Fig 3.4 Li ion battery.

Lead-Acid

Page 13: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 13/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

Reliable

Very robust

Inexpensive

Easy to re-charge

Immune to rough use

Bulky

Fig 3.5 Lead Acid battery

• Selection Of Power source

• Difference between AC and DC

• AC to DC conversion

• Bridge Rectifier

• Use of capacitor

• Types Of Transformer

• Selection of rectifier circuit as per the transformer

Selection of Power source: If we need DC power supply for a long time then AC is

converted to DC.

Difference between AC and DC: Electricity flows in two ways; either in alternating current or

AC and in direct current or DC. The word electricity comes from the fact that current is nothing

more than moving electrons along a conductor, like a wire, that have been harnessed for energy.

Therefore, the difference between AC and DC has to do with the direction in which the electrons

flow. In DC, the electrons flow steadily in a single direction, or "forward." In AC, electrons keep

switching directions, sometimes going "forwards" and then going "backwards." The power that

comes from our wall outlets is AC, the more common, efficient kind.

AC:

DC: This is also known as pulsating DC.

1.

Page 14: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 14/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

2.

Fig 3.6 Time Graph for AC and DC.

AC to DC Conversion: For the normal transformer having rating like 12-0 or 6-0,

following circuit is used.

Fig 3.7 Circuit Diagram for converting AC to DC.

For the central tapped transformer rating like12-0-12, following circuit is used.

Page 15: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 15/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

Fig 3.8 Circuit for12-0-12 transformer.

Fig 3.9 Circuit diagram for developing power circuit.

VOLTAG REGULATORS

Voltage regulators produce fixed DC output voltage from variable DC (a small amount of

AC on it). Normally we get fixed output by connecting the voltage regulator at the output

of the filtered DC (see in above diagram). It can also used in circuits to get a low DC

voltage from a high DC voltage (for example we use 7805 to get 5V from 12V). There are

two types of voltage regulators.

1. fixed voltage regulators (78xx, 79xx)

2. Variable voltage regulators (LM317)

In fixed voltage regulators there is another classification

1. +ve voltage regulators

Page 16: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 16/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

2. -ve voltage regulators

POSITIVE VOLTAGE REGULATORS

This includes 78xx voltage regulators. The most commonly used ones are 7805 and 7812.

7805 gives fixed 5V DC voltage if input voltage is in (7.5V, 20V). You may sometimes have

questions like, what happens if input voltage is <7.5 V or some 3V, the answer is that

regulation won't be proper. Suppose if input is 6V then output may be 5V or 4.8V, but

there are some parameters for the voltage regulators like maximum output current

capability, line regulation etc.. , that parameters won't be proper. When I applied 3.55V

input, I got around 3.5V. Remember that electronics components should be used in the

proper voltage and current ratings as specified in datasheet. You can work without

following it, but you won't be able to get some parameters of the component.

Fig 3.10 Pictorial View of Voltage Regulator 7805.

Fig 3.11 Circuit diagram for using 7805.

The above diagram show how to use 7805 voltage regulator. In this you can see that

Page 17: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 17/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

coupling capacitors are used for good regulation. But there is no need for it in normal

case( I never used these capacitors). But if you are using 7805 in analog circuit you

should use capacitor, otherwise the noise in the output voltage will be high.The mainly

available 78xx IC's are 7805,7809,7812,7815,7824.

NEGATIVE VOLTAGE REGULATORS

Mostly available -ve voltage regulators are of 79xx family. You will use -ve voltage if you

use IC741. For IC741 +12v and -12v will be enough, even though in most circuits we use

+15v and -15v.

VARIABLE VOLTAGE REGULATORS

Most commonly variable voltage regulator is LM317 although other variable voltageregulators are available. The advantage of variable voltage regulator is that you can get a

variable voltage supply by just varying the resistance only.

Fig 3.12 Circuit diagram for using LM317.

RELAYS

You have seen controlling home equipments such as light, fans and equipments that run

on 230V using parallel port of computer or a microcontroller or any other digital IC’s. This

is possible through relays. Relay is an electromagnetic device which works on magneticfield. If you apply proper low voltage on one side the metal will get contacted.

SESSION 4

SENSORS

Temperature sensor: Commonly available temperature sensors are LM35,

DS1621,thermistor. Thermistor gives resistance proportional to the temperature. But

Page 18: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 18/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

accuracy is not good in thermistor. DS1621 gives digital output in I2C format, so you

require a microcontroller to interface to see the temperature. Thermistor requires

accurate resistance in series to get good reading with accuracy. The resistance of

thermistors is 100ohm, 1Kohm. But thermistor creates some headaches LM35 have 3

terminal Vcc, ground, Vout. So it is easy and gives analog output.

Fig 4.01 Pictorial view of Temperature Sensor.

LIGHT SENSORS: Light sensors are used to measure the intensity of light. Mostly available

sensors are Cadmium Sulphide LDR sensor, IR senor like photo diode, photo transistor,

TSOP1738. For beginners LDR is easy to handle. So as a beginner better start with

LED+LDR combination or IR LED+photo diode. LDR is economical than other sensors and

easy to handle.

LIGHT DEPENDENT RESISTOR (LDR): LDR is basically a resistor whose resistance varies

with intensity of light. More intensity less its resistance (i.e, in black it offers high

resistance and in white it offers less resistance). This is the basic sensor which beginners

should start with. Figure below show some of the pictures of LDR which i obtained from

some site.

Fig 4.02 Pictorial view of LDR.

Resistance: 400ohm to 400Kohm

Normal resistance variation: 1Kohm to 10Kohm (in the robots which I used for line

Page 19: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 19/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

following for identifying black and white strips) sensitivity: about 3msec(Sensitivity is

defined as the time taken for output to change when input changes, i got this reading by

verifying with ADC interfaced with parallel port, sensitivity of LDR's is in milliseconds.

This is the best sensitivity obtained to me). Voltage ratings: I used it on 3V,5V and 12V

Practical application in Line follower Robots: LED's are used with LDR which will act as a

source of light for LDR because we are placing the LDR below the robot where light is not

present. If we want to identify Black and White strips we add a light source with LDR and

the white strip reflects light while black won't reflect light.

Fig 4.03 Arrangement of sensors.

PROBLEMS: LDR is mainly used with visible light. So the problem of external light will

affect the LDR. The affect of visible light is more in LDR then comes Photo diode, then

TSOP1738.

Photo Diode:

Photo diode works in reverse biase region. A photo diode leads can be identified by seeing

the length of the leads. Short lead is the cathode connected to greater voltage. The current

flowing through the photo diode changes with intensity of the light. You can use it for edge

detection. I tried to do edge detection of a table, i got range about 7cm. IR LED is used for

producing light. When you are using IR LED be sure that it is working properly by

measuring the voltage across the IR LED, should be greater than 2V. When connecting

IRLED the voltage of the circuit drops, so be careful that voltage to other circuits won't

The figure shows how LED is placed with LDR.

Here LDR is covered because we want light

reflections from ground only, not from sides of

LED. Also cover the LED so that the light willmove pointed, so that reflection will directly go

to LDR. When you attach LED and LDR to the

body of the robot, use tape to paste the

sensors. Remember if you robot body is of

aluminum, then some short circuit or current

flow can occurs through the body. So apply tape

perfectly so that no short circuit problems

occur. Remember that LDR is a resistor and

have no polarity while all other sensors have.

Page 20: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 20/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

fall below the level.

Fig 4.04 Circuit diagram for using 7805.

Photo diode and IR led looks same. The only difference is in its color IR LED is some dark

in color.

PHOTO TRANSISTOR

I haven't used photo transistor. But a photo transistor is one in which bases like the

receiver of light. When light falls there will be a short circuit between collector and

emitter. This can be used in optical communications. I heard that you can make a photo

transistor by cutting the upper portion of transistor BC107 and leaving the base. You can

use either IR or laser (cheap one available). But in case of transmission we require line of

sight propagation. Here is a circuit for detection of IR using photo transistor.

Page 21: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 21/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

Fig 4.05 Circuit diagram for using digital sensors.

Here when light is not there then the resistance of transistor will be high, so the V-

(pin2)>V+(pin3) making output of comparator LOW. That is when no reflection from

ground or any obstacle on the IR. When light is there then the resistance will be very less

and V+>V-. So output of comparator is HIGH. Suppose if you are using it for line detection,

then there is reflection of IR from the white surface, but IR radiations are absorbed by

black surface, so no or less reflection from the surface in black strip. Remember to check

the voltage across IR to see whether IR LED is working or not and it should be greater

than 2V. When black strip comes, output of comparator become 0V and the LED glows

(visible light LED).

TSOP17XX

Description

The TSOP17XX– series are miniaturized receivers for infrared remote control systems.

PIN diode and preamplifier are assembled on lead frame, the epoxy package is designed as

IR filter. The demodulated output signal can directly be decoded by a microprocessor.

TSOP17.. is the standard IR remote control receiver series, supporting all major

transmission codes.

Features

Photo detector and preamplifier in one package

Internal filter for PCM frequency Improved shielding against electrical field disturbance

TTL and CMOS compatibility

Output active low

Low power consumption

High immunity against ambient light

Continuous data transmission possible (up to 2400 bps)

Page 22: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 22/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

Suitable burst length ≥10 cycles/burst

Fig 4.06 Picture of TSOP sensors.

DISTANCE MEASUREMENTS

For a small distance measurement we can use a photo diode or photo transistor, but only

distance up to 5-7cm. You just connect the output to ADC or any comparator to

measurement. Suppose if we use one LM324 for distance measurement, you can measure

1cm, 2cm, 3cm and 4cm. You just connect a 330 ohm in series with IR LED. At the other

end use a photo diode in reverse region.

If you want a good distance then you should use 38Khz modulated IR with TSOP1738

detector. Use IC555 to generate 38 Khz square wave. You can get range about 1 Meter. If

you want to measure various distances then you should vary R2 of the IC555. Suppose if you want to measure distance from a fixed point, then you have to vary the frequency of

IC555. You can get range about 1 Meter. If you want to measure various distances then

you should vary Ra of the IC555. Suppose if you want to measure distance from a fixed

point, then you have to vary the frequency of IC555. You can do it fixing Rb>Ra and vary

Ra so that frequency will vary slightly from some 36Khz to 40Khz and find corresponding

reading. You can do it by using the following technique

Application Circuit:

Page 23: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 23/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

Fig 4.07 circuit diagram of TSOP sensor.

SESSION 5

MOTORS:-

As a beginner we mostly use DC motors, stepper motor and servo motor will come later.

As everybody knows DC motor has two leads. If we apply +ve to one lead and ground to

another motor will rotate in one direction, if we reverse the connection the motor will

rotate in opposite direction. If we keep both leads open or both leads ground it will not

rotate(but some inertia will be there). If we apply +ve voltage to both leads then braking

will occurs. You can test this, first without applying any voltage you rotate the shaft of the

motor, then apply ground on both lead and try to rotate the shaft. Both will almost remainsame, but if we apply both lead +ve voltage(+12V) and try to rotate the shaft, you can feel

the difference between the previous one. You have to apply more force to rotate the same

rotation in previous connection. So we take this condition as braking, because if we want

to stop the motor suddenly then this is the better way which is easily possible. There are

methods to brake motor fastly, like shorting two leads, applying negative polarity exists,

but we won't use this in robotics. We apply (1,1) condition to break the motor fastly(see

H-bridge section for more about it).

The main things about a DC motor are Voltage rating, current rating, Torque, Speed.

Remember Torque is inversely proportional to speed. So we had to get a good speed

motor to get good torque because we can operate the good speed motor in slow speed toget good torque. So maximum speed of the motor should be as high as possible.

Page 24: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 24/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

Fig 5.01 Graph of Torque with respect to speed

Motor Driver:

• Using Transistors

• Relay Circuitry

• Motor Driver ICs

H-Bridge:

Fig 5.02 Circuit diagram to drive motor

Here you can see that I just interchanged the position of transistors. Remember that

transistor is a current controlled device. The switching speed of a transistor is around

Page 25: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 25/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

10Khz . So if you want more switching speed you have to go for MOSFET which is having

speed around 100K. Second thing MOS is a voltage controlled device. Suppose if a device

you are using have high voltage and current rating (suppose if you are driving a big

motor), then you can use relay circuit to make H-bridge. Try to make the circuit and see

what are the practical limitations are.

In this circuit you can see a relay driving circuitry. This circuit has a limitation of relay

contacts in default position. In default position it should be connected to ground, so that

when I1=I2=0 motor get's zero. I assumed the motor will be DC motor of high ratings.

This circuitry can be applied to small 12V DC motor, but the main problem coming is

about the switching speed of the relay. It is around 10ms at maximum. So the circuit won't

switch fastly compared to H-bridge using transistor or mosfets. This is one of the

limitations of this circuit; second limitation is that when connecting the default positionwould be gnd for both relays.

The most commonly used H-bridges are L293D and L298. L293 have maximum current

rating of 600mA while that of L298 is 2A. L293B and L293D are available in market. If you

use L293B you have to put 4 protection diodes while in L293D, diodes are inside the IC.

L298 requires external protection diodes. Let's start with L293D

Fig 5.03 Pin diagram of Motor Driver L293D IC

Page 26: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 26/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

SPEED CONTROL OF DC MOTORS

There are mainly two ways of controlling speed of DC motor

1. Varying the supply voltage2. Pulse width modulation

First method is by varying the supply voltage, i.e. voltage across the motor. But this is a

somewhat a tough task because we mostly microcontrollers to vary the supply voltage

and to generate variable supply voltage we should go for analog circuit, then come analog

to digital conversion and other steps which makes the task tedious. See the line follower

project to see how to vary supply voltage to switch motor from one speed to another. But

the switching time of motor is less in this case compared to PWM case. Switching speed of

the motor is the time taken for the motor to change from one speed to another. Advantage

of pwm is that it is easy for driving analog circuits with digital outputs.

Fig 5.04 Graphical representation of pwm

See the above diagram, we can see three pulse having duty cycle (ton/T) of 10%, 50%,

90%. In all three cases total time, T remains same irrespective of value of t1, t2. This is a

PWM signal. A PWM signal is one in which total time always remain same and Ton and

Toff vary. Now you apply this output to a transistor circuit shown below.

Fig 5.05 Circuit Diagram to implement PWM on Motors

Page 27: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 27/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

Then the transistor continuously switch ON and OFF and the effective voltage across the

motor become voltage across motor= (Ton/Ttotal) *Vcc in PWM case Ttotal remains

same, only Ton will vary which makes a varying voltage across the motor. PWM can be

easily generated by any digital circuit (microcontroller used mostly). In PWM switchingspeed is comparatively slow because we continuously switch ON and OFF motor. A motor

is basically an induction; it takes some time to charge and discharge. So if the quality of

motor is good, then you can get a good PWM response. The inductance of the motor limits

the selection of T total. I used T total=10ms for the 2kgcms motor and it gave a good

response.

Generation of PWM:

PWM can be generated using IC555 or using microcontroller or computer parallel port.

Now you try to generate PWM using IC555, remember that T total should remain

constant.

Fig 5.06 Circuit Diagram of IC555

Stepper Motor:

Page 28: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 28/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

Widely use in Robotics ---

Because More precise than DC motor.Measured rotation and can be held at a particular position.

Fig 5.07 Diagram of Stepper Motor

Types of Stepper:Mainly two Types

Unipolar: - the current only flows in one direction in the windings of the coils. i.e. the

stator poles can only be polarized one way.

Bipolar: - Bipolar motor, the current flows in both direction in the windings of the coils.

i.e. the stator poles can be polarized both way.

Difference between Bipolar and Unipolar:

Unipolar Bipolar

Current flow in one direction

Less torque

Smooth drive

Current flow in both direction

High torque

Not Smooth

Unipolar Stepper Motor:

This kind of motor has four coils.

When energized in the correct sequence cause the permanent magnet attached to the

Page 29: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 29/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

shaft to rotate.

There are two basic step sequences. After step 4, the sequence is repeated from step 1

again.

Reversing the order of the steps in a sequence will reverse the direction of rotation.

Single-Coil Excitation - Each successive coil is energized in turn.

Fig 5.08 Stepper Motor Driving: Single Coil Excitation

Two-Coil Excitation - Each successive pair of adjacent coils is energized in turn.

Page 30: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 30/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

Fig 5.09 Stepper Motor Driving: Two Coil Excitation

Comparison:

Single coil Double coil

Low torque

Consumes less energy

High torque

Consumes double energy

Unipolar Motor Driver:-

Fig 5.10 Pin Diagram of ULN2803

Bipolar Stepper Driver: Bipolar Motor can be derived using H- Bridge Driver, like L293D

or L298. But the output current of the L298 is 2A. So it is preferred.

Page 31: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 31/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

Fig 5.11 Pin Diagram of L298

Application circuit:

Fig 5.11 Circuit Diagram of L298

SESSION 6

Microcontroller:

Page 32: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 32/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

Microcontrollers are "special purpose computers".

Any device that measures, stores, controls, calculates, or displays information is a

candidate for putting a microcontroller inside.

The microcontroller includes a CPU, RAM, ROM, I/O ports, and timers like a standard

computer.

Microcontrollers have become common in many areas, and can be found in home

appliances, computer equipment, and instrumentation.

They are often used in automobiles, and have many industrial uses as well, and have

become a central part of industrial robotics.

Because they are usually used to control a single process and execute simple instructions,

microcontrollers do not require significant processing power.

Microcontrollers are hidden inside a surprising number of products these days.

If your microwave oven has an LED or LCD screen and a keypad, it contains a

microcontroller.

All modern automobiles contain at least one microcontroller. The engine is controlled by a

microcontroller, as are the anti-lock brakes, the cruise control and so on.

Atmega16:

Fig 6.01 Picture of Atmega16

Page 33: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 33/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

Fig 6.02 Pin Diagram of Atmega16

Features:

High-performance, Low-power AVR

8-bit Microcontroller

Advanced RISC Architecture

131 Powerful Instructions – Most Single-clock Cycle Execution

32 x 8 General Purpose Working Registers

Fully Static OperationUp to 16 MIPS Throughput at 16 MHz

On-chip 2-cycle Multiplier

Nonvolatile Program and Data Memories

16K Bytes of In-System Self-Programmable Flash

Endurance: 10,000 Write/Erase Cycles

Optional Boot Code Section with Independent Lock Bits

In-System Programming by On-chip Boot Program

True Read-While-Write Operation

512 Bytes EEPROM

Endurance: 100,000 Write/Erase Cycles

1K Byte Internal SRAM

Programming Lock for Software Security

JTAG (IEEE std. 1149.1 Compliant) Interface

Boundary-scan Capabilities According to the JTAG Standard

Extensive On-chip Debug Support

Programming of Flash, EEPROM, Fuses, and Lock Bits through the JTAG Interface

Peripheral Features

Two 8-bit Timer/Counters with Separate Prescalers and Compare Modes

Page 34: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 34/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture Mode

Real Time Counter with Separate Oscillator

Four PWM Channels

8-channel, 10-bit ADC8 Single-ended Channels

7 Differential Channels in TQFP Package Only

2 Differential Channels with Programmable Gain at 1x, 10x, or 200x

Byte-oriented Two-wire Serial Interface

Programmable Serial USART

Master/Slave SPI Serial Interface

Programmable Watchdog Timer with Separate On-chip Oscillator

On-chip Analog Comparator

• Special Microcontroller Features

– Power-on Reset and Programmable Brown-out Detection

– Internal Calibrated RC Oscillator

– External and Internal Interrupt Sources

– Six Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, Standby and

Extended Standby

• I/O and Packages

– 32 Programmable I/O Lines

– 40-pin PDIP, 44-lead TQFP, and 44-pad QFN/MLF

• Operating Voltages

– 2.7 - 5.5V for ATmega16L

– 4.5 - 5.5V for ATmega16

• Speed Grades

– 0 - 8 MHz for ATmega16L

– 0 - 16 MHz for ATmega16

• Power Consumption @ 1 MHz, 3V, and 25°C for ATmega16L

– Active: 1.1 mA

– Idle Mode: 0.35 mA

– Power-down Mode: < 1 µA

CISC: -Pronounced sisk, and stands for Complex Instruction Set Computer. Most PC's use CPU

based on this architecture. For instance Intel and AMD CPU's are based on CISC

architectures.

Typically CISC chips have a large amount of different and complex instructions. The

philosophy behind it is that hardware is always faster than software, therefore one should

make a powerful instruction set, which provides programmers with assembly instructions

to do a lot with short programs.

Page 35: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 35/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

RISC

Pronounced risk, and stands for Reduced Instruction Set Computer. RISC chips evolved

around the mid-1980 as a reaction at CISC chips. The philosophy behind it is that almost

no one uses complex assembly language instructions as used by CISC, and people mostlyuse compilers which never use complex instructions. Apple for instance uses RISC chips.

Therefore fewer, simpler and faster instructions would be better, than the large, complex

and slower CISC instructions. However, more instructions are needed to accomplish a

task.

An other advantage of RISC is that - in theory - because of the more simple instructions,

RISC chips require fewer transistors, which makes them easier to design and cheaper to

produce.

Finally, it's easier to write powerful optimized compilers, since fewer instructions exist.

RISC Vs CISC

There is still considerable controversy among experts about which architecture is better.

Some say that RISC is cheaper and faster and therefore the architecture of the future.

Others note that by making the hardware simpler, RISC puts a greater burden on the

software. Software needs to become more complex. Software developers need to write

more lines for the same tasks.

Therefore they argue that RISC is not the architecture of the future, since conventional

CISC chips are becoming faster and cheaper anyway.

RISC has now existed more than 10 years and hasn't been able to kick CISC out of the

market. If we forget about the embedded market and mainly look at the market for PC's,

workstations and servers I guess a least 75% of the processors are based on the CISC

architecture. Most of them the x86 standard (Intel, AMD, etc.), but even in the mainframeterritory CISC is dominant via the IBM/390 chip. Looks like CISC is here to stay …

Is RISC than really not better? The answer isn't quite that simple. RISC and CISC

architectures are becoming more and more alike. Many of today's RISC chips support just

as many instructions as yesterday's CISC chips. The PowerPC 601, for example, supports

more instructions than the Pentium. Yet the 601 is considered a RISC chip, while the

Pentium is definitely CISC.

Page 36: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 36/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

Register Description for I/O Ports:

Port A Data Register – PORTA

Port A Data Direction Register – DDRA

Port A Input Pins Address – PINA

Page 37: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 37/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

Port B Data Register – PORTB

Port B Data Direction Register – DDRB

Port B Input Pins Address – PINB

Port C Data Register – PORTC

Port C Data Direction Register – DDRC

Page 38: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 38/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

Port C Input Pins Address – PINC

Port D Data Register – PORTD

Port D Data Direction Register – DDRD

Port D Input Pins Address – PIND

Page 39: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 39/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

Let us start the embedded coding:

These are the following software required for writing code in C language, generating hex

code and downloading the hex code in the microcontroller.

WinAVR2009

AVR Studio 4.0

AVRdude- GUI.

Install software 1 & 2.

Open AVRstudio

(Click on this symbol)

You will get ---

Then click on the new project.

Page 40: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 40/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

Select 1. AVR GCC 2.write the project name (3. Will be auto generated)4.

Browse the folder in which you have to save the program5. Next

Page 41: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 41/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

Select 1. AVR simulator2. Name of the microcontroller (here Atmega16)3.

Finish

Page 42: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 42/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

Write the program in main windowthen go in build menu and click on build

If there is no error in the program (No. of Warning doesn’t matter ). The hex file will be

generated in the default folder.

Downloading the Program in the microcontroller using RoboticWares’s Burner:

Connect the USB cable to the USB AVR programmer & USB port of the PC or Laptop, the Green LED will glow .

You will get the following pop up containing: Found New Hardware USBasp it means USB programmer is

working.

Page 43: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 43/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

Installation of Driver

Wait for windows information “Found New Hardware Wizard”.

Page 44: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 44/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

Installation of Driver

After device is detected Driver setup wizard opens. Select where USBASP driver “win-driver” is

located in your CD.

Page 45: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 45/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

Installation of Driver

Wait few seconds with the following window

Page 46: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 46/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

(Note:-If you are getting “USB Device Not Recognized” then your USB AVR programmer is not working.)

Installation of Driver

Finally the driver will be installing & you will get

Page 47: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 47/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

Installation of Driver

Go to the device manager list

(Right click on My Computer, Select Manage, You will get the new window named as Computer

Management, Select Device Manager present under System Tools)

Page 48: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 48/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

LibUSB –Win32 Devices ----- USBasp :: shows the successfully installation of driver.

(Note: A ping sound comes after connecting the USB AVR programmer.)

Programming the microcontroller

1. USING AVRDUDE GUI

Open avrdude-gui.exe from the CD and select the microcontroller and check the

boxes as per the following:

Select the hex file to write in the flash memory of microcontroller.

Page 49: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 49/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

Click on Execute.

Red LED will glow that shows the busy state of the programmer.

Finally the microcontroller is programmed.

2. USING SINAPROG HEX DOWNLOADER

Open SinaProg.exe from the CD and select the microcontroller and check the boxes

as per the following:

Follow the steps as per the image.

Page 50: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 50/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

Page 51: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 51/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

MICROCONTROLLER PROGRAMMINGSample Program to blink LED#include<avr\io.h>

#include<avr\delay.h>

void main()

unsigned char c=0;

DDRC=0xff;

PORTC=0x00;

while(1)

PORTC=0xff;

_delay_ms(500);

PORTC=0x00;

_delay_ms(500);

Analog to Digital Converter:Features:

• 10-bit Resolution

• ±2 LSB Absolute Accuracy• 13 - 260 µs Conversion Time

• 8 Multiplexed Single Ended Input Channels

• Optional Left adjustment for ADC Result Readout

• 0 - VCC ADC Input Voltage Range

• Selectable 2.56V ADC Reference Voltage

• Free Running or Single Conversion Mode

• ADC Start Conversion by Auto Triggering on Interrupt Sources

• Interrupt on ADC Conversion Complete

• Sleep Mode Noise Canceller

The ATmega16 features a 10-bit successive approximation ADC. The ADC is connected to an 8-

channel Analog Multiplexer which allows 8 single-ended voltage inputs constructed from the pins

of Port A. The single-ended voltage inputs refer to 0V (GND).

OPERATION:

The ADC converts an analog input voltage to a 10-bit digital value through successive

approximation. The minimum value represents GND and the maximum value represents the

Page 52: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 52/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

voltage on the AREF pin minus 1 LSB. Optionally, AVCC or an internal 2.56V reference voltage may

be connected to the AREF pin by writing to the REFSn bits in the ADMUX Register. The internal

voltage reference may thus be decoupled by an external capacitor at the AREF pin to improve

noise immunity.

The ADC is enabled by setting the ADC Enable bit, ADEN in ADCSRA. Voltage reference and input

channel selections will not go into effect until ADEN is set. The ADC does not consume power

when ADEN is cleared, so it is recommended to switch off the ADC before entering power saving

sleep modes. The ADC generates a 10-bit result which is presented in the ADC Data Registers,

ADCH and ADCL. By default, the result is presented right adjusted, but can optionally be presented

left adjusted by setting the ADLAR bit in ADMUX.

If the result is left adjusted and no more than 8-bit precision is required, it is sufficient to read

ADCH. Otherwise, ADCL must be read first, then ADCH, to ensure that the content of the Data

Registers belongs to the same conversion. Once ADCL is read, ADC access to Data Registers isblocked. This means that if ADCL has been read, and a conversion completes before ADCH is read,

neither register is updated and the result from the con version is lost. When ADCH is read, ADC

access to the ADCH and ADCL Registers is reenabled.

A single conversion is started by writing a logical one to the ADC Start Conversion bit, ADSC. This

bit stays high as long as the conversion is in progress and will be cleared by hardware when the

conversion is completed. If a different data channel is selected while a conversion is in progress,

the ADC will finish the current conversion before performing the channel change. Alternatively, a

conversion can be triggered automatically by various sources. Auto Triggering is enabled by

setting the ADC Auto Trigger Enable bit, ADATE in ADCSRA. The trigger source is selected bysetting the ADC Trigger Select bits, ADTS in SFIOR (see

description of the ADTS bits for a list of the trigger sources). When a positive edge occurs on the

selected trigger signal, the ADC prescaler is reset and a conversion is started. This provides a

method of starting conversions at fixed intervals. If the trigger signal still is set when the

conversion completes, a new conversion will not be started. If another positive edge occurs on the

trigger signal during conversion, the edge will be ignored.

Page 53: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 53/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

By default, the successive approximation circuitry requires an input clock frequency between 50

kHz and 200 kHz to get maximum resolution. If a lower resolution than 10 bits is needed, the input

clock frequency to the ADC can be higher than 200 kHz to get a higher sample rate.

The ADC module contains a prescaler, which generates an acceptable ADC clock frequency from

any CPU frequency above 100 kHz. The prescaling is set by the ADPS bits in ADCSRA. The

prescaler starts counting from the moment the ADC is switched on by setting the ADEN bit inADCSRA. The prescaler keeps running for as long as the ADEN bit is set, and is continuously reset

when ADEN is low. When initiating a single ended conversion by setting the ADSC bit in ADCSRA,

the conversion starts at the following rising edge of the ADC clock cycle.

Let us proceed for Analog to Digital Conversion

ADC Control and Status Register A – ADCSRA

Page 54: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 54/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

Writing this bit to one enables the ADC. By writing it to zero, the ADC is turned off.

Turning the ADC off while a conversion is in progress, will terminate this conversion.

When this bit is written to one, Auto Triggering of the ADC is enabled. The ADC will start a

conversion on a positive edge of the selected trigger signal. The trigger source is selected by

setting the ADC Trigger Select bits, ADTS in SFIOR.

In Single Conversion mode, write this bit to one to start each conversion. In Free Running Mode,

write this bit to one to start the first conversion.

Page 55: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 55/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

ADC Multiplexer Selection Register – ADMUX

Bit 7:6 – REFS1:0: Reference Selection Bits

• Bit 5 – ADLAR: ADC Left Adjust Result

The ADLAR bit affects the presentation of the ADC conversion result in the ADC Data Register.

Write one to ADLAR to left adjust the result. Otherwise, the result is right adjusted. Changing the

ADLAR bit will affect the ADC Data Register immediately.

ADLAR=0

Page 56: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 56/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

ADLAR=1

The value of these bits selects which combination of analog inputs is connected to the ADC.

ADC Conversion Result

After the conversion is complete (ADIF is high), the conversion result can be found in the ADC

Result Registers (ADCL, ADCH).

For conversion, the result is:

Application Program

#include<avr/io.h>

#include<avr/delay.h>

void adc_init()

Page 57: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 57/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

ADCSRA=0XE5;

unsigned char adc_channel_init(unsigned char x)

ADMUX=0X60 | x;_delay_ms(1);

unsigned char x1=ADCH;

return x1;

void main()

DDRA=0X00;;

DDRB=0XFF;

adc_init();

unsigned char a;

while(1)

a=adc_channel_init(0);if(a<128) // 255= 5v ; 128 =2.5v

PORTB=255;

else

PORTB=0;

Pulse Width Modulation

Pulse width modulation (PWM) is a powerful technique for controlling analog circuits with a

microprocessor's digital outputs. PWM is employed in a wide variety of applications, ranging from

measurement and communications to power control and conversion.

Page 58: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 58/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

The AVR atmega16 supports pulse width modulation (PWM) on all three timer counters. Initiallywe will use the 8 bit timer 0 to implement this function. The AVR supports normal PWM or so

called fast PWM. Normal PWM involves starting a counter which counts up to it’s maximum value

and then reverses, counts back to zero and then repeats. In order to create output pulses whose

mark:space ratio changes the output compare register (Ref ) is loaded with a value so that when the

count reaches that value the Output is reversed.

Timer/Counter Control Register – TCCR0

• Bit 3, 6 – WGM01:0: Waveform Generation Mode

Page 59: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 59/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

• Bit 5:4 – COM01:0: Compare Match Output Mode

Compare Output Mode, Fast PWM Mode

• Bit 2:0 – CS02:0: Clock Select

The three Clock Select bits select the clock source to be used by the Timer/Counter.

Output Compare Register – OCR0

Page 60: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 60/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

The Output Compare Register contains an 8-bit value that is continuously compared with

the counter value (TCNT0). A match can be used to generate an output compare interrupt,

or to generate a waveform output on the OC0 pin.

Application Program:

void pwm()

/*for PB3 i.e. 4th pin of PORTB*/TCCR0=0x6A;

OCR0=0xB4;//180 max. is 255

/*for PD7 i.e 8th pin of PORTD*/

TCCR2=0x6A;

OCR2=0xB4;//180 max. is 255

USART of AVR Microcontrollers.The ‘UART ‘ is an Egyptian term that means ‘the artist’s quarter ‘- a place for bifurcation or

division .However USART stands for Universal synchronous Asynchronous Receiver

Transmitter. The serial USART provide for full duplex (two-way) communication between

a receiver and transmitter. This is accomplished by equipping the ATmega16 with

independent hardware for the transmitter and receiver. The USART is typically used for

asynchronous communication.

USART Registers.

Page 61: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 61/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

UCSRA: USART Control and Status Register A

RXC this bit is set when the USART has completed receiving a byte from the host (may beyour PC) and the program should read it from UDR

TXC This bit is set (1) when the USART has completed transmitting a byte to the host andyour program can write new data to USART via UDR

UDRE: The UDRE Flag indicates if the transmit buffer (UDR) is ready to receive new data.

If UDRE is one, the buffer is empty, and therefore ready to be written. The UDRE Flag can

generate a Data Register empty Interrupt (see description of the UDRIE bit). UDRE is set

Page 62: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 62/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

after a reset to indicate that the transmitter is ready.

FE: Frame Error:

This bit is set if the next character in the receive buffer had a Frame Error when received.

i.e., when the first stop bit of the next character in the receive buffer is zero. This bit isvalid until the receive buffer (UDR) is read. The FE bit is zero when the stop bit of received

data is one. Always set this bit to zero when writing to UCSRA.

DOR: Data OverRun:

This bit is set if a Data OverRun condition is detected. A Data OverRun occurs when the

receive buffer is full (two characters), it is a new character waiting in the receive Shift

Register, and a new start bit is detected. This bit is valid until the receive buffer (UDR) is

read. Always set this bit to zero when writing to UCSRA.

PE: Parity Error:

This bit is set if the next character in the receive buffer had a Parity Error when received

and the parity checking was enabled at that point (UPM1 = 1). This bit is valid until the

receive buffer (UDR) is read. Always set this bit to zero when writing to UCSRA.

U2X: Double the USART Transmission Speed:

This bit only has effect for the asynchronous operation. Write this bit to zero when using

synchronous operation.

Writing this bit to one will reduce the divisor of the baud rate divider from 16 to 8

effectively doubling the transfer rate for asynchronous communication.

MPCM: Multi-processor Communication Mode:

This bit enables the Multi-processor Communication mode. When the MPCM bit is written

to one, all the incoming frames received by the USART receiver that do not contain

address information will be ignored.

UCSRB: USART Control And Status Register B

RXCIE: Receive Complete Interrupt Enable - When this bit is written one the the RXC

based flag interrupt is enabled.

TXCIE: Transmit Complete Interrupt Enable - When this bit is written one the theinterrupt based on TXC flag is enabled.

UDRIE: USART Data Register Empty Interrupt Enable

Page 63: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 63/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

Writing this bit to one enables interrupt on the UDRE Flag. A Data Register Empty

Interrupt will be generated only if the UDRIE bit is written to one, the Global Interrupt

Flag in SREG is written to one and the UDRE bit in UCSRA is set.

RXEN: Receiver Enable - When you write this bit to 1 the USART receiver is enabled.

The normal port functionality of RX pin will be overridden. So we see that the

associated I/O pin now switch to its secondary function, i.e. RX for USART.

TXEN: Transmitter Enable - When you write this bit to 1 the USART transmitter is

enabled. The normal port functionality of RX pin will be overridden. So you see that

the associated I/O pin now switch to its secondary function, i.e. TX for USART.

UCSZ2: Character Size:

The UCSZ2 bits combined with the UCSZ1:0 bit in UCSRC sets the number of data bits

(Character Size) in a frame the receiver and transmitter use.

RXB8: Receive Data Bit 8

RXB8 is the ninth data bit of the received character when operating with serial frames

with nine data bits. Must be read before reading the low bits from UDR.

TXB8: Transmit Data Bit 8

TXB8 is the ninth data bit in the character to be transmitted when operating with serial

frames with nine data bits. Must be written before writing the low bits to UDR.

UCSRC: USART Control And Status Register C

UCSRC . This allows the user to customize the data features to the application at hand. It

should be emphasized that both the transmitter and receiver be configured with the same

data features for proper data transmission. The UCSRC contains the following bits:

• Bit 7 – URSEL: Register Select

This bit selects between accessing the UCSRC or the UBRRH Register. It is read as one

when reading UCSRC. The URSEL must be one when writing the UCSRC.

Page 64: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 64/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

IMPORTANT : The UCSRC and the UBRRH register shares same address so to determine

which register user want to write is decided with the 7th(last) bit of data if its 1 then the

data is written to UCSRC else it goes to UBRRH.

• Bit 6 – UMSEL: USART Mode Select

This bit selects between Asynchronous and Synchronous mode of operation.

Bit 5:4 – UPM1:0: Parity ModeThese bits enable and set type of parity generation and check. If enabled, the transmitter

will automatically generate and send the parity of the transmitted data bits within each

frame. The Receiver will generate a parity value for the incoming data and compare it to

the UPM0 setting. If a mismatch is detected, the PE Flag in UCSRA will be set.

• Bit 3 – USBS: Stop Bit Select

This bit selects the number of Stop Bits to be inserted by the Transmitter. The Receiver

ignores this setting.

• Bit 2:1 – UCSZ1:0: Character Size

The UCSZ1:0 bits combined with the UCSZ2 bit in UCSRB sets the number of data bits(Character Size) in a frame the Receiver and Transmitter use.

Page 65: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 65/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

• Bit 0 – UCPOL: Clock PolarityThis bit is used for Synchronous mode only. Write this bit to zero when Asynchronous

mode is used. The UCPOL bit sets the relationship between data output change and data

input sample, and the synchronous clock (XCK).

USART Baud Rate Registers – UBRRL and UBRRH

System Operation and Programming:

The basic activities of the USART system consist of initialization, transmission, andreception. These activities are summarized in Figure given below. Both the transmitter

and receiver must be initialized

with the same communication parameters for proper data transmission. The transmission

and reception activities are similar except for the direction of data flow. In transmission

,we monitor for

the UDRE flag to set, indicating the data register is empty. We then load the data for

transmission into the UDR register. For reception, we monitor for the RXC bit to set,

indicating there are unread data in the UDR register. We then retrieve the data from the

Page 66: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 66/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

UDR register.

To program the USART, we implement the flow diagrams provided in Figure . In the

sample code provided, we assume the ATmega16 is operating at 8 MHz and we desire a

baud rate of 9600, asynchronous operation, no parity, one stop bit, and eight data bits.

To achieve 9600 baud with an operating frequency of 10 MHz requires that we set theUBRR registers to 51 using following formula:

// Program to send and receive the same character from the keyboard

#include<avr/io.h>

#include<avr/delay.h>

void USART_Init( unsigned char ubrr)

/* Set baud rate */

UBRRH = 0;

UBRRL = ubrr;

/* Enable receiver and transmitter */

UCSRB|= (1<<RXEN)|(1<<TXEN);

/* Set frame format: 8data---ucsz0=1,ucsz1=1, 1stop bit ---usbs=0*/

UCSRC |= (1 << URSEL)|(3<<UCSZ0);

Page 67: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 67/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

//Transmission

void USART_Transmit( unsigned char data )

/* Wait for empty transmit buffer */

while ( !( UCSRA & (1<<UDRE)) )

;

/* Put data into buffer, sends the data */

UDR = data;

//RX

unsigned char USART_Receive( void )

/* Wait for data to be received */

while ( !(UCSRA & (1<<RXC)) );

/* Get and return received data from buffer */

return UDR;

void main()

unsigned char x;

USART_Init(51);// 8MHZ fre. of MCU and 9600 baud rate value of UBRR is 51

while(1)

// put your statement

x= USART_Receive();

_delay_ms(1000);

USART_Transmit(x);

Fuse Bits

The ATmega16 has two fuse bytes. Table 1 and Table 2 describe briefly the functionality

of all the fuses and how they are mapped into the fuse bytes. Note that the fuses are read

as logical zero, “0”, if they are programmed.

FUSE HIGH BYTE: Table 1

Page 68: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 68/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

FUSE LOW BYTE: Table 2

USE OF FUSE BITS:

Fuse bits are used to disable JTAG , lock the microcontroller, change the clock

frequency of the microcontroller.

By default in the new microcontroller the JTAG is enabled so C2,C3,C4,C5 can’t be

used. After disabling JTAG, PORTC can be used properly. Pins C2,C3,C4,C5 are

properly used for other applications.

HOW TO CHANGE FUSE BITS USING SINAPROG DOWNLOADER:

Follow the steps as per the image: DISABLING JTAG AND USING INTERNAL 8Mhz CLOCK

Page 69: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 69/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

Line Follower

As the name implies, the aim of the line follower robot is to follow a predefined line. Mostly the

line is made of black or white. There will be different turns like 90 degree curving, some cutting in

the line, sometimes the way may be inclined depending on competition. There are different ways

of solving line follower robots. Here i am explaining it with analog circuit. In that case first robot

should remember the line, and then next time it will follow the line fast and perfectly. The main

concern of the line follower

robot is how fast it is. Here i will talk about white strip and black strip. Mostly the strip or line will

be black and the background is white. So when I am talking about white strip take it as

background and black as line. Some events have white strip also.

Page 70: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 70/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

The basic line follower is one in which consist of two motors. For taking turn we stop one motorand run the other motor. This makes the robot to take a turn. You should keep the sensors with

LED to sense dark and white. The sensor and LED should be covered properly to produce sharp

sensing.

Use LED+LDR combination or IR LED + Photo diode (photo transistor) or 38Khz modulated

IR+TSOP1738 to sense white and black strip.

SOME IMPORTANT THINGS ABOUT LINE FOLLOWERS WITH TWO SENSORS

1. The above circuits use switching OFF and ON the motor. This is not a good method because

motor is basically an inductor. The time taken for the motor to attain full speed from OFFcondition is too much (ie in milliseconds depends on quality of motor). Suppose if we use two

sensor for each side and when first sensor goes into black then motor speed will be 50% then the

time required for a motor to charge to full speed=time required to charge to 100% speed -time

required to charge to 50%. But in the previous robots it is the time required to charge up to 100%

speed. But this time is always in 10ms or more for charging up to 100% speed. I don't remember

the charging and discharging equation of inductor. Do some calculation and see the difference. So

the difference is above 10ms. This is a good time we are wasting.

2. Here we are stopping motor completely for a simple turn, so the time lost will be high. Think of

a train going at 100kmph, which had to stop at a station for a 2sec. The time lost in its run will be

around 7-

10sec, if it had stopped at a station compared to normal running of train. The same case with a

robot motor stopped completely. So we should avoid this.

3. There is some switching time with power transistor, relays. The switching time of power

transistor is around .1ms while that of relay is about 100ms (not accurate, but greater than 10ms).

So the time will be lost in the switching time of these components. So it is better not to use relays

Page 71: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 71/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

to drive motors. But if you are using big motors of high rating, then you can use relay because they

will move at low speed.

But the robots we make are so small, so we should try to avoid using relays in the circuits because

of its switching speeds.

4. We require high speed devices. Motor switching speed cannot be controlled very much, because

it is basically an inductor and we can do nothing to it except buying a costly motor. So here cost

will become high, if you go for good mechanical parts and motors. So let's think of reduced cost

and good speeds. Instead of power transistor you can use MOSFET's speed around 100K

(switching speed). So it is better to use MOS than power transistor in motor driving circuitary.

5. Figure shows the motion of a normal robot

See from the site how the robot moves in different bendings. Here the blue line represents the

path in which the robot has moved. You can see for a small bend how much time it switched. So if

you use a relay the time lost will be great will come around 2sec(or more) for a normal path. You

can see that as the number of bends increases the time for the robot to cover increase. Suppose if

the distance the robot has to move is of good length (suppose 5m), then the time lost will be

around 10sec(or more). If your arena has only bends and having sharp bends with some cutting,

then the time lost will be too much with the above circuits. The time will be number of

switching*(s/w of transistor+relay+motor). This will come in minutes if you had to travel a path

having irregular bends and of good length.

WHY MICROCONTROLLER IN LINE FOLLOWER ROBOTS?

See this track; there is a number of crossings. There are cuttings in the way and some extra lines

are added in the track to mislead the robot. See what happens when you use the above circuits.

The analog circuits above cannot take a decision. If they lose the way, they cannot come back to

the track. Then the speed will be reduced at the crossing. Analyze the circuit yourself. Sometimes

Page 72: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 72/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

your robot looses the way in crossings and cuttings and no way exist to bring back the robot back

to the track. If you want to do this then you had to add extra circuits and complexity of circuit

increase with the path. But if you use a microcontroller then this problem will be solved and the

requirement of processing circuits also avoided.

A microcontroller circuit can trace back the path which it followed. It can avoid the situation of

external light. If we use ADC for the LDR readings then the external light problem will be avoided.

External light affect the readings almost equally in all sensors, so it equally in ADC reading. We can

subtract the reading to avoid this problem. Suppose if we use 4 sensors on each side. Then from

the following circuit diagram you can use PWM to control the H-bridge by connecting PWM output

to enable of H-bridge. Then the PWM can be controlled by the following way. If ADC1 readings

increase then PWM will be reduced from 100% to 90%.Assuming that ADC1 reading is the front

LDR (ldr1). Suppose if ldr1 crosses line then we can detect it and we can reduce pwm to 80%. But

in analog case this was not possible. We can determine the instant position of the ldr's and takeappropriate decision while that is not possible in analog circuits. This makes the robot to get a

proper movement.

Suppose if we use microcontroller just like a parallel port and the sensor readings are inputted to

the microcontroller and LM317 circuit is connected to another port. You can see that there are 2^4

combinations of voltage are possible with that circuit, but with the analog circuit we are

able to use only about 4 voltages. We can use 16 different voltages using a microcontroller. This 16

different voltages are applied to the motor using the ADC readings of the sensor(1-4). Thus we can

get voltages from 1.25 to 12V with 1V difference and better control is possible and we can

determine the position of sensors, so that we can get a robot with good speed by adjusting voltagewith better precision.

Starters Projects on Robotics: Light Follower

Edge Detector

Obstacle Avoider

Wall Follower

All in one robot

Sound sensing Robot

Solar Powered Robot

Mobile operated robot

Path Finder

Rail Track Inspector

Sumo Robot

Page 73: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 73/74

www.roboticwares.com | www.learnics.in

LEAR NICSI M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

Robotics in INDIA

Robotics in INDIA is still at its infancy. But we are pretty confident that some of us can certainly play avital role in propelling INDIA to come out of this situation and become a technology solutions giant in thetime to come.

We believe that our efforts if based on the following three aspects will deliver the maximum results.

1. Sharing of knowledge:

The gap between science fiction and science fact is closing. With recent advances in robotic softwareand computer hardware, new levels of robotic intelligence are now available. For education, roboticsoffers an exciting, enjoyable means for students to learn and to apply useful transferable skills. Roboticsprovides a multidisciplinary learning tool for fundamentals, such as mathematics, physics, and science

Our academicians should understand this fact and act accordingly to include robotic in syllabus rightfrom secondary schools to higher studies.

2. A competitive environment for growth:

We need more and more Robotic clubs, robotic contests, seminars and workshops to be organized andconducted to cultivate a competitive environment.

3. Sharing of Resources:

Knowledge base and raw materials are equally important for the development of a technology like

robotics. One should practice and understand this science.

We do take up this as a challenge.

Page 74: Robo Gyan.pdf

7/30/2019 Robo Gyan.pdf

http://slidepdf.com/reader/full/robo-gyanpdf 74/74

LEAR NICS

I M P A R T I N G S K I L L S

E M P O W E R I NG P E R F O R M A N C E

“Excellent, it met my expectations.” Suhas Rohit Pal, NIT Surathkal

“ They gave us the idea and how to implement them in day to day life.”

Debesh kumar, NIT Rourkela

“The workshop was the best I have ever witnessed. I am not so good at electronic circuits, but the manner in which everything was explained could be understood even by a beginner.”

Akash Kumar, NIT Allahabad

“It was very knowledgeable and helpful in terms of i ll d l d h l i ”

Akhila Gollakota, BITS il i