self balancing robot

105
A Project Report On SELF BALANCING ROBOT” (Major project) Submitted in partial fulfillment of the requirement for the award of the Degree of Bachelor of Technology In ELECTRONICS & COMMUNICATION ENGINEERING Under the supervision of :- Submitted by:- Ms. Geetanjali Sharma Apurva Bhardwaj(050075) Iti Goyal(050049) Meenakshi Kushwah(050167)

Upload: apurvabhardwaj

Post on 18-Nov-2014

1.249 views

Category:

Documents


0 download

DESCRIPTION

Major Project Report

TRANSCRIPT

Page 1: Self Balancing Robot

AProject Report

On

ldquoSELF BALANCING ROBOTrdquo(Major project)

Submitted in partial fulfillment of the requirementfor the award of the

Degree ofBachelor of Technology

InELECTRONICS amp COMMUNICATION ENGINEERING

Under the supervision of - Submitted by-

Ms Geetanjali Sharma Apurva Bhardwaj(050075) Iti Goyal(050049)

Meenakshi Kushwah(050167)

May 2009Faculty of Engineering amp Technology

Mody Institute of Technology and Science(A Deemed University Under Section 3 of the UGC Act of 1956)

Lakshmangarh-332311(Distt-Sikar)

Mody Institute of Technology and Science

( a Deemed University Under Section 3 of the UGC Act 1956)

Lakshmangarh-332311 (Dist-Sikar)

P phones (01573) 225001 to 225012 (12 lines) Fax (01573) 225042

CERTIFICATE

This is to certify that the major project entitled ldquoSELF BALANCING ROBOTrdquo

submitted by MsApurva Bhardwaj(050075) MsIti Goyal(050049) MsMeenakshi

Kushwah(050167) to department of Electronics and Communication Engineering in

partial fulfillment of requirement for the degree of Bachelor of Technology by Mody

Institute of Technology and Science Lakshmangarh is a record of the work done under

my supervision and guidance

Date MsGeetanjali Sharma (Project Supervisor) Lecturer (ECE)

2

EXAMINER CERTIFICATE

The Project entitled ldquoSELF BALANCING ROBOTrdquo submitted by Ms Apurva

Bhardwaj(ECE) Ms Iti Goyal(ECE) Ms Meenakshi Kushwah(ECE) students of

BTech VII semester are approved in partial fulfillment of the requirement of the degree

of Bachelor of Technology from the Mody Institute Of Technology and

Science Lakshmangarh Sikar

Date (Examiner)

Prof SM Sharma (HOD ECE)

3

ACKNOWLEDGEMENT

ldquoPerseverance inspiration and motivation have always played a key role in any

venture It is not just the brain that matters most but that which guides them the

character the heart generous qualities and progressive forces What was conceived just

as an idea materialized slowly into concrete facts The metamorphosis took endless hours

of toil had its moments of frustration but in the end everything seemed to have senserdquo

At this level of understanding it is often difficult to understand the wide spectrum of

knowledge without proper guidance amp advice Hence we take this opportunity to express

our heartfelt gratitude to respected Ms Geetanjali Sharma who being our project guide

had faith in us enlightened us with the valuable guidance and allowed us to work on this

project

A heartfelt gratitude to Prof P K Das (Dean FET) for providing us with an opportunity

to work in the Power Electronics lab and VLSI lab as a part of the major project

We would like to thank Prof SM Sharma (HOD Electronics) for his immense interest

constant inspiration and kind co-operation throughout the period of work undertaken

We would like to pay our sincere gratitude to Mr Vijay Singh and Mr Santosh for

helping us with the technicalities of the electronics and computer lab and making our

work easier with his kind cooperation

We would also like to acknowledge our profound sense of gratitude to my Friends and

Parents for their moral support to crave out this project and above all GOD for removing

all the hurdles in the way

APURVA BHARDWAJ(050075)

ITI GOYAL(050049)

MEENAKSHI KUSHWAH(050167)

4

TABLE OF CONTENTS

SNO CONTENT PAGE NO

1 Abstract 6

2 Introduction 7

3 Component Description 10

4 Parallel Port 28

5 Power Supply 34

6 Circuit Description 41

7 Visual Basic 43

8 Coding 50

9 Conclusion 52

10 References 53

11 Appendix 54

5

ABSTRACT

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

System Required for this Project

PC with Minimum PIII with 256 MB Ram 10GB HDD amp VB60

Programmer skills

Visual Basic 60 Active Dlls ActiveX

End-user Skills

Basic Operating System handling

System Requirement

Computer Minimum PIII with 256 MB Ram 40Gb HDD VB60 Serial communication

port LPT Port

Hardware required

IR sensors Lasers Power supply D type 25 pin connector comparator IC

Global Application

Sky high building balancing

Precision balancing system

6

INTRODUCTION

What is a RobotA robot is an apparently human automaton intelligent and obedient but impersonal

machine Indeed the word robot comes from robota Czech for forced labour Yet as

robotics advances this definition is rapidly becoming old Basically a robot is a machine

designed to do a human job (excluding research robots) that is either tedious slow or

hazardous It is only relatively recently that robots have started to employ a degree of

Artificial Intelligence in their work - many robots required human operators or precise

guidance throughout their missions Slowly robots are becoming more and more

autonomous

The difference between robots and machinery is the presence of autonomy flexibility and

precision Indeed many few robots are mere extensions of machinery - but as the field

advances more and more the current fine line will widen more and more

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields Let us back-track

though and look at what could constitute a robot

Robotics is an absolutely fascinating field that interests most people - AI buff or not As

research from more serious robotics projects such as Cog and Kismet filter down into the

commercial arena we should look forward to some very interesting (and cheap) virtual

pets like Aibo and the furbies Hopefully commercial home-based robots will also be

available for a price not more than an expensive vacuum cleaner With computers

becoming more and more powerful interfacing home robots with your computer will

become a reality and house work will (hopefully) disappear

7

WHATrsquoS IN A ROBOT

Basically a robot consists of

A mechanical device such as a wheeled platform arm or other construction

capable of interacting with its environment

Sensors on or around the device that are able to sense the environment and give

useful feedback to the device

Systems that process sensory input in the context of the devices current situation

and instruct the device to perform actions in response to the situation

Mechanical platforms -- the hardware base

A robot consists of two main parts the robot body and some form of artificial

intelligence (AI) system Many different body parts can be called a robot Articulated

arms are used in welding and painting gantry and conveyor systems move parts in

factories and giant robotic machines move earth deep inside mines One of the most

interesting aspects of robots in general is their behavior which requires a form of

intelligence The simplest behavior of a robot is locomotion Typically wheels are used

as the underlying mechanism to make a robot move from one point to the next And some

force such as electricity is required to make the wheels turn under command

Motors

A variety of electric motors provide power to robots allowing them to move material

parts tools or specialized devices with various programmed motions The efficiency

rating of a motor describes how much of the electricity consumed is converted to

mechanical energy

Power supplies

Power supplies are generally provided by two types of battery Primary batteries are used

once and then discarded secondary batteries operate from a (mostly) reversible chemical

reaction and can be recharged several times Primary batteries have higher density and a

lower self-discharge rate Secondary (rechargeable) batteries have less energy than

8

primary batteries but can be recharged up to a thousand times depending on their

chemistry and environment

Sensors

Regardless of sensor hardware or software sensing and sensors can be thought of as

interacting with external events (in other words the outside world) The sensor measures

some attribute of the world The term transducer is often used interchangeably with

sensor A transducer is the mechanism or element of the sensor that transforms the

energy associated with what is being measured into another form of energy A sensor

receives energy and transmits a signal to a display or computer Sensors use transducers

to change the input signal (sound light pressure temperature etc) into an analog or

digital form capable of being used by a robot

Microcontroller systems

Microcontrollers (MCUs) are intelligent electronic devices used inside robots They

deliver functions similar to those performed by a microprocessor (central processing unit

or CPU) inside a personal computer MCUs are slower and can address less memory than

CPUs but are designed for real-world control problems One of the major differences

between CPUs and MCUs is the number of external components needed to operate them

MCUs can often run with zero external parts and typically need only an external crystal

or oscillator

There are four basic aspects of a microcontroller speed size memory and other Speed

is designated in clock cycles and is usually measured in millions of cycles per second

(Megahertz MHz) The use of the cycles varies in different MCUs affecting the usable

speed of the processor Size specifies the number of bits of information the MCU can

process in one step -- the size of its natural cluster of information

9

COMPONENT DESCRIPTION

Resistors

Example Circuit symbol

Function

Resistors restrict the flow of electric current for example a resistor is

placed in series with a light-emitting diode (LED) to limit the current

passing through the LED

Connecting and soldering

Resistors may be connected either way round They are not damaged

by heat when soldering

Resistor values - the resistor colour code

Resistance is measured in ohms the symbol for ohm is an omega

1 is quite small so resistor values are often given in k and M

1 k = 1000 1 M = 1000000

Resistor values are normally shown using coloured bands

Each colour represents a number as shown in the table

Most resistors have 4 bands

The first band gives the first digit

The second band gives the second digit

The third band indicates the number of zeros

The fourth band is used to shows the tolerance (precision) of the resistor this may

be ignored for almost all circuits but further details are given below

The Resistor

Colour Code

Colour Number

Black 0

Brown 1

Red 2

Orange 3

Yellow 4

Green 5

Blue 6

Violet 7

Grey 8

White 9

10

This resistor has red (2) violet (7) yellow (4 zeros) and gold bands

So its value is 270000 = 270 k

On circuit diagrams the is usually omitted and the value is written 270K

Small value resistors (less than 10 ohm)

The standard colour code cannot show values of less than 10 To show these small

values two special colours are used for the third band gold which means times 01 and silver

which means times 001 The first and second bands represent the digits as normal

For example

red violet gold bands represent 27 times 01 = 27

green blue silver bands represent 56 times 001 = 056

Tolerance of resistors (fourth band of colour code)

The tolerance of a resistor is shown by the fourth band of the colour code Tolerance is

the precision of the resistor and it is given as a percentage For example a 390 resistor

with a tolerance of plusmn10 will have a value within 10 of 390 between 390 - 39 = 351

and 390 + 39 = 429 (39 is 10 of 390)

A special colour code is used for the fourth band tolerance

silver plusmn10 gold plusmn5 red plusmn2 brown plusmn1

If no fourth band is shown the tolerance is plusmn20

Tolerance may be ignored for almost all circuits because precise resistor values are rarely

required

11

Transistors

Function

Transistors amplify current for example they can be used to amplify the small output

current from a logic chip so that it can operate a lamp relay or other high current device

In many circuits a resistor is used to convert the changing current to a changing voltage

so the transistor is being used to amplify voltage

A transistor may be used as a switch (either fully on with maximum current or fully off

with no current) and as an amplifier (always partly on)

The amount of current amplification is called the current gain symbol hFE

There are two types of standard transistors NPN and PNP

with different circuit symbols The letters refer to the layers

of semiconductor material used to make the transistor Most

transistors used today are NPN because this is the easiest

type to make from silicon If you are new to electronics it is

best to start by learning how to use NPN transistors

The leads are labeled base (B) collector (C) and emitter (E)

These terms refer to the internal operation of a transistor but they are not much help in

understanding how a transistor is used so just treat them as labels

A Darlington pair is two transistors connected together to give a very high current gain

In addition to standard (bipolar junction) transistors there are field-effect transistors

which are usually referred to as FETs They have different circuit symbols and properties

and they are not (yet) covered by this page

Transistor circuit symbols

12

Connecting

Transistors have three leads which

must be connected the correct way

round Please take care with this

because a wrongly connected transistor

may be damaged instantly when you

switch on

If you are lucky the orientation of the

transistor will be clear from the PCB or

stripboard layout diagram otherwise you will need to refer to a suppliers catalogue to

identify the leads

The drawings on the right show the leads for some of the most common case styles

Please note that transistor lead diagrams show the view from below with the leads

towards you This is the opposite of IC (chip) pin diagrams

which show the view from above

Soldering

Transistors can be damaged by heat when soldering so if you

are not an expert it is wise to use a heat sink clipped to the lead

between the joint and the transistor body A standard crocodile clip can be used as a heat

sink

Do not confuse this temporary heat sink with the permanent heat sink (described below)

which may be required for a power transistor to prevent it overheating during operation

Transistor leads for some common case styles

Crocodile clip

13

Heat sinks

Waste heat is produced in transistors due to the current flowing through

them Heat sinks are needed for power transistors because they pass

large currents If you find that a transistor is becoming too hot to touch it certainly needs

a heat sink The heat sink helps to dissipate (remove) the heat by transferring it to the

surrounding air

Darlington pair

This is two transistors connected together so that

the amplified current from the first is amplified further by the second transistor This

gives the Darlington pair a very high current gain such as 10000 Darlington pairs are

sold as complete packages containing the two transistors They have three leads

(B C and E) which are equivalent to the leads of a standard individual transistor

You can make up your own Darlington pair from two transistors

For example

For TR1 use BC548B with hFE1 = 220

For TR2 use BC639 with hFE2 = 40

The overall gain of this pair is hFE1 times hFE2 = 220 times 40 = 8800

The pairs maximum collector current IC(max) is the same as TR2

Heat sink

14

LED

Example Circuit symbol

Function

LEDs emit light when an electric current passes through them

Connecting and soldering

LEDs must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is the

short lead and there may be a slight flat on the body of round LEDs If you can see inside

the LED the cathode is the larger electrode (but this is not an official identification

method)

LEDs can be damaged by heat when soldering but the risk is small unless you are very

slow No special precautions are needed for soldering most LEDs

15

Testing an LED

Never connect an LED directly to a battery or power supply

It will be destroyed almost instantly because too much current will pass through and burn

it out

LEDs must have a resistor in series to limit the current to a safe value for quick testing

purposes a 1k resistor is suitable for most LEDs if your supply voltage is 12V or less

Remember to connect the LED the correct way round

Colours of LEDs

LEDs are available in red orange amber yellow green blue and white Blue and white

LEDs are much more expensive than the other colours

The colour of an LED is determined by the semiconductor material not by the colouring

of the package (the plastic body) LEDs of all colours are available in uncoloured

packages which may be diffused (milky) or clear (often described as water clear) The

coloured packages are also available as diffused (the standard type) or transparent

16

Capacitors

Function

Capacitors store electric charge They are used with resistors in timing circuits because it

takes time for a capacitor to fill with charge They are used to smooth varying DC

supplies by acting as a reservoir of charge They are also used in filter circuits because

capacitors easily pass AC (changing) signals but they block DC (constant) signals

Capacitance

This is a measure of a capacitors ability to store charge A large capacitance means that

more charge can be stored Capacitance is measured in farads symbol F However 1F is

very large so prefixes are used to show the smaller values

Three prefixes (multipliers) are used micro (micro) n (nano) and p (pico)

micro means 10-6 (millionth) so 1000000microF = 1F

n means 10-9 (thousand-millionth) so 1000nF = 1microF

p means 10-12 (million-millionth) so 1000pF = 1nF

Capacitor values can be very difficult to find because there are man

types of capacitor with different labeling systems

Capacitor Colour Code

A colour code was used on polyester capacitors for many years It is

now obsolete but of course there are many still around The colours

should be read like the resistor code the top three colour bands giving

the value in pF Ignore the 4th band (tolerance) and 5th band (voltage

rating) For example brown black orange means 10000pF = 10nF =

001microF Note that there are no gaps between the colour bands so 2 identical bands

actually appear as a wide band For example wide red yellow means 220nF = 022microF

Different types of capacitors

Colour Code

Colour Number

Black 0

Brown 1

Red 2

Orange 3

Yellow 4

Green 5

Blue 6

Violet 7

Grey 8

17

Electrolytic Capacitors Ceramic Capacitor

An electrolytic capacitor is a type of capacitor typically with a larger capacitance per

unit volume than other types making them valuable in relatively high-current and low-

frequency electrical circuits This is especially the case in power-supply filters where

they store charge needed to moderate output voltage and current fluctuations in rectifier

output and especially in the absence of rechargeable batteries that can provide similar

low-frequency current capacity They are also widely used as coupling capacitors in

circuits where AC should be conducted but DC should not the large value of the

capacitance allows them to pass very low frequencies

A Ceramic Capacitor is a capacitor constructed of alternating layers of metal and

ceramic with the ceramic material acting as the dielectric Depending on the dielectric

whether Class 1 or Class 2 the degree of temperaturecapacity dependence varies A

ceramic capacitor often has (especially the class 2) high dissipation factor high

frequency coefficient of dissipation Capacity depends on applied voltage and capacity

changes with aging Ceramic capacitors are used extensively in common low-precision

coupling and filtering applications They are suitable for high frequencies

A ceramic capacitor is a two-terminal non-polar device The classical ceramic capacitor

is the disk capacitor This device pre-dates the transistor and was used extensively in

vacuum-tube equipment (eg radio receivers)

Diodes

18

Function

Diodes allow electricity to flow in only one direction The arrow of the circuit symbol

shows the direction in which the current can flow Diodes are the electrical version of a

valve and early diodes were actually called valves

Example Circuit symbol

Forward Voltage Drop

Electricity uses up a little energy pushing its way through the diode rather like a person

pushing through a door with a spring This means that there is a small voltage across a

conducting diode it is called the forward voltage drop and is about 07V for all normal

diodes which are made from silicon The forward voltage drop of a diode is almost

constant whatever the current passing through the diode so they have a very steep

characteristic (current-voltage graph)

Reverse Voltage

When a reverse voltage is applied a perfect diode does not conduct but all real diodes

leak a very tiny current of a few microA or less This can be ignored in most circuits because

it will be very much smaller than the current flowing in the forward direction However

all diodes have a maximum reverse voltage (usually 50V or more) and if this is exceeded

the diode will fail and pass a large current in the reverse direction this is called

breakdown

Ordinary diodes can be split into two types Signal diodes which pass small currents of

100mA or less and Rectifier diodes which can pass large currents In addition there are

LEDs (which have their own page) and Zener diodes (at the bottom of this page)

19

Connecting and soldering

Diodes must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is

marked by a line painted on the body Diodes are labelled with their code in small print

you may need a magnifying glass to read this on small signal diodes Small signal diodes

can be damaged by heat when soldering but the risk is small unless you are using a

germanium diode (codes beginning OA) in which case you should use a heat sink

clipped to the lead between the joint and the diode body A standard crocodile clip can be

used as a heat sink

Rectifier diodes are quite robust and no special precautions are needed for soldering

them

Testing diodes

You can use a multimeter or a simple tester (battery resistor and LED) to check that a

diode conducts in one direction but not the other A lamp may be used to test a

rectifier diode but do NOT use a lamp to test a signal diode because the large current

passed by the lamp will destroy the diode

Signal diodes (small current)

20

Signal diodes are used to process information (electrical signals) in circuits so they are

only required to pass small currents of up to 100mA General purpose signal diodes such

as the 1N4148 are made from silicon and have a forward voltage drop of 07V

Germanium diodes

Such as the OA90 have a lower forward voltage drop of 02V and this makes them

suitable to use in radio circuits as detectors which extract the audio signal from the weak

radio signal

For general use where the size of the forward voltage drop is less important silicon

diodes are better because they are less easily damaged by heat when soldering they have

a lower resistance when conducting and they have very low leakage currents when a

reverse voltage is applied Rectifier diodes are used in power supplies to convert

alternating current (AC) to direct current (DC) a process called rectification They are

also used elsewhere in circuits where a large current must pass through the diode All

rectifier diodes are made from silicon and therefore have a forward voltage drop of 07V

The table shows maximum current and maximum reverse voltage for some popular

rectifier diodes The 1N4001 is suitable for most low voltage circuits with a current of

less than 1A

Bridge rectifiers

DiodeMaximum

Current

Maximum

Reverse

Voltage

1N4001 1A 50V

1N4002 1A 100V

1N4007 1A 1000V

1N5401 3A 100V

1N5408 3A 1000V

21

There are several ways of connecting diodes to make a rectifier to convert AC to

DC The bridge rectifier is one of them and it is available in special packages containing

the four diodes required Bridge rectifiers are rated by their maximum current and

maximum reverse voltage They have four leads or terminals the two DC outputs are

labeled + and - the two AC inputs are labeled

The diagram shows the operation of a bridge rectifier as it converts AC to DC Notice

how alternate pairs of diodes conduct

Transformer

A transformer makes use of Faradays law and the ferromagnetic properties of an iron

core to efficiently raise or lower AC voltages It of course cannot increase power so that

if the voltage is raised the current is proportionally lowered and vice versa

22

Flywheel Energy Storage

Overview

A flywheel in essence is a mechanical battery - simply a mass rotating about an axis

Flywheels store energy mechanically in the form of kinetic energy They take an

electrical input to accelerate the rotor up to speed by using the built-in motor and return

the electrical energy by using this same motor as a generator Flywheels are one of the

oldest and most common mechanical devises in existence They may still prove to serve

us as an important component on tomorrows vehicles and future energy needs Flywheels

are one of the most promising technologies for replacing conventional lead acid batteries

as energy storage systems for a variety of applications including automobiles

economical rural electrification systems and stand-alone remote power units commonly

used in the telecommunications industry Recent advances in the mechanical properties of

composites has rekindled interest in using the inertia of a spinning wheel to store energy

23

In addition to energy density flywheel energy storage systems (FES) also offer several

important advantages over chemical energy storage The rate at which energy can be

exchanged into or out of the battery is limited only by the motor--generator design

Therefore it is possible to withdraw large amounts of energy in a far shorter time than

with traditional chemical batteries Indeed research into exploiting this property of FES

systems to get short intense bursts of energy is ongoing with the most notable projects

being a magnetic tank gun and a fusion ignition system Of course it is also possible to

quickly charge FES batteries making them desirable for application in electric cars where

the charge time could be dropped from a matter of hours to a matter of minutes

Advantages Flywheels store energy very efficiently (high turn-around efficiency) and

have the potential for very high specific power compared with batteries Flywheels have

very high output potential and relatively long life Flywheels are relatively unaffected by

ambient temperature extremes

Disadvantages Current flywheels have low specific energy There are safety concerns

associated with flywheels due to their high speed rotor and the possibility of it breaking

loose and releasing all of its energy in an uncontrolled manner Flywheels are a less

mature technology than chemical batteries and the current cost is too high to make them

competitive in the market

VOLTAGE REGULATOR

24

A Voltage Regulator (also called a regulator) has only three legs and appears to be a

comparatively simple device but it is actually a very complex integrated circuit A

regulator converts varying input voltage and produces a constant regulated output

voltage Voltage regulators are available in a variety of outputs typically 5 volts 9 volts

and 12 volts The last two digits in the name indicate the output voltage

Introduction

It is very easy to get stabilized voltage for ICs by using a three terminal voltage regulator

The three terminal voltage regulator outputs stabilized voltage at a lower level than the

higher input voltage A voltage regulator cannot put out higher voltage than the input

voltage They are similar in appearance to a transistor The 7800 series consists of three-

terminal positive voltage regulators

These ICs are designed as fixed voltage regulators and with adequate heat sinking can

deliver output currents in excess of 1A These ICs are used to provide +5 volts and +12

volts supply Line regulation in these ICs is change in the output voltage for a change in

the input voltage Load regulation is defined as the change in output voltage for a change

in load current If there is any high voltage than 12 volt to 7812 it will convert to 12 V by

this IC If there is any voltage less than 12 volt it allows passing it FAN is used for

cooling the ICs

There are two ICs 7805 and 7812 attached with the Intel-fan heat sink From the base of

7805 IC we get the +5Volt Supply and from the base of 7812 IC we get the 12 Volt

25

supply Two LED are also connected with the respective ICs in order to indicate there

proper working

There are some voltage regulators

LM7805 for + 5 volts

LM7809 for +9 volts

LM7812 for+12 volts

LM7905 for-5 volts

LM7909 for-9 volts

LM7912 for-12 volts

Fig LM7805 Integrated Circuit Internal Schematic

The LM78XX series of voltage regulators are designed for positive input For

applications requiring negative input the LM79XX series is used

26

Fig Symbol of voltage regulator Fig A LM 7805 regulator

Fig The circuit diagram represents a typical use of a voltage regulator

Note The LM7805 can reliably deliver 1 amp at a constant voltage

Input Voltage

As a general rule the input voltage should be limited to 2 to 3 volts above the output

voltage The LM78XX series can handle up to 30 volts input but the power difference

between the input voltagecurrent ratio and output voltagecurrent ratio appears as heat If

the input voltage is unnecessarily high the regulator will get very hot Unless sufficient

heat sinking is provided the regulator will shut down

27

Parallel Port

Essentials

A first step in exploring the parallel port is learning how to get the most from a port with

your everyday applications and peripherals Things to know include how to find

configure and install a port how and when to use the new bidirectional EPP and ECP

modes and how to handle a system with multiple parallel-port peripherals

Defining the Ports

What is the parallel port In the computer world a port is a set of signal lines that the

microprocessor or CPU uses to exchange data with other components Typical uses for

ports are communicating with printers modems keyboards and displays or just about

any component Most computer ports are digital where each signal or bit is 0 or 1 A

parallel port transfers multiple bits at once while a serial port transfers a bit at a time

(though it may transfer in both directions at once)The ports explained here is about a

specific type of parallel port the one found on just about every Pc or IBM-compatible

personal computer Along with the RS-232 serial port the parallel port is a workhorse of

PC communications On newer PCs you may find other ports such as SCSI USB and

IrDA but the parallel port remains popular because its capable flexible and every PC

has one

The term PC-compatible or PC for short refers to the IBM PC and any of the

many many personal computers derived from it From another angle a PC is any

computer that can run Microsofts MS-DOS operating system and whose expansion bus is

compatible with the ISA bus in the original IBM Pc The category includes the PC XT

AT PS2 and most computers with 80x86 Pentium and compatible CPUs It does not

include the Macintosh Amiga or IBM mainframes though these and other computer

types may have ports that are similar to the parallel port on the Pc The original PCs

parallel port had eight outputs five inputs and four bidirectional lines

These are enough for communicating with many types of peripherals On many

newer PCs the eight outputs can also serve as inputs for faster communications with

scanners drives and other devices that send data to the Pc

28

The parallel port was designed as a printer port and many of the-original names for the

ports signals (PaperEnd AutoLineFeed) reflect that use But these days you can find all

kinds of things besides printers connected to the port The term peripheral or peripheral

device is a catch-all category that includes printers scanners modems and other devices

that connect to a Pc

29

Accessing Ports

Windows DOS C JAVA and Visual Basic provide several ways to read and write to

parallel ports The most direct way is reading and writing to the port registers Most

programming languages include this ability or at least allow you to add it Visual Basic

includes other options including the Printer object the Print Form method and Open

LPT x Windows also has API calls for accessing LPT ports and 16-bit programs can use

BIOS and DOS software interrupts for LPT access This chapter introduces the parallel

ports signals and ways of accessing them in the programs you write

Parallel ports can be used to connect a host of popular computer peripherals

bull Printers

bull Scanners

bull CD burners

bull External hard drives

bull Iomega Zip removable drives

bull Network adapters

bull Tape backup drives

30

Pin Out Diagram Of Parallel Port

31

Parallel Port Basics

Parallel ports were originally developed by IBM as a way to connect a printer to our PC

When IBM was in the process of designing the PC the company wanted the computer to

work with printers offered by Centronics a top printer manufacturer at the time IBM

decided not to use the same port interface on the computer that Centronics used on the

printer

Instead IBM engineers coupled a 25-pin connector DB-25 with a 36-pin Centronics

connector to create a special cable to connect the printer to the computer Other printer

manufacturers ended up adopting the Centronics interface making this strange hybrid

cable an unlikely de facto standard

When a PC sends data to a printer or other device using a parallel port it sends 8 bits of

data (1 byte) at a time These 8 bits are transmitted parallel to each other as opposed to

the same eight bits being transmitted serially (all in a single row) through a serial port

The standard parallel port is capable of sending 50 to 100 kilobytes of data per second

Lets take a closer look at what each pin does when used with a printer

bull Pin 1 carries the strobe signal It maintains a level of between 28 and 5 volts but drops

below 05 volts whenever the computer sends a byte of data This drop in voltage tells

the printer that data is being sent

Pins 2 through 9 are used to carry data To indicate that a bit has a value of 1 a

charge of 5 volts is sent through the correct pin No charge on a pin indicates avalue of

0 This is a simple but highly effective way to transmit digital information over an

analog cable in real-time

bull Pin 10 sends the acknowledge signal from the printer to the computer Like Pin 1 it

maintains a charge and drops the voltage below 05 volts to let the computer know that

the data was received

32

bull If the printer is busy it will charge Pin 11 Then it will drop the voltage below

05 volts to let the computer know it is ready to receive more data

bull The printer lets the computer know if it is out of paper by sending a charge on Pin 12

bull As long as the computer is receiving a charge on Pin 13 it knows that the device

is online

bull The computer sends an auto feed signal to the printer through Pin 14 using a 5-

volt charge

bull If the printer has any problems it drops the voltage to less than 05 volts on Pin

15 to let the computer know that there is an error

bull Whenever a new print job is ready the computer drops the charge on Pin 16 to

initialize the printer

bull Pin 17 is used by the computer to remotely take the printer offline This is

accomplished by sending a charge to the printer and maintaining it as long as you

want the printer offline

bull Pins 18-25 are grounds and are used as a reference signal for the low (below 05

volts) charge

33

Power Supply

Types of Power Supply

There are many types of power supply Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other

devices A power supply can by broken down into a series of blocks each of which

performs a particular function

For example a 5V regulated supply

Each of the blocks is described in more detail below

Transformer - steps down high voltage AC mains to low voltage AC

Rectifier - converts AC to DC but the DC output is varying

Smoothing - smooths the DC from varying greatly to a small ripple

Regulator - eliminates ripple by setting DC output to a fixed voltage

Power supplies made from these blocks are described below with a circuit diagram and a

graph of their output

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Dual Supplies

34

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 2: Self Balancing Robot

Mody Institute of Technology and Science

( a Deemed University Under Section 3 of the UGC Act 1956)

Lakshmangarh-332311 (Dist-Sikar)

P phones (01573) 225001 to 225012 (12 lines) Fax (01573) 225042

CERTIFICATE

This is to certify that the major project entitled ldquoSELF BALANCING ROBOTrdquo

submitted by MsApurva Bhardwaj(050075) MsIti Goyal(050049) MsMeenakshi

Kushwah(050167) to department of Electronics and Communication Engineering in

partial fulfillment of requirement for the degree of Bachelor of Technology by Mody

Institute of Technology and Science Lakshmangarh is a record of the work done under

my supervision and guidance

Date MsGeetanjali Sharma (Project Supervisor) Lecturer (ECE)

2

EXAMINER CERTIFICATE

The Project entitled ldquoSELF BALANCING ROBOTrdquo submitted by Ms Apurva

Bhardwaj(ECE) Ms Iti Goyal(ECE) Ms Meenakshi Kushwah(ECE) students of

BTech VII semester are approved in partial fulfillment of the requirement of the degree

of Bachelor of Technology from the Mody Institute Of Technology and

Science Lakshmangarh Sikar

Date (Examiner)

Prof SM Sharma (HOD ECE)

3

ACKNOWLEDGEMENT

ldquoPerseverance inspiration and motivation have always played a key role in any

venture It is not just the brain that matters most but that which guides them the

character the heart generous qualities and progressive forces What was conceived just

as an idea materialized slowly into concrete facts The metamorphosis took endless hours

of toil had its moments of frustration but in the end everything seemed to have senserdquo

At this level of understanding it is often difficult to understand the wide spectrum of

knowledge without proper guidance amp advice Hence we take this opportunity to express

our heartfelt gratitude to respected Ms Geetanjali Sharma who being our project guide

had faith in us enlightened us with the valuable guidance and allowed us to work on this

project

A heartfelt gratitude to Prof P K Das (Dean FET) for providing us with an opportunity

to work in the Power Electronics lab and VLSI lab as a part of the major project

We would like to thank Prof SM Sharma (HOD Electronics) for his immense interest

constant inspiration and kind co-operation throughout the period of work undertaken

We would like to pay our sincere gratitude to Mr Vijay Singh and Mr Santosh for

helping us with the technicalities of the electronics and computer lab and making our

work easier with his kind cooperation

We would also like to acknowledge our profound sense of gratitude to my Friends and

Parents for their moral support to crave out this project and above all GOD for removing

all the hurdles in the way

APURVA BHARDWAJ(050075)

ITI GOYAL(050049)

MEENAKSHI KUSHWAH(050167)

4

TABLE OF CONTENTS

SNO CONTENT PAGE NO

1 Abstract 6

2 Introduction 7

3 Component Description 10

4 Parallel Port 28

5 Power Supply 34

6 Circuit Description 41

7 Visual Basic 43

8 Coding 50

9 Conclusion 52

10 References 53

11 Appendix 54

5

ABSTRACT

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

System Required for this Project

PC with Minimum PIII with 256 MB Ram 10GB HDD amp VB60

Programmer skills

Visual Basic 60 Active Dlls ActiveX

End-user Skills

Basic Operating System handling

System Requirement

Computer Minimum PIII with 256 MB Ram 40Gb HDD VB60 Serial communication

port LPT Port

Hardware required

IR sensors Lasers Power supply D type 25 pin connector comparator IC

Global Application

Sky high building balancing

Precision balancing system

6

INTRODUCTION

What is a RobotA robot is an apparently human automaton intelligent and obedient but impersonal

machine Indeed the word robot comes from robota Czech for forced labour Yet as

robotics advances this definition is rapidly becoming old Basically a robot is a machine

designed to do a human job (excluding research robots) that is either tedious slow or

hazardous It is only relatively recently that robots have started to employ a degree of

Artificial Intelligence in their work - many robots required human operators or precise

guidance throughout their missions Slowly robots are becoming more and more

autonomous

The difference between robots and machinery is the presence of autonomy flexibility and

precision Indeed many few robots are mere extensions of machinery - but as the field

advances more and more the current fine line will widen more and more

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields Let us back-track

though and look at what could constitute a robot

Robotics is an absolutely fascinating field that interests most people - AI buff or not As

research from more serious robotics projects such as Cog and Kismet filter down into the

commercial arena we should look forward to some very interesting (and cheap) virtual

pets like Aibo and the furbies Hopefully commercial home-based robots will also be

available for a price not more than an expensive vacuum cleaner With computers

becoming more and more powerful interfacing home robots with your computer will

become a reality and house work will (hopefully) disappear

7

WHATrsquoS IN A ROBOT

Basically a robot consists of

A mechanical device such as a wheeled platform arm or other construction

capable of interacting with its environment

Sensors on or around the device that are able to sense the environment and give

useful feedback to the device

Systems that process sensory input in the context of the devices current situation

and instruct the device to perform actions in response to the situation

Mechanical platforms -- the hardware base

A robot consists of two main parts the robot body and some form of artificial

intelligence (AI) system Many different body parts can be called a robot Articulated

arms are used in welding and painting gantry and conveyor systems move parts in

factories and giant robotic machines move earth deep inside mines One of the most

interesting aspects of robots in general is their behavior which requires a form of

intelligence The simplest behavior of a robot is locomotion Typically wheels are used

as the underlying mechanism to make a robot move from one point to the next And some

force such as electricity is required to make the wheels turn under command

Motors

A variety of electric motors provide power to robots allowing them to move material

parts tools or specialized devices with various programmed motions The efficiency

rating of a motor describes how much of the electricity consumed is converted to

mechanical energy

Power supplies

Power supplies are generally provided by two types of battery Primary batteries are used

once and then discarded secondary batteries operate from a (mostly) reversible chemical

reaction and can be recharged several times Primary batteries have higher density and a

lower self-discharge rate Secondary (rechargeable) batteries have less energy than

8

primary batteries but can be recharged up to a thousand times depending on their

chemistry and environment

Sensors

Regardless of sensor hardware or software sensing and sensors can be thought of as

interacting with external events (in other words the outside world) The sensor measures

some attribute of the world The term transducer is often used interchangeably with

sensor A transducer is the mechanism or element of the sensor that transforms the

energy associated with what is being measured into another form of energy A sensor

receives energy and transmits a signal to a display or computer Sensors use transducers

to change the input signal (sound light pressure temperature etc) into an analog or

digital form capable of being used by a robot

Microcontroller systems

Microcontrollers (MCUs) are intelligent electronic devices used inside robots They

deliver functions similar to those performed by a microprocessor (central processing unit

or CPU) inside a personal computer MCUs are slower and can address less memory than

CPUs but are designed for real-world control problems One of the major differences

between CPUs and MCUs is the number of external components needed to operate them

MCUs can often run with zero external parts and typically need only an external crystal

or oscillator

There are four basic aspects of a microcontroller speed size memory and other Speed

is designated in clock cycles and is usually measured in millions of cycles per second

(Megahertz MHz) The use of the cycles varies in different MCUs affecting the usable

speed of the processor Size specifies the number of bits of information the MCU can

process in one step -- the size of its natural cluster of information

9

COMPONENT DESCRIPTION

Resistors

Example Circuit symbol

Function

Resistors restrict the flow of electric current for example a resistor is

placed in series with a light-emitting diode (LED) to limit the current

passing through the LED

Connecting and soldering

Resistors may be connected either way round They are not damaged

by heat when soldering

Resistor values - the resistor colour code

Resistance is measured in ohms the symbol for ohm is an omega

1 is quite small so resistor values are often given in k and M

1 k = 1000 1 M = 1000000

Resistor values are normally shown using coloured bands

Each colour represents a number as shown in the table

Most resistors have 4 bands

The first band gives the first digit

The second band gives the second digit

The third band indicates the number of zeros

The fourth band is used to shows the tolerance (precision) of the resistor this may

be ignored for almost all circuits but further details are given below

The Resistor

Colour Code

Colour Number

Black 0

Brown 1

Red 2

Orange 3

Yellow 4

Green 5

Blue 6

Violet 7

Grey 8

White 9

10

This resistor has red (2) violet (7) yellow (4 zeros) and gold bands

So its value is 270000 = 270 k

On circuit diagrams the is usually omitted and the value is written 270K

Small value resistors (less than 10 ohm)

The standard colour code cannot show values of less than 10 To show these small

values two special colours are used for the third band gold which means times 01 and silver

which means times 001 The first and second bands represent the digits as normal

For example

red violet gold bands represent 27 times 01 = 27

green blue silver bands represent 56 times 001 = 056

Tolerance of resistors (fourth band of colour code)

The tolerance of a resistor is shown by the fourth band of the colour code Tolerance is

the precision of the resistor and it is given as a percentage For example a 390 resistor

with a tolerance of plusmn10 will have a value within 10 of 390 between 390 - 39 = 351

and 390 + 39 = 429 (39 is 10 of 390)

A special colour code is used for the fourth band tolerance

silver plusmn10 gold plusmn5 red plusmn2 brown plusmn1

If no fourth band is shown the tolerance is plusmn20

Tolerance may be ignored for almost all circuits because precise resistor values are rarely

required

11

Transistors

Function

Transistors amplify current for example they can be used to amplify the small output

current from a logic chip so that it can operate a lamp relay or other high current device

In many circuits a resistor is used to convert the changing current to a changing voltage

so the transistor is being used to amplify voltage

A transistor may be used as a switch (either fully on with maximum current or fully off

with no current) and as an amplifier (always partly on)

The amount of current amplification is called the current gain symbol hFE

There are two types of standard transistors NPN and PNP

with different circuit symbols The letters refer to the layers

of semiconductor material used to make the transistor Most

transistors used today are NPN because this is the easiest

type to make from silicon If you are new to electronics it is

best to start by learning how to use NPN transistors

The leads are labeled base (B) collector (C) and emitter (E)

These terms refer to the internal operation of a transistor but they are not much help in

understanding how a transistor is used so just treat them as labels

A Darlington pair is two transistors connected together to give a very high current gain

In addition to standard (bipolar junction) transistors there are field-effect transistors

which are usually referred to as FETs They have different circuit symbols and properties

and they are not (yet) covered by this page

Transistor circuit symbols

12

Connecting

Transistors have three leads which

must be connected the correct way

round Please take care with this

because a wrongly connected transistor

may be damaged instantly when you

switch on

If you are lucky the orientation of the

transistor will be clear from the PCB or

stripboard layout diagram otherwise you will need to refer to a suppliers catalogue to

identify the leads

The drawings on the right show the leads for some of the most common case styles

Please note that transistor lead diagrams show the view from below with the leads

towards you This is the opposite of IC (chip) pin diagrams

which show the view from above

Soldering

Transistors can be damaged by heat when soldering so if you

are not an expert it is wise to use a heat sink clipped to the lead

between the joint and the transistor body A standard crocodile clip can be used as a heat

sink

Do not confuse this temporary heat sink with the permanent heat sink (described below)

which may be required for a power transistor to prevent it overheating during operation

Transistor leads for some common case styles

Crocodile clip

13

Heat sinks

Waste heat is produced in transistors due to the current flowing through

them Heat sinks are needed for power transistors because they pass

large currents If you find that a transistor is becoming too hot to touch it certainly needs

a heat sink The heat sink helps to dissipate (remove) the heat by transferring it to the

surrounding air

Darlington pair

This is two transistors connected together so that

the amplified current from the first is amplified further by the second transistor This

gives the Darlington pair a very high current gain such as 10000 Darlington pairs are

sold as complete packages containing the two transistors They have three leads

(B C and E) which are equivalent to the leads of a standard individual transistor

You can make up your own Darlington pair from two transistors

For example

For TR1 use BC548B with hFE1 = 220

For TR2 use BC639 with hFE2 = 40

The overall gain of this pair is hFE1 times hFE2 = 220 times 40 = 8800

The pairs maximum collector current IC(max) is the same as TR2

Heat sink

14

LED

Example Circuit symbol

Function

LEDs emit light when an electric current passes through them

Connecting and soldering

LEDs must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is the

short lead and there may be a slight flat on the body of round LEDs If you can see inside

the LED the cathode is the larger electrode (but this is not an official identification

method)

LEDs can be damaged by heat when soldering but the risk is small unless you are very

slow No special precautions are needed for soldering most LEDs

15

Testing an LED

Never connect an LED directly to a battery or power supply

It will be destroyed almost instantly because too much current will pass through and burn

it out

LEDs must have a resistor in series to limit the current to a safe value for quick testing

purposes a 1k resistor is suitable for most LEDs if your supply voltage is 12V or less

Remember to connect the LED the correct way round

Colours of LEDs

LEDs are available in red orange amber yellow green blue and white Blue and white

LEDs are much more expensive than the other colours

The colour of an LED is determined by the semiconductor material not by the colouring

of the package (the plastic body) LEDs of all colours are available in uncoloured

packages which may be diffused (milky) or clear (often described as water clear) The

coloured packages are also available as diffused (the standard type) or transparent

16

Capacitors

Function

Capacitors store electric charge They are used with resistors in timing circuits because it

takes time for a capacitor to fill with charge They are used to smooth varying DC

supplies by acting as a reservoir of charge They are also used in filter circuits because

capacitors easily pass AC (changing) signals but they block DC (constant) signals

Capacitance

This is a measure of a capacitors ability to store charge A large capacitance means that

more charge can be stored Capacitance is measured in farads symbol F However 1F is

very large so prefixes are used to show the smaller values

Three prefixes (multipliers) are used micro (micro) n (nano) and p (pico)

micro means 10-6 (millionth) so 1000000microF = 1F

n means 10-9 (thousand-millionth) so 1000nF = 1microF

p means 10-12 (million-millionth) so 1000pF = 1nF

Capacitor values can be very difficult to find because there are man

types of capacitor with different labeling systems

Capacitor Colour Code

A colour code was used on polyester capacitors for many years It is

now obsolete but of course there are many still around The colours

should be read like the resistor code the top three colour bands giving

the value in pF Ignore the 4th band (tolerance) and 5th band (voltage

rating) For example brown black orange means 10000pF = 10nF =

001microF Note that there are no gaps between the colour bands so 2 identical bands

actually appear as a wide band For example wide red yellow means 220nF = 022microF

Different types of capacitors

Colour Code

Colour Number

Black 0

Brown 1

Red 2

Orange 3

Yellow 4

Green 5

Blue 6

Violet 7

Grey 8

17

Electrolytic Capacitors Ceramic Capacitor

An electrolytic capacitor is a type of capacitor typically with a larger capacitance per

unit volume than other types making them valuable in relatively high-current and low-

frequency electrical circuits This is especially the case in power-supply filters where

they store charge needed to moderate output voltage and current fluctuations in rectifier

output and especially in the absence of rechargeable batteries that can provide similar

low-frequency current capacity They are also widely used as coupling capacitors in

circuits where AC should be conducted but DC should not the large value of the

capacitance allows them to pass very low frequencies

A Ceramic Capacitor is a capacitor constructed of alternating layers of metal and

ceramic with the ceramic material acting as the dielectric Depending on the dielectric

whether Class 1 or Class 2 the degree of temperaturecapacity dependence varies A

ceramic capacitor often has (especially the class 2) high dissipation factor high

frequency coefficient of dissipation Capacity depends on applied voltage and capacity

changes with aging Ceramic capacitors are used extensively in common low-precision

coupling and filtering applications They are suitable for high frequencies

A ceramic capacitor is a two-terminal non-polar device The classical ceramic capacitor

is the disk capacitor This device pre-dates the transistor and was used extensively in

vacuum-tube equipment (eg radio receivers)

Diodes

18

Function

Diodes allow electricity to flow in only one direction The arrow of the circuit symbol

shows the direction in which the current can flow Diodes are the electrical version of a

valve and early diodes were actually called valves

Example Circuit symbol

Forward Voltage Drop

Electricity uses up a little energy pushing its way through the diode rather like a person

pushing through a door with a spring This means that there is a small voltage across a

conducting diode it is called the forward voltage drop and is about 07V for all normal

diodes which are made from silicon The forward voltage drop of a diode is almost

constant whatever the current passing through the diode so they have a very steep

characteristic (current-voltage graph)

Reverse Voltage

When a reverse voltage is applied a perfect diode does not conduct but all real diodes

leak a very tiny current of a few microA or less This can be ignored in most circuits because

it will be very much smaller than the current flowing in the forward direction However

all diodes have a maximum reverse voltage (usually 50V or more) and if this is exceeded

the diode will fail and pass a large current in the reverse direction this is called

breakdown

Ordinary diodes can be split into two types Signal diodes which pass small currents of

100mA or less and Rectifier diodes which can pass large currents In addition there are

LEDs (which have their own page) and Zener diodes (at the bottom of this page)

19

Connecting and soldering

Diodes must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is

marked by a line painted on the body Diodes are labelled with their code in small print

you may need a magnifying glass to read this on small signal diodes Small signal diodes

can be damaged by heat when soldering but the risk is small unless you are using a

germanium diode (codes beginning OA) in which case you should use a heat sink

clipped to the lead between the joint and the diode body A standard crocodile clip can be

used as a heat sink

Rectifier diodes are quite robust and no special precautions are needed for soldering

them

Testing diodes

You can use a multimeter or a simple tester (battery resistor and LED) to check that a

diode conducts in one direction but not the other A lamp may be used to test a

rectifier diode but do NOT use a lamp to test a signal diode because the large current

passed by the lamp will destroy the diode

Signal diodes (small current)

20

Signal diodes are used to process information (electrical signals) in circuits so they are

only required to pass small currents of up to 100mA General purpose signal diodes such

as the 1N4148 are made from silicon and have a forward voltage drop of 07V

Germanium diodes

Such as the OA90 have a lower forward voltage drop of 02V and this makes them

suitable to use in radio circuits as detectors which extract the audio signal from the weak

radio signal

For general use where the size of the forward voltage drop is less important silicon

diodes are better because they are less easily damaged by heat when soldering they have

a lower resistance when conducting and they have very low leakage currents when a

reverse voltage is applied Rectifier diodes are used in power supplies to convert

alternating current (AC) to direct current (DC) a process called rectification They are

also used elsewhere in circuits where a large current must pass through the diode All

rectifier diodes are made from silicon and therefore have a forward voltage drop of 07V

The table shows maximum current and maximum reverse voltage for some popular

rectifier diodes The 1N4001 is suitable for most low voltage circuits with a current of

less than 1A

Bridge rectifiers

DiodeMaximum

Current

Maximum

Reverse

Voltage

1N4001 1A 50V

1N4002 1A 100V

1N4007 1A 1000V

1N5401 3A 100V

1N5408 3A 1000V

21

There are several ways of connecting diodes to make a rectifier to convert AC to

DC The bridge rectifier is one of them and it is available in special packages containing

the four diodes required Bridge rectifiers are rated by their maximum current and

maximum reverse voltage They have four leads or terminals the two DC outputs are

labeled + and - the two AC inputs are labeled

The diagram shows the operation of a bridge rectifier as it converts AC to DC Notice

how alternate pairs of diodes conduct

Transformer

A transformer makes use of Faradays law and the ferromagnetic properties of an iron

core to efficiently raise or lower AC voltages It of course cannot increase power so that

if the voltage is raised the current is proportionally lowered and vice versa

22

Flywheel Energy Storage

Overview

A flywheel in essence is a mechanical battery - simply a mass rotating about an axis

Flywheels store energy mechanically in the form of kinetic energy They take an

electrical input to accelerate the rotor up to speed by using the built-in motor and return

the electrical energy by using this same motor as a generator Flywheels are one of the

oldest and most common mechanical devises in existence They may still prove to serve

us as an important component on tomorrows vehicles and future energy needs Flywheels

are one of the most promising technologies for replacing conventional lead acid batteries

as energy storage systems for a variety of applications including automobiles

economical rural electrification systems and stand-alone remote power units commonly

used in the telecommunications industry Recent advances in the mechanical properties of

composites has rekindled interest in using the inertia of a spinning wheel to store energy

23

In addition to energy density flywheel energy storage systems (FES) also offer several

important advantages over chemical energy storage The rate at which energy can be

exchanged into or out of the battery is limited only by the motor--generator design

Therefore it is possible to withdraw large amounts of energy in a far shorter time than

with traditional chemical batteries Indeed research into exploiting this property of FES

systems to get short intense bursts of energy is ongoing with the most notable projects

being a magnetic tank gun and a fusion ignition system Of course it is also possible to

quickly charge FES batteries making them desirable for application in electric cars where

the charge time could be dropped from a matter of hours to a matter of minutes

Advantages Flywheels store energy very efficiently (high turn-around efficiency) and

have the potential for very high specific power compared with batteries Flywheels have

very high output potential and relatively long life Flywheels are relatively unaffected by

ambient temperature extremes

Disadvantages Current flywheels have low specific energy There are safety concerns

associated with flywheels due to their high speed rotor and the possibility of it breaking

loose and releasing all of its energy in an uncontrolled manner Flywheels are a less

mature technology than chemical batteries and the current cost is too high to make them

competitive in the market

VOLTAGE REGULATOR

24

A Voltage Regulator (also called a regulator) has only three legs and appears to be a

comparatively simple device but it is actually a very complex integrated circuit A

regulator converts varying input voltage and produces a constant regulated output

voltage Voltage regulators are available in a variety of outputs typically 5 volts 9 volts

and 12 volts The last two digits in the name indicate the output voltage

Introduction

It is very easy to get stabilized voltage for ICs by using a three terminal voltage regulator

The three terminal voltage regulator outputs stabilized voltage at a lower level than the

higher input voltage A voltage regulator cannot put out higher voltage than the input

voltage They are similar in appearance to a transistor The 7800 series consists of three-

terminal positive voltage regulators

These ICs are designed as fixed voltage regulators and with adequate heat sinking can

deliver output currents in excess of 1A These ICs are used to provide +5 volts and +12

volts supply Line regulation in these ICs is change in the output voltage for a change in

the input voltage Load regulation is defined as the change in output voltage for a change

in load current If there is any high voltage than 12 volt to 7812 it will convert to 12 V by

this IC If there is any voltage less than 12 volt it allows passing it FAN is used for

cooling the ICs

There are two ICs 7805 and 7812 attached with the Intel-fan heat sink From the base of

7805 IC we get the +5Volt Supply and from the base of 7812 IC we get the 12 Volt

25

supply Two LED are also connected with the respective ICs in order to indicate there

proper working

There are some voltage regulators

LM7805 for + 5 volts

LM7809 for +9 volts

LM7812 for+12 volts

LM7905 for-5 volts

LM7909 for-9 volts

LM7912 for-12 volts

Fig LM7805 Integrated Circuit Internal Schematic

The LM78XX series of voltage regulators are designed for positive input For

applications requiring negative input the LM79XX series is used

26

Fig Symbol of voltage regulator Fig A LM 7805 regulator

Fig The circuit diagram represents a typical use of a voltage regulator

Note The LM7805 can reliably deliver 1 amp at a constant voltage

Input Voltage

As a general rule the input voltage should be limited to 2 to 3 volts above the output

voltage The LM78XX series can handle up to 30 volts input but the power difference

between the input voltagecurrent ratio and output voltagecurrent ratio appears as heat If

the input voltage is unnecessarily high the regulator will get very hot Unless sufficient

heat sinking is provided the regulator will shut down

27

Parallel Port

Essentials

A first step in exploring the parallel port is learning how to get the most from a port with

your everyday applications and peripherals Things to know include how to find

configure and install a port how and when to use the new bidirectional EPP and ECP

modes and how to handle a system with multiple parallel-port peripherals

Defining the Ports

What is the parallel port In the computer world a port is a set of signal lines that the

microprocessor or CPU uses to exchange data with other components Typical uses for

ports are communicating with printers modems keyboards and displays or just about

any component Most computer ports are digital where each signal or bit is 0 or 1 A

parallel port transfers multiple bits at once while a serial port transfers a bit at a time

(though it may transfer in both directions at once)The ports explained here is about a

specific type of parallel port the one found on just about every Pc or IBM-compatible

personal computer Along with the RS-232 serial port the parallel port is a workhorse of

PC communications On newer PCs you may find other ports such as SCSI USB and

IrDA but the parallel port remains popular because its capable flexible and every PC

has one

The term PC-compatible or PC for short refers to the IBM PC and any of the

many many personal computers derived from it From another angle a PC is any

computer that can run Microsofts MS-DOS operating system and whose expansion bus is

compatible with the ISA bus in the original IBM Pc The category includes the PC XT

AT PS2 and most computers with 80x86 Pentium and compatible CPUs It does not

include the Macintosh Amiga or IBM mainframes though these and other computer

types may have ports that are similar to the parallel port on the Pc The original PCs

parallel port had eight outputs five inputs and four bidirectional lines

These are enough for communicating with many types of peripherals On many

newer PCs the eight outputs can also serve as inputs for faster communications with

scanners drives and other devices that send data to the Pc

28

The parallel port was designed as a printer port and many of the-original names for the

ports signals (PaperEnd AutoLineFeed) reflect that use But these days you can find all

kinds of things besides printers connected to the port The term peripheral or peripheral

device is a catch-all category that includes printers scanners modems and other devices

that connect to a Pc

29

Accessing Ports

Windows DOS C JAVA and Visual Basic provide several ways to read and write to

parallel ports The most direct way is reading and writing to the port registers Most

programming languages include this ability or at least allow you to add it Visual Basic

includes other options including the Printer object the Print Form method and Open

LPT x Windows also has API calls for accessing LPT ports and 16-bit programs can use

BIOS and DOS software interrupts for LPT access This chapter introduces the parallel

ports signals and ways of accessing them in the programs you write

Parallel ports can be used to connect a host of popular computer peripherals

bull Printers

bull Scanners

bull CD burners

bull External hard drives

bull Iomega Zip removable drives

bull Network adapters

bull Tape backup drives

30

Pin Out Diagram Of Parallel Port

31

Parallel Port Basics

Parallel ports were originally developed by IBM as a way to connect a printer to our PC

When IBM was in the process of designing the PC the company wanted the computer to

work with printers offered by Centronics a top printer manufacturer at the time IBM

decided not to use the same port interface on the computer that Centronics used on the

printer

Instead IBM engineers coupled a 25-pin connector DB-25 with a 36-pin Centronics

connector to create a special cable to connect the printer to the computer Other printer

manufacturers ended up adopting the Centronics interface making this strange hybrid

cable an unlikely de facto standard

When a PC sends data to a printer or other device using a parallel port it sends 8 bits of

data (1 byte) at a time These 8 bits are transmitted parallel to each other as opposed to

the same eight bits being transmitted serially (all in a single row) through a serial port

The standard parallel port is capable of sending 50 to 100 kilobytes of data per second

Lets take a closer look at what each pin does when used with a printer

bull Pin 1 carries the strobe signal It maintains a level of between 28 and 5 volts but drops

below 05 volts whenever the computer sends a byte of data This drop in voltage tells

the printer that data is being sent

Pins 2 through 9 are used to carry data To indicate that a bit has a value of 1 a

charge of 5 volts is sent through the correct pin No charge on a pin indicates avalue of

0 This is a simple but highly effective way to transmit digital information over an

analog cable in real-time

bull Pin 10 sends the acknowledge signal from the printer to the computer Like Pin 1 it

maintains a charge and drops the voltage below 05 volts to let the computer know that

the data was received

32

bull If the printer is busy it will charge Pin 11 Then it will drop the voltage below

05 volts to let the computer know it is ready to receive more data

bull The printer lets the computer know if it is out of paper by sending a charge on Pin 12

bull As long as the computer is receiving a charge on Pin 13 it knows that the device

is online

bull The computer sends an auto feed signal to the printer through Pin 14 using a 5-

volt charge

bull If the printer has any problems it drops the voltage to less than 05 volts on Pin

15 to let the computer know that there is an error

bull Whenever a new print job is ready the computer drops the charge on Pin 16 to

initialize the printer

bull Pin 17 is used by the computer to remotely take the printer offline This is

accomplished by sending a charge to the printer and maintaining it as long as you

want the printer offline

bull Pins 18-25 are grounds and are used as a reference signal for the low (below 05

volts) charge

33

Power Supply

Types of Power Supply

There are many types of power supply Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other

devices A power supply can by broken down into a series of blocks each of which

performs a particular function

For example a 5V regulated supply

Each of the blocks is described in more detail below

Transformer - steps down high voltage AC mains to low voltage AC

Rectifier - converts AC to DC but the DC output is varying

Smoothing - smooths the DC from varying greatly to a small ripple

Regulator - eliminates ripple by setting DC output to a fixed voltage

Power supplies made from these blocks are described below with a circuit diagram and a

graph of their output

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Dual Supplies

34

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 3: Self Balancing Robot

EXAMINER CERTIFICATE

The Project entitled ldquoSELF BALANCING ROBOTrdquo submitted by Ms Apurva

Bhardwaj(ECE) Ms Iti Goyal(ECE) Ms Meenakshi Kushwah(ECE) students of

BTech VII semester are approved in partial fulfillment of the requirement of the degree

of Bachelor of Technology from the Mody Institute Of Technology and

Science Lakshmangarh Sikar

Date (Examiner)

Prof SM Sharma (HOD ECE)

3

ACKNOWLEDGEMENT

ldquoPerseverance inspiration and motivation have always played a key role in any

venture It is not just the brain that matters most but that which guides them the

character the heart generous qualities and progressive forces What was conceived just

as an idea materialized slowly into concrete facts The metamorphosis took endless hours

of toil had its moments of frustration but in the end everything seemed to have senserdquo

At this level of understanding it is often difficult to understand the wide spectrum of

knowledge without proper guidance amp advice Hence we take this opportunity to express

our heartfelt gratitude to respected Ms Geetanjali Sharma who being our project guide

had faith in us enlightened us with the valuable guidance and allowed us to work on this

project

A heartfelt gratitude to Prof P K Das (Dean FET) for providing us with an opportunity

to work in the Power Electronics lab and VLSI lab as a part of the major project

We would like to thank Prof SM Sharma (HOD Electronics) for his immense interest

constant inspiration and kind co-operation throughout the period of work undertaken

We would like to pay our sincere gratitude to Mr Vijay Singh and Mr Santosh for

helping us with the technicalities of the electronics and computer lab and making our

work easier with his kind cooperation

We would also like to acknowledge our profound sense of gratitude to my Friends and

Parents for their moral support to crave out this project and above all GOD for removing

all the hurdles in the way

APURVA BHARDWAJ(050075)

ITI GOYAL(050049)

MEENAKSHI KUSHWAH(050167)

4

TABLE OF CONTENTS

SNO CONTENT PAGE NO

1 Abstract 6

2 Introduction 7

3 Component Description 10

4 Parallel Port 28

5 Power Supply 34

6 Circuit Description 41

7 Visual Basic 43

8 Coding 50

9 Conclusion 52

10 References 53

11 Appendix 54

5

ABSTRACT

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

System Required for this Project

PC with Minimum PIII with 256 MB Ram 10GB HDD amp VB60

Programmer skills

Visual Basic 60 Active Dlls ActiveX

End-user Skills

Basic Operating System handling

System Requirement

Computer Minimum PIII with 256 MB Ram 40Gb HDD VB60 Serial communication

port LPT Port

Hardware required

IR sensors Lasers Power supply D type 25 pin connector comparator IC

Global Application

Sky high building balancing

Precision balancing system

6

INTRODUCTION

What is a RobotA robot is an apparently human automaton intelligent and obedient but impersonal

machine Indeed the word robot comes from robota Czech for forced labour Yet as

robotics advances this definition is rapidly becoming old Basically a robot is a machine

designed to do a human job (excluding research robots) that is either tedious slow or

hazardous It is only relatively recently that robots have started to employ a degree of

Artificial Intelligence in their work - many robots required human operators or precise

guidance throughout their missions Slowly robots are becoming more and more

autonomous

The difference between robots and machinery is the presence of autonomy flexibility and

precision Indeed many few robots are mere extensions of machinery - but as the field

advances more and more the current fine line will widen more and more

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields Let us back-track

though and look at what could constitute a robot

Robotics is an absolutely fascinating field that interests most people - AI buff or not As

research from more serious robotics projects such as Cog and Kismet filter down into the

commercial arena we should look forward to some very interesting (and cheap) virtual

pets like Aibo and the furbies Hopefully commercial home-based robots will also be

available for a price not more than an expensive vacuum cleaner With computers

becoming more and more powerful interfacing home robots with your computer will

become a reality and house work will (hopefully) disappear

7

WHATrsquoS IN A ROBOT

Basically a robot consists of

A mechanical device such as a wheeled platform arm or other construction

capable of interacting with its environment

Sensors on or around the device that are able to sense the environment and give

useful feedback to the device

Systems that process sensory input in the context of the devices current situation

and instruct the device to perform actions in response to the situation

Mechanical platforms -- the hardware base

A robot consists of two main parts the robot body and some form of artificial

intelligence (AI) system Many different body parts can be called a robot Articulated

arms are used in welding and painting gantry and conveyor systems move parts in

factories and giant robotic machines move earth deep inside mines One of the most

interesting aspects of robots in general is their behavior which requires a form of

intelligence The simplest behavior of a robot is locomotion Typically wheels are used

as the underlying mechanism to make a robot move from one point to the next And some

force such as electricity is required to make the wheels turn under command

Motors

A variety of electric motors provide power to robots allowing them to move material

parts tools or specialized devices with various programmed motions The efficiency

rating of a motor describes how much of the electricity consumed is converted to

mechanical energy

Power supplies

Power supplies are generally provided by two types of battery Primary batteries are used

once and then discarded secondary batteries operate from a (mostly) reversible chemical

reaction and can be recharged several times Primary batteries have higher density and a

lower self-discharge rate Secondary (rechargeable) batteries have less energy than

8

primary batteries but can be recharged up to a thousand times depending on their

chemistry and environment

Sensors

Regardless of sensor hardware or software sensing and sensors can be thought of as

interacting with external events (in other words the outside world) The sensor measures

some attribute of the world The term transducer is often used interchangeably with

sensor A transducer is the mechanism or element of the sensor that transforms the

energy associated with what is being measured into another form of energy A sensor

receives energy and transmits a signal to a display or computer Sensors use transducers

to change the input signal (sound light pressure temperature etc) into an analog or

digital form capable of being used by a robot

Microcontroller systems

Microcontrollers (MCUs) are intelligent electronic devices used inside robots They

deliver functions similar to those performed by a microprocessor (central processing unit

or CPU) inside a personal computer MCUs are slower and can address less memory than

CPUs but are designed for real-world control problems One of the major differences

between CPUs and MCUs is the number of external components needed to operate them

MCUs can often run with zero external parts and typically need only an external crystal

or oscillator

There are four basic aspects of a microcontroller speed size memory and other Speed

is designated in clock cycles and is usually measured in millions of cycles per second

(Megahertz MHz) The use of the cycles varies in different MCUs affecting the usable

speed of the processor Size specifies the number of bits of information the MCU can

process in one step -- the size of its natural cluster of information

9

COMPONENT DESCRIPTION

Resistors

Example Circuit symbol

Function

Resistors restrict the flow of electric current for example a resistor is

placed in series with a light-emitting diode (LED) to limit the current

passing through the LED

Connecting and soldering

Resistors may be connected either way round They are not damaged

by heat when soldering

Resistor values - the resistor colour code

Resistance is measured in ohms the symbol for ohm is an omega

1 is quite small so resistor values are often given in k and M

1 k = 1000 1 M = 1000000

Resistor values are normally shown using coloured bands

Each colour represents a number as shown in the table

Most resistors have 4 bands

The first band gives the first digit

The second band gives the second digit

The third band indicates the number of zeros

The fourth band is used to shows the tolerance (precision) of the resistor this may

be ignored for almost all circuits but further details are given below

The Resistor

Colour Code

Colour Number

Black 0

Brown 1

Red 2

Orange 3

Yellow 4

Green 5

Blue 6

Violet 7

Grey 8

White 9

10

This resistor has red (2) violet (7) yellow (4 zeros) and gold bands

So its value is 270000 = 270 k

On circuit diagrams the is usually omitted and the value is written 270K

Small value resistors (less than 10 ohm)

The standard colour code cannot show values of less than 10 To show these small

values two special colours are used for the third band gold which means times 01 and silver

which means times 001 The first and second bands represent the digits as normal

For example

red violet gold bands represent 27 times 01 = 27

green blue silver bands represent 56 times 001 = 056

Tolerance of resistors (fourth band of colour code)

The tolerance of a resistor is shown by the fourth band of the colour code Tolerance is

the precision of the resistor and it is given as a percentage For example a 390 resistor

with a tolerance of plusmn10 will have a value within 10 of 390 between 390 - 39 = 351

and 390 + 39 = 429 (39 is 10 of 390)

A special colour code is used for the fourth band tolerance

silver plusmn10 gold plusmn5 red plusmn2 brown plusmn1

If no fourth band is shown the tolerance is plusmn20

Tolerance may be ignored for almost all circuits because precise resistor values are rarely

required

11

Transistors

Function

Transistors amplify current for example they can be used to amplify the small output

current from a logic chip so that it can operate a lamp relay or other high current device

In many circuits a resistor is used to convert the changing current to a changing voltage

so the transistor is being used to amplify voltage

A transistor may be used as a switch (either fully on with maximum current or fully off

with no current) and as an amplifier (always partly on)

The amount of current amplification is called the current gain symbol hFE

There are two types of standard transistors NPN and PNP

with different circuit symbols The letters refer to the layers

of semiconductor material used to make the transistor Most

transistors used today are NPN because this is the easiest

type to make from silicon If you are new to electronics it is

best to start by learning how to use NPN transistors

The leads are labeled base (B) collector (C) and emitter (E)

These terms refer to the internal operation of a transistor but they are not much help in

understanding how a transistor is used so just treat them as labels

A Darlington pair is two transistors connected together to give a very high current gain

In addition to standard (bipolar junction) transistors there are field-effect transistors

which are usually referred to as FETs They have different circuit symbols and properties

and they are not (yet) covered by this page

Transistor circuit symbols

12

Connecting

Transistors have three leads which

must be connected the correct way

round Please take care with this

because a wrongly connected transistor

may be damaged instantly when you

switch on

If you are lucky the orientation of the

transistor will be clear from the PCB or

stripboard layout diagram otherwise you will need to refer to a suppliers catalogue to

identify the leads

The drawings on the right show the leads for some of the most common case styles

Please note that transistor lead diagrams show the view from below with the leads

towards you This is the opposite of IC (chip) pin diagrams

which show the view from above

Soldering

Transistors can be damaged by heat when soldering so if you

are not an expert it is wise to use a heat sink clipped to the lead

between the joint and the transistor body A standard crocodile clip can be used as a heat

sink

Do not confuse this temporary heat sink with the permanent heat sink (described below)

which may be required for a power transistor to prevent it overheating during operation

Transistor leads for some common case styles

Crocodile clip

13

Heat sinks

Waste heat is produced in transistors due to the current flowing through

them Heat sinks are needed for power transistors because they pass

large currents If you find that a transistor is becoming too hot to touch it certainly needs

a heat sink The heat sink helps to dissipate (remove) the heat by transferring it to the

surrounding air

Darlington pair

This is two transistors connected together so that

the amplified current from the first is amplified further by the second transistor This

gives the Darlington pair a very high current gain such as 10000 Darlington pairs are

sold as complete packages containing the two transistors They have three leads

(B C and E) which are equivalent to the leads of a standard individual transistor

You can make up your own Darlington pair from two transistors

For example

For TR1 use BC548B with hFE1 = 220

For TR2 use BC639 with hFE2 = 40

The overall gain of this pair is hFE1 times hFE2 = 220 times 40 = 8800

The pairs maximum collector current IC(max) is the same as TR2

Heat sink

14

LED

Example Circuit symbol

Function

LEDs emit light when an electric current passes through them

Connecting and soldering

LEDs must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is the

short lead and there may be a slight flat on the body of round LEDs If you can see inside

the LED the cathode is the larger electrode (but this is not an official identification

method)

LEDs can be damaged by heat when soldering but the risk is small unless you are very

slow No special precautions are needed for soldering most LEDs

15

Testing an LED

Never connect an LED directly to a battery or power supply

It will be destroyed almost instantly because too much current will pass through and burn

it out

LEDs must have a resistor in series to limit the current to a safe value for quick testing

purposes a 1k resistor is suitable for most LEDs if your supply voltage is 12V or less

Remember to connect the LED the correct way round

Colours of LEDs

LEDs are available in red orange amber yellow green blue and white Blue and white

LEDs are much more expensive than the other colours

The colour of an LED is determined by the semiconductor material not by the colouring

of the package (the plastic body) LEDs of all colours are available in uncoloured

packages which may be diffused (milky) or clear (often described as water clear) The

coloured packages are also available as diffused (the standard type) or transparent

16

Capacitors

Function

Capacitors store electric charge They are used with resistors in timing circuits because it

takes time for a capacitor to fill with charge They are used to smooth varying DC

supplies by acting as a reservoir of charge They are also used in filter circuits because

capacitors easily pass AC (changing) signals but they block DC (constant) signals

Capacitance

This is a measure of a capacitors ability to store charge A large capacitance means that

more charge can be stored Capacitance is measured in farads symbol F However 1F is

very large so prefixes are used to show the smaller values

Three prefixes (multipliers) are used micro (micro) n (nano) and p (pico)

micro means 10-6 (millionth) so 1000000microF = 1F

n means 10-9 (thousand-millionth) so 1000nF = 1microF

p means 10-12 (million-millionth) so 1000pF = 1nF

Capacitor values can be very difficult to find because there are man

types of capacitor with different labeling systems

Capacitor Colour Code

A colour code was used on polyester capacitors for many years It is

now obsolete but of course there are many still around The colours

should be read like the resistor code the top three colour bands giving

the value in pF Ignore the 4th band (tolerance) and 5th band (voltage

rating) For example brown black orange means 10000pF = 10nF =

001microF Note that there are no gaps between the colour bands so 2 identical bands

actually appear as a wide band For example wide red yellow means 220nF = 022microF

Different types of capacitors

Colour Code

Colour Number

Black 0

Brown 1

Red 2

Orange 3

Yellow 4

Green 5

Blue 6

Violet 7

Grey 8

17

Electrolytic Capacitors Ceramic Capacitor

An electrolytic capacitor is a type of capacitor typically with a larger capacitance per

unit volume than other types making them valuable in relatively high-current and low-

frequency electrical circuits This is especially the case in power-supply filters where

they store charge needed to moderate output voltage and current fluctuations in rectifier

output and especially in the absence of rechargeable batteries that can provide similar

low-frequency current capacity They are also widely used as coupling capacitors in

circuits where AC should be conducted but DC should not the large value of the

capacitance allows them to pass very low frequencies

A Ceramic Capacitor is a capacitor constructed of alternating layers of metal and

ceramic with the ceramic material acting as the dielectric Depending on the dielectric

whether Class 1 or Class 2 the degree of temperaturecapacity dependence varies A

ceramic capacitor often has (especially the class 2) high dissipation factor high

frequency coefficient of dissipation Capacity depends on applied voltage and capacity

changes with aging Ceramic capacitors are used extensively in common low-precision

coupling and filtering applications They are suitable for high frequencies

A ceramic capacitor is a two-terminal non-polar device The classical ceramic capacitor

is the disk capacitor This device pre-dates the transistor and was used extensively in

vacuum-tube equipment (eg radio receivers)

Diodes

18

Function

Diodes allow electricity to flow in only one direction The arrow of the circuit symbol

shows the direction in which the current can flow Diodes are the electrical version of a

valve and early diodes were actually called valves

Example Circuit symbol

Forward Voltage Drop

Electricity uses up a little energy pushing its way through the diode rather like a person

pushing through a door with a spring This means that there is a small voltage across a

conducting diode it is called the forward voltage drop and is about 07V for all normal

diodes which are made from silicon The forward voltage drop of a diode is almost

constant whatever the current passing through the diode so they have a very steep

characteristic (current-voltage graph)

Reverse Voltage

When a reverse voltage is applied a perfect diode does not conduct but all real diodes

leak a very tiny current of a few microA or less This can be ignored in most circuits because

it will be very much smaller than the current flowing in the forward direction However

all diodes have a maximum reverse voltage (usually 50V or more) and if this is exceeded

the diode will fail and pass a large current in the reverse direction this is called

breakdown

Ordinary diodes can be split into two types Signal diodes which pass small currents of

100mA or less and Rectifier diodes which can pass large currents In addition there are

LEDs (which have their own page) and Zener diodes (at the bottom of this page)

19

Connecting and soldering

Diodes must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is

marked by a line painted on the body Diodes are labelled with their code in small print

you may need a magnifying glass to read this on small signal diodes Small signal diodes

can be damaged by heat when soldering but the risk is small unless you are using a

germanium diode (codes beginning OA) in which case you should use a heat sink

clipped to the lead between the joint and the diode body A standard crocodile clip can be

used as a heat sink

Rectifier diodes are quite robust and no special precautions are needed for soldering

them

Testing diodes

You can use a multimeter or a simple tester (battery resistor and LED) to check that a

diode conducts in one direction but not the other A lamp may be used to test a

rectifier diode but do NOT use a lamp to test a signal diode because the large current

passed by the lamp will destroy the diode

Signal diodes (small current)

20

Signal diodes are used to process information (electrical signals) in circuits so they are

only required to pass small currents of up to 100mA General purpose signal diodes such

as the 1N4148 are made from silicon and have a forward voltage drop of 07V

Germanium diodes

Such as the OA90 have a lower forward voltage drop of 02V and this makes them

suitable to use in radio circuits as detectors which extract the audio signal from the weak

radio signal

For general use where the size of the forward voltage drop is less important silicon

diodes are better because they are less easily damaged by heat when soldering they have

a lower resistance when conducting and they have very low leakage currents when a

reverse voltage is applied Rectifier diodes are used in power supplies to convert

alternating current (AC) to direct current (DC) a process called rectification They are

also used elsewhere in circuits where a large current must pass through the diode All

rectifier diodes are made from silicon and therefore have a forward voltage drop of 07V

The table shows maximum current and maximum reverse voltage for some popular

rectifier diodes The 1N4001 is suitable for most low voltage circuits with a current of

less than 1A

Bridge rectifiers

DiodeMaximum

Current

Maximum

Reverse

Voltage

1N4001 1A 50V

1N4002 1A 100V

1N4007 1A 1000V

1N5401 3A 100V

1N5408 3A 1000V

21

There are several ways of connecting diodes to make a rectifier to convert AC to

DC The bridge rectifier is one of them and it is available in special packages containing

the four diodes required Bridge rectifiers are rated by their maximum current and

maximum reverse voltage They have four leads or terminals the two DC outputs are

labeled + and - the two AC inputs are labeled

The diagram shows the operation of a bridge rectifier as it converts AC to DC Notice

how alternate pairs of diodes conduct

Transformer

A transformer makes use of Faradays law and the ferromagnetic properties of an iron

core to efficiently raise or lower AC voltages It of course cannot increase power so that

if the voltage is raised the current is proportionally lowered and vice versa

22

Flywheel Energy Storage

Overview

A flywheel in essence is a mechanical battery - simply a mass rotating about an axis

Flywheels store energy mechanically in the form of kinetic energy They take an

electrical input to accelerate the rotor up to speed by using the built-in motor and return

the electrical energy by using this same motor as a generator Flywheels are one of the

oldest and most common mechanical devises in existence They may still prove to serve

us as an important component on tomorrows vehicles and future energy needs Flywheels

are one of the most promising technologies for replacing conventional lead acid batteries

as energy storage systems for a variety of applications including automobiles

economical rural electrification systems and stand-alone remote power units commonly

used in the telecommunications industry Recent advances in the mechanical properties of

composites has rekindled interest in using the inertia of a spinning wheel to store energy

23

In addition to energy density flywheel energy storage systems (FES) also offer several

important advantages over chemical energy storage The rate at which energy can be

exchanged into or out of the battery is limited only by the motor--generator design

Therefore it is possible to withdraw large amounts of energy in a far shorter time than

with traditional chemical batteries Indeed research into exploiting this property of FES

systems to get short intense bursts of energy is ongoing with the most notable projects

being a magnetic tank gun and a fusion ignition system Of course it is also possible to

quickly charge FES batteries making them desirable for application in electric cars where

the charge time could be dropped from a matter of hours to a matter of minutes

Advantages Flywheels store energy very efficiently (high turn-around efficiency) and

have the potential for very high specific power compared with batteries Flywheels have

very high output potential and relatively long life Flywheels are relatively unaffected by

ambient temperature extremes

Disadvantages Current flywheels have low specific energy There are safety concerns

associated with flywheels due to their high speed rotor and the possibility of it breaking

loose and releasing all of its energy in an uncontrolled manner Flywheels are a less

mature technology than chemical batteries and the current cost is too high to make them

competitive in the market

VOLTAGE REGULATOR

24

A Voltage Regulator (also called a regulator) has only three legs and appears to be a

comparatively simple device but it is actually a very complex integrated circuit A

regulator converts varying input voltage and produces a constant regulated output

voltage Voltage regulators are available in a variety of outputs typically 5 volts 9 volts

and 12 volts The last two digits in the name indicate the output voltage

Introduction

It is very easy to get stabilized voltage for ICs by using a three terminal voltage regulator

The three terminal voltage regulator outputs stabilized voltage at a lower level than the

higher input voltage A voltage regulator cannot put out higher voltage than the input

voltage They are similar in appearance to a transistor The 7800 series consists of three-

terminal positive voltage regulators

These ICs are designed as fixed voltage regulators and with adequate heat sinking can

deliver output currents in excess of 1A These ICs are used to provide +5 volts and +12

volts supply Line regulation in these ICs is change in the output voltage for a change in

the input voltage Load regulation is defined as the change in output voltage for a change

in load current If there is any high voltage than 12 volt to 7812 it will convert to 12 V by

this IC If there is any voltage less than 12 volt it allows passing it FAN is used for

cooling the ICs

There are two ICs 7805 and 7812 attached with the Intel-fan heat sink From the base of

7805 IC we get the +5Volt Supply and from the base of 7812 IC we get the 12 Volt

25

supply Two LED are also connected with the respective ICs in order to indicate there

proper working

There are some voltage regulators

LM7805 for + 5 volts

LM7809 for +9 volts

LM7812 for+12 volts

LM7905 for-5 volts

LM7909 for-9 volts

LM7912 for-12 volts

Fig LM7805 Integrated Circuit Internal Schematic

The LM78XX series of voltage regulators are designed for positive input For

applications requiring negative input the LM79XX series is used

26

Fig Symbol of voltage regulator Fig A LM 7805 regulator

Fig The circuit diagram represents a typical use of a voltage regulator

Note The LM7805 can reliably deliver 1 amp at a constant voltage

Input Voltage

As a general rule the input voltage should be limited to 2 to 3 volts above the output

voltage The LM78XX series can handle up to 30 volts input but the power difference

between the input voltagecurrent ratio and output voltagecurrent ratio appears as heat If

the input voltage is unnecessarily high the regulator will get very hot Unless sufficient

heat sinking is provided the regulator will shut down

27

Parallel Port

Essentials

A first step in exploring the parallel port is learning how to get the most from a port with

your everyday applications and peripherals Things to know include how to find

configure and install a port how and when to use the new bidirectional EPP and ECP

modes and how to handle a system with multiple parallel-port peripherals

Defining the Ports

What is the parallel port In the computer world a port is a set of signal lines that the

microprocessor or CPU uses to exchange data with other components Typical uses for

ports are communicating with printers modems keyboards and displays or just about

any component Most computer ports are digital where each signal or bit is 0 or 1 A

parallel port transfers multiple bits at once while a serial port transfers a bit at a time

(though it may transfer in both directions at once)The ports explained here is about a

specific type of parallel port the one found on just about every Pc or IBM-compatible

personal computer Along with the RS-232 serial port the parallel port is a workhorse of

PC communications On newer PCs you may find other ports such as SCSI USB and

IrDA but the parallel port remains popular because its capable flexible and every PC

has one

The term PC-compatible or PC for short refers to the IBM PC and any of the

many many personal computers derived from it From another angle a PC is any

computer that can run Microsofts MS-DOS operating system and whose expansion bus is

compatible with the ISA bus in the original IBM Pc The category includes the PC XT

AT PS2 and most computers with 80x86 Pentium and compatible CPUs It does not

include the Macintosh Amiga or IBM mainframes though these and other computer

types may have ports that are similar to the parallel port on the Pc The original PCs

parallel port had eight outputs five inputs and four bidirectional lines

These are enough for communicating with many types of peripherals On many

newer PCs the eight outputs can also serve as inputs for faster communications with

scanners drives and other devices that send data to the Pc

28

The parallel port was designed as a printer port and many of the-original names for the

ports signals (PaperEnd AutoLineFeed) reflect that use But these days you can find all

kinds of things besides printers connected to the port The term peripheral or peripheral

device is a catch-all category that includes printers scanners modems and other devices

that connect to a Pc

29

Accessing Ports

Windows DOS C JAVA and Visual Basic provide several ways to read and write to

parallel ports The most direct way is reading and writing to the port registers Most

programming languages include this ability or at least allow you to add it Visual Basic

includes other options including the Printer object the Print Form method and Open

LPT x Windows also has API calls for accessing LPT ports and 16-bit programs can use

BIOS and DOS software interrupts for LPT access This chapter introduces the parallel

ports signals and ways of accessing them in the programs you write

Parallel ports can be used to connect a host of popular computer peripherals

bull Printers

bull Scanners

bull CD burners

bull External hard drives

bull Iomega Zip removable drives

bull Network adapters

bull Tape backup drives

30

Pin Out Diagram Of Parallel Port

31

Parallel Port Basics

Parallel ports were originally developed by IBM as a way to connect a printer to our PC

When IBM was in the process of designing the PC the company wanted the computer to

work with printers offered by Centronics a top printer manufacturer at the time IBM

decided not to use the same port interface on the computer that Centronics used on the

printer

Instead IBM engineers coupled a 25-pin connector DB-25 with a 36-pin Centronics

connector to create a special cable to connect the printer to the computer Other printer

manufacturers ended up adopting the Centronics interface making this strange hybrid

cable an unlikely de facto standard

When a PC sends data to a printer or other device using a parallel port it sends 8 bits of

data (1 byte) at a time These 8 bits are transmitted parallel to each other as opposed to

the same eight bits being transmitted serially (all in a single row) through a serial port

The standard parallel port is capable of sending 50 to 100 kilobytes of data per second

Lets take a closer look at what each pin does when used with a printer

bull Pin 1 carries the strobe signal It maintains a level of between 28 and 5 volts but drops

below 05 volts whenever the computer sends a byte of data This drop in voltage tells

the printer that data is being sent

Pins 2 through 9 are used to carry data To indicate that a bit has a value of 1 a

charge of 5 volts is sent through the correct pin No charge on a pin indicates avalue of

0 This is a simple but highly effective way to transmit digital information over an

analog cable in real-time

bull Pin 10 sends the acknowledge signal from the printer to the computer Like Pin 1 it

maintains a charge and drops the voltage below 05 volts to let the computer know that

the data was received

32

bull If the printer is busy it will charge Pin 11 Then it will drop the voltage below

05 volts to let the computer know it is ready to receive more data

bull The printer lets the computer know if it is out of paper by sending a charge on Pin 12

bull As long as the computer is receiving a charge on Pin 13 it knows that the device

is online

bull The computer sends an auto feed signal to the printer through Pin 14 using a 5-

volt charge

bull If the printer has any problems it drops the voltage to less than 05 volts on Pin

15 to let the computer know that there is an error

bull Whenever a new print job is ready the computer drops the charge on Pin 16 to

initialize the printer

bull Pin 17 is used by the computer to remotely take the printer offline This is

accomplished by sending a charge to the printer and maintaining it as long as you

want the printer offline

bull Pins 18-25 are grounds and are used as a reference signal for the low (below 05

volts) charge

33

Power Supply

Types of Power Supply

There are many types of power supply Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other

devices A power supply can by broken down into a series of blocks each of which

performs a particular function

For example a 5V regulated supply

Each of the blocks is described in more detail below

Transformer - steps down high voltage AC mains to low voltage AC

Rectifier - converts AC to DC but the DC output is varying

Smoothing - smooths the DC from varying greatly to a small ripple

Regulator - eliminates ripple by setting DC output to a fixed voltage

Power supplies made from these blocks are described below with a circuit diagram and a

graph of their output

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Dual Supplies

34

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 4: Self Balancing Robot

ACKNOWLEDGEMENT

ldquoPerseverance inspiration and motivation have always played a key role in any

venture It is not just the brain that matters most but that which guides them the

character the heart generous qualities and progressive forces What was conceived just

as an idea materialized slowly into concrete facts The metamorphosis took endless hours

of toil had its moments of frustration but in the end everything seemed to have senserdquo

At this level of understanding it is often difficult to understand the wide spectrum of

knowledge without proper guidance amp advice Hence we take this opportunity to express

our heartfelt gratitude to respected Ms Geetanjali Sharma who being our project guide

had faith in us enlightened us with the valuable guidance and allowed us to work on this

project

A heartfelt gratitude to Prof P K Das (Dean FET) for providing us with an opportunity

to work in the Power Electronics lab and VLSI lab as a part of the major project

We would like to thank Prof SM Sharma (HOD Electronics) for his immense interest

constant inspiration and kind co-operation throughout the period of work undertaken

We would like to pay our sincere gratitude to Mr Vijay Singh and Mr Santosh for

helping us with the technicalities of the electronics and computer lab and making our

work easier with his kind cooperation

We would also like to acknowledge our profound sense of gratitude to my Friends and

Parents for their moral support to crave out this project and above all GOD for removing

all the hurdles in the way

APURVA BHARDWAJ(050075)

ITI GOYAL(050049)

MEENAKSHI KUSHWAH(050167)

4

TABLE OF CONTENTS

SNO CONTENT PAGE NO

1 Abstract 6

2 Introduction 7

3 Component Description 10

4 Parallel Port 28

5 Power Supply 34

6 Circuit Description 41

7 Visual Basic 43

8 Coding 50

9 Conclusion 52

10 References 53

11 Appendix 54

5

ABSTRACT

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

System Required for this Project

PC with Minimum PIII with 256 MB Ram 10GB HDD amp VB60

Programmer skills

Visual Basic 60 Active Dlls ActiveX

End-user Skills

Basic Operating System handling

System Requirement

Computer Minimum PIII with 256 MB Ram 40Gb HDD VB60 Serial communication

port LPT Port

Hardware required

IR sensors Lasers Power supply D type 25 pin connector comparator IC

Global Application

Sky high building balancing

Precision balancing system

6

INTRODUCTION

What is a RobotA robot is an apparently human automaton intelligent and obedient but impersonal

machine Indeed the word robot comes from robota Czech for forced labour Yet as

robotics advances this definition is rapidly becoming old Basically a robot is a machine

designed to do a human job (excluding research robots) that is either tedious slow or

hazardous It is only relatively recently that robots have started to employ a degree of

Artificial Intelligence in their work - many robots required human operators or precise

guidance throughout their missions Slowly robots are becoming more and more

autonomous

The difference between robots and machinery is the presence of autonomy flexibility and

precision Indeed many few robots are mere extensions of machinery - but as the field

advances more and more the current fine line will widen more and more

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields Let us back-track

though and look at what could constitute a robot

Robotics is an absolutely fascinating field that interests most people - AI buff or not As

research from more serious robotics projects such as Cog and Kismet filter down into the

commercial arena we should look forward to some very interesting (and cheap) virtual

pets like Aibo and the furbies Hopefully commercial home-based robots will also be

available for a price not more than an expensive vacuum cleaner With computers

becoming more and more powerful interfacing home robots with your computer will

become a reality and house work will (hopefully) disappear

7

WHATrsquoS IN A ROBOT

Basically a robot consists of

A mechanical device such as a wheeled platform arm or other construction

capable of interacting with its environment

Sensors on or around the device that are able to sense the environment and give

useful feedback to the device

Systems that process sensory input in the context of the devices current situation

and instruct the device to perform actions in response to the situation

Mechanical platforms -- the hardware base

A robot consists of two main parts the robot body and some form of artificial

intelligence (AI) system Many different body parts can be called a robot Articulated

arms are used in welding and painting gantry and conveyor systems move parts in

factories and giant robotic machines move earth deep inside mines One of the most

interesting aspects of robots in general is their behavior which requires a form of

intelligence The simplest behavior of a robot is locomotion Typically wheels are used

as the underlying mechanism to make a robot move from one point to the next And some

force such as electricity is required to make the wheels turn under command

Motors

A variety of electric motors provide power to robots allowing them to move material

parts tools or specialized devices with various programmed motions The efficiency

rating of a motor describes how much of the electricity consumed is converted to

mechanical energy

Power supplies

Power supplies are generally provided by two types of battery Primary batteries are used

once and then discarded secondary batteries operate from a (mostly) reversible chemical

reaction and can be recharged several times Primary batteries have higher density and a

lower self-discharge rate Secondary (rechargeable) batteries have less energy than

8

primary batteries but can be recharged up to a thousand times depending on their

chemistry and environment

Sensors

Regardless of sensor hardware or software sensing and sensors can be thought of as

interacting with external events (in other words the outside world) The sensor measures

some attribute of the world The term transducer is often used interchangeably with

sensor A transducer is the mechanism or element of the sensor that transforms the

energy associated with what is being measured into another form of energy A sensor

receives energy and transmits a signal to a display or computer Sensors use transducers

to change the input signal (sound light pressure temperature etc) into an analog or

digital form capable of being used by a robot

Microcontroller systems

Microcontrollers (MCUs) are intelligent electronic devices used inside robots They

deliver functions similar to those performed by a microprocessor (central processing unit

or CPU) inside a personal computer MCUs are slower and can address less memory than

CPUs but are designed for real-world control problems One of the major differences

between CPUs and MCUs is the number of external components needed to operate them

MCUs can often run with zero external parts and typically need only an external crystal

or oscillator

There are four basic aspects of a microcontroller speed size memory and other Speed

is designated in clock cycles and is usually measured in millions of cycles per second

(Megahertz MHz) The use of the cycles varies in different MCUs affecting the usable

speed of the processor Size specifies the number of bits of information the MCU can

process in one step -- the size of its natural cluster of information

9

COMPONENT DESCRIPTION

Resistors

Example Circuit symbol

Function

Resistors restrict the flow of electric current for example a resistor is

placed in series with a light-emitting diode (LED) to limit the current

passing through the LED

Connecting and soldering

Resistors may be connected either way round They are not damaged

by heat when soldering

Resistor values - the resistor colour code

Resistance is measured in ohms the symbol for ohm is an omega

1 is quite small so resistor values are often given in k and M

1 k = 1000 1 M = 1000000

Resistor values are normally shown using coloured bands

Each colour represents a number as shown in the table

Most resistors have 4 bands

The first band gives the first digit

The second band gives the second digit

The third band indicates the number of zeros

The fourth band is used to shows the tolerance (precision) of the resistor this may

be ignored for almost all circuits but further details are given below

The Resistor

Colour Code

Colour Number

Black 0

Brown 1

Red 2

Orange 3

Yellow 4

Green 5

Blue 6

Violet 7

Grey 8

White 9

10

This resistor has red (2) violet (7) yellow (4 zeros) and gold bands

So its value is 270000 = 270 k

On circuit diagrams the is usually omitted and the value is written 270K

Small value resistors (less than 10 ohm)

The standard colour code cannot show values of less than 10 To show these small

values two special colours are used for the third band gold which means times 01 and silver

which means times 001 The first and second bands represent the digits as normal

For example

red violet gold bands represent 27 times 01 = 27

green blue silver bands represent 56 times 001 = 056

Tolerance of resistors (fourth band of colour code)

The tolerance of a resistor is shown by the fourth band of the colour code Tolerance is

the precision of the resistor and it is given as a percentage For example a 390 resistor

with a tolerance of plusmn10 will have a value within 10 of 390 between 390 - 39 = 351

and 390 + 39 = 429 (39 is 10 of 390)

A special colour code is used for the fourth band tolerance

silver plusmn10 gold plusmn5 red plusmn2 brown plusmn1

If no fourth band is shown the tolerance is plusmn20

Tolerance may be ignored for almost all circuits because precise resistor values are rarely

required

11

Transistors

Function

Transistors amplify current for example they can be used to amplify the small output

current from a logic chip so that it can operate a lamp relay or other high current device

In many circuits a resistor is used to convert the changing current to a changing voltage

so the transistor is being used to amplify voltage

A transistor may be used as a switch (either fully on with maximum current or fully off

with no current) and as an amplifier (always partly on)

The amount of current amplification is called the current gain symbol hFE

There are two types of standard transistors NPN and PNP

with different circuit symbols The letters refer to the layers

of semiconductor material used to make the transistor Most

transistors used today are NPN because this is the easiest

type to make from silicon If you are new to electronics it is

best to start by learning how to use NPN transistors

The leads are labeled base (B) collector (C) and emitter (E)

These terms refer to the internal operation of a transistor but they are not much help in

understanding how a transistor is used so just treat them as labels

A Darlington pair is two transistors connected together to give a very high current gain

In addition to standard (bipolar junction) transistors there are field-effect transistors

which are usually referred to as FETs They have different circuit symbols and properties

and they are not (yet) covered by this page

Transistor circuit symbols

12

Connecting

Transistors have three leads which

must be connected the correct way

round Please take care with this

because a wrongly connected transistor

may be damaged instantly when you

switch on

If you are lucky the orientation of the

transistor will be clear from the PCB or

stripboard layout diagram otherwise you will need to refer to a suppliers catalogue to

identify the leads

The drawings on the right show the leads for some of the most common case styles

Please note that transistor lead diagrams show the view from below with the leads

towards you This is the opposite of IC (chip) pin diagrams

which show the view from above

Soldering

Transistors can be damaged by heat when soldering so if you

are not an expert it is wise to use a heat sink clipped to the lead

between the joint and the transistor body A standard crocodile clip can be used as a heat

sink

Do not confuse this temporary heat sink with the permanent heat sink (described below)

which may be required for a power transistor to prevent it overheating during operation

Transistor leads for some common case styles

Crocodile clip

13

Heat sinks

Waste heat is produced in transistors due to the current flowing through

them Heat sinks are needed for power transistors because they pass

large currents If you find that a transistor is becoming too hot to touch it certainly needs

a heat sink The heat sink helps to dissipate (remove) the heat by transferring it to the

surrounding air

Darlington pair

This is two transistors connected together so that

the amplified current from the first is amplified further by the second transistor This

gives the Darlington pair a very high current gain such as 10000 Darlington pairs are

sold as complete packages containing the two transistors They have three leads

(B C and E) which are equivalent to the leads of a standard individual transistor

You can make up your own Darlington pair from two transistors

For example

For TR1 use BC548B with hFE1 = 220

For TR2 use BC639 with hFE2 = 40

The overall gain of this pair is hFE1 times hFE2 = 220 times 40 = 8800

The pairs maximum collector current IC(max) is the same as TR2

Heat sink

14

LED

Example Circuit symbol

Function

LEDs emit light when an electric current passes through them

Connecting and soldering

LEDs must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is the

short lead and there may be a slight flat on the body of round LEDs If you can see inside

the LED the cathode is the larger electrode (but this is not an official identification

method)

LEDs can be damaged by heat when soldering but the risk is small unless you are very

slow No special precautions are needed for soldering most LEDs

15

Testing an LED

Never connect an LED directly to a battery or power supply

It will be destroyed almost instantly because too much current will pass through and burn

it out

LEDs must have a resistor in series to limit the current to a safe value for quick testing

purposes a 1k resistor is suitable for most LEDs if your supply voltage is 12V or less

Remember to connect the LED the correct way round

Colours of LEDs

LEDs are available in red orange amber yellow green blue and white Blue and white

LEDs are much more expensive than the other colours

The colour of an LED is determined by the semiconductor material not by the colouring

of the package (the plastic body) LEDs of all colours are available in uncoloured

packages which may be diffused (milky) or clear (often described as water clear) The

coloured packages are also available as diffused (the standard type) or transparent

16

Capacitors

Function

Capacitors store electric charge They are used with resistors in timing circuits because it

takes time for a capacitor to fill with charge They are used to smooth varying DC

supplies by acting as a reservoir of charge They are also used in filter circuits because

capacitors easily pass AC (changing) signals but they block DC (constant) signals

Capacitance

This is a measure of a capacitors ability to store charge A large capacitance means that

more charge can be stored Capacitance is measured in farads symbol F However 1F is

very large so prefixes are used to show the smaller values

Three prefixes (multipliers) are used micro (micro) n (nano) and p (pico)

micro means 10-6 (millionth) so 1000000microF = 1F

n means 10-9 (thousand-millionth) so 1000nF = 1microF

p means 10-12 (million-millionth) so 1000pF = 1nF

Capacitor values can be very difficult to find because there are man

types of capacitor with different labeling systems

Capacitor Colour Code

A colour code was used on polyester capacitors for many years It is

now obsolete but of course there are many still around The colours

should be read like the resistor code the top three colour bands giving

the value in pF Ignore the 4th band (tolerance) and 5th band (voltage

rating) For example brown black orange means 10000pF = 10nF =

001microF Note that there are no gaps between the colour bands so 2 identical bands

actually appear as a wide band For example wide red yellow means 220nF = 022microF

Different types of capacitors

Colour Code

Colour Number

Black 0

Brown 1

Red 2

Orange 3

Yellow 4

Green 5

Blue 6

Violet 7

Grey 8

17

Electrolytic Capacitors Ceramic Capacitor

An electrolytic capacitor is a type of capacitor typically with a larger capacitance per

unit volume than other types making them valuable in relatively high-current and low-

frequency electrical circuits This is especially the case in power-supply filters where

they store charge needed to moderate output voltage and current fluctuations in rectifier

output and especially in the absence of rechargeable batteries that can provide similar

low-frequency current capacity They are also widely used as coupling capacitors in

circuits where AC should be conducted but DC should not the large value of the

capacitance allows them to pass very low frequencies

A Ceramic Capacitor is a capacitor constructed of alternating layers of metal and

ceramic with the ceramic material acting as the dielectric Depending on the dielectric

whether Class 1 or Class 2 the degree of temperaturecapacity dependence varies A

ceramic capacitor often has (especially the class 2) high dissipation factor high

frequency coefficient of dissipation Capacity depends on applied voltage and capacity

changes with aging Ceramic capacitors are used extensively in common low-precision

coupling and filtering applications They are suitable for high frequencies

A ceramic capacitor is a two-terminal non-polar device The classical ceramic capacitor

is the disk capacitor This device pre-dates the transistor and was used extensively in

vacuum-tube equipment (eg radio receivers)

Diodes

18

Function

Diodes allow electricity to flow in only one direction The arrow of the circuit symbol

shows the direction in which the current can flow Diodes are the electrical version of a

valve and early diodes were actually called valves

Example Circuit symbol

Forward Voltage Drop

Electricity uses up a little energy pushing its way through the diode rather like a person

pushing through a door with a spring This means that there is a small voltage across a

conducting diode it is called the forward voltage drop and is about 07V for all normal

diodes which are made from silicon The forward voltage drop of a diode is almost

constant whatever the current passing through the diode so they have a very steep

characteristic (current-voltage graph)

Reverse Voltage

When a reverse voltage is applied a perfect diode does not conduct but all real diodes

leak a very tiny current of a few microA or less This can be ignored in most circuits because

it will be very much smaller than the current flowing in the forward direction However

all diodes have a maximum reverse voltage (usually 50V or more) and if this is exceeded

the diode will fail and pass a large current in the reverse direction this is called

breakdown

Ordinary diodes can be split into two types Signal diodes which pass small currents of

100mA or less and Rectifier diodes which can pass large currents In addition there are

LEDs (which have their own page) and Zener diodes (at the bottom of this page)

19

Connecting and soldering

Diodes must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is

marked by a line painted on the body Diodes are labelled with their code in small print

you may need a magnifying glass to read this on small signal diodes Small signal diodes

can be damaged by heat when soldering but the risk is small unless you are using a

germanium diode (codes beginning OA) in which case you should use a heat sink

clipped to the lead between the joint and the diode body A standard crocodile clip can be

used as a heat sink

Rectifier diodes are quite robust and no special precautions are needed for soldering

them

Testing diodes

You can use a multimeter or a simple tester (battery resistor and LED) to check that a

diode conducts in one direction but not the other A lamp may be used to test a

rectifier diode but do NOT use a lamp to test a signal diode because the large current

passed by the lamp will destroy the diode

Signal diodes (small current)

20

Signal diodes are used to process information (electrical signals) in circuits so they are

only required to pass small currents of up to 100mA General purpose signal diodes such

as the 1N4148 are made from silicon and have a forward voltage drop of 07V

Germanium diodes

Such as the OA90 have a lower forward voltage drop of 02V and this makes them

suitable to use in radio circuits as detectors which extract the audio signal from the weak

radio signal

For general use where the size of the forward voltage drop is less important silicon

diodes are better because they are less easily damaged by heat when soldering they have

a lower resistance when conducting and they have very low leakage currents when a

reverse voltage is applied Rectifier diodes are used in power supplies to convert

alternating current (AC) to direct current (DC) a process called rectification They are

also used elsewhere in circuits where a large current must pass through the diode All

rectifier diodes are made from silicon and therefore have a forward voltage drop of 07V

The table shows maximum current and maximum reverse voltage for some popular

rectifier diodes The 1N4001 is suitable for most low voltage circuits with a current of

less than 1A

Bridge rectifiers

DiodeMaximum

Current

Maximum

Reverse

Voltage

1N4001 1A 50V

1N4002 1A 100V

1N4007 1A 1000V

1N5401 3A 100V

1N5408 3A 1000V

21

There are several ways of connecting diodes to make a rectifier to convert AC to

DC The bridge rectifier is one of them and it is available in special packages containing

the four diodes required Bridge rectifiers are rated by their maximum current and

maximum reverse voltage They have four leads or terminals the two DC outputs are

labeled + and - the two AC inputs are labeled

The diagram shows the operation of a bridge rectifier as it converts AC to DC Notice

how alternate pairs of diodes conduct

Transformer

A transformer makes use of Faradays law and the ferromagnetic properties of an iron

core to efficiently raise or lower AC voltages It of course cannot increase power so that

if the voltage is raised the current is proportionally lowered and vice versa

22

Flywheel Energy Storage

Overview

A flywheel in essence is a mechanical battery - simply a mass rotating about an axis

Flywheels store energy mechanically in the form of kinetic energy They take an

electrical input to accelerate the rotor up to speed by using the built-in motor and return

the electrical energy by using this same motor as a generator Flywheels are one of the

oldest and most common mechanical devises in existence They may still prove to serve

us as an important component on tomorrows vehicles and future energy needs Flywheels

are one of the most promising technologies for replacing conventional lead acid batteries

as energy storage systems for a variety of applications including automobiles

economical rural electrification systems and stand-alone remote power units commonly

used in the telecommunications industry Recent advances in the mechanical properties of

composites has rekindled interest in using the inertia of a spinning wheel to store energy

23

In addition to energy density flywheel energy storage systems (FES) also offer several

important advantages over chemical energy storage The rate at which energy can be

exchanged into or out of the battery is limited only by the motor--generator design

Therefore it is possible to withdraw large amounts of energy in a far shorter time than

with traditional chemical batteries Indeed research into exploiting this property of FES

systems to get short intense bursts of energy is ongoing with the most notable projects

being a magnetic tank gun and a fusion ignition system Of course it is also possible to

quickly charge FES batteries making them desirable for application in electric cars where

the charge time could be dropped from a matter of hours to a matter of minutes

Advantages Flywheels store energy very efficiently (high turn-around efficiency) and

have the potential for very high specific power compared with batteries Flywheels have

very high output potential and relatively long life Flywheels are relatively unaffected by

ambient temperature extremes

Disadvantages Current flywheels have low specific energy There are safety concerns

associated with flywheels due to their high speed rotor and the possibility of it breaking

loose and releasing all of its energy in an uncontrolled manner Flywheels are a less

mature technology than chemical batteries and the current cost is too high to make them

competitive in the market

VOLTAGE REGULATOR

24

A Voltage Regulator (also called a regulator) has only three legs and appears to be a

comparatively simple device but it is actually a very complex integrated circuit A

regulator converts varying input voltage and produces a constant regulated output

voltage Voltage regulators are available in a variety of outputs typically 5 volts 9 volts

and 12 volts The last two digits in the name indicate the output voltage

Introduction

It is very easy to get stabilized voltage for ICs by using a three terminal voltage regulator

The three terminal voltage regulator outputs stabilized voltage at a lower level than the

higher input voltage A voltage regulator cannot put out higher voltage than the input

voltage They are similar in appearance to a transistor The 7800 series consists of three-

terminal positive voltage regulators

These ICs are designed as fixed voltage regulators and with adequate heat sinking can

deliver output currents in excess of 1A These ICs are used to provide +5 volts and +12

volts supply Line regulation in these ICs is change in the output voltage for a change in

the input voltage Load regulation is defined as the change in output voltage for a change

in load current If there is any high voltage than 12 volt to 7812 it will convert to 12 V by

this IC If there is any voltage less than 12 volt it allows passing it FAN is used for

cooling the ICs

There are two ICs 7805 and 7812 attached with the Intel-fan heat sink From the base of

7805 IC we get the +5Volt Supply and from the base of 7812 IC we get the 12 Volt

25

supply Two LED are also connected with the respective ICs in order to indicate there

proper working

There are some voltage regulators

LM7805 for + 5 volts

LM7809 for +9 volts

LM7812 for+12 volts

LM7905 for-5 volts

LM7909 for-9 volts

LM7912 for-12 volts

Fig LM7805 Integrated Circuit Internal Schematic

The LM78XX series of voltage regulators are designed for positive input For

applications requiring negative input the LM79XX series is used

26

Fig Symbol of voltage regulator Fig A LM 7805 regulator

Fig The circuit diagram represents a typical use of a voltage regulator

Note The LM7805 can reliably deliver 1 amp at a constant voltage

Input Voltage

As a general rule the input voltage should be limited to 2 to 3 volts above the output

voltage The LM78XX series can handle up to 30 volts input but the power difference

between the input voltagecurrent ratio and output voltagecurrent ratio appears as heat If

the input voltage is unnecessarily high the regulator will get very hot Unless sufficient

heat sinking is provided the regulator will shut down

27

Parallel Port

Essentials

A first step in exploring the parallel port is learning how to get the most from a port with

your everyday applications and peripherals Things to know include how to find

configure and install a port how and when to use the new bidirectional EPP and ECP

modes and how to handle a system with multiple parallel-port peripherals

Defining the Ports

What is the parallel port In the computer world a port is a set of signal lines that the

microprocessor or CPU uses to exchange data with other components Typical uses for

ports are communicating with printers modems keyboards and displays or just about

any component Most computer ports are digital where each signal or bit is 0 or 1 A

parallel port transfers multiple bits at once while a serial port transfers a bit at a time

(though it may transfer in both directions at once)The ports explained here is about a

specific type of parallel port the one found on just about every Pc or IBM-compatible

personal computer Along with the RS-232 serial port the parallel port is a workhorse of

PC communications On newer PCs you may find other ports such as SCSI USB and

IrDA but the parallel port remains popular because its capable flexible and every PC

has one

The term PC-compatible or PC for short refers to the IBM PC and any of the

many many personal computers derived from it From another angle a PC is any

computer that can run Microsofts MS-DOS operating system and whose expansion bus is

compatible with the ISA bus in the original IBM Pc The category includes the PC XT

AT PS2 and most computers with 80x86 Pentium and compatible CPUs It does not

include the Macintosh Amiga or IBM mainframes though these and other computer

types may have ports that are similar to the parallel port on the Pc The original PCs

parallel port had eight outputs five inputs and four bidirectional lines

These are enough for communicating with many types of peripherals On many

newer PCs the eight outputs can also serve as inputs for faster communications with

scanners drives and other devices that send data to the Pc

28

The parallel port was designed as a printer port and many of the-original names for the

ports signals (PaperEnd AutoLineFeed) reflect that use But these days you can find all

kinds of things besides printers connected to the port The term peripheral or peripheral

device is a catch-all category that includes printers scanners modems and other devices

that connect to a Pc

29

Accessing Ports

Windows DOS C JAVA and Visual Basic provide several ways to read and write to

parallel ports The most direct way is reading and writing to the port registers Most

programming languages include this ability or at least allow you to add it Visual Basic

includes other options including the Printer object the Print Form method and Open

LPT x Windows also has API calls for accessing LPT ports and 16-bit programs can use

BIOS and DOS software interrupts for LPT access This chapter introduces the parallel

ports signals and ways of accessing them in the programs you write

Parallel ports can be used to connect a host of popular computer peripherals

bull Printers

bull Scanners

bull CD burners

bull External hard drives

bull Iomega Zip removable drives

bull Network adapters

bull Tape backup drives

30

Pin Out Diagram Of Parallel Port

31

Parallel Port Basics

Parallel ports were originally developed by IBM as a way to connect a printer to our PC

When IBM was in the process of designing the PC the company wanted the computer to

work with printers offered by Centronics a top printer manufacturer at the time IBM

decided not to use the same port interface on the computer that Centronics used on the

printer

Instead IBM engineers coupled a 25-pin connector DB-25 with a 36-pin Centronics

connector to create a special cable to connect the printer to the computer Other printer

manufacturers ended up adopting the Centronics interface making this strange hybrid

cable an unlikely de facto standard

When a PC sends data to a printer or other device using a parallel port it sends 8 bits of

data (1 byte) at a time These 8 bits are transmitted parallel to each other as opposed to

the same eight bits being transmitted serially (all in a single row) through a serial port

The standard parallel port is capable of sending 50 to 100 kilobytes of data per second

Lets take a closer look at what each pin does when used with a printer

bull Pin 1 carries the strobe signal It maintains a level of between 28 and 5 volts but drops

below 05 volts whenever the computer sends a byte of data This drop in voltage tells

the printer that data is being sent

Pins 2 through 9 are used to carry data To indicate that a bit has a value of 1 a

charge of 5 volts is sent through the correct pin No charge on a pin indicates avalue of

0 This is a simple but highly effective way to transmit digital information over an

analog cable in real-time

bull Pin 10 sends the acknowledge signal from the printer to the computer Like Pin 1 it

maintains a charge and drops the voltage below 05 volts to let the computer know that

the data was received

32

bull If the printer is busy it will charge Pin 11 Then it will drop the voltage below

05 volts to let the computer know it is ready to receive more data

bull The printer lets the computer know if it is out of paper by sending a charge on Pin 12

bull As long as the computer is receiving a charge on Pin 13 it knows that the device

is online

bull The computer sends an auto feed signal to the printer through Pin 14 using a 5-

volt charge

bull If the printer has any problems it drops the voltage to less than 05 volts on Pin

15 to let the computer know that there is an error

bull Whenever a new print job is ready the computer drops the charge on Pin 16 to

initialize the printer

bull Pin 17 is used by the computer to remotely take the printer offline This is

accomplished by sending a charge to the printer and maintaining it as long as you

want the printer offline

bull Pins 18-25 are grounds and are used as a reference signal for the low (below 05

volts) charge

33

Power Supply

Types of Power Supply

There are many types of power supply Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other

devices A power supply can by broken down into a series of blocks each of which

performs a particular function

For example a 5V regulated supply

Each of the blocks is described in more detail below

Transformer - steps down high voltage AC mains to low voltage AC

Rectifier - converts AC to DC but the DC output is varying

Smoothing - smooths the DC from varying greatly to a small ripple

Regulator - eliminates ripple by setting DC output to a fixed voltage

Power supplies made from these blocks are described below with a circuit diagram and a

graph of their output

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Dual Supplies

34

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 5: Self Balancing Robot

TABLE OF CONTENTS

SNO CONTENT PAGE NO

1 Abstract 6

2 Introduction 7

3 Component Description 10

4 Parallel Port 28

5 Power Supply 34

6 Circuit Description 41

7 Visual Basic 43

8 Coding 50

9 Conclusion 52

10 References 53

11 Appendix 54

5

ABSTRACT

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

System Required for this Project

PC with Minimum PIII with 256 MB Ram 10GB HDD amp VB60

Programmer skills

Visual Basic 60 Active Dlls ActiveX

End-user Skills

Basic Operating System handling

System Requirement

Computer Minimum PIII with 256 MB Ram 40Gb HDD VB60 Serial communication

port LPT Port

Hardware required

IR sensors Lasers Power supply D type 25 pin connector comparator IC

Global Application

Sky high building balancing

Precision balancing system

6

INTRODUCTION

What is a RobotA robot is an apparently human automaton intelligent and obedient but impersonal

machine Indeed the word robot comes from robota Czech for forced labour Yet as

robotics advances this definition is rapidly becoming old Basically a robot is a machine

designed to do a human job (excluding research robots) that is either tedious slow or

hazardous It is only relatively recently that robots have started to employ a degree of

Artificial Intelligence in their work - many robots required human operators or precise

guidance throughout their missions Slowly robots are becoming more and more

autonomous

The difference between robots and machinery is the presence of autonomy flexibility and

precision Indeed many few robots are mere extensions of machinery - but as the field

advances more and more the current fine line will widen more and more

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields Let us back-track

though and look at what could constitute a robot

Robotics is an absolutely fascinating field that interests most people - AI buff or not As

research from more serious robotics projects such as Cog and Kismet filter down into the

commercial arena we should look forward to some very interesting (and cheap) virtual

pets like Aibo and the furbies Hopefully commercial home-based robots will also be

available for a price not more than an expensive vacuum cleaner With computers

becoming more and more powerful interfacing home robots with your computer will

become a reality and house work will (hopefully) disappear

7

WHATrsquoS IN A ROBOT

Basically a robot consists of

A mechanical device such as a wheeled platform arm or other construction

capable of interacting with its environment

Sensors on or around the device that are able to sense the environment and give

useful feedback to the device

Systems that process sensory input in the context of the devices current situation

and instruct the device to perform actions in response to the situation

Mechanical platforms -- the hardware base

A robot consists of two main parts the robot body and some form of artificial

intelligence (AI) system Many different body parts can be called a robot Articulated

arms are used in welding and painting gantry and conveyor systems move parts in

factories and giant robotic machines move earth deep inside mines One of the most

interesting aspects of robots in general is their behavior which requires a form of

intelligence The simplest behavior of a robot is locomotion Typically wheels are used

as the underlying mechanism to make a robot move from one point to the next And some

force such as electricity is required to make the wheels turn under command

Motors

A variety of electric motors provide power to robots allowing them to move material

parts tools or specialized devices with various programmed motions The efficiency

rating of a motor describes how much of the electricity consumed is converted to

mechanical energy

Power supplies

Power supplies are generally provided by two types of battery Primary batteries are used

once and then discarded secondary batteries operate from a (mostly) reversible chemical

reaction and can be recharged several times Primary batteries have higher density and a

lower self-discharge rate Secondary (rechargeable) batteries have less energy than

8

primary batteries but can be recharged up to a thousand times depending on their

chemistry and environment

Sensors

Regardless of sensor hardware or software sensing and sensors can be thought of as

interacting with external events (in other words the outside world) The sensor measures

some attribute of the world The term transducer is often used interchangeably with

sensor A transducer is the mechanism or element of the sensor that transforms the

energy associated with what is being measured into another form of energy A sensor

receives energy and transmits a signal to a display or computer Sensors use transducers

to change the input signal (sound light pressure temperature etc) into an analog or

digital form capable of being used by a robot

Microcontroller systems

Microcontrollers (MCUs) are intelligent electronic devices used inside robots They

deliver functions similar to those performed by a microprocessor (central processing unit

or CPU) inside a personal computer MCUs are slower and can address less memory than

CPUs but are designed for real-world control problems One of the major differences

between CPUs and MCUs is the number of external components needed to operate them

MCUs can often run with zero external parts and typically need only an external crystal

or oscillator

There are four basic aspects of a microcontroller speed size memory and other Speed

is designated in clock cycles and is usually measured in millions of cycles per second

(Megahertz MHz) The use of the cycles varies in different MCUs affecting the usable

speed of the processor Size specifies the number of bits of information the MCU can

process in one step -- the size of its natural cluster of information

9

COMPONENT DESCRIPTION

Resistors

Example Circuit symbol

Function

Resistors restrict the flow of electric current for example a resistor is

placed in series with a light-emitting diode (LED) to limit the current

passing through the LED

Connecting and soldering

Resistors may be connected either way round They are not damaged

by heat when soldering

Resistor values - the resistor colour code

Resistance is measured in ohms the symbol for ohm is an omega

1 is quite small so resistor values are often given in k and M

1 k = 1000 1 M = 1000000

Resistor values are normally shown using coloured bands

Each colour represents a number as shown in the table

Most resistors have 4 bands

The first band gives the first digit

The second band gives the second digit

The third band indicates the number of zeros

The fourth band is used to shows the tolerance (precision) of the resistor this may

be ignored for almost all circuits but further details are given below

The Resistor

Colour Code

Colour Number

Black 0

Brown 1

Red 2

Orange 3

Yellow 4

Green 5

Blue 6

Violet 7

Grey 8

White 9

10

This resistor has red (2) violet (7) yellow (4 zeros) and gold bands

So its value is 270000 = 270 k

On circuit diagrams the is usually omitted and the value is written 270K

Small value resistors (less than 10 ohm)

The standard colour code cannot show values of less than 10 To show these small

values two special colours are used for the third band gold which means times 01 and silver

which means times 001 The first and second bands represent the digits as normal

For example

red violet gold bands represent 27 times 01 = 27

green blue silver bands represent 56 times 001 = 056

Tolerance of resistors (fourth band of colour code)

The tolerance of a resistor is shown by the fourth band of the colour code Tolerance is

the precision of the resistor and it is given as a percentage For example a 390 resistor

with a tolerance of plusmn10 will have a value within 10 of 390 between 390 - 39 = 351

and 390 + 39 = 429 (39 is 10 of 390)

A special colour code is used for the fourth band tolerance

silver plusmn10 gold plusmn5 red plusmn2 brown plusmn1

If no fourth band is shown the tolerance is plusmn20

Tolerance may be ignored for almost all circuits because precise resistor values are rarely

required

11

Transistors

Function

Transistors amplify current for example they can be used to amplify the small output

current from a logic chip so that it can operate a lamp relay or other high current device

In many circuits a resistor is used to convert the changing current to a changing voltage

so the transistor is being used to amplify voltage

A transistor may be used as a switch (either fully on with maximum current or fully off

with no current) and as an amplifier (always partly on)

The amount of current amplification is called the current gain symbol hFE

There are two types of standard transistors NPN and PNP

with different circuit symbols The letters refer to the layers

of semiconductor material used to make the transistor Most

transistors used today are NPN because this is the easiest

type to make from silicon If you are new to electronics it is

best to start by learning how to use NPN transistors

The leads are labeled base (B) collector (C) and emitter (E)

These terms refer to the internal operation of a transistor but they are not much help in

understanding how a transistor is used so just treat them as labels

A Darlington pair is two transistors connected together to give a very high current gain

In addition to standard (bipolar junction) transistors there are field-effect transistors

which are usually referred to as FETs They have different circuit symbols and properties

and they are not (yet) covered by this page

Transistor circuit symbols

12

Connecting

Transistors have three leads which

must be connected the correct way

round Please take care with this

because a wrongly connected transistor

may be damaged instantly when you

switch on

If you are lucky the orientation of the

transistor will be clear from the PCB or

stripboard layout diagram otherwise you will need to refer to a suppliers catalogue to

identify the leads

The drawings on the right show the leads for some of the most common case styles

Please note that transistor lead diagrams show the view from below with the leads

towards you This is the opposite of IC (chip) pin diagrams

which show the view from above

Soldering

Transistors can be damaged by heat when soldering so if you

are not an expert it is wise to use a heat sink clipped to the lead

between the joint and the transistor body A standard crocodile clip can be used as a heat

sink

Do not confuse this temporary heat sink with the permanent heat sink (described below)

which may be required for a power transistor to prevent it overheating during operation

Transistor leads for some common case styles

Crocodile clip

13

Heat sinks

Waste heat is produced in transistors due to the current flowing through

them Heat sinks are needed for power transistors because they pass

large currents If you find that a transistor is becoming too hot to touch it certainly needs

a heat sink The heat sink helps to dissipate (remove) the heat by transferring it to the

surrounding air

Darlington pair

This is two transistors connected together so that

the amplified current from the first is amplified further by the second transistor This

gives the Darlington pair a very high current gain such as 10000 Darlington pairs are

sold as complete packages containing the two transistors They have three leads

(B C and E) which are equivalent to the leads of a standard individual transistor

You can make up your own Darlington pair from two transistors

For example

For TR1 use BC548B with hFE1 = 220

For TR2 use BC639 with hFE2 = 40

The overall gain of this pair is hFE1 times hFE2 = 220 times 40 = 8800

The pairs maximum collector current IC(max) is the same as TR2

Heat sink

14

LED

Example Circuit symbol

Function

LEDs emit light when an electric current passes through them

Connecting and soldering

LEDs must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is the

short lead and there may be a slight flat on the body of round LEDs If you can see inside

the LED the cathode is the larger electrode (but this is not an official identification

method)

LEDs can be damaged by heat when soldering but the risk is small unless you are very

slow No special precautions are needed for soldering most LEDs

15

Testing an LED

Never connect an LED directly to a battery or power supply

It will be destroyed almost instantly because too much current will pass through and burn

it out

LEDs must have a resistor in series to limit the current to a safe value for quick testing

purposes a 1k resistor is suitable for most LEDs if your supply voltage is 12V or less

Remember to connect the LED the correct way round

Colours of LEDs

LEDs are available in red orange amber yellow green blue and white Blue and white

LEDs are much more expensive than the other colours

The colour of an LED is determined by the semiconductor material not by the colouring

of the package (the plastic body) LEDs of all colours are available in uncoloured

packages which may be diffused (milky) or clear (often described as water clear) The

coloured packages are also available as diffused (the standard type) or transparent

16

Capacitors

Function

Capacitors store electric charge They are used with resistors in timing circuits because it

takes time for a capacitor to fill with charge They are used to smooth varying DC

supplies by acting as a reservoir of charge They are also used in filter circuits because

capacitors easily pass AC (changing) signals but they block DC (constant) signals

Capacitance

This is a measure of a capacitors ability to store charge A large capacitance means that

more charge can be stored Capacitance is measured in farads symbol F However 1F is

very large so prefixes are used to show the smaller values

Three prefixes (multipliers) are used micro (micro) n (nano) and p (pico)

micro means 10-6 (millionth) so 1000000microF = 1F

n means 10-9 (thousand-millionth) so 1000nF = 1microF

p means 10-12 (million-millionth) so 1000pF = 1nF

Capacitor values can be very difficult to find because there are man

types of capacitor with different labeling systems

Capacitor Colour Code

A colour code was used on polyester capacitors for many years It is

now obsolete but of course there are many still around The colours

should be read like the resistor code the top three colour bands giving

the value in pF Ignore the 4th band (tolerance) and 5th band (voltage

rating) For example brown black orange means 10000pF = 10nF =

001microF Note that there are no gaps between the colour bands so 2 identical bands

actually appear as a wide band For example wide red yellow means 220nF = 022microF

Different types of capacitors

Colour Code

Colour Number

Black 0

Brown 1

Red 2

Orange 3

Yellow 4

Green 5

Blue 6

Violet 7

Grey 8

17

Electrolytic Capacitors Ceramic Capacitor

An electrolytic capacitor is a type of capacitor typically with a larger capacitance per

unit volume than other types making them valuable in relatively high-current and low-

frequency electrical circuits This is especially the case in power-supply filters where

they store charge needed to moderate output voltage and current fluctuations in rectifier

output and especially in the absence of rechargeable batteries that can provide similar

low-frequency current capacity They are also widely used as coupling capacitors in

circuits where AC should be conducted but DC should not the large value of the

capacitance allows them to pass very low frequencies

A Ceramic Capacitor is a capacitor constructed of alternating layers of metal and

ceramic with the ceramic material acting as the dielectric Depending on the dielectric

whether Class 1 or Class 2 the degree of temperaturecapacity dependence varies A

ceramic capacitor often has (especially the class 2) high dissipation factor high

frequency coefficient of dissipation Capacity depends on applied voltage and capacity

changes with aging Ceramic capacitors are used extensively in common low-precision

coupling and filtering applications They are suitable for high frequencies

A ceramic capacitor is a two-terminal non-polar device The classical ceramic capacitor

is the disk capacitor This device pre-dates the transistor and was used extensively in

vacuum-tube equipment (eg radio receivers)

Diodes

18

Function

Diodes allow electricity to flow in only one direction The arrow of the circuit symbol

shows the direction in which the current can flow Diodes are the electrical version of a

valve and early diodes were actually called valves

Example Circuit symbol

Forward Voltage Drop

Electricity uses up a little energy pushing its way through the diode rather like a person

pushing through a door with a spring This means that there is a small voltage across a

conducting diode it is called the forward voltage drop and is about 07V for all normal

diodes which are made from silicon The forward voltage drop of a diode is almost

constant whatever the current passing through the diode so they have a very steep

characteristic (current-voltage graph)

Reverse Voltage

When a reverse voltage is applied a perfect diode does not conduct but all real diodes

leak a very tiny current of a few microA or less This can be ignored in most circuits because

it will be very much smaller than the current flowing in the forward direction However

all diodes have a maximum reverse voltage (usually 50V or more) and if this is exceeded

the diode will fail and pass a large current in the reverse direction this is called

breakdown

Ordinary diodes can be split into two types Signal diodes which pass small currents of

100mA or less and Rectifier diodes which can pass large currents In addition there are

LEDs (which have their own page) and Zener diodes (at the bottom of this page)

19

Connecting and soldering

Diodes must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is

marked by a line painted on the body Diodes are labelled with their code in small print

you may need a magnifying glass to read this on small signal diodes Small signal diodes

can be damaged by heat when soldering but the risk is small unless you are using a

germanium diode (codes beginning OA) in which case you should use a heat sink

clipped to the lead between the joint and the diode body A standard crocodile clip can be

used as a heat sink

Rectifier diodes are quite robust and no special precautions are needed for soldering

them

Testing diodes

You can use a multimeter or a simple tester (battery resistor and LED) to check that a

diode conducts in one direction but not the other A lamp may be used to test a

rectifier diode but do NOT use a lamp to test a signal diode because the large current

passed by the lamp will destroy the diode

Signal diodes (small current)

20

Signal diodes are used to process information (electrical signals) in circuits so they are

only required to pass small currents of up to 100mA General purpose signal diodes such

as the 1N4148 are made from silicon and have a forward voltage drop of 07V

Germanium diodes

Such as the OA90 have a lower forward voltage drop of 02V and this makes them

suitable to use in radio circuits as detectors which extract the audio signal from the weak

radio signal

For general use where the size of the forward voltage drop is less important silicon

diodes are better because they are less easily damaged by heat when soldering they have

a lower resistance when conducting and they have very low leakage currents when a

reverse voltage is applied Rectifier diodes are used in power supplies to convert

alternating current (AC) to direct current (DC) a process called rectification They are

also used elsewhere in circuits where a large current must pass through the diode All

rectifier diodes are made from silicon and therefore have a forward voltage drop of 07V

The table shows maximum current and maximum reverse voltage for some popular

rectifier diodes The 1N4001 is suitable for most low voltage circuits with a current of

less than 1A

Bridge rectifiers

DiodeMaximum

Current

Maximum

Reverse

Voltage

1N4001 1A 50V

1N4002 1A 100V

1N4007 1A 1000V

1N5401 3A 100V

1N5408 3A 1000V

21

There are several ways of connecting diodes to make a rectifier to convert AC to

DC The bridge rectifier is one of them and it is available in special packages containing

the four diodes required Bridge rectifiers are rated by their maximum current and

maximum reverse voltage They have four leads or terminals the two DC outputs are

labeled + and - the two AC inputs are labeled

The diagram shows the operation of a bridge rectifier as it converts AC to DC Notice

how alternate pairs of diodes conduct

Transformer

A transformer makes use of Faradays law and the ferromagnetic properties of an iron

core to efficiently raise or lower AC voltages It of course cannot increase power so that

if the voltage is raised the current is proportionally lowered and vice versa

22

Flywheel Energy Storage

Overview

A flywheel in essence is a mechanical battery - simply a mass rotating about an axis

Flywheels store energy mechanically in the form of kinetic energy They take an

electrical input to accelerate the rotor up to speed by using the built-in motor and return

the electrical energy by using this same motor as a generator Flywheels are one of the

oldest and most common mechanical devises in existence They may still prove to serve

us as an important component on tomorrows vehicles and future energy needs Flywheels

are one of the most promising technologies for replacing conventional lead acid batteries

as energy storage systems for a variety of applications including automobiles

economical rural electrification systems and stand-alone remote power units commonly

used in the telecommunications industry Recent advances in the mechanical properties of

composites has rekindled interest in using the inertia of a spinning wheel to store energy

23

In addition to energy density flywheel energy storage systems (FES) also offer several

important advantages over chemical energy storage The rate at which energy can be

exchanged into or out of the battery is limited only by the motor--generator design

Therefore it is possible to withdraw large amounts of energy in a far shorter time than

with traditional chemical batteries Indeed research into exploiting this property of FES

systems to get short intense bursts of energy is ongoing with the most notable projects

being a magnetic tank gun and a fusion ignition system Of course it is also possible to

quickly charge FES batteries making them desirable for application in electric cars where

the charge time could be dropped from a matter of hours to a matter of minutes

Advantages Flywheels store energy very efficiently (high turn-around efficiency) and

have the potential for very high specific power compared with batteries Flywheels have

very high output potential and relatively long life Flywheels are relatively unaffected by

ambient temperature extremes

Disadvantages Current flywheels have low specific energy There are safety concerns

associated with flywheels due to their high speed rotor and the possibility of it breaking

loose and releasing all of its energy in an uncontrolled manner Flywheels are a less

mature technology than chemical batteries and the current cost is too high to make them

competitive in the market

VOLTAGE REGULATOR

24

A Voltage Regulator (also called a regulator) has only three legs and appears to be a

comparatively simple device but it is actually a very complex integrated circuit A

regulator converts varying input voltage and produces a constant regulated output

voltage Voltage regulators are available in a variety of outputs typically 5 volts 9 volts

and 12 volts The last two digits in the name indicate the output voltage

Introduction

It is very easy to get stabilized voltage for ICs by using a three terminal voltage regulator

The three terminal voltage regulator outputs stabilized voltage at a lower level than the

higher input voltage A voltage regulator cannot put out higher voltage than the input

voltage They are similar in appearance to a transistor The 7800 series consists of three-

terminal positive voltage regulators

These ICs are designed as fixed voltage regulators and with adequate heat sinking can

deliver output currents in excess of 1A These ICs are used to provide +5 volts and +12

volts supply Line regulation in these ICs is change in the output voltage for a change in

the input voltage Load regulation is defined as the change in output voltage for a change

in load current If there is any high voltage than 12 volt to 7812 it will convert to 12 V by

this IC If there is any voltage less than 12 volt it allows passing it FAN is used for

cooling the ICs

There are two ICs 7805 and 7812 attached with the Intel-fan heat sink From the base of

7805 IC we get the +5Volt Supply and from the base of 7812 IC we get the 12 Volt

25

supply Two LED are also connected with the respective ICs in order to indicate there

proper working

There are some voltage regulators

LM7805 for + 5 volts

LM7809 for +9 volts

LM7812 for+12 volts

LM7905 for-5 volts

LM7909 for-9 volts

LM7912 for-12 volts

Fig LM7805 Integrated Circuit Internal Schematic

The LM78XX series of voltage regulators are designed for positive input For

applications requiring negative input the LM79XX series is used

26

Fig Symbol of voltage regulator Fig A LM 7805 regulator

Fig The circuit diagram represents a typical use of a voltage regulator

Note The LM7805 can reliably deliver 1 amp at a constant voltage

Input Voltage

As a general rule the input voltage should be limited to 2 to 3 volts above the output

voltage The LM78XX series can handle up to 30 volts input but the power difference

between the input voltagecurrent ratio and output voltagecurrent ratio appears as heat If

the input voltage is unnecessarily high the regulator will get very hot Unless sufficient

heat sinking is provided the regulator will shut down

27

Parallel Port

Essentials

A first step in exploring the parallel port is learning how to get the most from a port with

your everyday applications and peripherals Things to know include how to find

configure and install a port how and when to use the new bidirectional EPP and ECP

modes and how to handle a system with multiple parallel-port peripherals

Defining the Ports

What is the parallel port In the computer world a port is a set of signal lines that the

microprocessor or CPU uses to exchange data with other components Typical uses for

ports are communicating with printers modems keyboards and displays or just about

any component Most computer ports are digital where each signal or bit is 0 or 1 A

parallel port transfers multiple bits at once while a serial port transfers a bit at a time

(though it may transfer in both directions at once)The ports explained here is about a

specific type of parallel port the one found on just about every Pc or IBM-compatible

personal computer Along with the RS-232 serial port the parallel port is a workhorse of

PC communications On newer PCs you may find other ports such as SCSI USB and

IrDA but the parallel port remains popular because its capable flexible and every PC

has one

The term PC-compatible or PC for short refers to the IBM PC and any of the

many many personal computers derived from it From another angle a PC is any

computer that can run Microsofts MS-DOS operating system and whose expansion bus is

compatible with the ISA bus in the original IBM Pc The category includes the PC XT

AT PS2 and most computers with 80x86 Pentium and compatible CPUs It does not

include the Macintosh Amiga or IBM mainframes though these and other computer

types may have ports that are similar to the parallel port on the Pc The original PCs

parallel port had eight outputs five inputs and four bidirectional lines

These are enough for communicating with many types of peripherals On many

newer PCs the eight outputs can also serve as inputs for faster communications with

scanners drives and other devices that send data to the Pc

28

The parallel port was designed as a printer port and many of the-original names for the

ports signals (PaperEnd AutoLineFeed) reflect that use But these days you can find all

kinds of things besides printers connected to the port The term peripheral or peripheral

device is a catch-all category that includes printers scanners modems and other devices

that connect to a Pc

29

Accessing Ports

Windows DOS C JAVA and Visual Basic provide several ways to read and write to

parallel ports The most direct way is reading and writing to the port registers Most

programming languages include this ability or at least allow you to add it Visual Basic

includes other options including the Printer object the Print Form method and Open

LPT x Windows also has API calls for accessing LPT ports and 16-bit programs can use

BIOS and DOS software interrupts for LPT access This chapter introduces the parallel

ports signals and ways of accessing them in the programs you write

Parallel ports can be used to connect a host of popular computer peripherals

bull Printers

bull Scanners

bull CD burners

bull External hard drives

bull Iomega Zip removable drives

bull Network adapters

bull Tape backup drives

30

Pin Out Diagram Of Parallel Port

31

Parallel Port Basics

Parallel ports were originally developed by IBM as a way to connect a printer to our PC

When IBM was in the process of designing the PC the company wanted the computer to

work with printers offered by Centronics a top printer manufacturer at the time IBM

decided not to use the same port interface on the computer that Centronics used on the

printer

Instead IBM engineers coupled a 25-pin connector DB-25 with a 36-pin Centronics

connector to create a special cable to connect the printer to the computer Other printer

manufacturers ended up adopting the Centronics interface making this strange hybrid

cable an unlikely de facto standard

When a PC sends data to a printer or other device using a parallel port it sends 8 bits of

data (1 byte) at a time These 8 bits are transmitted parallel to each other as opposed to

the same eight bits being transmitted serially (all in a single row) through a serial port

The standard parallel port is capable of sending 50 to 100 kilobytes of data per second

Lets take a closer look at what each pin does when used with a printer

bull Pin 1 carries the strobe signal It maintains a level of between 28 and 5 volts but drops

below 05 volts whenever the computer sends a byte of data This drop in voltage tells

the printer that data is being sent

Pins 2 through 9 are used to carry data To indicate that a bit has a value of 1 a

charge of 5 volts is sent through the correct pin No charge on a pin indicates avalue of

0 This is a simple but highly effective way to transmit digital information over an

analog cable in real-time

bull Pin 10 sends the acknowledge signal from the printer to the computer Like Pin 1 it

maintains a charge and drops the voltage below 05 volts to let the computer know that

the data was received

32

bull If the printer is busy it will charge Pin 11 Then it will drop the voltage below

05 volts to let the computer know it is ready to receive more data

bull The printer lets the computer know if it is out of paper by sending a charge on Pin 12

bull As long as the computer is receiving a charge on Pin 13 it knows that the device

is online

bull The computer sends an auto feed signal to the printer through Pin 14 using a 5-

volt charge

bull If the printer has any problems it drops the voltage to less than 05 volts on Pin

15 to let the computer know that there is an error

bull Whenever a new print job is ready the computer drops the charge on Pin 16 to

initialize the printer

bull Pin 17 is used by the computer to remotely take the printer offline This is

accomplished by sending a charge to the printer and maintaining it as long as you

want the printer offline

bull Pins 18-25 are grounds and are used as a reference signal for the low (below 05

volts) charge

33

Power Supply

Types of Power Supply

There are many types of power supply Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other

devices A power supply can by broken down into a series of blocks each of which

performs a particular function

For example a 5V regulated supply

Each of the blocks is described in more detail below

Transformer - steps down high voltage AC mains to low voltage AC

Rectifier - converts AC to DC but the DC output is varying

Smoothing - smooths the DC from varying greatly to a small ripple

Regulator - eliminates ripple by setting DC output to a fixed voltage

Power supplies made from these blocks are described below with a circuit diagram and a

graph of their output

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Dual Supplies

34

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 6: Self Balancing Robot

ABSTRACT

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

System Required for this Project

PC with Minimum PIII with 256 MB Ram 10GB HDD amp VB60

Programmer skills

Visual Basic 60 Active Dlls ActiveX

End-user Skills

Basic Operating System handling

System Requirement

Computer Minimum PIII with 256 MB Ram 40Gb HDD VB60 Serial communication

port LPT Port

Hardware required

IR sensors Lasers Power supply D type 25 pin connector comparator IC

Global Application

Sky high building balancing

Precision balancing system

6

INTRODUCTION

What is a RobotA robot is an apparently human automaton intelligent and obedient but impersonal

machine Indeed the word robot comes from robota Czech for forced labour Yet as

robotics advances this definition is rapidly becoming old Basically a robot is a machine

designed to do a human job (excluding research robots) that is either tedious slow or

hazardous It is only relatively recently that robots have started to employ a degree of

Artificial Intelligence in their work - many robots required human operators or precise

guidance throughout their missions Slowly robots are becoming more and more

autonomous

The difference between robots and machinery is the presence of autonomy flexibility and

precision Indeed many few robots are mere extensions of machinery - but as the field

advances more and more the current fine line will widen more and more

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields Let us back-track

though and look at what could constitute a robot

Robotics is an absolutely fascinating field that interests most people - AI buff or not As

research from more serious robotics projects such as Cog and Kismet filter down into the

commercial arena we should look forward to some very interesting (and cheap) virtual

pets like Aibo and the furbies Hopefully commercial home-based robots will also be

available for a price not more than an expensive vacuum cleaner With computers

becoming more and more powerful interfacing home robots with your computer will

become a reality and house work will (hopefully) disappear

7

WHATrsquoS IN A ROBOT

Basically a robot consists of

A mechanical device such as a wheeled platform arm or other construction

capable of interacting with its environment

Sensors on or around the device that are able to sense the environment and give

useful feedback to the device

Systems that process sensory input in the context of the devices current situation

and instruct the device to perform actions in response to the situation

Mechanical platforms -- the hardware base

A robot consists of two main parts the robot body and some form of artificial

intelligence (AI) system Many different body parts can be called a robot Articulated

arms are used in welding and painting gantry and conveyor systems move parts in

factories and giant robotic machines move earth deep inside mines One of the most

interesting aspects of robots in general is their behavior which requires a form of

intelligence The simplest behavior of a robot is locomotion Typically wheels are used

as the underlying mechanism to make a robot move from one point to the next And some

force such as electricity is required to make the wheels turn under command

Motors

A variety of electric motors provide power to robots allowing them to move material

parts tools or specialized devices with various programmed motions The efficiency

rating of a motor describes how much of the electricity consumed is converted to

mechanical energy

Power supplies

Power supplies are generally provided by two types of battery Primary batteries are used

once and then discarded secondary batteries operate from a (mostly) reversible chemical

reaction and can be recharged several times Primary batteries have higher density and a

lower self-discharge rate Secondary (rechargeable) batteries have less energy than

8

primary batteries but can be recharged up to a thousand times depending on their

chemistry and environment

Sensors

Regardless of sensor hardware or software sensing and sensors can be thought of as

interacting with external events (in other words the outside world) The sensor measures

some attribute of the world The term transducer is often used interchangeably with

sensor A transducer is the mechanism or element of the sensor that transforms the

energy associated with what is being measured into another form of energy A sensor

receives energy and transmits a signal to a display or computer Sensors use transducers

to change the input signal (sound light pressure temperature etc) into an analog or

digital form capable of being used by a robot

Microcontroller systems

Microcontrollers (MCUs) are intelligent electronic devices used inside robots They

deliver functions similar to those performed by a microprocessor (central processing unit

or CPU) inside a personal computer MCUs are slower and can address less memory than

CPUs but are designed for real-world control problems One of the major differences

between CPUs and MCUs is the number of external components needed to operate them

MCUs can often run with zero external parts and typically need only an external crystal

or oscillator

There are four basic aspects of a microcontroller speed size memory and other Speed

is designated in clock cycles and is usually measured in millions of cycles per second

(Megahertz MHz) The use of the cycles varies in different MCUs affecting the usable

speed of the processor Size specifies the number of bits of information the MCU can

process in one step -- the size of its natural cluster of information

9

COMPONENT DESCRIPTION

Resistors

Example Circuit symbol

Function

Resistors restrict the flow of electric current for example a resistor is

placed in series with a light-emitting diode (LED) to limit the current

passing through the LED

Connecting and soldering

Resistors may be connected either way round They are not damaged

by heat when soldering

Resistor values - the resistor colour code

Resistance is measured in ohms the symbol for ohm is an omega

1 is quite small so resistor values are often given in k and M

1 k = 1000 1 M = 1000000

Resistor values are normally shown using coloured bands

Each colour represents a number as shown in the table

Most resistors have 4 bands

The first band gives the first digit

The second band gives the second digit

The third band indicates the number of zeros

The fourth band is used to shows the tolerance (precision) of the resistor this may

be ignored for almost all circuits but further details are given below

The Resistor

Colour Code

Colour Number

Black 0

Brown 1

Red 2

Orange 3

Yellow 4

Green 5

Blue 6

Violet 7

Grey 8

White 9

10

This resistor has red (2) violet (7) yellow (4 zeros) and gold bands

So its value is 270000 = 270 k

On circuit diagrams the is usually omitted and the value is written 270K

Small value resistors (less than 10 ohm)

The standard colour code cannot show values of less than 10 To show these small

values two special colours are used for the third band gold which means times 01 and silver

which means times 001 The first and second bands represent the digits as normal

For example

red violet gold bands represent 27 times 01 = 27

green blue silver bands represent 56 times 001 = 056

Tolerance of resistors (fourth band of colour code)

The tolerance of a resistor is shown by the fourth band of the colour code Tolerance is

the precision of the resistor and it is given as a percentage For example a 390 resistor

with a tolerance of plusmn10 will have a value within 10 of 390 between 390 - 39 = 351

and 390 + 39 = 429 (39 is 10 of 390)

A special colour code is used for the fourth band tolerance

silver plusmn10 gold plusmn5 red plusmn2 brown plusmn1

If no fourth band is shown the tolerance is plusmn20

Tolerance may be ignored for almost all circuits because precise resistor values are rarely

required

11

Transistors

Function

Transistors amplify current for example they can be used to amplify the small output

current from a logic chip so that it can operate a lamp relay or other high current device

In many circuits a resistor is used to convert the changing current to a changing voltage

so the transistor is being used to amplify voltage

A transistor may be used as a switch (either fully on with maximum current or fully off

with no current) and as an amplifier (always partly on)

The amount of current amplification is called the current gain symbol hFE

There are two types of standard transistors NPN and PNP

with different circuit symbols The letters refer to the layers

of semiconductor material used to make the transistor Most

transistors used today are NPN because this is the easiest

type to make from silicon If you are new to electronics it is

best to start by learning how to use NPN transistors

The leads are labeled base (B) collector (C) and emitter (E)

These terms refer to the internal operation of a transistor but they are not much help in

understanding how a transistor is used so just treat them as labels

A Darlington pair is two transistors connected together to give a very high current gain

In addition to standard (bipolar junction) transistors there are field-effect transistors

which are usually referred to as FETs They have different circuit symbols and properties

and they are not (yet) covered by this page

Transistor circuit symbols

12

Connecting

Transistors have three leads which

must be connected the correct way

round Please take care with this

because a wrongly connected transistor

may be damaged instantly when you

switch on

If you are lucky the orientation of the

transistor will be clear from the PCB or

stripboard layout diagram otherwise you will need to refer to a suppliers catalogue to

identify the leads

The drawings on the right show the leads for some of the most common case styles

Please note that transistor lead diagrams show the view from below with the leads

towards you This is the opposite of IC (chip) pin diagrams

which show the view from above

Soldering

Transistors can be damaged by heat when soldering so if you

are not an expert it is wise to use a heat sink clipped to the lead

between the joint and the transistor body A standard crocodile clip can be used as a heat

sink

Do not confuse this temporary heat sink with the permanent heat sink (described below)

which may be required for a power transistor to prevent it overheating during operation

Transistor leads for some common case styles

Crocodile clip

13

Heat sinks

Waste heat is produced in transistors due to the current flowing through

them Heat sinks are needed for power transistors because they pass

large currents If you find that a transistor is becoming too hot to touch it certainly needs

a heat sink The heat sink helps to dissipate (remove) the heat by transferring it to the

surrounding air

Darlington pair

This is two transistors connected together so that

the amplified current from the first is amplified further by the second transistor This

gives the Darlington pair a very high current gain such as 10000 Darlington pairs are

sold as complete packages containing the two transistors They have three leads

(B C and E) which are equivalent to the leads of a standard individual transistor

You can make up your own Darlington pair from two transistors

For example

For TR1 use BC548B with hFE1 = 220

For TR2 use BC639 with hFE2 = 40

The overall gain of this pair is hFE1 times hFE2 = 220 times 40 = 8800

The pairs maximum collector current IC(max) is the same as TR2

Heat sink

14

LED

Example Circuit symbol

Function

LEDs emit light when an electric current passes through them

Connecting and soldering

LEDs must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is the

short lead and there may be a slight flat on the body of round LEDs If you can see inside

the LED the cathode is the larger electrode (but this is not an official identification

method)

LEDs can be damaged by heat when soldering but the risk is small unless you are very

slow No special precautions are needed for soldering most LEDs

15

Testing an LED

Never connect an LED directly to a battery or power supply

It will be destroyed almost instantly because too much current will pass through and burn

it out

LEDs must have a resistor in series to limit the current to a safe value for quick testing

purposes a 1k resistor is suitable for most LEDs if your supply voltage is 12V or less

Remember to connect the LED the correct way round

Colours of LEDs

LEDs are available in red orange amber yellow green blue and white Blue and white

LEDs are much more expensive than the other colours

The colour of an LED is determined by the semiconductor material not by the colouring

of the package (the plastic body) LEDs of all colours are available in uncoloured

packages which may be diffused (milky) or clear (often described as water clear) The

coloured packages are also available as diffused (the standard type) or transparent

16

Capacitors

Function

Capacitors store electric charge They are used with resistors in timing circuits because it

takes time for a capacitor to fill with charge They are used to smooth varying DC

supplies by acting as a reservoir of charge They are also used in filter circuits because

capacitors easily pass AC (changing) signals but they block DC (constant) signals

Capacitance

This is a measure of a capacitors ability to store charge A large capacitance means that

more charge can be stored Capacitance is measured in farads symbol F However 1F is

very large so prefixes are used to show the smaller values

Three prefixes (multipliers) are used micro (micro) n (nano) and p (pico)

micro means 10-6 (millionth) so 1000000microF = 1F

n means 10-9 (thousand-millionth) so 1000nF = 1microF

p means 10-12 (million-millionth) so 1000pF = 1nF

Capacitor values can be very difficult to find because there are man

types of capacitor with different labeling systems

Capacitor Colour Code

A colour code was used on polyester capacitors for many years It is

now obsolete but of course there are many still around The colours

should be read like the resistor code the top three colour bands giving

the value in pF Ignore the 4th band (tolerance) and 5th band (voltage

rating) For example brown black orange means 10000pF = 10nF =

001microF Note that there are no gaps between the colour bands so 2 identical bands

actually appear as a wide band For example wide red yellow means 220nF = 022microF

Different types of capacitors

Colour Code

Colour Number

Black 0

Brown 1

Red 2

Orange 3

Yellow 4

Green 5

Blue 6

Violet 7

Grey 8

17

Electrolytic Capacitors Ceramic Capacitor

An electrolytic capacitor is a type of capacitor typically with a larger capacitance per

unit volume than other types making them valuable in relatively high-current and low-

frequency electrical circuits This is especially the case in power-supply filters where

they store charge needed to moderate output voltage and current fluctuations in rectifier

output and especially in the absence of rechargeable batteries that can provide similar

low-frequency current capacity They are also widely used as coupling capacitors in

circuits where AC should be conducted but DC should not the large value of the

capacitance allows them to pass very low frequencies

A Ceramic Capacitor is a capacitor constructed of alternating layers of metal and

ceramic with the ceramic material acting as the dielectric Depending on the dielectric

whether Class 1 or Class 2 the degree of temperaturecapacity dependence varies A

ceramic capacitor often has (especially the class 2) high dissipation factor high

frequency coefficient of dissipation Capacity depends on applied voltage and capacity

changes with aging Ceramic capacitors are used extensively in common low-precision

coupling and filtering applications They are suitable for high frequencies

A ceramic capacitor is a two-terminal non-polar device The classical ceramic capacitor

is the disk capacitor This device pre-dates the transistor and was used extensively in

vacuum-tube equipment (eg radio receivers)

Diodes

18

Function

Diodes allow electricity to flow in only one direction The arrow of the circuit symbol

shows the direction in which the current can flow Diodes are the electrical version of a

valve and early diodes were actually called valves

Example Circuit symbol

Forward Voltage Drop

Electricity uses up a little energy pushing its way through the diode rather like a person

pushing through a door with a spring This means that there is a small voltage across a

conducting diode it is called the forward voltage drop and is about 07V for all normal

diodes which are made from silicon The forward voltage drop of a diode is almost

constant whatever the current passing through the diode so they have a very steep

characteristic (current-voltage graph)

Reverse Voltage

When a reverse voltage is applied a perfect diode does not conduct but all real diodes

leak a very tiny current of a few microA or less This can be ignored in most circuits because

it will be very much smaller than the current flowing in the forward direction However

all diodes have a maximum reverse voltage (usually 50V or more) and if this is exceeded

the diode will fail and pass a large current in the reverse direction this is called

breakdown

Ordinary diodes can be split into two types Signal diodes which pass small currents of

100mA or less and Rectifier diodes which can pass large currents In addition there are

LEDs (which have their own page) and Zener diodes (at the bottom of this page)

19

Connecting and soldering

Diodes must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is

marked by a line painted on the body Diodes are labelled with their code in small print

you may need a magnifying glass to read this on small signal diodes Small signal diodes

can be damaged by heat when soldering but the risk is small unless you are using a

germanium diode (codes beginning OA) in which case you should use a heat sink

clipped to the lead between the joint and the diode body A standard crocodile clip can be

used as a heat sink

Rectifier diodes are quite robust and no special precautions are needed for soldering

them

Testing diodes

You can use a multimeter or a simple tester (battery resistor and LED) to check that a

diode conducts in one direction but not the other A lamp may be used to test a

rectifier diode but do NOT use a lamp to test a signal diode because the large current

passed by the lamp will destroy the diode

Signal diodes (small current)

20

Signal diodes are used to process information (electrical signals) in circuits so they are

only required to pass small currents of up to 100mA General purpose signal diodes such

as the 1N4148 are made from silicon and have a forward voltage drop of 07V

Germanium diodes

Such as the OA90 have a lower forward voltage drop of 02V and this makes them

suitable to use in radio circuits as detectors which extract the audio signal from the weak

radio signal

For general use where the size of the forward voltage drop is less important silicon

diodes are better because they are less easily damaged by heat when soldering they have

a lower resistance when conducting and they have very low leakage currents when a

reverse voltage is applied Rectifier diodes are used in power supplies to convert

alternating current (AC) to direct current (DC) a process called rectification They are

also used elsewhere in circuits where a large current must pass through the diode All

rectifier diodes are made from silicon and therefore have a forward voltage drop of 07V

The table shows maximum current and maximum reverse voltage for some popular

rectifier diodes The 1N4001 is suitable for most low voltage circuits with a current of

less than 1A

Bridge rectifiers

DiodeMaximum

Current

Maximum

Reverse

Voltage

1N4001 1A 50V

1N4002 1A 100V

1N4007 1A 1000V

1N5401 3A 100V

1N5408 3A 1000V

21

There are several ways of connecting diodes to make a rectifier to convert AC to

DC The bridge rectifier is one of them and it is available in special packages containing

the four diodes required Bridge rectifiers are rated by their maximum current and

maximum reverse voltage They have four leads or terminals the two DC outputs are

labeled + and - the two AC inputs are labeled

The diagram shows the operation of a bridge rectifier as it converts AC to DC Notice

how alternate pairs of diodes conduct

Transformer

A transformer makes use of Faradays law and the ferromagnetic properties of an iron

core to efficiently raise or lower AC voltages It of course cannot increase power so that

if the voltage is raised the current is proportionally lowered and vice versa

22

Flywheel Energy Storage

Overview

A flywheel in essence is a mechanical battery - simply a mass rotating about an axis

Flywheels store energy mechanically in the form of kinetic energy They take an

electrical input to accelerate the rotor up to speed by using the built-in motor and return

the electrical energy by using this same motor as a generator Flywheels are one of the

oldest and most common mechanical devises in existence They may still prove to serve

us as an important component on tomorrows vehicles and future energy needs Flywheels

are one of the most promising technologies for replacing conventional lead acid batteries

as energy storage systems for a variety of applications including automobiles

economical rural electrification systems and stand-alone remote power units commonly

used in the telecommunications industry Recent advances in the mechanical properties of

composites has rekindled interest in using the inertia of a spinning wheel to store energy

23

In addition to energy density flywheel energy storage systems (FES) also offer several

important advantages over chemical energy storage The rate at which energy can be

exchanged into or out of the battery is limited only by the motor--generator design

Therefore it is possible to withdraw large amounts of energy in a far shorter time than

with traditional chemical batteries Indeed research into exploiting this property of FES

systems to get short intense bursts of energy is ongoing with the most notable projects

being a magnetic tank gun and a fusion ignition system Of course it is also possible to

quickly charge FES batteries making them desirable for application in electric cars where

the charge time could be dropped from a matter of hours to a matter of minutes

Advantages Flywheels store energy very efficiently (high turn-around efficiency) and

have the potential for very high specific power compared with batteries Flywheels have

very high output potential and relatively long life Flywheels are relatively unaffected by

ambient temperature extremes

Disadvantages Current flywheels have low specific energy There are safety concerns

associated with flywheels due to their high speed rotor and the possibility of it breaking

loose and releasing all of its energy in an uncontrolled manner Flywheels are a less

mature technology than chemical batteries and the current cost is too high to make them

competitive in the market

VOLTAGE REGULATOR

24

A Voltage Regulator (also called a regulator) has only three legs and appears to be a

comparatively simple device but it is actually a very complex integrated circuit A

regulator converts varying input voltage and produces a constant regulated output

voltage Voltage regulators are available in a variety of outputs typically 5 volts 9 volts

and 12 volts The last two digits in the name indicate the output voltage

Introduction

It is very easy to get stabilized voltage for ICs by using a three terminal voltage regulator

The three terminal voltage regulator outputs stabilized voltage at a lower level than the

higher input voltage A voltage regulator cannot put out higher voltage than the input

voltage They are similar in appearance to a transistor The 7800 series consists of three-

terminal positive voltage regulators

These ICs are designed as fixed voltage regulators and with adequate heat sinking can

deliver output currents in excess of 1A These ICs are used to provide +5 volts and +12

volts supply Line regulation in these ICs is change in the output voltage for a change in

the input voltage Load regulation is defined as the change in output voltage for a change

in load current If there is any high voltage than 12 volt to 7812 it will convert to 12 V by

this IC If there is any voltage less than 12 volt it allows passing it FAN is used for

cooling the ICs

There are two ICs 7805 and 7812 attached with the Intel-fan heat sink From the base of

7805 IC we get the +5Volt Supply and from the base of 7812 IC we get the 12 Volt

25

supply Two LED are also connected with the respective ICs in order to indicate there

proper working

There are some voltage regulators

LM7805 for + 5 volts

LM7809 for +9 volts

LM7812 for+12 volts

LM7905 for-5 volts

LM7909 for-9 volts

LM7912 for-12 volts

Fig LM7805 Integrated Circuit Internal Schematic

The LM78XX series of voltage regulators are designed for positive input For

applications requiring negative input the LM79XX series is used

26

Fig Symbol of voltage regulator Fig A LM 7805 regulator

Fig The circuit diagram represents a typical use of a voltage regulator

Note The LM7805 can reliably deliver 1 amp at a constant voltage

Input Voltage

As a general rule the input voltage should be limited to 2 to 3 volts above the output

voltage The LM78XX series can handle up to 30 volts input but the power difference

between the input voltagecurrent ratio and output voltagecurrent ratio appears as heat If

the input voltage is unnecessarily high the regulator will get very hot Unless sufficient

heat sinking is provided the regulator will shut down

27

Parallel Port

Essentials

A first step in exploring the parallel port is learning how to get the most from a port with

your everyday applications and peripherals Things to know include how to find

configure and install a port how and when to use the new bidirectional EPP and ECP

modes and how to handle a system with multiple parallel-port peripherals

Defining the Ports

What is the parallel port In the computer world a port is a set of signal lines that the

microprocessor or CPU uses to exchange data with other components Typical uses for

ports are communicating with printers modems keyboards and displays or just about

any component Most computer ports are digital where each signal or bit is 0 or 1 A

parallel port transfers multiple bits at once while a serial port transfers a bit at a time

(though it may transfer in both directions at once)The ports explained here is about a

specific type of parallel port the one found on just about every Pc or IBM-compatible

personal computer Along with the RS-232 serial port the parallel port is a workhorse of

PC communications On newer PCs you may find other ports such as SCSI USB and

IrDA but the parallel port remains popular because its capable flexible and every PC

has one

The term PC-compatible or PC for short refers to the IBM PC and any of the

many many personal computers derived from it From another angle a PC is any

computer that can run Microsofts MS-DOS operating system and whose expansion bus is

compatible with the ISA bus in the original IBM Pc The category includes the PC XT

AT PS2 and most computers with 80x86 Pentium and compatible CPUs It does not

include the Macintosh Amiga or IBM mainframes though these and other computer

types may have ports that are similar to the parallel port on the Pc The original PCs

parallel port had eight outputs five inputs and four bidirectional lines

These are enough for communicating with many types of peripherals On many

newer PCs the eight outputs can also serve as inputs for faster communications with

scanners drives and other devices that send data to the Pc

28

The parallel port was designed as a printer port and many of the-original names for the

ports signals (PaperEnd AutoLineFeed) reflect that use But these days you can find all

kinds of things besides printers connected to the port The term peripheral or peripheral

device is a catch-all category that includes printers scanners modems and other devices

that connect to a Pc

29

Accessing Ports

Windows DOS C JAVA and Visual Basic provide several ways to read and write to

parallel ports The most direct way is reading and writing to the port registers Most

programming languages include this ability or at least allow you to add it Visual Basic

includes other options including the Printer object the Print Form method and Open

LPT x Windows also has API calls for accessing LPT ports and 16-bit programs can use

BIOS and DOS software interrupts for LPT access This chapter introduces the parallel

ports signals and ways of accessing them in the programs you write

Parallel ports can be used to connect a host of popular computer peripherals

bull Printers

bull Scanners

bull CD burners

bull External hard drives

bull Iomega Zip removable drives

bull Network adapters

bull Tape backup drives

30

Pin Out Diagram Of Parallel Port

31

Parallel Port Basics

Parallel ports were originally developed by IBM as a way to connect a printer to our PC

When IBM was in the process of designing the PC the company wanted the computer to

work with printers offered by Centronics a top printer manufacturer at the time IBM

decided not to use the same port interface on the computer that Centronics used on the

printer

Instead IBM engineers coupled a 25-pin connector DB-25 with a 36-pin Centronics

connector to create a special cable to connect the printer to the computer Other printer

manufacturers ended up adopting the Centronics interface making this strange hybrid

cable an unlikely de facto standard

When a PC sends data to a printer or other device using a parallel port it sends 8 bits of

data (1 byte) at a time These 8 bits are transmitted parallel to each other as opposed to

the same eight bits being transmitted serially (all in a single row) through a serial port

The standard parallel port is capable of sending 50 to 100 kilobytes of data per second

Lets take a closer look at what each pin does when used with a printer

bull Pin 1 carries the strobe signal It maintains a level of between 28 and 5 volts but drops

below 05 volts whenever the computer sends a byte of data This drop in voltage tells

the printer that data is being sent

Pins 2 through 9 are used to carry data To indicate that a bit has a value of 1 a

charge of 5 volts is sent through the correct pin No charge on a pin indicates avalue of

0 This is a simple but highly effective way to transmit digital information over an

analog cable in real-time

bull Pin 10 sends the acknowledge signal from the printer to the computer Like Pin 1 it

maintains a charge and drops the voltage below 05 volts to let the computer know that

the data was received

32

bull If the printer is busy it will charge Pin 11 Then it will drop the voltage below

05 volts to let the computer know it is ready to receive more data

bull The printer lets the computer know if it is out of paper by sending a charge on Pin 12

bull As long as the computer is receiving a charge on Pin 13 it knows that the device

is online

bull The computer sends an auto feed signal to the printer through Pin 14 using a 5-

volt charge

bull If the printer has any problems it drops the voltage to less than 05 volts on Pin

15 to let the computer know that there is an error

bull Whenever a new print job is ready the computer drops the charge on Pin 16 to

initialize the printer

bull Pin 17 is used by the computer to remotely take the printer offline This is

accomplished by sending a charge to the printer and maintaining it as long as you

want the printer offline

bull Pins 18-25 are grounds and are used as a reference signal for the low (below 05

volts) charge

33

Power Supply

Types of Power Supply

There are many types of power supply Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other

devices A power supply can by broken down into a series of blocks each of which

performs a particular function

For example a 5V regulated supply

Each of the blocks is described in more detail below

Transformer - steps down high voltage AC mains to low voltage AC

Rectifier - converts AC to DC but the DC output is varying

Smoothing - smooths the DC from varying greatly to a small ripple

Regulator - eliminates ripple by setting DC output to a fixed voltage

Power supplies made from these blocks are described below with a circuit diagram and a

graph of their output

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Dual Supplies

34

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 7: Self Balancing Robot

INTRODUCTION

What is a RobotA robot is an apparently human automaton intelligent and obedient but impersonal

machine Indeed the word robot comes from robota Czech for forced labour Yet as

robotics advances this definition is rapidly becoming old Basically a robot is a machine

designed to do a human job (excluding research robots) that is either tedious slow or

hazardous It is only relatively recently that robots have started to employ a degree of

Artificial Intelligence in their work - many robots required human operators or precise

guidance throughout their missions Slowly robots are becoming more and more

autonomous

The difference between robots and machinery is the presence of autonomy flexibility and

precision Indeed many few robots are mere extensions of machinery - but as the field

advances more and more the current fine line will widen more and more

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields Let us back-track

though and look at what could constitute a robot

Robotics is an absolutely fascinating field that interests most people - AI buff or not As

research from more serious robotics projects such as Cog and Kismet filter down into the

commercial arena we should look forward to some very interesting (and cheap) virtual

pets like Aibo and the furbies Hopefully commercial home-based robots will also be

available for a price not more than an expensive vacuum cleaner With computers

becoming more and more powerful interfacing home robots with your computer will

become a reality and house work will (hopefully) disappear

7

WHATrsquoS IN A ROBOT

Basically a robot consists of

A mechanical device such as a wheeled platform arm or other construction

capable of interacting with its environment

Sensors on or around the device that are able to sense the environment and give

useful feedback to the device

Systems that process sensory input in the context of the devices current situation

and instruct the device to perform actions in response to the situation

Mechanical platforms -- the hardware base

A robot consists of two main parts the robot body and some form of artificial

intelligence (AI) system Many different body parts can be called a robot Articulated

arms are used in welding and painting gantry and conveyor systems move parts in

factories and giant robotic machines move earth deep inside mines One of the most

interesting aspects of robots in general is their behavior which requires a form of

intelligence The simplest behavior of a robot is locomotion Typically wheels are used

as the underlying mechanism to make a robot move from one point to the next And some

force such as electricity is required to make the wheels turn under command

Motors

A variety of electric motors provide power to robots allowing them to move material

parts tools or specialized devices with various programmed motions The efficiency

rating of a motor describes how much of the electricity consumed is converted to

mechanical energy

Power supplies

Power supplies are generally provided by two types of battery Primary batteries are used

once and then discarded secondary batteries operate from a (mostly) reversible chemical

reaction and can be recharged several times Primary batteries have higher density and a

lower self-discharge rate Secondary (rechargeable) batteries have less energy than

8

primary batteries but can be recharged up to a thousand times depending on their

chemistry and environment

Sensors

Regardless of sensor hardware or software sensing and sensors can be thought of as

interacting with external events (in other words the outside world) The sensor measures

some attribute of the world The term transducer is often used interchangeably with

sensor A transducer is the mechanism or element of the sensor that transforms the

energy associated with what is being measured into another form of energy A sensor

receives energy and transmits a signal to a display or computer Sensors use transducers

to change the input signal (sound light pressure temperature etc) into an analog or

digital form capable of being used by a robot

Microcontroller systems

Microcontrollers (MCUs) are intelligent electronic devices used inside robots They

deliver functions similar to those performed by a microprocessor (central processing unit

or CPU) inside a personal computer MCUs are slower and can address less memory than

CPUs but are designed for real-world control problems One of the major differences

between CPUs and MCUs is the number of external components needed to operate them

MCUs can often run with zero external parts and typically need only an external crystal

or oscillator

There are four basic aspects of a microcontroller speed size memory and other Speed

is designated in clock cycles and is usually measured in millions of cycles per second

(Megahertz MHz) The use of the cycles varies in different MCUs affecting the usable

speed of the processor Size specifies the number of bits of information the MCU can

process in one step -- the size of its natural cluster of information

9

COMPONENT DESCRIPTION

Resistors

Example Circuit symbol

Function

Resistors restrict the flow of electric current for example a resistor is

placed in series with a light-emitting diode (LED) to limit the current

passing through the LED

Connecting and soldering

Resistors may be connected either way round They are not damaged

by heat when soldering

Resistor values - the resistor colour code

Resistance is measured in ohms the symbol for ohm is an omega

1 is quite small so resistor values are often given in k and M

1 k = 1000 1 M = 1000000

Resistor values are normally shown using coloured bands

Each colour represents a number as shown in the table

Most resistors have 4 bands

The first band gives the first digit

The second band gives the second digit

The third band indicates the number of zeros

The fourth band is used to shows the tolerance (precision) of the resistor this may

be ignored for almost all circuits but further details are given below

The Resistor

Colour Code

Colour Number

Black 0

Brown 1

Red 2

Orange 3

Yellow 4

Green 5

Blue 6

Violet 7

Grey 8

White 9

10

This resistor has red (2) violet (7) yellow (4 zeros) and gold bands

So its value is 270000 = 270 k

On circuit diagrams the is usually omitted and the value is written 270K

Small value resistors (less than 10 ohm)

The standard colour code cannot show values of less than 10 To show these small

values two special colours are used for the third band gold which means times 01 and silver

which means times 001 The first and second bands represent the digits as normal

For example

red violet gold bands represent 27 times 01 = 27

green blue silver bands represent 56 times 001 = 056

Tolerance of resistors (fourth band of colour code)

The tolerance of a resistor is shown by the fourth band of the colour code Tolerance is

the precision of the resistor and it is given as a percentage For example a 390 resistor

with a tolerance of plusmn10 will have a value within 10 of 390 between 390 - 39 = 351

and 390 + 39 = 429 (39 is 10 of 390)

A special colour code is used for the fourth band tolerance

silver plusmn10 gold plusmn5 red plusmn2 brown plusmn1

If no fourth band is shown the tolerance is plusmn20

Tolerance may be ignored for almost all circuits because precise resistor values are rarely

required

11

Transistors

Function

Transistors amplify current for example they can be used to amplify the small output

current from a logic chip so that it can operate a lamp relay or other high current device

In many circuits a resistor is used to convert the changing current to a changing voltage

so the transistor is being used to amplify voltage

A transistor may be used as a switch (either fully on with maximum current or fully off

with no current) and as an amplifier (always partly on)

The amount of current amplification is called the current gain symbol hFE

There are two types of standard transistors NPN and PNP

with different circuit symbols The letters refer to the layers

of semiconductor material used to make the transistor Most

transistors used today are NPN because this is the easiest

type to make from silicon If you are new to electronics it is

best to start by learning how to use NPN transistors

The leads are labeled base (B) collector (C) and emitter (E)

These terms refer to the internal operation of a transistor but they are not much help in

understanding how a transistor is used so just treat them as labels

A Darlington pair is two transistors connected together to give a very high current gain

In addition to standard (bipolar junction) transistors there are field-effect transistors

which are usually referred to as FETs They have different circuit symbols and properties

and they are not (yet) covered by this page

Transistor circuit symbols

12

Connecting

Transistors have three leads which

must be connected the correct way

round Please take care with this

because a wrongly connected transistor

may be damaged instantly when you

switch on

If you are lucky the orientation of the

transistor will be clear from the PCB or

stripboard layout diagram otherwise you will need to refer to a suppliers catalogue to

identify the leads

The drawings on the right show the leads for some of the most common case styles

Please note that transistor lead diagrams show the view from below with the leads

towards you This is the opposite of IC (chip) pin diagrams

which show the view from above

Soldering

Transistors can be damaged by heat when soldering so if you

are not an expert it is wise to use a heat sink clipped to the lead

between the joint and the transistor body A standard crocodile clip can be used as a heat

sink

Do not confuse this temporary heat sink with the permanent heat sink (described below)

which may be required for a power transistor to prevent it overheating during operation

Transistor leads for some common case styles

Crocodile clip

13

Heat sinks

Waste heat is produced in transistors due to the current flowing through

them Heat sinks are needed for power transistors because they pass

large currents If you find that a transistor is becoming too hot to touch it certainly needs

a heat sink The heat sink helps to dissipate (remove) the heat by transferring it to the

surrounding air

Darlington pair

This is two transistors connected together so that

the amplified current from the first is amplified further by the second transistor This

gives the Darlington pair a very high current gain such as 10000 Darlington pairs are

sold as complete packages containing the two transistors They have three leads

(B C and E) which are equivalent to the leads of a standard individual transistor

You can make up your own Darlington pair from two transistors

For example

For TR1 use BC548B with hFE1 = 220

For TR2 use BC639 with hFE2 = 40

The overall gain of this pair is hFE1 times hFE2 = 220 times 40 = 8800

The pairs maximum collector current IC(max) is the same as TR2

Heat sink

14

LED

Example Circuit symbol

Function

LEDs emit light when an electric current passes through them

Connecting and soldering

LEDs must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is the

short lead and there may be a slight flat on the body of round LEDs If you can see inside

the LED the cathode is the larger electrode (but this is not an official identification

method)

LEDs can be damaged by heat when soldering but the risk is small unless you are very

slow No special precautions are needed for soldering most LEDs

15

Testing an LED

Never connect an LED directly to a battery or power supply

It will be destroyed almost instantly because too much current will pass through and burn

it out

LEDs must have a resistor in series to limit the current to a safe value for quick testing

purposes a 1k resistor is suitable for most LEDs if your supply voltage is 12V or less

Remember to connect the LED the correct way round

Colours of LEDs

LEDs are available in red orange amber yellow green blue and white Blue and white

LEDs are much more expensive than the other colours

The colour of an LED is determined by the semiconductor material not by the colouring

of the package (the plastic body) LEDs of all colours are available in uncoloured

packages which may be diffused (milky) or clear (often described as water clear) The

coloured packages are also available as diffused (the standard type) or transparent

16

Capacitors

Function

Capacitors store electric charge They are used with resistors in timing circuits because it

takes time for a capacitor to fill with charge They are used to smooth varying DC

supplies by acting as a reservoir of charge They are also used in filter circuits because

capacitors easily pass AC (changing) signals but they block DC (constant) signals

Capacitance

This is a measure of a capacitors ability to store charge A large capacitance means that

more charge can be stored Capacitance is measured in farads symbol F However 1F is

very large so prefixes are used to show the smaller values

Three prefixes (multipliers) are used micro (micro) n (nano) and p (pico)

micro means 10-6 (millionth) so 1000000microF = 1F

n means 10-9 (thousand-millionth) so 1000nF = 1microF

p means 10-12 (million-millionth) so 1000pF = 1nF

Capacitor values can be very difficult to find because there are man

types of capacitor with different labeling systems

Capacitor Colour Code

A colour code was used on polyester capacitors for many years It is

now obsolete but of course there are many still around The colours

should be read like the resistor code the top three colour bands giving

the value in pF Ignore the 4th band (tolerance) and 5th band (voltage

rating) For example brown black orange means 10000pF = 10nF =

001microF Note that there are no gaps between the colour bands so 2 identical bands

actually appear as a wide band For example wide red yellow means 220nF = 022microF

Different types of capacitors

Colour Code

Colour Number

Black 0

Brown 1

Red 2

Orange 3

Yellow 4

Green 5

Blue 6

Violet 7

Grey 8

17

Electrolytic Capacitors Ceramic Capacitor

An electrolytic capacitor is a type of capacitor typically with a larger capacitance per

unit volume than other types making them valuable in relatively high-current and low-

frequency electrical circuits This is especially the case in power-supply filters where

they store charge needed to moderate output voltage and current fluctuations in rectifier

output and especially in the absence of rechargeable batteries that can provide similar

low-frequency current capacity They are also widely used as coupling capacitors in

circuits where AC should be conducted but DC should not the large value of the

capacitance allows them to pass very low frequencies

A Ceramic Capacitor is a capacitor constructed of alternating layers of metal and

ceramic with the ceramic material acting as the dielectric Depending on the dielectric

whether Class 1 or Class 2 the degree of temperaturecapacity dependence varies A

ceramic capacitor often has (especially the class 2) high dissipation factor high

frequency coefficient of dissipation Capacity depends on applied voltage and capacity

changes with aging Ceramic capacitors are used extensively in common low-precision

coupling and filtering applications They are suitable for high frequencies

A ceramic capacitor is a two-terminal non-polar device The classical ceramic capacitor

is the disk capacitor This device pre-dates the transistor and was used extensively in

vacuum-tube equipment (eg radio receivers)

Diodes

18

Function

Diodes allow electricity to flow in only one direction The arrow of the circuit symbol

shows the direction in which the current can flow Diodes are the electrical version of a

valve and early diodes were actually called valves

Example Circuit symbol

Forward Voltage Drop

Electricity uses up a little energy pushing its way through the diode rather like a person

pushing through a door with a spring This means that there is a small voltage across a

conducting diode it is called the forward voltage drop and is about 07V for all normal

diodes which are made from silicon The forward voltage drop of a diode is almost

constant whatever the current passing through the diode so they have a very steep

characteristic (current-voltage graph)

Reverse Voltage

When a reverse voltage is applied a perfect diode does not conduct but all real diodes

leak a very tiny current of a few microA or less This can be ignored in most circuits because

it will be very much smaller than the current flowing in the forward direction However

all diodes have a maximum reverse voltage (usually 50V or more) and if this is exceeded

the diode will fail and pass a large current in the reverse direction this is called

breakdown

Ordinary diodes can be split into two types Signal diodes which pass small currents of

100mA or less and Rectifier diodes which can pass large currents In addition there are

LEDs (which have their own page) and Zener diodes (at the bottom of this page)

19

Connecting and soldering

Diodes must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is

marked by a line painted on the body Diodes are labelled with their code in small print

you may need a magnifying glass to read this on small signal diodes Small signal diodes

can be damaged by heat when soldering but the risk is small unless you are using a

germanium diode (codes beginning OA) in which case you should use a heat sink

clipped to the lead between the joint and the diode body A standard crocodile clip can be

used as a heat sink

Rectifier diodes are quite robust and no special precautions are needed for soldering

them

Testing diodes

You can use a multimeter or a simple tester (battery resistor and LED) to check that a

diode conducts in one direction but not the other A lamp may be used to test a

rectifier diode but do NOT use a lamp to test a signal diode because the large current

passed by the lamp will destroy the diode

Signal diodes (small current)

20

Signal diodes are used to process information (electrical signals) in circuits so they are

only required to pass small currents of up to 100mA General purpose signal diodes such

as the 1N4148 are made from silicon and have a forward voltage drop of 07V

Germanium diodes

Such as the OA90 have a lower forward voltage drop of 02V and this makes them

suitable to use in radio circuits as detectors which extract the audio signal from the weak

radio signal

For general use where the size of the forward voltage drop is less important silicon

diodes are better because they are less easily damaged by heat when soldering they have

a lower resistance when conducting and they have very low leakage currents when a

reverse voltage is applied Rectifier diodes are used in power supplies to convert

alternating current (AC) to direct current (DC) a process called rectification They are

also used elsewhere in circuits where a large current must pass through the diode All

rectifier diodes are made from silicon and therefore have a forward voltage drop of 07V

The table shows maximum current and maximum reverse voltage for some popular

rectifier diodes The 1N4001 is suitable for most low voltage circuits with a current of

less than 1A

Bridge rectifiers

DiodeMaximum

Current

Maximum

Reverse

Voltage

1N4001 1A 50V

1N4002 1A 100V

1N4007 1A 1000V

1N5401 3A 100V

1N5408 3A 1000V

21

There are several ways of connecting diodes to make a rectifier to convert AC to

DC The bridge rectifier is one of them and it is available in special packages containing

the four diodes required Bridge rectifiers are rated by their maximum current and

maximum reverse voltage They have four leads or terminals the two DC outputs are

labeled + and - the two AC inputs are labeled

The diagram shows the operation of a bridge rectifier as it converts AC to DC Notice

how alternate pairs of diodes conduct

Transformer

A transformer makes use of Faradays law and the ferromagnetic properties of an iron

core to efficiently raise or lower AC voltages It of course cannot increase power so that

if the voltage is raised the current is proportionally lowered and vice versa

22

Flywheel Energy Storage

Overview

A flywheel in essence is a mechanical battery - simply a mass rotating about an axis

Flywheels store energy mechanically in the form of kinetic energy They take an

electrical input to accelerate the rotor up to speed by using the built-in motor and return

the electrical energy by using this same motor as a generator Flywheels are one of the

oldest and most common mechanical devises in existence They may still prove to serve

us as an important component on tomorrows vehicles and future energy needs Flywheels

are one of the most promising technologies for replacing conventional lead acid batteries

as energy storage systems for a variety of applications including automobiles

economical rural electrification systems and stand-alone remote power units commonly

used in the telecommunications industry Recent advances in the mechanical properties of

composites has rekindled interest in using the inertia of a spinning wheel to store energy

23

In addition to energy density flywheel energy storage systems (FES) also offer several

important advantages over chemical energy storage The rate at which energy can be

exchanged into or out of the battery is limited only by the motor--generator design

Therefore it is possible to withdraw large amounts of energy in a far shorter time than

with traditional chemical batteries Indeed research into exploiting this property of FES

systems to get short intense bursts of energy is ongoing with the most notable projects

being a magnetic tank gun and a fusion ignition system Of course it is also possible to

quickly charge FES batteries making them desirable for application in electric cars where

the charge time could be dropped from a matter of hours to a matter of minutes

Advantages Flywheels store energy very efficiently (high turn-around efficiency) and

have the potential for very high specific power compared with batteries Flywheels have

very high output potential and relatively long life Flywheels are relatively unaffected by

ambient temperature extremes

Disadvantages Current flywheels have low specific energy There are safety concerns

associated with flywheels due to their high speed rotor and the possibility of it breaking

loose and releasing all of its energy in an uncontrolled manner Flywheels are a less

mature technology than chemical batteries and the current cost is too high to make them

competitive in the market

VOLTAGE REGULATOR

24

A Voltage Regulator (also called a regulator) has only three legs and appears to be a

comparatively simple device but it is actually a very complex integrated circuit A

regulator converts varying input voltage and produces a constant regulated output

voltage Voltage regulators are available in a variety of outputs typically 5 volts 9 volts

and 12 volts The last two digits in the name indicate the output voltage

Introduction

It is very easy to get stabilized voltage for ICs by using a three terminal voltage regulator

The three terminal voltage regulator outputs stabilized voltage at a lower level than the

higher input voltage A voltage regulator cannot put out higher voltage than the input

voltage They are similar in appearance to a transistor The 7800 series consists of three-

terminal positive voltage regulators

These ICs are designed as fixed voltage regulators and with adequate heat sinking can

deliver output currents in excess of 1A These ICs are used to provide +5 volts and +12

volts supply Line regulation in these ICs is change in the output voltage for a change in

the input voltage Load regulation is defined as the change in output voltage for a change

in load current If there is any high voltage than 12 volt to 7812 it will convert to 12 V by

this IC If there is any voltage less than 12 volt it allows passing it FAN is used for

cooling the ICs

There are two ICs 7805 and 7812 attached with the Intel-fan heat sink From the base of

7805 IC we get the +5Volt Supply and from the base of 7812 IC we get the 12 Volt

25

supply Two LED are also connected with the respective ICs in order to indicate there

proper working

There are some voltage regulators

LM7805 for + 5 volts

LM7809 for +9 volts

LM7812 for+12 volts

LM7905 for-5 volts

LM7909 for-9 volts

LM7912 for-12 volts

Fig LM7805 Integrated Circuit Internal Schematic

The LM78XX series of voltage regulators are designed for positive input For

applications requiring negative input the LM79XX series is used

26

Fig Symbol of voltage regulator Fig A LM 7805 regulator

Fig The circuit diagram represents a typical use of a voltage regulator

Note The LM7805 can reliably deliver 1 amp at a constant voltage

Input Voltage

As a general rule the input voltage should be limited to 2 to 3 volts above the output

voltage The LM78XX series can handle up to 30 volts input but the power difference

between the input voltagecurrent ratio and output voltagecurrent ratio appears as heat If

the input voltage is unnecessarily high the regulator will get very hot Unless sufficient

heat sinking is provided the regulator will shut down

27

Parallel Port

Essentials

A first step in exploring the parallel port is learning how to get the most from a port with

your everyday applications and peripherals Things to know include how to find

configure and install a port how and when to use the new bidirectional EPP and ECP

modes and how to handle a system with multiple parallel-port peripherals

Defining the Ports

What is the parallel port In the computer world a port is a set of signal lines that the

microprocessor or CPU uses to exchange data with other components Typical uses for

ports are communicating with printers modems keyboards and displays or just about

any component Most computer ports are digital where each signal or bit is 0 or 1 A

parallel port transfers multiple bits at once while a serial port transfers a bit at a time

(though it may transfer in both directions at once)The ports explained here is about a

specific type of parallel port the one found on just about every Pc or IBM-compatible

personal computer Along with the RS-232 serial port the parallel port is a workhorse of

PC communications On newer PCs you may find other ports such as SCSI USB and

IrDA but the parallel port remains popular because its capable flexible and every PC

has one

The term PC-compatible or PC for short refers to the IBM PC and any of the

many many personal computers derived from it From another angle a PC is any

computer that can run Microsofts MS-DOS operating system and whose expansion bus is

compatible with the ISA bus in the original IBM Pc The category includes the PC XT

AT PS2 and most computers with 80x86 Pentium and compatible CPUs It does not

include the Macintosh Amiga or IBM mainframes though these and other computer

types may have ports that are similar to the parallel port on the Pc The original PCs

parallel port had eight outputs five inputs and four bidirectional lines

These are enough for communicating with many types of peripherals On many

newer PCs the eight outputs can also serve as inputs for faster communications with

scanners drives and other devices that send data to the Pc

28

The parallel port was designed as a printer port and many of the-original names for the

ports signals (PaperEnd AutoLineFeed) reflect that use But these days you can find all

kinds of things besides printers connected to the port The term peripheral or peripheral

device is a catch-all category that includes printers scanners modems and other devices

that connect to a Pc

29

Accessing Ports

Windows DOS C JAVA and Visual Basic provide several ways to read and write to

parallel ports The most direct way is reading and writing to the port registers Most

programming languages include this ability or at least allow you to add it Visual Basic

includes other options including the Printer object the Print Form method and Open

LPT x Windows also has API calls for accessing LPT ports and 16-bit programs can use

BIOS and DOS software interrupts for LPT access This chapter introduces the parallel

ports signals and ways of accessing them in the programs you write

Parallel ports can be used to connect a host of popular computer peripherals

bull Printers

bull Scanners

bull CD burners

bull External hard drives

bull Iomega Zip removable drives

bull Network adapters

bull Tape backup drives

30

Pin Out Diagram Of Parallel Port

31

Parallel Port Basics

Parallel ports were originally developed by IBM as a way to connect a printer to our PC

When IBM was in the process of designing the PC the company wanted the computer to

work with printers offered by Centronics a top printer manufacturer at the time IBM

decided not to use the same port interface on the computer that Centronics used on the

printer

Instead IBM engineers coupled a 25-pin connector DB-25 with a 36-pin Centronics

connector to create a special cable to connect the printer to the computer Other printer

manufacturers ended up adopting the Centronics interface making this strange hybrid

cable an unlikely de facto standard

When a PC sends data to a printer or other device using a parallel port it sends 8 bits of

data (1 byte) at a time These 8 bits are transmitted parallel to each other as opposed to

the same eight bits being transmitted serially (all in a single row) through a serial port

The standard parallel port is capable of sending 50 to 100 kilobytes of data per second

Lets take a closer look at what each pin does when used with a printer

bull Pin 1 carries the strobe signal It maintains a level of between 28 and 5 volts but drops

below 05 volts whenever the computer sends a byte of data This drop in voltage tells

the printer that data is being sent

Pins 2 through 9 are used to carry data To indicate that a bit has a value of 1 a

charge of 5 volts is sent through the correct pin No charge on a pin indicates avalue of

0 This is a simple but highly effective way to transmit digital information over an

analog cable in real-time

bull Pin 10 sends the acknowledge signal from the printer to the computer Like Pin 1 it

maintains a charge and drops the voltage below 05 volts to let the computer know that

the data was received

32

bull If the printer is busy it will charge Pin 11 Then it will drop the voltage below

05 volts to let the computer know it is ready to receive more data

bull The printer lets the computer know if it is out of paper by sending a charge on Pin 12

bull As long as the computer is receiving a charge on Pin 13 it knows that the device

is online

bull The computer sends an auto feed signal to the printer through Pin 14 using a 5-

volt charge

bull If the printer has any problems it drops the voltage to less than 05 volts on Pin

15 to let the computer know that there is an error

bull Whenever a new print job is ready the computer drops the charge on Pin 16 to

initialize the printer

bull Pin 17 is used by the computer to remotely take the printer offline This is

accomplished by sending a charge to the printer and maintaining it as long as you

want the printer offline

bull Pins 18-25 are grounds and are used as a reference signal for the low (below 05

volts) charge

33

Power Supply

Types of Power Supply

There are many types of power supply Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other

devices A power supply can by broken down into a series of blocks each of which

performs a particular function

For example a 5V regulated supply

Each of the blocks is described in more detail below

Transformer - steps down high voltage AC mains to low voltage AC

Rectifier - converts AC to DC but the DC output is varying

Smoothing - smooths the DC from varying greatly to a small ripple

Regulator - eliminates ripple by setting DC output to a fixed voltage

Power supplies made from these blocks are described below with a circuit diagram and a

graph of their output

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Dual Supplies

34

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 8: Self Balancing Robot

WHATrsquoS IN A ROBOT

Basically a robot consists of

A mechanical device such as a wheeled platform arm or other construction

capable of interacting with its environment

Sensors on or around the device that are able to sense the environment and give

useful feedback to the device

Systems that process sensory input in the context of the devices current situation

and instruct the device to perform actions in response to the situation

Mechanical platforms -- the hardware base

A robot consists of two main parts the robot body and some form of artificial

intelligence (AI) system Many different body parts can be called a robot Articulated

arms are used in welding and painting gantry and conveyor systems move parts in

factories and giant robotic machines move earth deep inside mines One of the most

interesting aspects of robots in general is their behavior which requires a form of

intelligence The simplest behavior of a robot is locomotion Typically wheels are used

as the underlying mechanism to make a robot move from one point to the next And some

force such as electricity is required to make the wheels turn under command

Motors

A variety of electric motors provide power to robots allowing them to move material

parts tools or specialized devices with various programmed motions The efficiency

rating of a motor describes how much of the electricity consumed is converted to

mechanical energy

Power supplies

Power supplies are generally provided by two types of battery Primary batteries are used

once and then discarded secondary batteries operate from a (mostly) reversible chemical

reaction and can be recharged several times Primary batteries have higher density and a

lower self-discharge rate Secondary (rechargeable) batteries have less energy than

8

primary batteries but can be recharged up to a thousand times depending on their

chemistry and environment

Sensors

Regardless of sensor hardware or software sensing and sensors can be thought of as

interacting with external events (in other words the outside world) The sensor measures

some attribute of the world The term transducer is often used interchangeably with

sensor A transducer is the mechanism or element of the sensor that transforms the

energy associated with what is being measured into another form of energy A sensor

receives energy and transmits a signal to a display or computer Sensors use transducers

to change the input signal (sound light pressure temperature etc) into an analog or

digital form capable of being used by a robot

Microcontroller systems

Microcontrollers (MCUs) are intelligent electronic devices used inside robots They

deliver functions similar to those performed by a microprocessor (central processing unit

or CPU) inside a personal computer MCUs are slower and can address less memory than

CPUs but are designed for real-world control problems One of the major differences

between CPUs and MCUs is the number of external components needed to operate them

MCUs can often run with zero external parts and typically need only an external crystal

or oscillator

There are four basic aspects of a microcontroller speed size memory and other Speed

is designated in clock cycles and is usually measured in millions of cycles per second

(Megahertz MHz) The use of the cycles varies in different MCUs affecting the usable

speed of the processor Size specifies the number of bits of information the MCU can

process in one step -- the size of its natural cluster of information

9

COMPONENT DESCRIPTION

Resistors

Example Circuit symbol

Function

Resistors restrict the flow of electric current for example a resistor is

placed in series with a light-emitting diode (LED) to limit the current

passing through the LED

Connecting and soldering

Resistors may be connected either way round They are not damaged

by heat when soldering

Resistor values - the resistor colour code

Resistance is measured in ohms the symbol for ohm is an omega

1 is quite small so resistor values are often given in k and M

1 k = 1000 1 M = 1000000

Resistor values are normally shown using coloured bands

Each colour represents a number as shown in the table

Most resistors have 4 bands

The first band gives the first digit

The second band gives the second digit

The third band indicates the number of zeros

The fourth band is used to shows the tolerance (precision) of the resistor this may

be ignored for almost all circuits but further details are given below

The Resistor

Colour Code

Colour Number

Black 0

Brown 1

Red 2

Orange 3

Yellow 4

Green 5

Blue 6

Violet 7

Grey 8

White 9

10

This resistor has red (2) violet (7) yellow (4 zeros) and gold bands

So its value is 270000 = 270 k

On circuit diagrams the is usually omitted and the value is written 270K

Small value resistors (less than 10 ohm)

The standard colour code cannot show values of less than 10 To show these small

values two special colours are used for the third band gold which means times 01 and silver

which means times 001 The first and second bands represent the digits as normal

For example

red violet gold bands represent 27 times 01 = 27

green blue silver bands represent 56 times 001 = 056

Tolerance of resistors (fourth band of colour code)

The tolerance of a resistor is shown by the fourth band of the colour code Tolerance is

the precision of the resistor and it is given as a percentage For example a 390 resistor

with a tolerance of plusmn10 will have a value within 10 of 390 between 390 - 39 = 351

and 390 + 39 = 429 (39 is 10 of 390)

A special colour code is used for the fourth band tolerance

silver plusmn10 gold plusmn5 red plusmn2 brown plusmn1

If no fourth band is shown the tolerance is plusmn20

Tolerance may be ignored for almost all circuits because precise resistor values are rarely

required

11

Transistors

Function

Transistors amplify current for example they can be used to amplify the small output

current from a logic chip so that it can operate a lamp relay or other high current device

In many circuits a resistor is used to convert the changing current to a changing voltage

so the transistor is being used to amplify voltage

A transistor may be used as a switch (either fully on with maximum current or fully off

with no current) and as an amplifier (always partly on)

The amount of current amplification is called the current gain symbol hFE

There are two types of standard transistors NPN and PNP

with different circuit symbols The letters refer to the layers

of semiconductor material used to make the transistor Most

transistors used today are NPN because this is the easiest

type to make from silicon If you are new to electronics it is

best to start by learning how to use NPN transistors

The leads are labeled base (B) collector (C) and emitter (E)

These terms refer to the internal operation of a transistor but they are not much help in

understanding how a transistor is used so just treat them as labels

A Darlington pair is two transistors connected together to give a very high current gain

In addition to standard (bipolar junction) transistors there are field-effect transistors

which are usually referred to as FETs They have different circuit symbols and properties

and they are not (yet) covered by this page

Transistor circuit symbols

12

Connecting

Transistors have three leads which

must be connected the correct way

round Please take care with this

because a wrongly connected transistor

may be damaged instantly when you

switch on

If you are lucky the orientation of the

transistor will be clear from the PCB or

stripboard layout diagram otherwise you will need to refer to a suppliers catalogue to

identify the leads

The drawings on the right show the leads for some of the most common case styles

Please note that transistor lead diagrams show the view from below with the leads

towards you This is the opposite of IC (chip) pin diagrams

which show the view from above

Soldering

Transistors can be damaged by heat when soldering so if you

are not an expert it is wise to use a heat sink clipped to the lead

between the joint and the transistor body A standard crocodile clip can be used as a heat

sink

Do not confuse this temporary heat sink with the permanent heat sink (described below)

which may be required for a power transistor to prevent it overheating during operation

Transistor leads for some common case styles

Crocodile clip

13

Heat sinks

Waste heat is produced in transistors due to the current flowing through

them Heat sinks are needed for power transistors because they pass

large currents If you find that a transistor is becoming too hot to touch it certainly needs

a heat sink The heat sink helps to dissipate (remove) the heat by transferring it to the

surrounding air

Darlington pair

This is two transistors connected together so that

the amplified current from the first is amplified further by the second transistor This

gives the Darlington pair a very high current gain such as 10000 Darlington pairs are

sold as complete packages containing the two transistors They have three leads

(B C and E) which are equivalent to the leads of a standard individual transistor

You can make up your own Darlington pair from two transistors

For example

For TR1 use BC548B with hFE1 = 220

For TR2 use BC639 with hFE2 = 40

The overall gain of this pair is hFE1 times hFE2 = 220 times 40 = 8800

The pairs maximum collector current IC(max) is the same as TR2

Heat sink

14

LED

Example Circuit symbol

Function

LEDs emit light when an electric current passes through them

Connecting and soldering

LEDs must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is the

short lead and there may be a slight flat on the body of round LEDs If you can see inside

the LED the cathode is the larger electrode (but this is not an official identification

method)

LEDs can be damaged by heat when soldering but the risk is small unless you are very

slow No special precautions are needed for soldering most LEDs

15

Testing an LED

Never connect an LED directly to a battery or power supply

It will be destroyed almost instantly because too much current will pass through and burn

it out

LEDs must have a resistor in series to limit the current to a safe value for quick testing

purposes a 1k resistor is suitable for most LEDs if your supply voltage is 12V or less

Remember to connect the LED the correct way round

Colours of LEDs

LEDs are available in red orange amber yellow green blue and white Blue and white

LEDs are much more expensive than the other colours

The colour of an LED is determined by the semiconductor material not by the colouring

of the package (the plastic body) LEDs of all colours are available in uncoloured

packages which may be diffused (milky) or clear (often described as water clear) The

coloured packages are also available as diffused (the standard type) or transparent

16

Capacitors

Function

Capacitors store electric charge They are used with resistors in timing circuits because it

takes time for a capacitor to fill with charge They are used to smooth varying DC

supplies by acting as a reservoir of charge They are also used in filter circuits because

capacitors easily pass AC (changing) signals but they block DC (constant) signals

Capacitance

This is a measure of a capacitors ability to store charge A large capacitance means that

more charge can be stored Capacitance is measured in farads symbol F However 1F is

very large so prefixes are used to show the smaller values

Three prefixes (multipliers) are used micro (micro) n (nano) and p (pico)

micro means 10-6 (millionth) so 1000000microF = 1F

n means 10-9 (thousand-millionth) so 1000nF = 1microF

p means 10-12 (million-millionth) so 1000pF = 1nF

Capacitor values can be very difficult to find because there are man

types of capacitor with different labeling systems

Capacitor Colour Code

A colour code was used on polyester capacitors for many years It is

now obsolete but of course there are many still around The colours

should be read like the resistor code the top three colour bands giving

the value in pF Ignore the 4th band (tolerance) and 5th band (voltage

rating) For example brown black orange means 10000pF = 10nF =

001microF Note that there are no gaps between the colour bands so 2 identical bands

actually appear as a wide band For example wide red yellow means 220nF = 022microF

Different types of capacitors

Colour Code

Colour Number

Black 0

Brown 1

Red 2

Orange 3

Yellow 4

Green 5

Blue 6

Violet 7

Grey 8

17

Electrolytic Capacitors Ceramic Capacitor

An electrolytic capacitor is a type of capacitor typically with a larger capacitance per

unit volume than other types making them valuable in relatively high-current and low-

frequency electrical circuits This is especially the case in power-supply filters where

they store charge needed to moderate output voltage and current fluctuations in rectifier

output and especially in the absence of rechargeable batteries that can provide similar

low-frequency current capacity They are also widely used as coupling capacitors in

circuits where AC should be conducted but DC should not the large value of the

capacitance allows them to pass very low frequencies

A Ceramic Capacitor is a capacitor constructed of alternating layers of metal and

ceramic with the ceramic material acting as the dielectric Depending on the dielectric

whether Class 1 or Class 2 the degree of temperaturecapacity dependence varies A

ceramic capacitor often has (especially the class 2) high dissipation factor high

frequency coefficient of dissipation Capacity depends on applied voltage and capacity

changes with aging Ceramic capacitors are used extensively in common low-precision

coupling and filtering applications They are suitable for high frequencies

A ceramic capacitor is a two-terminal non-polar device The classical ceramic capacitor

is the disk capacitor This device pre-dates the transistor and was used extensively in

vacuum-tube equipment (eg radio receivers)

Diodes

18

Function

Diodes allow electricity to flow in only one direction The arrow of the circuit symbol

shows the direction in which the current can flow Diodes are the electrical version of a

valve and early diodes were actually called valves

Example Circuit symbol

Forward Voltage Drop

Electricity uses up a little energy pushing its way through the diode rather like a person

pushing through a door with a spring This means that there is a small voltage across a

conducting diode it is called the forward voltage drop and is about 07V for all normal

diodes which are made from silicon The forward voltage drop of a diode is almost

constant whatever the current passing through the diode so they have a very steep

characteristic (current-voltage graph)

Reverse Voltage

When a reverse voltage is applied a perfect diode does not conduct but all real diodes

leak a very tiny current of a few microA or less This can be ignored in most circuits because

it will be very much smaller than the current flowing in the forward direction However

all diodes have a maximum reverse voltage (usually 50V or more) and if this is exceeded

the diode will fail and pass a large current in the reverse direction this is called

breakdown

Ordinary diodes can be split into two types Signal diodes which pass small currents of

100mA or less and Rectifier diodes which can pass large currents In addition there are

LEDs (which have their own page) and Zener diodes (at the bottom of this page)

19

Connecting and soldering

Diodes must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is

marked by a line painted on the body Diodes are labelled with their code in small print

you may need a magnifying glass to read this on small signal diodes Small signal diodes

can be damaged by heat when soldering but the risk is small unless you are using a

germanium diode (codes beginning OA) in which case you should use a heat sink

clipped to the lead between the joint and the diode body A standard crocodile clip can be

used as a heat sink

Rectifier diodes are quite robust and no special precautions are needed for soldering

them

Testing diodes

You can use a multimeter or a simple tester (battery resistor and LED) to check that a

diode conducts in one direction but not the other A lamp may be used to test a

rectifier diode but do NOT use a lamp to test a signal diode because the large current

passed by the lamp will destroy the diode

Signal diodes (small current)

20

Signal diodes are used to process information (electrical signals) in circuits so they are

only required to pass small currents of up to 100mA General purpose signal diodes such

as the 1N4148 are made from silicon and have a forward voltage drop of 07V

Germanium diodes

Such as the OA90 have a lower forward voltage drop of 02V and this makes them

suitable to use in radio circuits as detectors which extract the audio signal from the weak

radio signal

For general use where the size of the forward voltage drop is less important silicon

diodes are better because they are less easily damaged by heat when soldering they have

a lower resistance when conducting and they have very low leakage currents when a

reverse voltage is applied Rectifier diodes are used in power supplies to convert

alternating current (AC) to direct current (DC) a process called rectification They are

also used elsewhere in circuits where a large current must pass through the diode All

rectifier diodes are made from silicon and therefore have a forward voltage drop of 07V

The table shows maximum current and maximum reverse voltage for some popular

rectifier diodes The 1N4001 is suitable for most low voltage circuits with a current of

less than 1A

Bridge rectifiers

DiodeMaximum

Current

Maximum

Reverse

Voltage

1N4001 1A 50V

1N4002 1A 100V

1N4007 1A 1000V

1N5401 3A 100V

1N5408 3A 1000V

21

There are several ways of connecting diodes to make a rectifier to convert AC to

DC The bridge rectifier is one of them and it is available in special packages containing

the four diodes required Bridge rectifiers are rated by their maximum current and

maximum reverse voltage They have four leads or terminals the two DC outputs are

labeled + and - the two AC inputs are labeled

The diagram shows the operation of a bridge rectifier as it converts AC to DC Notice

how alternate pairs of diodes conduct

Transformer

A transformer makes use of Faradays law and the ferromagnetic properties of an iron

core to efficiently raise or lower AC voltages It of course cannot increase power so that

if the voltage is raised the current is proportionally lowered and vice versa

22

Flywheel Energy Storage

Overview

A flywheel in essence is a mechanical battery - simply a mass rotating about an axis

Flywheels store energy mechanically in the form of kinetic energy They take an

electrical input to accelerate the rotor up to speed by using the built-in motor and return

the electrical energy by using this same motor as a generator Flywheels are one of the

oldest and most common mechanical devises in existence They may still prove to serve

us as an important component on tomorrows vehicles and future energy needs Flywheels

are one of the most promising technologies for replacing conventional lead acid batteries

as energy storage systems for a variety of applications including automobiles

economical rural electrification systems and stand-alone remote power units commonly

used in the telecommunications industry Recent advances in the mechanical properties of

composites has rekindled interest in using the inertia of a spinning wheel to store energy

23

In addition to energy density flywheel energy storage systems (FES) also offer several

important advantages over chemical energy storage The rate at which energy can be

exchanged into or out of the battery is limited only by the motor--generator design

Therefore it is possible to withdraw large amounts of energy in a far shorter time than

with traditional chemical batteries Indeed research into exploiting this property of FES

systems to get short intense bursts of energy is ongoing with the most notable projects

being a magnetic tank gun and a fusion ignition system Of course it is also possible to

quickly charge FES batteries making them desirable for application in electric cars where

the charge time could be dropped from a matter of hours to a matter of minutes

Advantages Flywheels store energy very efficiently (high turn-around efficiency) and

have the potential for very high specific power compared with batteries Flywheels have

very high output potential and relatively long life Flywheels are relatively unaffected by

ambient temperature extremes

Disadvantages Current flywheels have low specific energy There are safety concerns

associated with flywheels due to their high speed rotor and the possibility of it breaking

loose and releasing all of its energy in an uncontrolled manner Flywheels are a less

mature technology than chemical batteries and the current cost is too high to make them

competitive in the market

VOLTAGE REGULATOR

24

A Voltage Regulator (also called a regulator) has only three legs and appears to be a

comparatively simple device but it is actually a very complex integrated circuit A

regulator converts varying input voltage and produces a constant regulated output

voltage Voltage regulators are available in a variety of outputs typically 5 volts 9 volts

and 12 volts The last two digits in the name indicate the output voltage

Introduction

It is very easy to get stabilized voltage for ICs by using a three terminal voltage regulator

The three terminal voltage regulator outputs stabilized voltage at a lower level than the

higher input voltage A voltage regulator cannot put out higher voltage than the input

voltage They are similar in appearance to a transistor The 7800 series consists of three-

terminal positive voltage regulators

These ICs are designed as fixed voltage regulators and with adequate heat sinking can

deliver output currents in excess of 1A These ICs are used to provide +5 volts and +12

volts supply Line regulation in these ICs is change in the output voltage for a change in

the input voltage Load regulation is defined as the change in output voltage for a change

in load current If there is any high voltage than 12 volt to 7812 it will convert to 12 V by

this IC If there is any voltage less than 12 volt it allows passing it FAN is used for

cooling the ICs

There are two ICs 7805 and 7812 attached with the Intel-fan heat sink From the base of

7805 IC we get the +5Volt Supply and from the base of 7812 IC we get the 12 Volt

25

supply Two LED are also connected with the respective ICs in order to indicate there

proper working

There are some voltage regulators

LM7805 for + 5 volts

LM7809 for +9 volts

LM7812 for+12 volts

LM7905 for-5 volts

LM7909 for-9 volts

LM7912 for-12 volts

Fig LM7805 Integrated Circuit Internal Schematic

The LM78XX series of voltage regulators are designed for positive input For

applications requiring negative input the LM79XX series is used

26

Fig Symbol of voltage regulator Fig A LM 7805 regulator

Fig The circuit diagram represents a typical use of a voltage regulator

Note The LM7805 can reliably deliver 1 amp at a constant voltage

Input Voltage

As a general rule the input voltage should be limited to 2 to 3 volts above the output

voltage The LM78XX series can handle up to 30 volts input but the power difference

between the input voltagecurrent ratio and output voltagecurrent ratio appears as heat If

the input voltage is unnecessarily high the regulator will get very hot Unless sufficient

heat sinking is provided the regulator will shut down

27

Parallel Port

Essentials

A first step in exploring the parallel port is learning how to get the most from a port with

your everyday applications and peripherals Things to know include how to find

configure and install a port how and when to use the new bidirectional EPP and ECP

modes and how to handle a system with multiple parallel-port peripherals

Defining the Ports

What is the parallel port In the computer world a port is a set of signal lines that the

microprocessor or CPU uses to exchange data with other components Typical uses for

ports are communicating with printers modems keyboards and displays or just about

any component Most computer ports are digital where each signal or bit is 0 or 1 A

parallel port transfers multiple bits at once while a serial port transfers a bit at a time

(though it may transfer in both directions at once)The ports explained here is about a

specific type of parallel port the one found on just about every Pc or IBM-compatible

personal computer Along with the RS-232 serial port the parallel port is a workhorse of

PC communications On newer PCs you may find other ports such as SCSI USB and

IrDA but the parallel port remains popular because its capable flexible and every PC

has one

The term PC-compatible or PC for short refers to the IBM PC and any of the

many many personal computers derived from it From another angle a PC is any

computer that can run Microsofts MS-DOS operating system and whose expansion bus is

compatible with the ISA bus in the original IBM Pc The category includes the PC XT

AT PS2 and most computers with 80x86 Pentium and compatible CPUs It does not

include the Macintosh Amiga or IBM mainframes though these and other computer

types may have ports that are similar to the parallel port on the Pc The original PCs

parallel port had eight outputs five inputs and four bidirectional lines

These are enough for communicating with many types of peripherals On many

newer PCs the eight outputs can also serve as inputs for faster communications with

scanners drives and other devices that send data to the Pc

28

The parallel port was designed as a printer port and many of the-original names for the

ports signals (PaperEnd AutoLineFeed) reflect that use But these days you can find all

kinds of things besides printers connected to the port The term peripheral or peripheral

device is a catch-all category that includes printers scanners modems and other devices

that connect to a Pc

29

Accessing Ports

Windows DOS C JAVA and Visual Basic provide several ways to read and write to

parallel ports The most direct way is reading and writing to the port registers Most

programming languages include this ability or at least allow you to add it Visual Basic

includes other options including the Printer object the Print Form method and Open

LPT x Windows also has API calls for accessing LPT ports and 16-bit programs can use

BIOS and DOS software interrupts for LPT access This chapter introduces the parallel

ports signals and ways of accessing them in the programs you write

Parallel ports can be used to connect a host of popular computer peripherals

bull Printers

bull Scanners

bull CD burners

bull External hard drives

bull Iomega Zip removable drives

bull Network adapters

bull Tape backup drives

30

Pin Out Diagram Of Parallel Port

31

Parallel Port Basics

Parallel ports were originally developed by IBM as a way to connect a printer to our PC

When IBM was in the process of designing the PC the company wanted the computer to

work with printers offered by Centronics a top printer manufacturer at the time IBM

decided not to use the same port interface on the computer that Centronics used on the

printer

Instead IBM engineers coupled a 25-pin connector DB-25 with a 36-pin Centronics

connector to create a special cable to connect the printer to the computer Other printer

manufacturers ended up adopting the Centronics interface making this strange hybrid

cable an unlikely de facto standard

When a PC sends data to a printer or other device using a parallel port it sends 8 bits of

data (1 byte) at a time These 8 bits are transmitted parallel to each other as opposed to

the same eight bits being transmitted serially (all in a single row) through a serial port

The standard parallel port is capable of sending 50 to 100 kilobytes of data per second

Lets take a closer look at what each pin does when used with a printer

bull Pin 1 carries the strobe signal It maintains a level of between 28 and 5 volts but drops

below 05 volts whenever the computer sends a byte of data This drop in voltage tells

the printer that data is being sent

Pins 2 through 9 are used to carry data To indicate that a bit has a value of 1 a

charge of 5 volts is sent through the correct pin No charge on a pin indicates avalue of

0 This is a simple but highly effective way to transmit digital information over an

analog cable in real-time

bull Pin 10 sends the acknowledge signal from the printer to the computer Like Pin 1 it

maintains a charge and drops the voltage below 05 volts to let the computer know that

the data was received

32

bull If the printer is busy it will charge Pin 11 Then it will drop the voltage below

05 volts to let the computer know it is ready to receive more data

bull The printer lets the computer know if it is out of paper by sending a charge on Pin 12

bull As long as the computer is receiving a charge on Pin 13 it knows that the device

is online

bull The computer sends an auto feed signal to the printer through Pin 14 using a 5-

volt charge

bull If the printer has any problems it drops the voltage to less than 05 volts on Pin

15 to let the computer know that there is an error

bull Whenever a new print job is ready the computer drops the charge on Pin 16 to

initialize the printer

bull Pin 17 is used by the computer to remotely take the printer offline This is

accomplished by sending a charge to the printer and maintaining it as long as you

want the printer offline

bull Pins 18-25 are grounds and are used as a reference signal for the low (below 05

volts) charge

33

Power Supply

Types of Power Supply

There are many types of power supply Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other

devices A power supply can by broken down into a series of blocks each of which

performs a particular function

For example a 5V regulated supply

Each of the blocks is described in more detail below

Transformer - steps down high voltage AC mains to low voltage AC

Rectifier - converts AC to DC but the DC output is varying

Smoothing - smooths the DC from varying greatly to a small ripple

Regulator - eliminates ripple by setting DC output to a fixed voltage

Power supplies made from these blocks are described below with a circuit diagram and a

graph of their output

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Dual Supplies

34

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 9: Self Balancing Robot

primary batteries but can be recharged up to a thousand times depending on their

chemistry and environment

Sensors

Regardless of sensor hardware or software sensing and sensors can be thought of as

interacting with external events (in other words the outside world) The sensor measures

some attribute of the world The term transducer is often used interchangeably with

sensor A transducer is the mechanism or element of the sensor that transforms the

energy associated with what is being measured into another form of energy A sensor

receives energy and transmits a signal to a display or computer Sensors use transducers

to change the input signal (sound light pressure temperature etc) into an analog or

digital form capable of being used by a robot

Microcontroller systems

Microcontrollers (MCUs) are intelligent electronic devices used inside robots They

deliver functions similar to those performed by a microprocessor (central processing unit

or CPU) inside a personal computer MCUs are slower and can address less memory than

CPUs but are designed for real-world control problems One of the major differences

between CPUs and MCUs is the number of external components needed to operate them

MCUs can often run with zero external parts and typically need only an external crystal

or oscillator

There are four basic aspects of a microcontroller speed size memory and other Speed

is designated in clock cycles and is usually measured in millions of cycles per second

(Megahertz MHz) The use of the cycles varies in different MCUs affecting the usable

speed of the processor Size specifies the number of bits of information the MCU can

process in one step -- the size of its natural cluster of information

9

COMPONENT DESCRIPTION

Resistors

Example Circuit symbol

Function

Resistors restrict the flow of electric current for example a resistor is

placed in series with a light-emitting diode (LED) to limit the current

passing through the LED

Connecting and soldering

Resistors may be connected either way round They are not damaged

by heat when soldering

Resistor values - the resistor colour code

Resistance is measured in ohms the symbol for ohm is an omega

1 is quite small so resistor values are often given in k and M

1 k = 1000 1 M = 1000000

Resistor values are normally shown using coloured bands

Each colour represents a number as shown in the table

Most resistors have 4 bands

The first band gives the first digit

The second band gives the second digit

The third band indicates the number of zeros

The fourth band is used to shows the tolerance (precision) of the resistor this may

be ignored for almost all circuits but further details are given below

The Resistor

Colour Code

Colour Number

Black 0

Brown 1

Red 2

Orange 3

Yellow 4

Green 5

Blue 6

Violet 7

Grey 8

White 9

10

This resistor has red (2) violet (7) yellow (4 zeros) and gold bands

So its value is 270000 = 270 k

On circuit diagrams the is usually omitted and the value is written 270K

Small value resistors (less than 10 ohm)

The standard colour code cannot show values of less than 10 To show these small

values two special colours are used for the third band gold which means times 01 and silver

which means times 001 The first and second bands represent the digits as normal

For example

red violet gold bands represent 27 times 01 = 27

green blue silver bands represent 56 times 001 = 056

Tolerance of resistors (fourth band of colour code)

The tolerance of a resistor is shown by the fourth band of the colour code Tolerance is

the precision of the resistor and it is given as a percentage For example a 390 resistor

with a tolerance of plusmn10 will have a value within 10 of 390 between 390 - 39 = 351

and 390 + 39 = 429 (39 is 10 of 390)

A special colour code is used for the fourth band tolerance

silver plusmn10 gold plusmn5 red plusmn2 brown plusmn1

If no fourth band is shown the tolerance is plusmn20

Tolerance may be ignored for almost all circuits because precise resistor values are rarely

required

11

Transistors

Function

Transistors amplify current for example they can be used to amplify the small output

current from a logic chip so that it can operate a lamp relay or other high current device

In many circuits a resistor is used to convert the changing current to a changing voltage

so the transistor is being used to amplify voltage

A transistor may be used as a switch (either fully on with maximum current or fully off

with no current) and as an amplifier (always partly on)

The amount of current amplification is called the current gain symbol hFE

There are two types of standard transistors NPN and PNP

with different circuit symbols The letters refer to the layers

of semiconductor material used to make the transistor Most

transistors used today are NPN because this is the easiest

type to make from silicon If you are new to electronics it is

best to start by learning how to use NPN transistors

The leads are labeled base (B) collector (C) and emitter (E)

These terms refer to the internal operation of a transistor but they are not much help in

understanding how a transistor is used so just treat them as labels

A Darlington pair is two transistors connected together to give a very high current gain

In addition to standard (bipolar junction) transistors there are field-effect transistors

which are usually referred to as FETs They have different circuit symbols and properties

and they are not (yet) covered by this page

Transistor circuit symbols

12

Connecting

Transistors have three leads which

must be connected the correct way

round Please take care with this

because a wrongly connected transistor

may be damaged instantly when you

switch on

If you are lucky the orientation of the

transistor will be clear from the PCB or

stripboard layout diagram otherwise you will need to refer to a suppliers catalogue to

identify the leads

The drawings on the right show the leads for some of the most common case styles

Please note that transistor lead diagrams show the view from below with the leads

towards you This is the opposite of IC (chip) pin diagrams

which show the view from above

Soldering

Transistors can be damaged by heat when soldering so if you

are not an expert it is wise to use a heat sink clipped to the lead

between the joint and the transistor body A standard crocodile clip can be used as a heat

sink

Do not confuse this temporary heat sink with the permanent heat sink (described below)

which may be required for a power transistor to prevent it overheating during operation

Transistor leads for some common case styles

Crocodile clip

13

Heat sinks

Waste heat is produced in transistors due to the current flowing through

them Heat sinks are needed for power transistors because they pass

large currents If you find that a transistor is becoming too hot to touch it certainly needs

a heat sink The heat sink helps to dissipate (remove) the heat by transferring it to the

surrounding air

Darlington pair

This is two transistors connected together so that

the amplified current from the first is amplified further by the second transistor This

gives the Darlington pair a very high current gain such as 10000 Darlington pairs are

sold as complete packages containing the two transistors They have three leads

(B C and E) which are equivalent to the leads of a standard individual transistor

You can make up your own Darlington pair from two transistors

For example

For TR1 use BC548B with hFE1 = 220

For TR2 use BC639 with hFE2 = 40

The overall gain of this pair is hFE1 times hFE2 = 220 times 40 = 8800

The pairs maximum collector current IC(max) is the same as TR2

Heat sink

14

LED

Example Circuit symbol

Function

LEDs emit light when an electric current passes through them

Connecting and soldering

LEDs must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is the

short lead and there may be a slight flat on the body of round LEDs If you can see inside

the LED the cathode is the larger electrode (but this is not an official identification

method)

LEDs can be damaged by heat when soldering but the risk is small unless you are very

slow No special precautions are needed for soldering most LEDs

15

Testing an LED

Never connect an LED directly to a battery or power supply

It will be destroyed almost instantly because too much current will pass through and burn

it out

LEDs must have a resistor in series to limit the current to a safe value for quick testing

purposes a 1k resistor is suitable for most LEDs if your supply voltage is 12V or less

Remember to connect the LED the correct way round

Colours of LEDs

LEDs are available in red orange amber yellow green blue and white Blue and white

LEDs are much more expensive than the other colours

The colour of an LED is determined by the semiconductor material not by the colouring

of the package (the plastic body) LEDs of all colours are available in uncoloured

packages which may be diffused (milky) or clear (often described as water clear) The

coloured packages are also available as diffused (the standard type) or transparent

16

Capacitors

Function

Capacitors store electric charge They are used with resistors in timing circuits because it

takes time for a capacitor to fill with charge They are used to smooth varying DC

supplies by acting as a reservoir of charge They are also used in filter circuits because

capacitors easily pass AC (changing) signals but they block DC (constant) signals

Capacitance

This is a measure of a capacitors ability to store charge A large capacitance means that

more charge can be stored Capacitance is measured in farads symbol F However 1F is

very large so prefixes are used to show the smaller values

Three prefixes (multipliers) are used micro (micro) n (nano) and p (pico)

micro means 10-6 (millionth) so 1000000microF = 1F

n means 10-9 (thousand-millionth) so 1000nF = 1microF

p means 10-12 (million-millionth) so 1000pF = 1nF

Capacitor values can be very difficult to find because there are man

types of capacitor with different labeling systems

Capacitor Colour Code

A colour code was used on polyester capacitors for many years It is

now obsolete but of course there are many still around The colours

should be read like the resistor code the top three colour bands giving

the value in pF Ignore the 4th band (tolerance) and 5th band (voltage

rating) For example brown black orange means 10000pF = 10nF =

001microF Note that there are no gaps between the colour bands so 2 identical bands

actually appear as a wide band For example wide red yellow means 220nF = 022microF

Different types of capacitors

Colour Code

Colour Number

Black 0

Brown 1

Red 2

Orange 3

Yellow 4

Green 5

Blue 6

Violet 7

Grey 8

17

Electrolytic Capacitors Ceramic Capacitor

An electrolytic capacitor is a type of capacitor typically with a larger capacitance per

unit volume than other types making them valuable in relatively high-current and low-

frequency electrical circuits This is especially the case in power-supply filters where

they store charge needed to moderate output voltage and current fluctuations in rectifier

output and especially in the absence of rechargeable batteries that can provide similar

low-frequency current capacity They are also widely used as coupling capacitors in

circuits where AC should be conducted but DC should not the large value of the

capacitance allows them to pass very low frequencies

A Ceramic Capacitor is a capacitor constructed of alternating layers of metal and

ceramic with the ceramic material acting as the dielectric Depending on the dielectric

whether Class 1 or Class 2 the degree of temperaturecapacity dependence varies A

ceramic capacitor often has (especially the class 2) high dissipation factor high

frequency coefficient of dissipation Capacity depends on applied voltage and capacity

changes with aging Ceramic capacitors are used extensively in common low-precision

coupling and filtering applications They are suitable for high frequencies

A ceramic capacitor is a two-terminal non-polar device The classical ceramic capacitor

is the disk capacitor This device pre-dates the transistor and was used extensively in

vacuum-tube equipment (eg radio receivers)

Diodes

18

Function

Diodes allow electricity to flow in only one direction The arrow of the circuit symbol

shows the direction in which the current can flow Diodes are the electrical version of a

valve and early diodes were actually called valves

Example Circuit symbol

Forward Voltage Drop

Electricity uses up a little energy pushing its way through the diode rather like a person

pushing through a door with a spring This means that there is a small voltage across a

conducting diode it is called the forward voltage drop and is about 07V for all normal

diodes which are made from silicon The forward voltage drop of a diode is almost

constant whatever the current passing through the diode so they have a very steep

characteristic (current-voltage graph)

Reverse Voltage

When a reverse voltage is applied a perfect diode does not conduct but all real diodes

leak a very tiny current of a few microA or less This can be ignored in most circuits because

it will be very much smaller than the current flowing in the forward direction However

all diodes have a maximum reverse voltage (usually 50V or more) and if this is exceeded

the diode will fail and pass a large current in the reverse direction this is called

breakdown

Ordinary diodes can be split into two types Signal diodes which pass small currents of

100mA or less and Rectifier diodes which can pass large currents In addition there are

LEDs (which have their own page) and Zener diodes (at the bottom of this page)

19

Connecting and soldering

Diodes must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is

marked by a line painted on the body Diodes are labelled with their code in small print

you may need a magnifying glass to read this on small signal diodes Small signal diodes

can be damaged by heat when soldering but the risk is small unless you are using a

germanium diode (codes beginning OA) in which case you should use a heat sink

clipped to the lead between the joint and the diode body A standard crocodile clip can be

used as a heat sink

Rectifier diodes are quite robust and no special precautions are needed for soldering

them

Testing diodes

You can use a multimeter or a simple tester (battery resistor and LED) to check that a

diode conducts in one direction but not the other A lamp may be used to test a

rectifier diode but do NOT use a lamp to test a signal diode because the large current

passed by the lamp will destroy the diode

Signal diodes (small current)

20

Signal diodes are used to process information (electrical signals) in circuits so they are

only required to pass small currents of up to 100mA General purpose signal diodes such

as the 1N4148 are made from silicon and have a forward voltage drop of 07V

Germanium diodes

Such as the OA90 have a lower forward voltage drop of 02V and this makes them

suitable to use in radio circuits as detectors which extract the audio signal from the weak

radio signal

For general use where the size of the forward voltage drop is less important silicon

diodes are better because they are less easily damaged by heat when soldering they have

a lower resistance when conducting and they have very low leakage currents when a

reverse voltage is applied Rectifier diodes are used in power supplies to convert

alternating current (AC) to direct current (DC) a process called rectification They are

also used elsewhere in circuits where a large current must pass through the diode All

rectifier diodes are made from silicon and therefore have a forward voltage drop of 07V

The table shows maximum current and maximum reverse voltage for some popular

rectifier diodes The 1N4001 is suitable for most low voltage circuits with a current of

less than 1A

Bridge rectifiers

DiodeMaximum

Current

Maximum

Reverse

Voltage

1N4001 1A 50V

1N4002 1A 100V

1N4007 1A 1000V

1N5401 3A 100V

1N5408 3A 1000V

21

There are several ways of connecting diodes to make a rectifier to convert AC to

DC The bridge rectifier is one of them and it is available in special packages containing

the four diodes required Bridge rectifiers are rated by their maximum current and

maximum reverse voltage They have four leads or terminals the two DC outputs are

labeled + and - the two AC inputs are labeled

The diagram shows the operation of a bridge rectifier as it converts AC to DC Notice

how alternate pairs of diodes conduct

Transformer

A transformer makes use of Faradays law and the ferromagnetic properties of an iron

core to efficiently raise or lower AC voltages It of course cannot increase power so that

if the voltage is raised the current is proportionally lowered and vice versa

22

Flywheel Energy Storage

Overview

A flywheel in essence is a mechanical battery - simply a mass rotating about an axis

Flywheels store energy mechanically in the form of kinetic energy They take an

electrical input to accelerate the rotor up to speed by using the built-in motor and return

the electrical energy by using this same motor as a generator Flywheels are one of the

oldest and most common mechanical devises in existence They may still prove to serve

us as an important component on tomorrows vehicles and future energy needs Flywheels

are one of the most promising technologies for replacing conventional lead acid batteries

as energy storage systems for a variety of applications including automobiles

economical rural electrification systems and stand-alone remote power units commonly

used in the telecommunications industry Recent advances in the mechanical properties of

composites has rekindled interest in using the inertia of a spinning wheel to store energy

23

In addition to energy density flywheel energy storage systems (FES) also offer several

important advantages over chemical energy storage The rate at which energy can be

exchanged into or out of the battery is limited only by the motor--generator design

Therefore it is possible to withdraw large amounts of energy in a far shorter time than

with traditional chemical batteries Indeed research into exploiting this property of FES

systems to get short intense bursts of energy is ongoing with the most notable projects

being a magnetic tank gun and a fusion ignition system Of course it is also possible to

quickly charge FES batteries making them desirable for application in electric cars where

the charge time could be dropped from a matter of hours to a matter of minutes

Advantages Flywheels store energy very efficiently (high turn-around efficiency) and

have the potential for very high specific power compared with batteries Flywheels have

very high output potential and relatively long life Flywheels are relatively unaffected by

ambient temperature extremes

Disadvantages Current flywheels have low specific energy There are safety concerns

associated with flywheels due to their high speed rotor and the possibility of it breaking

loose and releasing all of its energy in an uncontrolled manner Flywheels are a less

mature technology than chemical batteries and the current cost is too high to make them

competitive in the market

VOLTAGE REGULATOR

24

A Voltage Regulator (also called a regulator) has only three legs and appears to be a

comparatively simple device but it is actually a very complex integrated circuit A

regulator converts varying input voltage and produces a constant regulated output

voltage Voltage regulators are available in a variety of outputs typically 5 volts 9 volts

and 12 volts The last two digits in the name indicate the output voltage

Introduction

It is very easy to get stabilized voltage for ICs by using a three terminal voltage regulator

The three terminal voltage regulator outputs stabilized voltage at a lower level than the

higher input voltage A voltage regulator cannot put out higher voltage than the input

voltage They are similar in appearance to a transistor The 7800 series consists of three-

terminal positive voltage regulators

These ICs are designed as fixed voltage regulators and with adequate heat sinking can

deliver output currents in excess of 1A These ICs are used to provide +5 volts and +12

volts supply Line regulation in these ICs is change in the output voltage for a change in

the input voltage Load regulation is defined as the change in output voltage for a change

in load current If there is any high voltage than 12 volt to 7812 it will convert to 12 V by

this IC If there is any voltage less than 12 volt it allows passing it FAN is used for

cooling the ICs

There are two ICs 7805 and 7812 attached with the Intel-fan heat sink From the base of

7805 IC we get the +5Volt Supply and from the base of 7812 IC we get the 12 Volt

25

supply Two LED are also connected with the respective ICs in order to indicate there

proper working

There are some voltage regulators

LM7805 for + 5 volts

LM7809 for +9 volts

LM7812 for+12 volts

LM7905 for-5 volts

LM7909 for-9 volts

LM7912 for-12 volts

Fig LM7805 Integrated Circuit Internal Schematic

The LM78XX series of voltage regulators are designed for positive input For

applications requiring negative input the LM79XX series is used

26

Fig Symbol of voltage regulator Fig A LM 7805 regulator

Fig The circuit diagram represents a typical use of a voltage regulator

Note The LM7805 can reliably deliver 1 amp at a constant voltage

Input Voltage

As a general rule the input voltage should be limited to 2 to 3 volts above the output

voltage The LM78XX series can handle up to 30 volts input but the power difference

between the input voltagecurrent ratio and output voltagecurrent ratio appears as heat If

the input voltage is unnecessarily high the regulator will get very hot Unless sufficient

heat sinking is provided the regulator will shut down

27

Parallel Port

Essentials

A first step in exploring the parallel port is learning how to get the most from a port with

your everyday applications and peripherals Things to know include how to find

configure and install a port how and when to use the new bidirectional EPP and ECP

modes and how to handle a system with multiple parallel-port peripherals

Defining the Ports

What is the parallel port In the computer world a port is a set of signal lines that the

microprocessor or CPU uses to exchange data with other components Typical uses for

ports are communicating with printers modems keyboards and displays or just about

any component Most computer ports are digital where each signal or bit is 0 or 1 A

parallel port transfers multiple bits at once while a serial port transfers a bit at a time

(though it may transfer in both directions at once)The ports explained here is about a

specific type of parallel port the one found on just about every Pc or IBM-compatible

personal computer Along with the RS-232 serial port the parallel port is a workhorse of

PC communications On newer PCs you may find other ports such as SCSI USB and

IrDA but the parallel port remains popular because its capable flexible and every PC

has one

The term PC-compatible or PC for short refers to the IBM PC and any of the

many many personal computers derived from it From another angle a PC is any

computer that can run Microsofts MS-DOS operating system and whose expansion bus is

compatible with the ISA bus in the original IBM Pc The category includes the PC XT

AT PS2 and most computers with 80x86 Pentium and compatible CPUs It does not

include the Macintosh Amiga or IBM mainframes though these and other computer

types may have ports that are similar to the parallel port on the Pc The original PCs

parallel port had eight outputs five inputs and four bidirectional lines

These are enough for communicating with many types of peripherals On many

newer PCs the eight outputs can also serve as inputs for faster communications with

scanners drives and other devices that send data to the Pc

28

The parallel port was designed as a printer port and many of the-original names for the

ports signals (PaperEnd AutoLineFeed) reflect that use But these days you can find all

kinds of things besides printers connected to the port The term peripheral or peripheral

device is a catch-all category that includes printers scanners modems and other devices

that connect to a Pc

29

Accessing Ports

Windows DOS C JAVA and Visual Basic provide several ways to read and write to

parallel ports The most direct way is reading and writing to the port registers Most

programming languages include this ability or at least allow you to add it Visual Basic

includes other options including the Printer object the Print Form method and Open

LPT x Windows also has API calls for accessing LPT ports and 16-bit programs can use

BIOS and DOS software interrupts for LPT access This chapter introduces the parallel

ports signals and ways of accessing them in the programs you write

Parallel ports can be used to connect a host of popular computer peripherals

bull Printers

bull Scanners

bull CD burners

bull External hard drives

bull Iomega Zip removable drives

bull Network adapters

bull Tape backup drives

30

Pin Out Diagram Of Parallel Port

31

Parallel Port Basics

Parallel ports were originally developed by IBM as a way to connect a printer to our PC

When IBM was in the process of designing the PC the company wanted the computer to

work with printers offered by Centronics a top printer manufacturer at the time IBM

decided not to use the same port interface on the computer that Centronics used on the

printer

Instead IBM engineers coupled a 25-pin connector DB-25 with a 36-pin Centronics

connector to create a special cable to connect the printer to the computer Other printer

manufacturers ended up adopting the Centronics interface making this strange hybrid

cable an unlikely de facto standard

When a PC sends data to a printer or other device using a parallel port it sends 8 bits of

data (1 byte) at a time These 8 bits are transmitted parallel to each other as opposed to

the same eight bits being transmitted serially (all in a single row) through a serial port

The standard parallel port is capable of sending 50 to 100 kilobytes of data per second

Lets take a closer look at what each pin does when used with a printer

bull Pin 1 carries the strobe signal It maintains a level of between 28 and 5 volts but drops

below 05 volts whenever the computer sends a byte of data This drop in voltage tells

the printer that data is being sent

Pins 2 through 9 are used to carry data To indicate that a bit has a value of 1 a

charge of 5 volts is sent through the correct pin No charge on a pin indicates avalue of

0 This is a simple but highly effective way to transmit digital information over an

analog cable in real-time

bull Pin 10 sends the acknowledge signal from the printer to the computer Like Pin 1 it

maintains a charge and drops the voltage below 05 volts to let the computer know that

the data was received

32

bull If the printer is busy it will charge Pin 11 Then it will drop the voltage below

05 volts to let the computer know it is ready to receive more data

bull The printer lets the computer know if it is out of paper by sending a charge on Pin 12

bull As long as the computer is receiving a charge on Pin 13 it knows that the device

is online

bull The computer sends an auto feed signal to the printer through Pin 14 using a 5-

volt charge

bull If the printer has any problems it drops the voltage to less than 05 volts on Pin

15 to let the computer know that there is an error

bull Whenever a new print job is ready the computer drops the charge on Pin 16 to

initialize the printer

bull Pin 17 is used by the computer to remotely take the printer offline This is

accomplished by sending a charge to the printer and maintaining it as long as you

want the printer offline

bull Pins 18-25 are grounds and are used as a reference signal for the low (below 05

volts) charge

33

Power Supply

Types of Power Supply

There are many types of power supply Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other

devices A power supply can by broken down into a series of blocks each of which

performs a particular function

For example a 5V regulated supply

Each of the blocks is described in more detail below

Transformer - steps down high voltage AC mains to low voltage AC

Rectifier - converts AC to DC but the DC output is varying

Smoothing - smooths the DC from varying greatly to a small ripple

Regulator - eliminates ripple by setting DC output to a fixed voltage

Power supplies made from these blocks are described below with a circuit diagram and a

graph of their output

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Dual Supplies

34

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 10: Self Balancing Robot

COMPONENT DESCRIPTION

Resistors

Example Circuit symbol

Function

Resistors restrict the flow of electric current for example a resistor is

placed in series with a light-emitting diode (LED) to limit the current

passing through the LED

Connecting and soldering

Resistors may be connected either way round They are not damaged

by heat when soldering

Resistor values - the resistor colour code

Resistance is measured in ohms the symbol for ohm is an omega

1 is quite small so resistor values are often given in k and M

1 k = 1000 1 M = 1000000

Resistor values are normally shown using coloured bands

Each colour represents a number as shown in the table

Most resistors have 4 bands

The first band gives the first digit

The second band gives the second digit

The third band indicates the number of zeros

The fourth band is used to shows the tolerance (precision) of the resistor this may

be ignored for almost all circuits but further details are given below

The Resistor

Colour Code

Colour Number

Black 0

Brown 1

Red 2

Orange 3

Yellow 4

Green 5

Blue 6

Violet 7

Grey 8

White 9

10

This resistor has red (2) violet (7) yellow (4 zeros) and gold bands

So its value is 270000 = 270 k

On circuit diagrams the is usually omitted and the value is written 270K

Small value resistors (less than 10 ohm)

The standard colour code cannot show values of less than 10 To show these small

values two special colours are used for the third band gold which means times 01 and silver

which means times 001 The first and second bands represent the digits as normal

For example

red violet gold bands represent 27 times 01 = 27

green blue silver bands represent 56 times 001 = 056

Tolerance of resistors (fourth band of colour code)

The tolerance of a resistor is shown by the fourth band of the colour code Tolerance is

the precision of the resistor and it is given as a percentage For example a 390 resistor

with a tolerance of plusmn10 will have a value within 10 of 390 between 390 - 39 = 351

and 390 + 39 = 429 (39 is 10 of 390)

A special colour code is used for the fourth band tolerance

silver plusmn10 gold plusmn5 red plusmn2 brown plusmn1

If no fourth band is shown the tolerance is plusmn20

Tolerance may be ignored for almost all circuits because precise resistor values are rarely

required

11

Transistors

Function

Transistors amplify current for example they can be used to amplify the small output

current from a logic chip so that it can operate a lamp relay or other high current device

In many circuits a resistor is used to convert the changing current to a changing voltage

so the transistor is being used to amplify voltage

A transistor may be used as a switch (either fully on with maximum current or fully off

with no current) and as an amplifier (always partly on)

The amount of current amplification is called the current gain symbol hFE

There are two types of standard transistors NPN and PNP

with different circuit symbols The letters refer to the layers

of semiconductor material used to make the transistor Most

transistors used today are NPN because this is the easiest

type to make from silicon If you are new to electronics it is

best to start by learning how to use NPN transistors

The leads are labeled base (B) collector (C) and emitter (E)

These terms refer to the internal operation of a transistor but they are not much help in

understanding how a transistor is used so just treat them as labels

A Darlington pair is two transistors connected together to give a very high current gain

In addition to standard (bipolar junction) transistors there are field-effect transistors

which are usually referred to as FETs They have different circuit symbols and properties

and they are not (yet) covered by this page

Transistor circuit symbols

12

Connecting

Transistors have three leads which

must be connected the correct way

round Please take care with this

because a wrongly connected transistor

may be damaged instantly when you

switch on

If you are lucky the orientation of the

transistor will be clear from the PCB or

stripboard layout diagram otherwise you will need to refer to a suppliers catalogue to

identify the leads

The drawings on the right show the leads for some of the most common case styles

Please note that transistor lead diagrams show the view from below with the leads

towards you This is the opposite of IC (chip) pin diagrams

which show the view from above

Soldering

Transistors can be damaged by heat when soldering so if you

are not an expert it is wise to use a heat sink clipped to the lead

between the joint and the transistor body A standard crocodile clip can be used as a heat

sink

Do not confuse this temporary heat sink with the permanent heat sink (described below)

which may be required for a power transistor to prevent it overheating during operation

Transistor leads for some common case styles

Crocodile clip

13

Heat sinks

Waste heat is produced in transistors due to the current flowing through

them Heat sinks are needed for power transistors because they pass

large currents If you find that a transistor is becoming too hot to touch it certainly needs

a heat sink The heat sink helps to dissipate (remove) the heat by transferring it to the

surrounding air

Darlington pair

This is two transistors connected together so that

the amplified current from the first is amplified further by the second transistor This

gives the Darlington pair a very high current gain such as 10000 Darlington pairs are

sold as complete packages containing the two transistors They have three leads

(B C and E) which are equivalent to the leads of a standard individual transistor

You can make up your own Darlington pair from two transistors

For example

For TR1 use BC548B with hFE1 = 220

For TR2 use BC639 with hFE2 = 40

The overall gain of this pair is hFE1 times hFE2 = 220 times 40 = 8800

The pairs maximum collector current IC(max) is the same as TR2

Heat sink

14

LED

Example Circuit symbol

Function

LEDs emit light when an electric current passes through them

Connecting and soldering

LEDs must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is the

short lead and there may be a slight flat on the body of round LEDs If you can see inside

the LED the cathode is the larger electrode (but this is not an official identification

method)

LEDs can be damaged by heat when soldering but the risk is small unless you are very

slow No special precautions are needed for soldering most LEDs

15

Testing an LED

Never connect an LED directly to a battery or power supply

It will be destroyed almost instantly because too much current will pass through and burn

it out

LEDs must have a resistor in series to limit the current to a safe value for quick testing

purposes a 1k resistor is suitable for most LEDs if your supply voltage is 12V or less

Remember to connect the LED the correct way round

Colours of LEDs

LEDs are available in red orange amber yellow green blue and white Blue and white

LEDs are much more expensive than the other colours

The colour of an LED is determined by the semiconductor material not by the colouring

of the package (the plastic body) LEDs of all colours are available in uncoloured

packages which may be diffused (milky) or clear (often described as water clear) The

coloured packages are also available as diffused (the standard type) or transparent

16

Capacitors

Function

Capacitors store electric charge They are used with resistors in timing circuits because it

takes time for a capacitor to fill with charge They are used to smooth varying DC

supplies by acting as a reservoir of charge They are also used in filter circuits because

capacitors easily pass AC (changing) signals but they block DC (constant) signals

Capacitance

This is a measure of a capacitors ability to store charge A large capacitance means that

more charge can be stored Capacitance is measured in farads symbol F However 1F is

very large so prefixes are used to show the smaller values

Three prefixes (multipliers) are used micro (micro) n (nano) and p (pico)

micro means 10-6 (millionth) so 1000000microF = 1F

n means 10-9 (thousand-millionth) so 1000nF = 1microF

p means 10-12 (million-millionth) so 1000pF = 1nF

Capacitor values can be very difficult to find because there are man

types of capacitor with different labeling systems

Capacitor Colour Code

A colour code was used on polyester capacitors for many years It is

now obsolete but of course there are many still around The colours

should be read like the resistor code the top three colour bands giving

the value in pF Ignore the 4th band (tolerance) and 5th band (voltage

rating) For example brown black orange means 10000pF = 10nF =

001microF Note that there are no gaps between the colour bands so 2 identical bands

actually appear as a wide band For example wide red yellow means 220nF = 022microF

Different types of capacitors

Colour Code

Colour Number

Black 0

Brown 1

Red 2

Orange 3

Yellow 4

Green 5

Blue 6

Violet 7

Grey 8

17

Electrolytic Capacitors Ceramic Capacitor

An electrolytic capacitor is a type of capacitor typically with a larger capacitance per

unit volume than other types making them valuable in relatively high-current and low-

frequency electrical circuits This is especially the case in power-supply filters where

they store charge needed to moderate output voltage and current fluctuations in rectifier

output and especially in the absence of rechargeable batteries that can provide similar

low-frequency current capacity They are also widely used as coupling capacitors in

circuits where AC should be conducted but DC should not the large value of the

capacitance allows them to pass very low frequencies

A Ceramic Capacitor is a capacitor constructed of alternating layers of metal and

ceramic with the ceramic material acting as the dielectric Depending on the dielectric

whether Class 1 or Class 2 the degree of temperaturecapacity dependence varies A

ceramic capacitor often has (especially the class 2) high dissipation factor high

frequency coefficient of dissipation Capacity depends on applied voltage and capacity

changes with aging Ceramic capacitors are used extensively in common low-precision

coupling and filtering applications They are suitable for high frequencies

A ceramic capacitor is a two-terminal non-polar device The classical ceramic capacitor

is the disk capacitor This device pre-dates the transistor and was used extensively in

vacuum-tube equipment (eg radio receivers)

Diodes

18

Function

Diodes allow electricity to flow in only one direction The arrow of the circuit symbol

shows the direction in which the current can flow Diodes are the electrical version of a

valve and early diodes were actually called valves

Example Circuit symbol

Forward Voltage Drop

Electricity uses up a little energy pushing its way through the diode rather like a person

pushing through a door with a spring This means that there is a small voltage across a

conducting diode it is called the forward voltage drop and is about 07V for all normal

diodes which are made from silicon The forward voltage drop of a diode is almost

constant whatever the current passing through the diode so they have a very steep

characteristic (current-voltage graph)

Reverse Voltage

When a reverse voltage is applied a perfect diode does not conduct but all real diodes

leak a very tiny current of a few microA or less This can be ignored in most circuits because

it will be very much smaller than the current flowing in the forward direction However

all diodes have a maximum reverse voltage (usually 50V or more) and if this is exceeded

the diode will fail and pass a large current in the reverse direction this is called

breakdown

Ordinary diodes can be split into two types Signal diodes which pass small currents of

100mA or less and Rectifier diodes which can pass large currents In addition there are

LEDs (which have their own page) and Zener diodes (at the bottom of this page)

19

Connecting and soldering

Diodes must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is

marked by a line painted on the body Diodes are labelled with their code in small print

you may need a magnifying glass to read this on small signal diodes Small signal diodes

can be damaged by heat when soldering but the risk is small unless you are using a

germanium diode (codes beginning OA) in which case you should use a heat sink

clipped to the lead between the joint and the diode body A standard crocodile clip can be

used as a heat sink

Rectifier diodes are quite robust and no special precautions are needed for soldering

them

Testing diodes

You can use a multimeter or a simple tester (battery resistor and LED) to check that a

diode conducts in one direction but not the other A lamp may be used to test a

rectifier diode but do NOT use a lamp to test a signal diode because the large current

passed by the lamp will destroy the diode

Signal diodes (small current)

20

Signal diodes are used to process information (electrical signals) in circuits so they are

only required to pass small currents of up to 100mA General purpose signal diodes such

as the 1N4148 are made from silicon and have a forward voltage drop of 07V

Germanium diodes

Such as the OA90 have a lower forward voltage drop of 02V and this makes them

suitable to use in radio circuits as detectors which extract the audio signal from the weak

radio signal

For general use where the size of the forward voltage drop is less important silicon

diodes are better because they are less easily damaged by heat when soldering they have

a lower resistance when conducting and they have very low leakage currents when a

reverse voltage is applied Rectifier diodes are used in power supplies to convert

alternating current (AC) to direct current (DC) a process called rectification They are

also used elsewhere in circuits where a large current must pass through the diode All

rectifier diodes are made from silicon and therefore have a forward voltage drop of 07V

The table shows maximum current and maximum reverse voltage for some popular

rectifier diodes The 1N4001 is suitable for most low voltage circuits with a current of

less than 1A

Bridge rectifiers

DiodeMaximum

Current

Maximum

Reverse

Voltage

1N4001 1A 50V

1N4002 1A 100V

1N4007 1A 1000V

1N5401 3A 100V

1N5408 3A 1000V

21

There are several ways of connecting diodes to make a rectifier to convert AC to

DC The bridge rectifier is one of them and it is available in special packages containing

the four diodes required Bridge rectifiers are rated by their maximum current and

maximum reverse voltage They have four leads or terminals the two DC outputs are

labeled + and - the two AC inputs are labeled

The diagram shows the operation of a bridge rectifier as it converts AC to DC Notice

how alternate pairs of diodes conduct

Transformer

A transformer makes use of Faradays law and the ferromagnetic properties of an iron

core to efficiently raise or lower AC voltages It of course cannot increase power so that

if the voltage is raised the current is proportionally lowered and vice versa

22

Flywheel Energy Storage

Overview

A flywheel in essence is a mechanical battery - simply a mass rotating about an axis

Flywheels store energy mechanically in the form of kinetic energy They take an

electrical input to accelerate the rotor up to speed by using the built-in motor and return

the electrical energy by using this same motor as a generator Flywheels are one of the

oldest and most common mechanical devises in existence They may still prove to serve

us as an important component on tomorrows vehicles and future energy needs Flywheels

are one of the most promising technologies for replacing conventional lead acid batteries

as energy storage systems for a variety of applications including automobiles

economical rural electrification systems and stand-alone remote power units commonly

used in the telecommunications industry Recent advances in the mechanical properties of

composites has rekindled interest in using the inertia of a spinning wheel to store energy

23

In addition to energy density flywheel energy storage systems (FES) also offer several

important advantages over chemical energy storage The rate at which energy can be

exchanged into or out of the battery is limited only by the motor--generator design

Therefore it is possible to withdraw large amounts of energy in a far shorter time than

with traditional chemical batteries Indeed research into exploiting this property of FES

systems to get short intense bursts of energy is ongoing with the most notable projects

being a magnetic tank gun and a fusion ignition system Of course it is also possible to

quickly charge FES batteries making them desirable for application in electric cars where

the charge time could be dropped from a matter of hours to a matter of minutes

Advantages Flywheels store energy very efficiently (high turn-around efficiency) and

have the potential for very high specific power compared with batteries Flywheels have

very high output potential and relatively long life Flywheels are relatively unaffected by

ambient temperature extremes

Disadvantages Current flywheels have low specific energy There are safety concerns

associated with flywheels due to their high speed rotor and the possibility of it breaking

loose and releasing all of its energy in an uncontrolled manner Flywheels are a less

mature technology than chemical batteries and the current cost is too high to make them

competitive in the market

VOLTAGE REGULATOR

24

A Voltage Regulator (also called a regulator) has only three legs and appears to be a

comparatively simple device but it is actually a very complex integrated circuit A

regulator converts varying input voltage and produces a constant regulated output

voltage Voltage regulators are available in a variety of outputs typically 5 volts 9 volts

and 12 volts The last two digits in the name indicate the output voltage

Introduction

It is very easy to get stabilized voltage for ICs by using a three terminal voltage regulator

The three terminal voltage regulator outputs stabilized voltage at a lower level than the

higher input voltage A voltage regulator cannot put out higher voltage than the input

voltage They are similar in appearance to a transistor The 7800 series consists of three-

terminal positive voltage regulators

These ICs are designed as fixed voltage regulators and with adequate heat sinking can

deliver output currents in excess of 1A These ICs are used to provide +5 volts and +12

volts supply Line regulation in these ICs is change in the output voltage for a change in

the input voltage Load regulation is defined as the change in output voltage for a change

in load current If there is any high voltage than 12 volt to 7812 it will convert to 12 V by

this IC If there is any voltage less than 12 volt it allows passing it FAN is used for

cooling the ICs

There are two ICs 7805 and 7812 attached with the Intel-fan heat sink From the base of

7805 IC we get the +5Volt Supply and from the base of 7812 IC we get the 12 Volt

25

supply Two LED are also connected with the respective ICs in order to indicate there

proper working

There are some voltage regulators

LM7805 for + 5 volts

LM7809 for +9 volts

LM7812 for+12 volts

LM7905 for-5 volts

LM7909 for-9 volts

LM7912 for-12 volts

Fig LM7805 Integrated Circuit Internal Schematic

The LM78XX series of voltage regulators are designed for positive input For

applications requiring negative input the LM79XX series is used

26

Fig Symbol of voltage regulator Fig A LM 7805 regulator

Fig The circuit diagram represents a typical use of a voltage regulator

Note The LM7805 can reliably deliver 1 amp at a constant voltage

Input Voltage

As a general rule the input voltage should be limited to 2 to 3 volts above the output

voltage The LM78XX series can handle up to 30 volts input but the power difference

between the input voltagecurrent ratio and output voltagecurrent ratio appears as heat If

the input voltage is unnecessarily high the regulator will get very hot Unless sufficient

heat sinking is provided the regulator will shut down

27

Parallel Port

Essentials

A first step in exploring the parallel port is learning how to get the most from a port with

your everyday applications and peripherals Things to know include how to find

configure and install a port how and when to use the new bidirectional EPP and ECP

modes and how to handle a system with multiple parallel-port peripherals

Defining the Ports

What is the parallel port In the computer world a port is a set of signal lines that the

microprocessor or CPU uses to exchange data with other components Typical uses for

ports are communicating with printers modems keyboards and displays or just about

any component Most computer ports are digital where each signal or bit is 0 or 1 A

parallel port transfers multiple bits at once while a serial port transfers a bit at a time

(though it may transfer in both directions at once)The ports explained here is about a

specific type of parallel port the one found on just about every Pc or IBM-compatible

personal computer Along with the RS-232 serial port the parallel port is a workhorse of

PC communications On newer PCs you may find other ports such as SCSI USB and

IrDA but the parallel port remains popular because its capable flexible and every PC

has one

The term PC-compatible or PC for short refers to the IBM PC and any of the

many many personal computers derived from it From another angle a PC is any

computer that can run Microsofts MS-DOS operating system and whose expansion bus is

compatible with the ISA bus in the original IBM Pc The category includes the PC XT

AT PS2 and most computers with 80x86 Pentium and compatible CPUs It does not

include the Macintosh Amiga or IBM mainframes though these and other computer

types may have ports that are similar to the parallel port on the Pc The original PCs

parallel port had eight outputs five inputs and four bidirectional lines

These are enough for communicating with many types of peripherals On many

newer PCs the eight outputs can also serve as inputs for faster communications with

scanners drives and other devices that send data to the Pc

28

The parallel port was designed as a printer port and many of the-original names for the

ports signals (PaperEnd AutoLineFeed) reflect that use But these days you can find all

kinds of things besides printers connected to the port The term peripheral or peripheral

device is a catch-all category that includes printers scanners modems and other devices

that connect to a Pc

29

Accessing Ports

Windows DOS C JAVA and Visual Basic provide several ways to read and write to

parallel ports The most direct way is reading and writing to the port registers Most

programming languages include this ability or at least allow you to add it Visual Basic

includes other options including the Printer object the Print Form method and Open

LPT x Windows also has API calls for accessing LPT ports and 16-bit programs can use

BIOS and DOS software interrupts for LPT access This chapter introduces the parallel

ports signals and ways of accessing them in the programs you write

Parallel ports can be used to connect a host of popular computer peripherals

bull Printers

bull Scanners

bull CD burners

bull External hard drives

bull Iomega Zip removable drives

bull Network adapters

bull Tape backup drives

30

Pin Out Diagram Of Parallel Port

31

Parallel Port Basics

Parallel ports were originally developed by IBM as a way to connect a printer to our PC

When IBM was in the process of designing the PC the company wanted the computer to

work with printers offered by Centronics a top printer manufacturer at the time IBM

decided not to use the same port interface on the computer that Centronics used on the

printer

Instead IBM engineers coupled a 25-pin connector DB-25 with a 36-pin Centronics

connector to create a special cable to connect the printer to the computer Other printer

manufacturers ended up adopting the Centronics interface making this strange hybrid

cable an unlikely de facto standard

When a PC sends data to a printer or other device using a parallel port it sends 8 bits of

data (1 byte) at a time These 8 bits are transmitted parallel to each other as opposed to

the same eight bits being transmitted serially (all in a single row) through a serial port

The standard parallel port is capable of sending 50 to 100 kilobytes of data per second

Lets take a closer look at what each pin does when used with a printer

bull Pin 1 carries the strobe signal It maintains a level of between 28 and 5 volts but drops

below 05 volts whenever the computer sends a byte of data This drop in voltage tells

the printer that data is being sent

Pins 2 through 9 are used to carry data To indicate that a bit has a value of 1 a

charge of 5 volts is sent through the correct pin No charge on a pin indicates avalue of

0 This is a simple but highly effective way to transmit digital information over an

analog cable in real-time

bull Pin 10 sends the acknowledge signal from the printer to the computer Like Pin 1 it

maintains a charge and drops the voltage below 05 volts to let the computer know that

the data was received

32

bull If the printer is busy it will charge Pin 11 Then it will drop the voltage below

05 volts to let the computer know it is ready to receive more data

bull The printer lets the computer know if it is out of paper by sending a charge on Pin 12

bull As long as the computer is receiving a charge on Pin 13 it knows that the device

is online

bull The computer sends an auto feed signal to the printer through Pin 14 using a 5-

volt charge

bull If the printer has any problems it drops the voltage to less than 05 volts on Pin

15 to let the computer know that there is an error

bull Whenever a new print job is ready the computer drops the charge on Pin 16 to

initialize the printer

bull Pin 17 is used by the computer to remotely take the printer offline This is

accomplished by sending a charge to the printer and maintaining it as long as you

want the printer offline

bull Pins 18-25 are grounds and are used as a reference signal for the low (below 05

volts) charge

33

Power Supply

Types of Power Supply

There are many types of power supply Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other

devices A power supply can by broken down into a series of blocks each of which

performs a particular function

For example a 5V regulated supply

Each of the blocks is described in more detail below

Transformer - steps down high voltage AC mains to low voltage AC

Rectifier - converts AC to DC but the DC output is varying

Smoothing - smooths the DC from varying greatly to a small ripple

Regulator - eliminates ripple by setting DC output to a fixed voltage

Power supplies made from these blocks are described below with a circuit diagram and a

graph of their output

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Dual Supplies

34

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 11: Self Balancing Robot

This resistor has red (2) violet (7) yellow (4 zeros) and gold bands

So its value is 270000 = 270 k

On circuit diagrams the is usually omitted and the value is written 270K

Small value resistors (less than 10 ohm)

The standard colour code cannot show values of less than 10 To show these small

values two special colours are used for the third band gold which means times 01 and silver

which means times 001 The first and second bands represent the digits as normal

For example

red violet gold bands represent 27 times 01 = 27

green blue silver bands represent 56 times 001 = 056

Tolerance of resistors (fourth band of colour code)

The tolerance of a resistor is shown by the fourth band of the colour code Tolerance is

the precision of the resistor and it is given as a percentage For example a 390 resistor

with a tolerance of plusmn10 will have a value within 10 of 390 between 390 - 39 = 351

and 390 + 39 = 429 (39 is 10 of 390)

A special colour code is used for the fourth band tolerance

silver plusmn10 gold plusmn5 red plusmn2 brown plusmn1

If no fourth band is shown the tolerance is plusmn20

Tolerance may be ignored for almost all circuits because precise resistor values are rarely

required

11

Transistors

Function

Transistors amplify current for example they can be used to amplify the small output

current from a logic chip so that it can operate a lamp relay or other high current device

In many circuits a resistor is used to convert the changing current to a changing voltage

so the transistor is being used to amplify voltage

A transistor may be used as a switch (either fully on with maximum current or fully off

with no current) and as an amplifier (always partly on)

The amount of current amplification is called the current gain symbol hFE

There are two types of standard transistors NPN and PNP

with different circuit symbols The letters refer to the layers

of semiconductor material used to make the transistor Most

transistors used today are NPN because this is the easiest

type to make from silicon If you are new to electronics it is

best to start by learning how to use NPN transistors

The leads are labeled base (B) collector (C) and emitter (E)

These terms refer to the internal operation of a transistor but they are not much help in

understanding how a transistor is used so just treat them as labels

A Darlington pair is two transistors connected together to give a very high current gain

In addition to standard (bipolar junction) transistors there are field-effect transistors

which are usually referred to as FETs They have different circuit symbols and properties

and they are not (yet) covered by this page

Transistor circuit symbols

12

Connecting

Transistors have three leads which

must be connected the correct way

round Please take care with this

because a wrongly connected transistor

may be damaged instantly when you

switch on

If you are lucky the orientation of the

transistor will be clear from the PCB or

stripboard layout diagram otherwise you will need to refer to a suppliers catalogue to

identify the leads

The drawings on the right show the leads for some of the most common case styles

Please note that transistor lead diagrams show the view from below with the leads

towards you This is the opposite of IC (chip) pin diagrams

which show the view from above

Soldering

Transistors can be damaged by heat when soldering so if you

are not an expert it is wise to use a heat sink clipped to the lead

between the joint and the transistor body A standard crocodile clip can be used as a heat

sink

Do not confuse this temporary heat sink with the permanent heat sink (described below)

which may be required for a power transistor to prevent it overheating during operation

Transistor leads for some common case styles

Crocodile clip

13

Heat sinks

Waste heat is produced in transistors due to the current flowing through

them Heat sinks are needed for power transistors because they pass

large currents If you find that a transistor is becoming too hot to touch it certainly needs

a heat sink The heat sink helps to dissipate (remove) the heat by transferring it to the

surrounding air

Darlington pair

This is two transistors connected together so that

the amplified current from the first is amplified further by the second transistor This

gives the Darlington pair a very high current gain such as 10000 Darlington pairs are

sold as complete packages containing the two transistors They have three leads

(B C and E) which are equivalent to the leads of a standard individual transistor

You can make up your own Darlington pair from two transistors

For example

For TR1 use BC548B with hFE1 = 220

For TR2 use BC639 with hFE2 = 40

The overall gain of this pair is hFE1 times hFE2 = 220 times 40 = 8800

The pairs maximum collector current IC(max) is the same as TR2

Heat sink

14

LED

Example Circuit symbol

Function

LEDs emit light when an electric current passes through them

Connecting and soldering

LEDs must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is the

short lead and there may be a slight flat on the body of round LEDs If you can see inside

the LED the cathode is the larger electrode (but this is not an official identification

method)

LEDs can be damaged by heat when soldering but the risk is small unless you are very

slow No special precautions are needed for soldering most LEDs

15

Testing an LED

Never connect an LED directly to a battery or power supply

It will be destroyed almost instantly because too much current will pass through and burn

it out

LEDs must have a resistor in series to limit the current to a safe value for quick testing

purposes a 1k resistor is suitable for most LEDs if your supply voltage is 12V or less

Remember to connect the LED the correct way round

Colours of LEDs

LEDs are available in red orange amber yellow green blue and white Blue and white

LEDs are much more expensive than the other colours

The colour of an LED is determined by the semiconductor material not by the colouring

of the package (the plastic body) LEDs of all colours are available in uncoloured

packages which may be diffused (milky) or clear (often described as water clear) The

coloured packages are also available as diffused (the standard type) or transparent

16

Capacitors

Function

Capacitors store electric charge They are used with resistors in timing circuits because it

takes time for a capacitor to fill with charge They are used to smooth varying DC

supplies by acting as a reservoir of charge They are also used in filter circuits because

capacitors easily pass AC (changing) signals but they block DC (constant) signals

Capacitance

This is a measure of a capacitors ability to store charge A large capacitance means that

more charge can be stored Capacitance is measured in farads symbol F However 1F is

very large so prefixes are used to show the smaller values

Three prefixes (multipliers) are used micro (micro) n (nano) and p (pico)

micro means 10-6 (millionth) so 1000000microF = 1F

n means 10-9 (thousand-millionth) so 1000nF = 1microF

p means 10-12 (million-millionth) so 1000pF = 1nF

Capacitor values can be very difficult to find because there are man

types of capacitor with different labeling systems

Capacitor Colour Code

A colour code was used on polyester capacitors for many years It is

now obsolete but of course there are many still around The colours

should be read like the resistor code the top three colour bands giving

the value in pF Ignore the 4th band (tolerance) and 5th band (voltage

rating) For example brown black orange means 10000pF = 10nF =

001microF Note that there are no gaps between the colour bands so 2 identical bands

actually appear as a wide band For example wide red yellow means 220nF = 022microF

Different types of capacitors

Colour Code

Colour Number

Black 0

Brown 1

Red 2

Orange 3

Yellow 4

Green 5

Blue 6

Violet 7

Grey 8

17

Electrolytic Capacitors Ceramic Capacitor

An electrolytic capacitor is a type of capacitor typically with a larger capacitance per

unit volume than other types making them valuable in relatively high-current and low-

frequency electrical circuits This is especially the case in power-supply filters where

they store charge needed to moderate output voltage and current fluctuations in rectifier

output and especially in the absence of rechargeable batteries that can provide similar

low-frequency current capacity They are also widely used as coupling capacitors in

circuits where AC should be conducted but DC should not the large value of the

capacitance allows them to pass very low frequencies

A Ceramic Capacitor is a capacitor constructed of alternating layers of metal and

ceramic with the ceramic material acting as the dielectric Depending on the dielectric

whether Class 1 or Class 2 the degree of temperaturecapacity dependence varies A

ceramic capacitor often has (especially the class 2) high dissipation factor high

frequency coefficient of dissipation Capacity depends on applied voltage and capacity

changes with aging Ceramic capacitors are used extensively in common low-precision

coupling and filtering applications They are suitable for high frequencies

A ceramic capacitor is a two-terminal non-polar device The classical ceramic capacitor

is the disk capacitor This device pre-dates the transistor and was used extensively in

vacuum-tube equipment (eg radio receivers)

Diodes

18

Function

Diodes allow electricity to flow in only one direction The arrow of the circuit symbol

shows the direction in which the current can flow Diodes are the electrical version of a

valve and early diodes were actually called valves

Example Circuit symbol

Forward Voltage Drop

Electricity uses up a little energy pushing its way through the diode rather like a person

pushing through a door with a spring This means that there is a small voltage across a

conducting diode it is called the forward voltage drop and is about 07V for all normal

diodes which are made from silicon The forward voltage drop of a diode is almost

constant whatever the current passing through the diode so they have a very steep

characteristic (current-voltage graph)

Reverse Voltage

When a reverse voltage is applied a perfect diode does not conduct but all real diodes

leak a very tiny current of a few microA or less This can be ignored in most circuits because

it will be very much smaller than the current flowing in the forward direction However

all diodes have a maximum reverse voltage (usually 50V or more) and if this is exceeded

the diode will fail and pass a large current in the reverse direction this is called

breakdown

Ordinary diodes can be split into two types Signal diodes which pass small currents of

100mA or less and Rectifier diodes which can pass large currents In addition there are

LEDs (which have their own page) and Zener diodes (at the bottom of this page)

19

Connecting and soldering

Diodes must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is

marked by a line painted on the body Diodes are labelled with their code in small print

you may need a magnifying glass to read this on small signal diodes Small signal diodes

can be damaged by heat when soldering but the risk is small unless you are using a

germanium diode (codes beginning OA) in which case you should use a heat sink

clipped to the lead between the joint and the diode body A standard crocodile clip can be

used as a heat sink

Rectifier diodes are quite robust and no special precautions are needed for soldering

them

Testing diodes

You can use a multimeter or a simple tester (battery resistor and LED) to check that a

diode conducts in one direction but not the other A lamp may be used to test a

rectifier diode but do NOT use a lamp to test a signal diode because the large current

passed by the lamp will destroy the diode

Signal diodes (small current)

20

Signal diodes are used to process information (electrical signals) in circuits so they are

only required to pass small currents of up to 100mA General purpose signal diodes such

as the 1N4148 are made from silicon and have a forward voltage drop of 07V

Germanium diodes

Such as the OA90 have a lower forward voltage drop of 02V and this makes them

suitable to use in radio circuits as detectors which extract the audio signal from the weak

radio signal

For general use where the size of the forward voltage drop is less important silicon

diodes are better because they are less easily damaged by heat when soldering they have

a lower resistance when conducting and they have very low leakage currents when a

reverse voltage is applied Rectifier diodes are used in power supplies to convert

alternating current (AC) to direct current (DC) a process called rectification They are

also used elsewhere in circuits where a large current must pass through the diode All

rectifier diodes are made from silicon and therefore have a forward voltage drop of 07V

The table shows maximum current and maximum reverse voltage for some popular

rectifier diodes The 1N4001 is suitable for most low voltage circuits with a current of

less than 1A

Bridge rectifiers

DiodeMaximum

Current

Maximum

Reverse

Voltage

1N4001 1A 50V

1N4002 1A 100V

1N4007 1A 1000V

1N5401 3A 100V

1N5408 3A 1000V

21

There are several ways of connecting diodes to make a rectifier to convert AC to

DC The bridge rectifier is one of them and it is available in special packages containing

the four diodes required Bridge rectifiers are rated by their maximum current and

maximum reverse voltage They have four leads or terminals the two DC outputs are

labeled + and - the two AC inputs are labeled

The diagram shows the operation of a bridge rectifier as it converts AC to DC Notice

how alternate pairs of diodes conduct

Transformer

A transformer makes use of Faradays law and the ferromagnetic properties of an iron

core to efficiently raise or lower AC voltages It of course cannot increase power so that

if the voltage is raised the current is proportionally lowered and vice versa

22

Flywheel Energy Storage

Overview

A flywheel in essence is a mechanical battery - simply a mass rotating about an axis

Flywheels store energy mechanically in the form of kinetic energy They take an

electrical input to accelerate the rotor up to speed by using the built-in motor and return

the electrical energy by using this same motor as a generator Flywheels are one of the

oldest and most common mechanical devises in existence They may still prove to serve

us as an important component on tomorrows vehicles and future energy needs Flywheels

are one of the most promising technologies for replacing conventional lead acid batteries

as energy storage systems for a variety of applications including automobiles

economical rural electrification systems and stand-alone remote power units commonly

used in the telecommunications industry Recent advances in the mechanical properties of

composites has rekindled interest in using the inertia of a spinning wheel to store energy

23

In addition to energy density flywheel energy storage systems (FES) also offer several

important advantages over chemical energy storage The rate at which energy can be

exchanged into or out of the battery is limited only by the motor--generator design

Therefore it is possible to withdraw large amounts of energy in a far shorter time than

with traditional chemical batteries Indeed research into exploiting this property of FES

systems to get short intense bursts of energy is ongoing with the most notable projects

being a magnetic tank gun and a fusion ignition system Of course it is also possible to

quickly charge FES batteries making them desirable for application in electric cars where

the charge time could be dropped from a matter of hours to a matter of minutes

Advantages Flywheels store energy very efficiently (high turn-around efficiency) and

have the potential for very high specific power compared with batteries Flywheels have

very high output potential and relatively long life Flywheels are relatively unaffected by

ambient temperature extremes

Disadvantages Current flywheels have low specific energy There are safety concerns

associated with flywheels due to their high speed rotor and the possibility of it breaking

loose and releasing all of its energy in an uncontrolled manner Flywheels are a less

mature technology than chemical batteries and the current cost is too high to make them

competitive in the market

VOLTAGE REGULATOR

24

A Voltage Regulator (also called a regulator) has only three legs and appears to be a

comparatively simple device but it is actually a very complex integrated circuit A

regulator converts varying input voltage and produces a constant regulated output

voltage Voltage regulators are available in a variety of outputs typically 5 volts 9 volts

and 12 volts The last two digits in the name indicate the output voltage

Introduction

It is very easy to get stabilized voltage for ICs by using a three terminal voltage regulator

The three terminal voltage regulator outputs stabilized voltage at a lower level than the

higher input voltage A voltage regulator cannot put out higher voltage than the input

voltage They are similar in appearance to a transistor The 7800 series consists of three-

terminal positive voltage regulators

These ICs are designed as fixed voltage regulators and with adequate heat sinking can

deliver output currents in excess of 1A These ICs are used to provide +5 volts and +12

volts supply Line regulation in these ICs is change in the output voltage for a change in

the input voltage Load regulation is defined as the change in output voltage for a change

in load current If there is any high voltage than 12 volt to 7812 it will convert to 12 V by

this IC If there is any voltage less than 12 volt it allows passing it FAN is used for

cooling the ICs

There are two ICs 7805 and 7812 attached with the Intel-fan heat sink From the base of

7805 IC we get the +5Volt Supply and from the base of 7812 IC we get the 12 Volt

25

supply Two LED are also connected with the respective ICs in order to indicate there

proper working

There are some voltage regulators

LM7805 for + 5 volts

LM7809 for +9 volts

LM7812 for+12 volts

LM7905 for-5 volts

LM7909 for-9 volts

LM7912 for-12 volts

Fig LM7805 Integrated Circuit Internal Schematic

The LM78XX series of voltage regulators are designed for positive input For

applications requiring negative input the LM79XX series is used

26

Fig Symbol of voltage regulator Fig A LM 7805 regulator

Fig The circuit diagram represents a typical use of a voltage regulator

Note The LM7805 can reliably deliver 1 amp at a constant voltage

Input Voltage

As a general rule the input voltage should be limited to 2 to 3 volts above the output

voltage The LM78XX series can handle up to 30 volts input but the power difference

between the input voltagecurrent ratio and output voltagecurrent ratio appears as heat If

the input voltage is unnecessarily high the regulator will get very hot Unless sufficient

heat sinking is provided the regulator will shut down

27

Parallel Port

Essentials

A first step in exploring the parallel port is learning how to get the most from a port with

your everyday applications and peripherals Things to know include how to find

configure and install a port how and when to use the new bidirectional EPP and ECP

modes and how to handle a system with multiple parallel-port peripherals

Defining the Ports

What is the parallel port In the computer world a port is a set of signal lines that the

microprocessor or CPU uses to exchange data with other components Typical uses for

ports are communicating with printers modems keyboards and displays or just about

any component Most computer ports are digital where each signal or bit is 0 or 1 A

parallel port transfers multiple bits at once while a serial port transfers a bit at a time

(though it may transfer in both directions at once)The ports explained here is about a

specific type of parallel port the one found on just about every Pc or IBM-compatible

personal computer Along with the RS-232 serial port the parallel port is a workhorse of

PC communications On newer PCs you may find other ports such as SCSI USB and

IrDA but the parallel port remains popular because its capable flexible and every PC

has one

The term PC-compatible or PC for short refers to the IBM PC and any of the

many many personal computers derived from it From another angle a PC is any

computer that can run Microsofts MS-DOS operating system and whose expansion bus is

compatible with the ISA bus in the original IBM Pc The category includes the PC XT

AT PS2 and most computers with 80x86 Pentium and compatible CPUs It does not

include the Macintosh Amiga or IBM mainframes though these and other computer

types may have ports that are similar to the parallel port on the Pc The original PCs

parallel port had eight outputs five inputs and four bidirectional lines

These are enough for communicating with many types of peripherals On many

newer PCs the eight outputs can also serve as inputs for faster communications with

scanners drives and other devices that send data to the Pc

28

The parallel port was designed as a printer port and many of the-original names for the

ports signals (PaperEnd AutoLineFeed) reflect that use But these days you can find all

kinds of things besides printers connected to the port The term peripheral or peripheral

device is a catch-all category that includes printers scanners modems and other devices

that connect to a Pc

29

Accessing Ports

Windows DOS C JAVA and Visual Basic provide several ways to read and write to

parallel ports The most direct way is reading and writing to the port registers Most

programming languages include this ability or at least allow you to add it Visual Basic

includes other options including the Printer object the Print Form method and Open

LPT x Windows also has API calls for accessing LPT ports and 16-bit programs can use

BIOS and DOS software interrupts for LPT access This chapter introduces the parallel

ports signals and ways of accessing them in the programs you write

Parallel ports can be used to connect a host of popular computer peripherals

bull Printers

bull Scanners

bull CD burners

bull External hard drives

bull Iomega Zip removable drives

bull Network adapters

bull Tape backup drives

30

Pin Out Diagram Of Parallel Port

31

Parallel Port Basics

Parallel ports were originally developed by IBM as a way to connect a printer to our PC

When IBM was in the process of designing the PC the company wanted the computer to

work with printers offered by Centronics a top printer manufacturer at the time IBM

decided not to use the same port interface on the computer that Centronics used on the

printer

Instead IBM engineers coupled a 25-pin connector DB-25 with a 36-pin Centronics

connector to create a special cable to connect the printer to the computer Other printer

manufacturers ended up adopting the Centronics interface making this strange hybrid

cable an unlikely de facto standard

When a PC sends data to a printer or other device using a parallel port it sends 8 bits of

data (1 byte) at a time These 8 bits are transmitted parallel to each other as opposed to

the same eight bits being transmitted serially (all in a single row) through a serial port

The standard parallel port is capable of sending 50 to 100 kilobytes of data per second

Lets take a closer look at what each pin does when used with a printer

bull Pin 1 carries the strobe signal It maintains a level of between 28 and 5 volts but drops

below 05 volts whenever the computer sends a byte of data This drop in voltage tells

the printer that data is being sent

Pins 2 through 9 are used to carry data To indicate that a bit has a value of 1 a

charge of 5 volts is sent through the correct pin No charge on a pin indicates avalue of

0 This is a simple but highly effective way to transmit digital information over an

analog cable in real-time

bull Pin 10 sends the acknowledge signal from the printer to the computer Like Pin 1 it

maintains a charge and drops the voltage below 05 volts to let the computer know that

the data was received

32

bull If the printer is busy it will charge Pin 11 Then it will drop the voltage below

05 volts to let the computer know it is ready to receive more data

bull The printer lets the computer know if it is out of paper by sending a charge on Pin 12

bull As long as the computer is receiving a charge on Pin 13 it knows that the device

is online

bull The computer sends an auto feed signal to the printer through Pin 14 using a 5-

volt charge

bull If the printer has any problems it drops the voltage to less than 05 volts on Pin

15 to let the computer know that there is an error

bull Whenever a new print job is ready the computer drops the charge on Pin 16 to

initialize the printer

bull Pin 17 is used by the computer to remotely take the printer offline This is

accomplished by sending a charge to the printer and maintaining it as long as you

want the printer offline

bull Pins 18-25 are grounds and are used as a reference signal for the low (below 05

volts) charge

33

Power Supply

Types of Power Supply

There are many types of power supply Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other

devices A power supply can by broken down into a series of blocks each of which

performs a particular function

For example a 5V regulated supply

Each of the blocks is described in more detail below

Transformer - steps down high voltage AC mains to low voltage AC

Rectifier - converts AC to DC but the DC output is varying

Smoothing - smooths the DC from varying greatly to a small ripple

Regulator - eliminates ripple by setting DC output to a fixed voltage

Power supplies made from these blocks are described below with a circuit diagram and a

graph of their output

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Dual Supplies

34

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 12: Self Balancing Robot

Transistors

Function

Transistors amplify current for example they can be used to amplify the small output

current from a logic chip so that it can operate a lamp relay or other high current device

In many circuits a resistor is used to convert the changing current to a changing voltage

so the transistor is being used to amplify voltage

A transistor may be used as a switch (either fully on with maximum current or fully off

with no current) and as an amplifier (always partly on)

The amount of current amplification is called the current gain symbol hFE

There are two types of standard transistors NPN and PNP

with different circuit symbols The letters refer to the layers

of semiconductor material used to make the transistor Most

transistors used today are NPN because this is the easiest

type to make from silicon If you are new to electronics it is

best to start by learning how to use NPN transistors

The leads are labeled base (B) collector (C) and emitter (E)

These terms refer to the internal operation of a transistor but they are not much help in

understanding how a transistor is used so just treat them as labels

A Darlington pair is two transistors connected together to give a very high current gain

In addition to standard (bipolar junction) transistors there are field-effect transistors

which are usually referred to as FETs They have different circuit symbols and properties

and they are not (yet) covered by this page

Transistor circuit symbols

12

Connecting

Transistors have three leads which

must be connected the correct way

round Please take care with this

because a wrongly connected transistor

may be damaged instantly when you

switch on

If you are lucky the orientation of the

transistor will be clear from the PCB or

stripboard layout diagram otherwise you will need to refer to a suppliers catalogue to

identify the leads

The drawings on the right show the leads for some of the most common case styles

Please note that transistor lead diagrams show the view from below with the leads

towards you This is the opposite of IC (chip) pin diagrams

which show the view from above

Soldering

Transistors can be damaged by heat when soldering so if you

are not an expert it is wise to use a heat sink clipped to the lead

between the joint and the transistor body A standard crocodile clip can be used as a heat

sink

Do not confuse this temporary heat sink with the permanent heat sink (described below)

which may be required for a power transistor to prevent it overheating during operation

Transistor leads for some common case styles

Crocodile clip

13

Heat sinks

Waste heat is produced in transistors due to the current flowing through

them Heat sinks are needed for power transistors because they pass

large currents If you find that a transistor is becoming too hot to touch it certainly needs

a heat sink The heat sink helps to dissipate (remove) the heat by transferring it to the

surrounding air

Darlington pair

This is two transistors connected together so that

the amplified current from the first is amplified further by the second transistor This

gives the Darlington pair a very high current gain such as 10000 Darlington pairs are

sold as complete packages containing the two transistors They have three leads

(B C and E) which are equivalent to the leads of a standard individual transistor

You can make up your own Darlington pair from two transistors

For example

For TR1 use BC548B with hFE1 = 220

For TR2 use BC639 with hFE2 = 40

The overall gain of this pair is hFE1 times hFE2 = 220 times 40 = 8800

The pairs maximum collector current IC(max) is the same as TR2

Heat sink

14

LED

Example Circuit symbol

Function

LEDs emit light when an electric current passes through them

Connecting and soldering

LEDs must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is the

short lead and there may be a slight flat on the body of round LEDs If you can see inside

the LED the cathode is the larger electrode (but this is not an official identification

method)

LEDs can be damaged by heat when soldering but the risk is small unless you are very

slow No special precautions are needed for soldering most LEDs

15

Testing an LED

Never connect an LED directly to a battery or power supply

It will be destroyed almost instantly because too much current will pass through and burn

it out

LEDs must have a resistor in series to limit the current to a safe value for quick testing

purposes a 1k resistor is suitable for most LEDs if your supply voltage is 12V or less

Remember to connect the LED the correct way round

Colours of LEDs

LEDs are available in red orange amber yellow green blue and white Blue and white

LEDs are much more expensive than the other colours

The colour of an LED is determined by the semiconductor material not by the colouring

of the package (the plastic body) LEDs of all colours are available in uncoloured

packages which may be diffused (milky) or clear (often described as water clear) The

coloured packages are also available as diffused (the standard type) or transparent

16

Capacitors

Function

Capacitors store electric charge They are used with resistors in timing circuits because it

takes time for a capacitor to fill with charge They are used to smooth varying DC

supplies by acting as a reservoir of charge They are also used in filter circuits because

capacitors easily pass AC (changing) signals but they block DC (constant) signals

Capacitance

This is a measure of a capacitors ability to store charge A large capacitance means that

more charge can be stored Capacitance is measured in farads symbol F However 1F is

very large so prefixes are used to show the smaller values

Three prefixes (multipliers) are used micro (micro) n (nano) and p (pico)

micro means 10-6 (millionth) so 1000000microF = 1F

n means 10-9 (thousand-millionth) so 1000nF = 1microF

p means 10-12 (million-millionth) so 1000pF = 1nF

Capacitor values can be very difficult to find because there are man

types of capacitor with different labeling systems

Capacitor Colour Code

A colour code was used on polyester capacitors for many years It is

now obsolete but of course there are many still around The colours

should be read like the resistor code the top three colour bands giving

the value in pF Ignore the 4th band (tolerance) and 5th band (voltage

rating) For example brown black orange means 10000pF = 10nF =

001microF Note that there are no gaps between the colour bands so 2 identical bands

actually appear as a wide band For example wide red yellow means 220nF = 022microF

Different types of capacitors

Colour Code

Colour Number

Black 0

Brown 1

Red 2

Orange 3

Yellow 4

Green 5

Blue 6

Violet 7

Grey 8

17

Electrolytic Capacitors Ceramic Capacitor

An electrolytic capacitor is a type of capacitor typically with a larger capacitance per

unit volume than other types making them valuable in relatively high-current and low-

frequency electrical circuits This is especially the case in power-supply filters where

they store charge needed to moderate output voltage and current fluctuations in rectifier

output and especially in the absence of rechargeable batteries that can provide similar

low-frequency current capacity They are also widely used as coupling capacitors in

circuits where AC should be conducted but DC should not the large value of the

capacitance allows them to pass very low frequencies

A Ceramic Capacitor is a capacitor constructed of alternating layers of metal and

ceramic with the ceramic material acting as the dielectric Depending on the dielectric

whether Class 1 or Class 2 the degree of temperaturecapacity dependence varies A

ceramic capacitor often has (especially the class 2) high dissipation factor high

frequency coefficient of dissipation Capacity depends on applied voltage and capacity

changes with aging Ceramic capacitors are used extensively in common low-precision

coupling and filtering applications They are suitable for high frequencies

A ceramic capacitor is a two-terminal non-polar device The classical ceramic capacitor

is the disk capacitor This device pre-dates the transistor and was used extensively in

vacuum-tube equipment (eg radio receivers)

Diodes

18

Function

Diodes allow electricity to flow in only one direction The arrow of the circuit symbol

shows the direction in which the current can flow Diodes are the electrical version of a

valve and early diodes were actually called valves

Example Circuit symbol

Forward Voltage Drop

Electricity uses up a little energy pushing its way through the diode rather like a person

pushing through a door with a spring This means that there is a small voltage across a

conducting diode it is called the forward voltage drop and is about 07V for all normal

diodes which are made from silicon The forward voltage drop of a diode is almost

constant whatever the current passing through the diode so they have a very steep

characteristic (current-voltage graph)

Reverse Voltage

When a reverse voltage is applied a perfect diode does not conduct but all real diodes

leak a very tiny current of a few microA or less This can be ignored in most circuits because

it will be very much smaller than the current flowing in the forward direction However

all diodes have a maximum reverse voltage (usually 50V or more) and if this is exceeded

the diode will fail and pass a large current in the reverse direction this is called

breakdown

Ordinary diodes can be split into two types Signal diodes which pass small currents of

100mA or less and Rectifier diodes which can pass large currents In addition there are

LEDs (which have their own page) and Zener diodes (at the bottom of this page)

19

Connecting and soldering

Diodes must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is

marked by a line painted on the body Diodes are labelled with their code in small print

you may need a magnifying glass to read this on small signal diodes Small signal diodes

can be damaged by heat when soldering but the risk is small unless you are using a

germanium diode (codes beginning OA) in which case you should use a heat sink

clipped to the lead between the joint and the diode body A standard crocodile clip can be

used as a heat sink

Rectifier diodes are quite robust and no special precautions are needed for soldering

them

Testing diodes

You can use a multimeter or a simple tester (battery resistor and LED) to check that a

diode conducts in one direction but not the other A lamp may be used to test a

rectifier diode but do NOT use a lamp to test a signal diode because the large current

passed by the lamp will destroy the diode

Signal diodes (small current)

20

Signal diodes are used to process information (electrical signals) in circuits so they are

only required to pass small currents of up to 100mA General purpose signal diodes such

as the 1N4148 are made from silicon and have a forward voltage drop of 07V

Germanium diodes

Such as the OA90 have a lower forward voltage drop of 02V and this makes them

suitable to use in radio circuits as detectors which extract the audio signal from the weak

radio signal

For general use where the size of the forward voltage drop is less important silicon

diodes are better because they are less easily damaged by heat when soldering they have

a lower resistance when conducting and they have very low leakage currents when a

reverse voltage is applied Rectifier diodes are used in power supplies to convert

alternating current (AC) to direct current (DC) a process called rectification They are

also used elsewhere in circuits where a large current must pass through the diode All

rectifier diodes are made from silicon and therefore have a forward voltage drop of 07V

The table shows maximum current and maximum reverse voltage for some popular

rectifier diodes The 1N4001 is suitable for most low voltage circuits with a current of

less than 1A

Bridge rectifiers

DiodeMaximum

Current

Maximum

Reverse

Voltage

1N4001 1A 50V

1N4002 1A 100V

1N4007 1A 1000V

1N5401 3A 100V

1N5408 3A 1000V

21

There are several ways of connecting diodes to make a rectifier to convert AC to

DC The bridge rectifier is one of them and it is available in special packages containing

the four diodes required Bridge rectifiers are rated by their maximum current and

maximum reverse voltage They have four leads or terminals the two DC outputs are

labeled + and - the two AC inputs are labeled

The diagram shows the operation of a bridge rectifier as it converts AC to DC Notice

how alternate pairs of diodes conduct

Transformer

A transformer makes use of Faradays law and the ferromagnetic properties of an iron

core to efficiently raise or lower AC voltages It of course cannot increase power so that

if the voltage is raised the current is proportionally lowered and vice versa

22

Flywheel Energy Storage

Overview

A flywheel in essence is a mechanical battery - simply a mass rotating about an axis

Flywheels store energy mechanically in the form of kinetic energy They take an

electrical input to accelerate the rotor up to speed by using the built-in motor and return

the electrical energy by using this same motor as a generator Flywheels are one of the

oldest and most common mechanical devises in existence They may still prove to serve

us as an important component on tomorrows vehicles and future energy needs Flywheels

are one of the most promising technologies for replacing conventional lead acid batteries

as energy storage systems for a variety of applications including automobiles

economical rural electrification systems and stand-alone remote power units commonly

used in the telecommunications industry Recent advances in the mechanical properties of

composites has rekindled interest in using the inertia of a spinning wheel to store energy

23

In addition to energy density flywheel energy storage systems (FES) also offer several

important advantages over chemical energy storage The rate at which energy can be

exchanged into or out of the battery is limited only by the motor--generator design

Therefore it is possible to withdraw large amounts of energy in a far shorter time than

with traditional chemical batteries Indeed research into exploiting this property of FES

systems to get short intense bursts of energy is ongoing with the most notable projects

being a magnetic tank gun and a fusion ignition system Of course it is also possible to

quickly charge FES batteries making them desirable for application in electric cars where

the charge time could be dropped from a matter of hours to a matter of minutes

Advantages Flywheels store energy very efficiently (high turn-around efficiency) and

have the potential for very high specific power compared with batteries Flywheels have

very high output potential and relatively long life Flywheels are relatively unaffected by

ambient temperature extremes

Disadvantages Current flywheels have low specific energy There are safety concerns

associated with flywheels due to their high speed rotor and the possibility of it breaking

loose and releasing all of its energy in an uncontrolled manner Flywheels are a less

mature technology than chemical batteries and the current cost is too high to make them

competitive in the market

VOLTAGE REGULATOR

24

A Voltage Regulator (also called a regulator) has only three legs and appears to be a

comparatively simple device but it is actually a very complex integrated circuit A

regulator converts varying input voltage and produces a constant regulated output

voltage Voltage regulators are available in a variety of outputs typically 5 volts 9 volts

and 12 volts The last two digits in the name indicate the output voltage

Introduction

It is very easy to get stabilized voltage for ICs by using a three terminal voltage regulator

The three terminal voltage regulator outputs stabilized voltage at a lower level than the

higher input voltage A voltage regulator cannot put out higher voltage than the input

voltage They are similar in appearance to a transistor The 7800 series consists of three-

terminal positive voltage regulators

These ICs are designed as fixed voltage regulators and with adequate heat sinking can

deliver output currents in excess of 1A These ICs are used to provide +5 volts and +12

volts supply Line regulation in these ICs is change in the output voltage for a change in

the input voltage Load regulation is defined as the change in output voltage for a change

in load current If there is any high voltage than 12 volt to 7812 it will convert to 12 V by

this IC If there is any voltage less than 12 volt it allows passing it FAN is used for

cooling the ICs

There are two ICs 7805 and 7812 attached with the Intel-fan heat sink From the base of

7805 IC we get the +5Volt Supply and from the base of 7812 IC we get the 12 Volt

25

supply Two LED are also connected with the respective ICs in order to indicate there

proper working

There are some voltage regulators

LM7805 for + 5 volts

LM7809 for +9 volts

LM7812 for+12 volts

LM7905 for-5 volts

LM7909 for-9 volts

LM7912 for-12 volts

Fig LM7805 Integrated Circuit Internal Schematic

The LM78XX series of voltage regulators are designed for positive input For

applications requiring negative input the LM79XX series is used

26

Fig Symbol of voltage regulator Fig A LM 7805 regulator

Fig The circuit diagram represents a typical use of a voltage regulator

Note The LM7805 can reliably deliver 1 amp at a constant voltage

Input Voltage

As a general rule the input voltage should be limited to 2 to 3 volts above the output

voltage The LM78XX series can handle up to 30 volts input but the power difference

between the input voltagecurrent ratio and output voltagecurrent ratio appears as heat If

the input voltage is unnecessarily high the regulator will get very hot Unless sufficient

heat sinking is provided the regulator will shut down

27

Parallel Port

Essentials

A first step in exploring the parallel port is learning how to get the most from a port with

your everyday applications and peripherals Things to know include how to find

configure and install a port how and when to use the new bidirectional EPP and ECP

modes and how to handle a system with multiple parallel-port peripherals

Defining the Ports

What is the parallel port In the computer world a port is a set of signal lines that the

microprocessor or CPU uses to exchange data with other components Typical uses for

ports are communicating with printers modems keyboards and displays or just about

any component Most computer ports are digital where each signal or bit is 0 or 1 A

parallel port transfers multiple bits at once while a serial port transfers a bit at a time

(though it may transfer in both directions at once)The ports explained here is about a

specific type of parallel port the one found on just about every Pc or IBM-compatible

personal computer Along with the RS-232 serial port the parallel port is a workhorse of

PC communications On newer PCs you may find other ports such as SCSI USB and

IrDA but the parallel port remains popular because its capable flexible and every PC

has one

The term PC-compatible or PC for short refers to the IBM PC and any of the

many many personal computers derived from it From another angle a PC is any

computer that can run Microsofts MS-DOS operating system and whose expansion bus is

compatible with the ISA bus in the original IBM Pc The category includes the PC XT

AT PS2 and most computers with 80x86 Pentium and compatible CPUs It does not

include the Macintosh Amiga or IBM mainframes though these and other computer

types may have ports that are similar to the parallel port on the Pc The original PCs

parallel port had eight outputs five inputs and four bidirectional lines

These are enough for communicating with many types of peripherals On many

newer PCs the eight outputs can also serve as inputs for faster communications with

scanners drives and other devices that send data to the Pc

28

The parallel port was designed as a printer port and many of the-original names for the

ports signals (PaperEnd AutoLineFeed) reflect that use But these days you can find all

kinds of things besides printers connected to the port The term peripheral or peripheral

device is a catch-all category that includes printers scanners modems and other devices

that connect to a Pc

29

Accessing Ports

Windows DOS C JAVA and Visual Basic provide several ways to read and write to

parallel ports The most direct way is reading and writing to the port registers Most

programming languages include this ability or at least allow you to add it Visual Basic

includes other options including the Printer object the Print Form method and Open

LPT x Windows also has API calls for accessing LPT ports and 16-bit programs can use

BIOS and DOS software interrupts for LPT access This chapter introduces the parallel

ports signals and ways of accessing them in the programs you write

Parallel ports can be used to connect a host of popular computer peripherals

bull Printers

bull Scanners

bull CD burners

bull External hard drives

bull Iomega Zip removable drives

bull Network adapters

bull Tape backup drives

30

Pin Out Diagram Of Parallel Port

31

Parallel Port Basics

Parallel ports were originally developed by IBM as a way to connect a printer to our PC

When IBM was in the process of designing the PC the company wanted the computer to

work with printers offered by Centronics a top printer manufacturer at the time IBM

decided not to use the same port interface on the computer that Centronics used on the

printer

Instead IBM engineers coupled a 25-pin connector DB-25 with a 36-pin Centronics

connector to create a special cable to connect the printer to the computer Other printer

manufacturers ended up adopting the Centronics interface making this strange hybrid

cable an unlikely de facto standard

When a PC sends data to a printer or other device using a parallel port it sends 8 bits of

data (1 byte) at a time These 8 bits are transmitted parallel to each other as opposed to

the same eight bits being transmitted serially (all in a single row) through a serial port

The standard parallel port is capable of sending 50 to 100 kilobytes of data per second

Lets take a closer look at what each pin does when used with a printer

bull Pin 1 carries the strobe signal It maintains a level of between 28 and 5 volts but drops

below 05 volts whenever the computer sends a byte of data This drop in voltage tells

the printer that data is being sent

Pins 2 through 9 are used to carry data To indicate that a bit has a value of 1 a

charge of 5 volts is sent through the correct pin No charge on a pin indicates avalue of

0 This is a simple but highly effective way to transmit digital information over an

analog cable in real-time

bull Pin 10 sends the acknowledge signal from the printer to the computer Like Pin 1 it

maintains a charge and drops the voltage below 05 volts to let the computer know that

the data was received

32

bull If the printer is busy it will charge Pin 11 Then it will drop the voltage below

05 volts to let the computer know it is ready to receive more data

bull The printer lets the computer know if it is out of paper by sending a charge on Pin 12

bull As long as the computer is receiving a charge on Pin 13 it knows that the device

is online

bull The computer sends an auto feed signal to the printer through Pin 14 using a 5-

volt charge

bull If the printer has any problems it drops the voltage to less than 05 volts on Pin

15 to let the computer know that there is an error

bull Whenever a new print job is ready the computer drops the charge on Pin 16 to

initialize the printer

bull Pin 17 is used by the computer to remotely take the printer offline This is

accomplished by sending a charge to the printer and maintaining it as long as you

want the printer offline

bull Pins 18-25 are grounds and are used as a reference signal for the low (below 05

volts) charge

33

Power Supply

Types of Power Supply

There are many types of power supply Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other

devices A power supply can by broken down into a series of blocks each of which

performs a particular function

For example a 5V regulated supply

Each of the blocks is described in more detail below

Transformer - steps down high voltage AC mains to low voltage AC

Rectifier - converts AC to DC but the DC output is varying

Smoothing - smooths the DC from varying greatly to a small ripple

Regulator - eliminates ripple by setting DC output to a fixed voltage

Power supplies made from these blocks are described below with a circuit diagram and a

graph of their output

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Dual Supplies

34

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 13: Self Balancing Robot

Connecting

Transistors have three leads which

must be connected the correct way

round Please take care with this

because a wrongly connected transistor

may be damaged instantly when you

switch on

If you are lucky the orientation of the

transistor will be clear from the PCB or

stripboard layout diagram otherwise you will need to refer to a suppliers catalogue to

identify the leads

The drawings on the right show the leads for some of the most common case styles

Please note that transistor lead diagrams show the view from below with the leads

towards you This is the opposite of IC (chip) pin diagrams

which show the view from above

Soldering

Transistors can be damaged by heat when soldering so if you

are not an expert it is wise to use a heat sink clipped to the lead

between the joint and the transistor body A standard crocodile clip can be used as a heat

sink

Do not confuse this temporary heat sink with the permanent heat sink (described below)

which may be required for a power transistor to prevent it overheating during operation

Transistor leads for some common case styles

Crocodile clip

13

Heat sinks

Waste heat is produced in transistors due to the current flowing through

them Heat sinks are needed for power transistors because they pass

large currents If you find that a transistor is becoming too hot to touch it certainly needs

a heat sink The heat sink helps to dissipate (remove) the heat by transferring it to the

surrounding air

Darlington pair

This is two transistors connected together so that

the amplified current from the first is amplified further by the second transistor This

gives the Darlington pair a very high current gain such as 10000 Darlington pairs are

sold as complete packages containing the two transistors They have three leads

(B C and E) which are equivalent to the leads of a standard individual transistor

You can make up your own Darlington pair from two transistors

For example

For TR1 use BC548B with hFE1 = 220

For TR2 use BC639 with hFE2 = 40

The overall gain of this pair is hFE1 times hFE2 = 220 times 40 = 8800

The pairs maximum collector current IC(max) is the same as TR2

Heat sink

14

LED

Example Circuit symbol

Function

LEDs emit light when an electric current passes through them

Connecting and soldering

LEDs must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is the

short lead and there may be a slight flat on the body of round LEDs If you can see inside

the LED the cathode is the larger electrode (but this is not an official identification

method)

LEDs can be damaged by heat when soldering but the risk is small unless you are very

slow No special precautions are needed for soldering most LEDs

15

Testing an LED

Never connect an LED directly to a battery or power supply

It will be destroyed almost instantly because too much current will pass through and burn

it out

LEDs must have a resistor in series to limit the current to a safe value for quick testing

purposes a 1k resistor is suitable for most LEDs if your supply voltage is 12V or less

Remember to connect the LED the correct way round

Colours of LEDs

LEDs are available in red orange amber yellow green blue and white Blue and white

LEDs are much more expensive than the other colours

The colour of an LED is determined by the semiconductor material not by the colouring

of the package (the plastic body) LEDs of all colours are available in uncoloured

packages which may be diffused (milky) or clear (often described as water clear) The

coloured packages are also available as diffused (the standard type) or transparent

16

Capacitors

Function

Capacitors store electric charge They are used with resistors in timing circuits because it

takes time for a capacitor to fill with charge They are used to smooth varying DC

supplies by acting as a reservoir of charge They are also used in filter circuits because

capacitors easily pass AC (changing) signals but they block DC (constant) signals

Capacitance

This is a measure of a capacitors ability to store charge A large capacitance means that

more charge can be stored Capacitance is measured in farads symbol F However 1F is

very large so prefixes are used to show the smaller values

Three prefixes (multipliers) are used micro (micro) n (nano) and p (pico)

micro means 10-6 (millionth) so 1000000microF = 1F

n means 10-9 (thousand-millionth) so 1000nF = 1microF

p means 10-12 (million-millionth) so 1000pF = 1nF

Capacitor values can be very difficult to find because there are man

types of capacitor with different labeling systems

Capacitor Colour Code

A colour code was used on polyester capacitors for many years It is

now obsolete but of course there are many still around The colours

should be read like the resistor code the top three colour bands giving

the value in pF Ignore the 4th band (tolerance) and 5th band (voltage

rating) For example brown black orange means 10000pF = 10nF =

001microF Note that there are no gaps between the colour bands so 2 identical bands

actually appear as a wide band For example wide red yellow means 220nF = 022microF

Different types of capacitors

Colour Code

Colour Number

Black 0

Brown 1

Red 2

Orange 3

Yellow 4

Green 5

Blue 6

Violet 7

Grey 8

17

Electrolytic Capacitors Ceramic Capacitor

An electrolytic capacitor is a type of capacitor typically with a larger capacitance per

unit volume than other types making them valuable in relatively high-current and low-

frequency electrical circuits This is especially the case in power-supply filters where

they store charge needed to moderate output voltage and current fluctuations in rectifier

output and especially in the absence of rechargeable batteries that can provide similar

low-frequency current capacity They are also widely used as coupling capacitors in

circuits where AC should be conducted but DC should not the large value of the

capacitance allows them to pass very low frequencies

A Ceramic Capacitor is a capacitor constructed of alternating layers of metal and

ceramic with the ceramic material acting as the dielectric Depending on the dielectric

whether Class 1 or Class 2 the degree of temperaturecapacity dependence varies A

ceramic capacitor often has (especially the class 2) high dissipation factor high

frequency coefficient of dissipation Capacity depends on applied voltage and capacity

changes with aging Ceramic capacitors are used extensively in common low-precision

coupling and filtering applications They are suitable for high frequencies

A ceramic capacitor is a two-terminal non-polar device The classical ceramic capacitor

is the disk capacitor This device pre-dates the transistor and was used extensively in

vacuum-tube equipment (eg radio receivers)

Diodes

18

Function

Diodes allow electricity to flow in only one direction The arrow of the circuit symbol

shows the direction in which the current can flow Diodes are the electrical version of a

valve and early diodes were actually called valves

Example Circuit symbol

Forward Voltage Drop

Electricity uses up a little energy pushing its way through the diode rather like a person

pushing through a door with a spring This means that there is a small voltage across a

conducting diode it is called the forward voltage drop and is about 07V for all normal

diodes which are made from silicon The forward voltage drop of a diode is almost

constant whatever the current passing through the diode so they have a very steep

characteristic (current-voltage graph)

Reverse Voltage

When a reverse voltage is applied a perfect diode does not conduct but all real diodes

leak a very tiny current of a few microA or less This can be ignored in most circuits because

it will be very much smaller than the current flowing in the forward direction However

all diodes have a maximum reverse voltage (usually 50V or more) and if this is exceeded

the diode will fail and pass a large current in the reverse direction this is called

breakdown

Ordinary diodes can be split into two types Signal diodes which pass small currents of

100mA or less and Rectifier diodes which can pass large currents In addition there are

LEDs (which have their own page) and Zener diodes (at the bottom of this page)

19

Connecting and soldering

Diodes must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is

marked by a line painted on the body Diodes are labelled with their code in small print

you may need a magnifying glass to read this on small signal diodes Small signal diodes

can be damaged by heat when soldering but the risk is small unless you are using a

germanium diode (codes beginning OA) in which case you should use a heat sink

clipped to the lead between the joint and the diode body A standard crocodile clip can be

used as a heat sink

Rectifier diodes are quite robust and no special precautions are needed for soldering

them

Testing diodes

You can use a multimeter or a simple tester (battery resistor and LED) to check that a

diode conducts in one direction but not the other A lamp may be used to test a

rectifier diode but do NOT use a lamp to test a signal diode because the large current

passed by the lamp will destroy the diode

Signal diodes (small current)

20

Signal diodes are used to process information (electrical signals) in circuits so they are

only required to pass small currents of up to 100mA General purpose signal diodes such

as the 1N4148 are made from silicon and have a forward voltage drop of 07V

Germanium diodes

Such as the OA90 have a lower forward voltage drop of 02V and this makes them

suitable to use in radio circuits as detectors which extract the audio signal from the weak

radio signal

For general use where the size of the forward voltage drop is less important silicon

diodes are better because they are less easily damaged by heat when soldering they have

a lower resistance when conducting and they have very low leakage currents when a

reverse voltage is applied Rectifier diodes are used in power supplies to convert

alternating current (AC) to direct current (DC) a process called rectification They are

also used elsewhere in circuits where a large current must pass through the diode All

rectifier diodes are made from silicon and therefore have a forward voltage drop of 07V

The table shows maximum current and maximum reverse voltage for some popular

rectifier diodes The 1N4001 is suitable for most low voltage circuits with a current of

less than 1A

Bridge rectifiers

DiodeMaximum

Current

Maximum

Reverse

Voltage

1N4001 1A 50V

1N4002 1A 100V

1N4007 1A 1000V

1N5401 3A 100V

1N5408 3A 1000V

21

There are several ways of connecting diodes to make a rectifier to convert AC to

DC The bridge rectifier is one of them and it is available in special packages containing

the four diodes required Bridge rectifiers are rated by their maximum current and

maximum reverse voltage They have four leads or terminals the two DC outputs are

labeled + and - the two AC inputs are labeled

The diagram shows the operation of a bridge rectifier as it converts AC to DC Notice

how alternate pairs of diodes conduct

Transformer

A transformer makes use of Faradays law and the ferromagnetic properties of an iron

core to efficiently raise or lower AC voltages It of course cannot increase power so that

if the voltage is raised the current is proportionally lowered and vice versa

22

Flywheel Energy Storage

Overview

A flywheel in essence is a mechanical battery - simply a mass rotating about an axis

Flywheels store energy mechanically in the form of kinetic energy They take an

electrical input to accelerate the rotor up to speed by using the built-in motor and return

the electrical energy by using this same motor as a generator Flywheels are one of the

oldest and most common mechanical devises in existence They may still prove to serve

us as an important component on tomorrows vehicles and future energy needs Flywheels

are one of the most promising technologies for replacing conventional lead acid batteries

as energy storage systems for a variety of applications including automobiles

economical rural electrification systems and stand-alone remote power units commonly

used in the telecommunications industry Recent advances in the mechanical properties of

composites has rekindled interest in using the inertia of a spinning wheel to store energy

23

In addition to energy density flywheel energy storage systems (FES) also offer several

important advantages over chemical energy storage The rate at which energy can be

exchanged into or out of the battery is limited only by the motor--generator design

Therefore it is possible to withdraw large amounts of energy in a far shorter time than

with traditional chemical batteries Indeed research into exploiting this property of FES

systems to get short intense bursts of energy is ongoing with the most notable projects

being a magnetic tank gun and a fusion ignition system Of course it is also possible to

quickly charge FES batteries making them desirable for application in electric cars where

the charge time could be dropped from a matter of hours to a matter of minutes

Advantages Flywheels store energy very efficiently (high turn-around efficiency) and

have the potential for very high specific power compared with batteries Flywheels have

very high output potential and relatively long life Flywheels are relatively unaffected by

ambient temperature extremes

Disadvantages Current flywheels have low specific energy There are safety concerns

associated with flywheels due to their high speed rotor and the possibility of it breaking

loose and releasing all of its energy in an uncontrolled manner Flywheels are a less

mature technology than chemical batteries and the current cost is too high to make them

competitive in the market

VOLTAGE REGULATOR

24

A Voltage Regulator (also called a regulator) has only three legs and appears to be a

comparatively simple device but it is actually a very complex integrated circuit A

regulator converts varying input voltage and produces a constant regulated output

voltage Voltage regulators are available in a variety of outputs typically 5 volts 9 volts

and 12 volts The last two digits in the name indicate the output voltage

Introduction

It is very easy to get stabilized voltage for ICs by using a three terminal voltage regulator

The three terminal voltage regulator outputs stabilized voltage at a lower level than the

higher input voltage A voltage regulator cannot put out higher voltage than the input

voltage They are similar in appearance to a transistor The 7800 series consists of three-

terminal positive voltage regulators

These ICs are designed as fixed voltage regulators and with adequate heat sinking can

deliver output currents in excess of 1A These ICs are used to provide +5 volts and +12

volts supply Line regulation in these ICs is change in the output voltage for a change in

the input voltage Load regulation is defined as the change in output voltage for a change

in load current If there is any high voltage than 12 volt to 7812 it will convert to 12 V by

this IC If there is any voltage less than 12 volt it allows passing it FAN is used for

cooling the ICs

There are two ICs 7805 and 7812 attached with the Intel-fan heat sink From the base of

7805 IC we get the +5Volt Supply and from the base of 7812 IC we get the 12 Volt

25

supply Two LED are also connected with the respective ICs in order to indicate there

proper working

There are some voltage regulators

LM7805 for + 5 volts

LM7809 for +9 volts

LM7812 for+12 volts

LM7905 for-5 volts

LM7909 for-9 volts

LM7912 for-12 volts

Fig LM7805 Integrated Circuit Internal Schematic

The LM78XX series of voltage regulators are designed for positive input For

applications requiring negative input the LM79XX series is used

26

Fig Symbol of voltage regulator Fig A LM 7805 regulator

Fig The circuit diagram represents a typical use of a voltage regulator

Note The LM7805 can reliably deliver 1 amp at a constant voltage

Input Voltage

As a general rule the input voltage should be limited to 2 to 3 volts above the output

voltage The LM78XX series can handle up to 30 volts input but the power difference

between the input voltagecurrent ratio and output voltagecurrent ratio appears as heat If

the input voltage is unnecessarily high the regulator will get very hot Unless sufficient

heat sinking is provided the regulator will shut down

27

Parallel Port

Essentials

A first step in exploring the parallel port is learning how to get the most from a port with

your everyday applications and peripherals Things to know include how to find

configure and install a port how and when to use the new bidirectional EPP and ECP

modes and how to handle a system with multiple parallel-port peripherals

Defining the Ports

What is the parallel port In the computer world a port is a set of signal lines that the

microprocessor or CPU uses to exchange data with other components Typical uses for

ports are communicating with printers modems keyboards and displays or just about

any component Most computer ports are digital where each signal or bit is 0 or 1 A

parallel port transfers multiple bits at once while a serial port transfers a bit at a time

(though it may transfer in both directions at once)The ports explained here is about a

specific type of parallel port the one found on just about every Pc or IBM-compatible

personal computer Along with the RS-232 serial port the parallel port is a workhorse of

PC communications On newer PCs you may find other ports such as SCSI USB and

IrDA but the parallel port remains popular because its capable flexible and every PC

has one

The term PC-compatible or PC for short refers to the IBM PC and any of the

many many personal computers derived from it From another angle a PC is any

computer that can run Microsofts MS-DOS operating system and whose expansion bus is

compatible with the ISA bus in the original IBM Pc The category includes the PC XT

AT PS2 and most computers with 80x86 Pentium and compatible CPUs It does not

include the Macintosh Amiga or IBM mainframes though these and other computer

types may have ports that are similar to the parallel port on the Pc The original PCs

parallel port had eight outputs five inputs and four bidirectional lines

These are enough for communicating with many types of peripherals On many

newer PCs the eight outputs can also serve as inputs for faster communications with

scanners drives and other devices that send data to the Pc

28

The parallel port was designed as a printer port and many of the-original names for the

ports signals (PaperEnd AutoLineFeed) reflect that use But these days you can find all

kinds of things besides printers connected to the port The term peripheral or peripheral

device is a catch-all category that includes printers scanners modems and other devices

that connect to a Pc

29

Accessing Ports

Windows DOS C JAVA and Visual Basic provide several ways to read and write to

parallel ports The most direct way is reading and writing to the port registers Most

programming languages include this ability or at least allow you to add it Visual Basic

includes other options including the Printer object the Print Form method and Open

LPT x Windows also has API calls for accessing LPT ports and 16-bit programs can use

BIOS and DOS software interrupts for LPT access This chapter introduces the parallel

ports signals and ways of accessing them in the programs you write

Parallel ports can be used to connect a host of popular computer peripherals

bull Printers

bull Scanners

bull CD burners

bull External hard drives

bull Iomega Zip removable drives

bull Network adapters

bull Tape backup drives

30

Pin Out Diagram Of Parallel Port

31

Parallel Port Basics

Parallel ports were originally developed by IBM as a way to connect a printer to our PC

When IBM was in the process of designing the PC the company wanted the computer to

work with printers offered by Centronics a top printer manufacturer at the time IBM

decided not to use the same port interface on the computer that Centronics used on the

printer

Instead IBM engineers coupled a 25-pin connector DB-25 with a 36-pin Centronics

connector to create a special cable to connect the printer to the computer Other printer

manufacturers ended up adopting the Centronics interface making this strange hybrid

cable an unlikely de facto standard

When a PC sends data to a printer or other device using a parallel port it sends 8 bits of

data (1 byte) at a time These 8 bits are transmitted parallel to each other as opposed to

the same eight bits being transmitted serially (all in a single row) through a serial port

The standard parallel port is capable of sending 50 to 100 kilobytes of data per second

Lets take a closer look at what each pin does when used with a printer

bull Pin 1 carries the strobe signal It maintains a level of between 28 and 5 volts but drops

below 05 volts whenever the computer sends a byte of data This drop in voltage tells

the printer that data is being sent

Pins 2 through 9 are used to carry data To indicate that a bit has a value of 1 a

charge of 5 volts is sent through the correct pin No charge on a pin indicates avalue of

0 This is a simple but highly effective way to transmit digital information over an

analog cable in real-time

bull Pin 10 sends the acknowledge signal from the printer to the computer Like Pin 1 it

maintains a charge and drops the voltage below 05 volts to let the computer know that

the data was received

32

bull If the printer is busy it will charge Pin 11 Then it will drop the voltage below

05 volts to let the computer know it is ready to receive more data

bull The printer lets the computer know if it is out of paper by sending a charge on Pin 12

bull As long as the computer is receiving a charge on Pin 13 it knows that the device

is online

bull The computer sends an auto feed signal to the printer through Pin 14 using a 5-

volt charge

bull If the printer has any problems it drops the voltage to less than 05 volts on Pin

15 to let the computer know that there is an error

bull Whenever a new print job is ready the computer drops the charge on Pin 16 to

initialize the printer

bull Pin 17 is used by the computer to remotely take the printer offline This is

accomplished by sending a charge to the printer and maintaining it as long as you

want the printer offline

bull Pins 18-25 are grounds and are used as a reference signal for the low (below 05

volts) charge

33

Power Supply

Types of Power Supply

There are many types of power supply Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other

devices A power supply can by broken down into a series of blocks each of which

performs a particular function

For example a 5V regulated supply

Each of the blocks is described in more detail below

Transformer - steps down high voltage AC mains to low voltage AC

Rectifier - converts AC to DC but the DC output is varying

Smoothing - smooths the DC from varying greatly to a small ripple

Regulator - eliminates ripple by setting DC output to a fixed voltage

Power supplies made from these blocks are described below with a circuit diagram and a

graph of their output

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Dual Supplies

34

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 14: Self Balancing Robot

Heat sinks

Waste heat is produced in transistors due to the current flowing through

them Heat sinks are needed for power transistors because they pass

large currents If you find that a transistor is becoming too hot to touch it certainly needs

a heat sink The heat sink helps to dissipate (remove) the heat by transferring it to the

surrounding air

Darlington pair

This is two transistors connected together so that

the amplified current from the first is amplified further by the second transistor This

gives the Darlington pair a very high current gain such as 10000 Darlington pairs are

sold as complete packages containing the two transistors They have three leads

(B C and E) which are equivalent to the leads of a standard individual transistor

You can make up your own Darlington pair from two transistors

For example

For TR1 use BC548B with hFE1 = 220

For TR2 use BC639 with hFE2 = 40

The overall gain of this pair is hFE1 times hFE2 = 220 times 40 = 8800

The pairs maximum collector current IC(max) is the same as TR2

Heat sink

14

LED

Example Circuit symbol

Function

LEDs emit light when an electric current passes through them

Connecting and soldering

LEDs must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is the

short lead and there may be a slight flat on the body of round LEDs If you can see inside

the LED the cathode is the larger electrode (but this is not an official identification

method)

LEDs can be damaged by heat when soldering but the risk is small unless you are very

slow No special precautions are needed for soldering most LEDs

15

Testing an LED

Never connect an LED directly to a battery or power supply

It will be destroyed almost instantly because too much current will pass through and burn

it out

LEDs must have a resistor in series to limit the current to a safe value for quick testing

purposes a 1k resistor is suitable for most LEDs if your supply voltage is 12V or less

Remember to connect the LED the correct way round

Colours of LEDs

LEDs are available in red orange amber yellow green blue and white Blue and white

LEDs are much more expensive than the other colours

The colour of an LED is determined by the semiconductor material not by the colouring

of the package (the plastic body) LEDs of all colours are available in uncoloured

packages which may be diffused (milky) or clear (often described as water clear) The

coloured packages are also available as diffused (the standard type) or transparent

16

Capacitors

Function

Capacitors store electric charge They are used with resistors in timing circuits because it

takes time for a capacitor to fill with charge They are used to smooth varying DC

supplies by acting as a reservoir of charge They are also used in filter circuits because

capacitors easily pass AC (changing) signals but they block DC (constant) signals

Capacitance

This is a measure of a capacitors ability to store charge A large capacitance means that

more charge can be stored Capacitance is measured in farads symbol F However 1F is

very large so prefixes are used to show the smaller values

Three prefixes (multipliers) are used micro (micro) n (nano) and p (pico)

micro means 10-6 (millionth) so 1000000microF = 1F

n means 10-9 (thousand-millionth) so 1000nF = 1microF

p means 10-12 (million-millionth) so 1000pF = 1nF

Capacitor values can be very difficult to find because there are man

types of capacitor with different labeling systems

Capacitor Colour Code

A colour code was used on polyester capacitors for many years It is

now obsolete but of course there are many still around The colours

should be read like the resistor code the top three colour bands giving

the value in pF Ignore the 4th band (tolerance) and 5th band (voltage

rating) For example brown black orange means 10000pF = 10nF =

001microF Note that there are no gaps between the colour bands so 2 identical bands

actually appear as a wide band For example wide red yellow means 220nF = 022microF

Different types of capacitors

Colour Code

Colour Number

Black 0

Brown 1

Red 2

Orange 3

Yellow 4

Green 5

Blue 6

Violet 7

Grey 8

17

Electrolytic Capacitors Ceramic Capacitor

An electrolytic capacitor is a type of capacitor typically with a larger capacitance per

unit volume than other types making them valuable in relatively high-current and low-

frequency electrical circuits This is especially the case in power-supply filters where

they store charge needed to moderate output voltage and current fluctuations in rectifier

output and especially in the absence of rechargeable batteries that can provide similar

low-frequency current capacity They are also widely used as coupling capacitors in

circuits where AC should be conducted but DC should not the large value of the

capacitance allows them to pass very low frequencies

A Ceramic Capacitor is a capacitor constructed of alternating layers of metal and

ceramic with the ceramic material acting as the dielectric Depending on the dielectric

whether Class 1 or Class 2 the degree of temperaturecapacity dependence varies A

ceramic capacitor often has (especially the class 2) high dissipation factor high

frequency coefficient of dissipation Capacity depends on applied voltage and capacity

changes with aging Ceramic capacitors are used extensively in common low-precision

coupling and filtering applications They are suitable for high frequencies

A ceramic capacitor is a two-terminal non-polar device The classical ceramic capacitor

is the disk capacitor This device pre-dates the transistor and was used extensively in

vacuum-tube equipment (eg radio receivers)

Diodes

18

Function

Diodes allow electricity to flow in only one direction The arrow of the circuit symbol

shows the direction in which the current can flow Diodes are the electrical version of a

valve and early diodes were actually called valves

Example Circuit symbol

Forward Voltage Drop

Electricity uses up a little energy pushing its way through the diode rather like a person

pushing through a door with a spring This means that there is a small voltage across a

conducting diode it is called the forward voltage drop and is about 07V for all normal

diodes which are made from silicon The forward voltage drop of a diode is almost

constant whatever the current passing through the diode so they have a very steep

characteristic (current-voltage graph)

Reverse Voltage

When a reverse voltage is applied a perfect diode does not conduct but all real diodes

leak a very tiny current of a few microA or less This can be ignored in most circuits because

it will be very much smaller than the current flowing in the forward direction However

all diodes have a maximum reverse voltage (usually 50V or more) and if this is exceeded

the diode will fail and pass a large current in the reverse direction this is called

breakdown

Ordinary diodes can be split into two types Signal diodes which pass small currents of

100mA or less and Rectifier diodes which can pass large currents In addition there are

LEDs (which have their own page) and Zener diodes (at the bottom of this page)

19

Connecting and soldering

Diodes must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is

marked by a line painted on the body Diodes are labelled with their code in small print

you may need a magnifying glass to read this on small signal diodes Small signal diodes

can be damaged by heat when soldering but the risk is small unless you are using a

germanium diode (codes beginning OA) in which case you should use a heat sink

clipped to the lead between the joint and the diode body A standard crocodile clip can be

used as a heat sink

Rectifier diodes are quite robust and no special precautions are needed for soldering

them

Testing diodes

You can use a multimeter or a simple tester (battery resistor and LED) to check that a

diode conducts in one direction but not the other A lamp may be used to test a

rectifier diode but do NOT use a lamp to test a signal diode because the large current

passed by the lamp will destroy the diode

Signal diodes (small current)

20

Signal diodes are used to process information (electrical signals) in circuits so they are

only required to pass small currents of up to 100mA General purpose signal diodes such

as the 1N4148 are made from silicon and have a forward voltage drop of 07V

Germanium diodes

Such as the OA90 have a lower forward voltage drop of 02V and this makes them

suitable to use in radio circuits as detectors which extract the audio signal from the weak

radio signal

For general use where the size of the forward voltage drop is less important silicon

diodes are better because they are less easily damaged by heat when soldering they have

a lower resistance when conducting and they have very low leakage currents when a

reverse voltage is applied Rectifier diodes are used in power supplies to convert

alternating current (AC) to direct current (DC) a process called rectification They are

also used elsewhere in circuits where a large current must pass through the diode All

rectifier diodes are made from silicon and therefore have a forward voltage drop of 07V

The table shows maximum current and maximum reverse voltage for some popular

rectifier diodes The 1N4001 is suitable for most low voltage circuits with a current of

less than 1A

Bridge rectifiers

DiodeMaximum

Current

Maximum

Reverse

Voltage

1N4001 1A 50V

1N4002 1A 100V

1N4007 1A 1000V

1N5401 3A 100V

1N5408 3A 1000V

21

There are several ways of connecting diodes to make a rectifier to convert AC to

DC The bridge rectifier is one of them and it is available in special packages containing

the four diodes required Bridge rectifiers are rated by their maximum current and

maximum reverse voltage They have four leads or terminals the two DC outputs are

labeled + and - the two AC inputs are labeled

The diagram shows the operation of a bridge rectifier as it converts AC to DC Notice

how alternate pairs of diodes conduct

Transformer

A transformer makes use of Faradays law and the ferromagnetic properties of an iron

core to efficiently raise or lower AC voltages It of course cannot increase power so that

if the voltage is raised the current is proportionally lowered and vice versa

22

Flywheel Energy Storage

Overview

A flywheel in essence is a mechanical battery - simply a mass rotating about an axis

Flywheels store energy mechanically in the form of kinetic energy They take an

electrical input to accelerate the rotor up to speed by using the built-in motor and return

the electrical energy by using this same motor as a generator Flywheels are one of the

oldest and most common mechanical devises in existence They may still prove to serve

us as an important component on tomorrows vehicles and future energy needs Flywheels

are one of the most promising technologies for replacing conventional lead acid batteries

as energy storage systems for a variety of applications including automobiles

economical rural electrification systems and stand-alone remote power units commonly

used in the telecommunications industry Recent advances in the mechanical properties of

composites has rekindled interest in using the inertia of a spinning wheel to store energy

23

In addition to energy density flywheel energy storage systems (FES) also offer several

important advantages over chemical energy storage The rate at which energy can be

exchanged into or out of the battery is limited only by the motor--generator design

Therefore it is possible to withdraw large amounts of energy in a far shorter time than

with traditional chemical batteries Indeed research into exploiting this property of FES

systems to get short intense bursts of energy is ongoing with the most notable projects

being a magnetic tank gun and a fusion ignition system Of course it is also possible to

quickly charge FES batteries making them desirable for application in electric cars where

the charge time could be dropped from a matter of hours to a matter of minutes

Advantages Flywheels store energy very efficiently (high turn-around efficiency) and

have the potential for very high specific power compared with batteries Flywheels have

very high output potential and relatively long life Flywheels are relatively unaffected by

ambient temperature extremes

Disadvantages Current flywheels have low specific energy There are safety concerns

associated with flywheels due to their high speed rotor and the possibility of it breaking

loose and releasing all of its energy in an uncontrolled manner Flywheels are a less

mature technology than chemical batteries and the current cost is too high to make them

competitive in the market

VOLTAGE REGULATOR

24

A Voltage Regulator (also called a regulator) has only three legs and appears to be a

comparatively simple device but it is actually a very complex integrated circuit A

regulator converts varying input voltage and produces a constant regulated output

voltage Voltage regulators are available in a variety of outputs typically 5 volts 9 volts

and 12 volts The last two digits in the name indicate the output voltage

Introduction

It is very easy to get stabilized voltage for ICs by using a three terminal voltage regulator

The three terminal voltage regulator outputs stabilized voltage at a lower level than the

higher input voltage A voltage regulator cannot put out higher voltage than the input

voltage They are similar in appearance to a transistor The 7800 series consists of three-

terminal positive voltage regulators

These ICs are designed as fixed voltage regulators and with adequate heat sinking can

deliver output currents in excess of 1A These ICs are used to provide +5 volts and +12

volts supply Line regulation in these ICs is change in the output voltage for a change in

the input voltage Load regulation is defined as the change in output voltage for a change

in load current If there is any high voltage than 12 volt to 7812 it will convert to 12 V by

this IC If there is any voltage less than 12 volt it allows passing it FAN is used for

cooling the ICs

There are two ICs 7805 and 7812 attached with the Intel-fan heat sink From the base of

7805 IC we get the +5Volt Supply and from the base of 7812 IC we get the 12 Volt

25

supply Two LED are also connected with the respective ICs in order to indicate there

proper working

There are some voltage regulators

LM7805 for + 5 volts

LM7809 for +9 volts

LM7812 for+12 volts

LM7905 for-5 volts

LM7909 for-9 volts

LM7912 for-12 volts

Fig LM7805 Integrated Circuit Internal Schematic

The LM78XX series of voltage regulators are designed for positive input For

applications requiring negative input the LM79XX series is used

26

Fig Symbol of voltage regulator Fig A LM 7805 regulator

Fig The circuit diagram represents a typical use of a voltage regulator

Note The LM7805 can reliably deliver 1 amp at a constant voltage

Input Voltage

As a general rule the input voltage should be limited to 2 to 3 volts above the output

voltage The LM78XX series can handle up to 30 volts input but the power difference

between the input voltagecurrent ratio and output voltagecurrent ratio appears as heat If

the input voltage is unnecessarily high the regulator will get very hot Unless sufficient

heat sinking is provided the regulator will shut down

27

Parallel Port

Essentials

A first step in exploring the parallel port is learning how to get the most from a port with

your everyday applications and peripherals Things to know include how to find

configure and install a port how and when to use the new bidirectional EPP and ECP

modes and how to handle a system with multiple parallel-port peripherals

Defining the Ports

What is the parallel port In the computer world a port is a set of signal lines that the

microprocessor or CPU uses to exchange data with other components Typical uses for

ports are communicating with printers modems keyboards and displays or just about

any component Most computer ports are digital where each signal or bit is 0 or 1 A

parallel port transfers multiple bits at once while a serial port transfers a bit at a time

(though it may transfer in both directions at once)The ports explained here is about a

specific type of parallel port the one found on just about every Pc or IBM-compatible

personal computer Along with the RS-232 serial port the parallel port is a workhorse of

PC communications On newer PCs you may find other ports such as SCSI USB and

IrDA but the parallel port remains popular because its capable flexible and every PC

has one

The term PC-compatible or PC for short refers to the IBM PC and any of the

many many personal computers derived from it From another angle a PC is any

computer that can run Microsofts MS-DOS operating system and whose expansion bus is

compatible with the ISA bus in the original IBM Pc The category includes the PC XT

AT PS2 and most computers with 80x86 Pentium and compatible CPUs It does not

include the Macintosh Amiga or IBM mainframes though these and other computer

types may have ports that are similar to the parallel port on the Pc The original PCs

parallel port had eight outputs five inputs and four bidirectional lines

These are enough for communicating with many types of peripherals On many

newer PCs the eight outputs can also serve as inputs for faster communications with

scanners drives and other devices that send data to the Pc

28

The parallel port was designed as a printer port and many of the-original names for the

ports signals (PaperEnd AutoLineFeed) reflect that use But these days you can find all

kinds of things besides printers connected to the port The term peripheral or peripheral

device is a catch-all category that includes printers scanners modems and other devices

that connect to a Pc

29

Accessing Ports

Windows DOS C JAVA and Visual Basic provide several ways to read and write to

parallel ports The most direct way is reading and writing to the port registers Most

programming languages include this ability or at least allow you to add it Visual Basic

includes other options including the Printer object the Print Form method and Open

LPT x Windows also has API calls for accessing LPT ports and 16-bit programs can use

BIOS and DOS software interrupts for LPT access This chapter introduces the parallel

ports signals and ways of accessing them in the programs you write

Parallel ports can be used to connect a host of popular computer peripherals

bull Printers

bull Scanners

bull CD burners

bull External hard drives

bull Iomega Zip removable drives

bull Network adapters

bull Tape backup drives

30

Pin Out Diagram Of Parallel Port

31

Parallel Port Basics

Parallel ports were originally developed by IBM as a way to connect a printer to our PC

When IBM was in the process of designing the PC the company wanted the computer to

work with printers offered by Centronics a top printer manufacturer at the time IBM

decided not to use the same port interface on the computer that Centronics used on the

printer

Instead IBM engineers coupled a 25-pin connector DB-25 with a 36-pin Centronics

connector to create a special cable to connect the printer to the computer Other printer

manufacturers ended up adopting the Centronics interface making this strange hybrid

cable an unlikely de facto standard

When a PC sends data to a printer or other device using a parallel port it sends 8 bits of

data (1 byte) at a time These 8 bits are transmitted parallel to each other as opposed to

the same eight bits being transmitted serially (all in a single row) through a serial port

The standard parallel port is capable of sending 50 to 100 kilobytes of data per second

Lets take a closer look at what each pin does when used with a printer

bull Pin 1 carries the strobe signal It maintains a level of between 28 and 5 volts but drops

below 05 volts whenever the computer sends a byte of data This drop in voltage tells

the printer that data is being sent

Pins 2 through 9 are used to carry data To indicate that a bit has a value of 1 a

charge of 5 volts is sent through the correct pin No charge on a pin indicates avalue of

0 This is a simple but highly effective way to transmit digital information over an

analog cable in real-time

bull Pin 10 sends the acknowledge signal from the printer to the computer Like Pin 1 it

maintains a charge and drops the voltage below 05 volts to let the computer know that

the data was received

32

bull If the printer is busy it will charge Pin 11 Then it will drop the voltage below

05 volts to let the computer know it is ready to receive more data

bull The printer lets the computer know if it is out of paper by sending a charge on Pin 12

bull As long as the computer is receiving a charge on Pin 13 it knows that the device

is online

bull The computer sends an auto feed signal to the printer through Pin 14 using a 5-

volt charge

bull If the printer has any problems it drops the voltage to less than 05 volts on Pin

15 to let the computer know that there is an error

bull Whenever a new print job is ready the computer drops the charge on Pin 16 to

initialize the printer

bull Pin 17 is used by the computer to remotely take the printer offline This is

accomplished by sending a charge to the printer and maintaining it as long as you

want the printer offline

bull Pins 18-25 are grounds and are used as a reference signal for the low (below 05

volts) charge

33

Power Supply

Types of Power Supply

There are many types of power supply Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other

devices A power supply can by broken down into a series of blocks each of which

performs a particular function

For example a 5V regulated supply

Each of the blocks is described in more detail below

Transformer - steps down high voltage AC mains to low voltage AC

Rectifier - converts AC to DC but the DC output is varying

Smoothing - smooths the DC from varying greatly to a small ripple

Regulator - eliminates ripple by setting DC output to a fixed voltage

Power supplies made from these blocks are described below with a circuit diagram and a

graph of their output

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Dual Supplies

34

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 15: Self Balancing Robot

LED

Example Circuit symbol

Function

LEDs emit light when an electric current passes through them

Connecting and soldering

LEDs must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is the

short lead and there may be a slight flat on the body of round LEDs If you can see inside

the LED the cathode is the larger electrode (but this is not an official identification

method)

LEDs can be damaged by heat when soldering but the risk is small unless you are very

slow No special precautions are needed for soldering most LEDs

15

Testing an LED

Never connect an LED directly to a battery or power supply

It will be destroyed almost instantly because too much current will pass through and burn

it out

LEDs must have a resistor in series to limit the current to a safe value for quick testing

purposes a 1k resistor is suitable for most LEDs if your supply voltage is 12V or less

Remember to connect the LED the correct way round

Colours of LEDs

LEDs are available in red orange amber yellow green blue and white Blue and white

LEDs are much more expensive than the other colours

The colour of an LED is determined by the semiconductor material not by the colouring

of the package (the plastic body) LEDs of all colours are available in uncoloured

packages which may be diffused (milky) or clear (often described as water clear) The

coloured packages are also available as diffused (the standard type) or transparent

16

Capacitors

Function

Capacitors store electric charge They are used with resistors in timing circuits because it

takes time for a capacitor to fill with charge They are used to smooth varying DC

supplies by acting as a reservoir of charge They are also used in filter circuits because

capacitors easily pass AC (changing) signals but they block DC (constant) signals

Capacitance

This is a measure of a capacitors ability to store charge A large capacitance means that

more charge can be stored Capacitance is measured in farads symbol F However 1F is

very large so prefixes are used to show the smaller values

Three prefixes (multipliers) are used micro (micro) n (nano) and p (pico)

micro means 10-6 (millionth) so 1000000microF = 1F

n means 10-9 (thousand-millionth) so 1000nF = 1microF

p means 10-12 (million-millionth) so 1000pF = 1nF

Capacitor values can be very difficult to find because there are man

types of capacitor with different labeling systems

Capacitor Colour Code

A colour code was used on polyester capacitors for many years It is

now obsolete but of course there are many still around The colours

should be read like the resistor code the top three colour bands giving

the value in pF Ignore the 4th band (tolerance) and 5th band (voltage

rating) For example brown black orange means 10000pF = 10nF =

001microF Note that there are no gaps between the colour bands so 2 identical bands

actually appear as a wide band For example wide red yellow means 220nF = 022microF

Different types of capacitors

Colour Code

Colour Number

Black 0

Brown 1

Red 2

Orange 3

Yellow 4

Green 5

Blue 6

Violet 7

Grey 8

17

Electrolytic Capacitors Ceramic Capacitor

An electrolytic capacitor is a type of capacitor typically with a larger capacitance per

unit volume than other types making them valuable in relatively high-current and low-

frequency electrical circuits This is especially the case in power-supply filters where

they store charge needed to moderate output voltage and current fluctuations in rectifier

output and especially in the absence of rechargeable batteries that can provide similar

low-frequency current capacity They are also widely used as coupling capacitors in

circuits where AC should be conducted but DC should not the large value of the

capacitance allows them to pass very low frequencies

A Ceramic Capacitor is a capacitor constructed of alternating layers of metal and

ceramic with the ceramic material acting as the dielectric Depending on the dielectric

whether Class 1 or Class 2 the degree of temperaturecapacity dependence varies A

ceramic capacitor often has (especially the class 2) high dissipation factor high

frequency coefficient of dissipation Capacity depends on applied voltage and capacity

changes with aging Ceramic capacitors are used extensively in common low-precision

coupling and filtering applications They are suitable for high frequencies

A ceramic capacitor is a two-terminal non-polar device The classical ceramic capacitor

is the disk capacitor This device pre-dates the transistor and was used extensively in

vacuum-tube equipment (eg radio receivers)

Diodes

18

Function

Diodes allow electricity to flow in only one direction The arrow of the circuit symbol

shows the direction in which the current can flow Diodes are the electrical version of a

valve and early diodes were actually called valves

Example Circuit symbol

Forward Voltage Drop

Electricity uses up a little energy pushing its way through the diode rather like a person

pushing through a door with a spring This means that there is a small voltage across a

conducting diode it is called the forward voltage drop and is about 07V for all normal

diodes which are made from silicon The forward voltage drop of a diode is almost

constant whatever the current passing through the diode so they have a very steep

characteristic (current-voltage graph)

Reverse Voltage

When a reverse voltage is applied a perfect diode does not conduct but all real diodes

leak a very tiny current of a few microA or less This can be ignored in most circuits because

it will be very much smaller than the current flowing in the forward direction However

all diodes have a maximum reverse voltage (usually 50V or more) and if this is exceeded

the diode will fail and pass a large current in the reverse direction this is called

breakdown

Ordinary diodes can be split into two types Signal diodes which pass small currents of

100mA or less and Rectifier diodes which can pass large currents In addition there are

LEDs (which have their own page) and Zener diodes (at the bottom of this page)

19

Connecting and soldering

Diodes must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is

marked by a line painted on the body Diodes are labelled with their code in small print

you may need a magnifying glass to read this on small signal diodes Small signal diodes

can be damaged by heat when soldering but the risk is small unless you are using a

germanium diode (codes beginning OA) in which case you should use a heat sink

clipped to the lead between the joint and the diode body A standard crocodile clip can be

used as a heat sink

Rectifier diodes are quite robust and no special precautions are needed for soldering

them

Testing diodes

You can use a multimeter or a simple tester (battery resistor and LED) to check that a

diode conducts in one direction but not the other A lamp may be used to test a

rectifier diode but do NOT use a lamp to test a signal diode because the large current

passed by the lamp will destroy the diode

Signal diodes (small current)

20

Signal diodes are used to process information (electrical signals) in circuits so they are

only required to pass small currents of up to 100mA General purpose signal diodes such

as the 1N4148 are made from silicon and have a forward voltage drop of 07V

Germanium diodes

Such as the OA90 have a lower forward voltage drop of 02V and this makes them

suitable to use in radio circuits as detectors which extract the audio signal from the weak

radio signal

For general use where the size of the forward voltage drop is less important silicon

diodes are better because they are less easily damaged by heat when soldering they have

a lower resistance when conducting and they have very low leakage currents when a

reverse voltage is applied Rectifier diodes are used in power supplies to convert

alternating current (AC) to direct current (DC) a process called rectification They are

also used elsewhere in circuits where a large current must pass through the diode All

rectifier diodes are made from silicon and therefore have a forward voltage drop of 07V

The table shows maximum current and maximum reverse voltage for some popular

rectifier diodes The 1N4001 is suitable for most low voltage circuits with a current of

less than 1A

Bridge rectifiers

DiodeMaximum

Current

Maximum

Reverse

Voltage

1N4001 1A 50V

1N4002 1A 100V

1N4007 1A 1000V

1N5401 3A 100V

1N5408 3A 1000V

21

There are several ways of connecting diodes to make a rectifier to convert AC to

DC The bridge rectifier is one of them and it is available in special packages containing

the four diodes required Bridge rectifiers are rated by their maximum current and

maximum reverse voltage They have four leads or terminals the two DC outputs are

labeled + and - the two AC inputs are labeled

The diagram shows the operation of a bridge rectifier as it converts AC to DC Notice

how alternate pairs of diodes conduct

Transformer

A transformer makes use of Faradays law and the ferromagnetic properties of an iron

core to efficiently raise or lower AC voltages It of course cannot increase power so that

if the voltage is raised the current is proportionally lowered and vice versa

22

Flywheel Energy Storage

Overview

A flywheel in essence is a mechanical battery - simply a mass rotating about an axis

Flywheels store energy mechanically in the form of kinetic energy They take an

electrical input to accelerate the rotor up to speed by using the built-in motor and return

the electrical energy by using this same motor as a generator Flywheels are one of the

oldest and most common mechanical devises in existence They may still prove to serve

us as an important component on tomorrows vehicles and future energy needs Flywheels

are one of the most promising technologies for replacing conventional lead acid batteries

as energy storage systems for a variety of applications including automobiles

economical rural electrification systems and stand-alone remote power units commonly

used in the telecommunications industry Recent advances in the mechanical properties of

composites has rekindled interest in using the inertia of a spinning wheel to store energy

23

In addition to energy density flywheel energy storage systems (FES) also offer several

important advantages over chemical energy storage The rate at which energy can be

exchanged into or out of the battery is limited only by the motor--generator design

Therefore it is possible to withdraw large amounts of energy in a far shorter time than

with traditional chemical batteries Indeed research into exploiting this property of FES

systems to get short intense bursts of energy is ongoing with the most notable projects

being a magnetic tank gun and a fusion ignition system Of course it is also possible to

quickly charge FES batteries making them desirable for application in electric cars where

the charge time could be dropped from a matter of hours to a matter of minutes

Advantages Flywheels store energy very efficiently (high turn-around efficiency) and

have the potential for very high specific power compared with batteries Flywheels have

very high output potential and relatively long life Flywheels are relatively unaffected by

ambient temperature extremes

Disadvantages Current flywheels have low specific energy There are safety concerns

associated with flywheels due to their high speed rotor and the possibility of it breaking

loose and releasing all of its energy in an uncontrolled manner Flywheels are a less

mature technology than chemical batteries and the current cost is too high to make them

competitive in the market

VOLTAGE REGULATOR

24

A Voltage Regulator (also called a regulator) has only three legs and appears to be a

comparatively simple device but it is actually a very complex integrated circuit A

regulator converts varying input voltage and produces a constant regulated output

voltage Voltage regulators are available in a variety of outputs typically 5 volts 9 volts

and 12 volts The last two digits in the name indicate the output voltage

Introduction

It is very easy to get stabilized voltage for ICs by using a three terminal voltage regulator

The three terminal voltage regulator outputs stabilized voltage at a lower level than the

higher input voltage A voltage regulator cannot put out higher voltage than the input

voltage They are similar in appearance to a transistor The 7800 series consists of three-

terminal positive voltage regulators

These ICs are designed as fixed voltage regulators and with adequate heat sinking can

deliver output currents in excess of 1A These ICs are used to provide +5 volts and +12

volts supply Line regulation in these ICs is change in the output voltage for a change in

the input voltage Load regulation is defined as the change in output voltage for a change

in load current If there is any high voltage than 12 volt to 7812 it will convert to 12 V by

this IC If there is any voltage less than 12 volt it allows passing it FAN is used for

cooling the ICs

There are two ICs 7805 and 7812 attached with the Intel-fan heat sink From the base of

7805 IC we get the +5Volt Supply and from the base of 7812 IC we get the 12 Volt

25

supply Two LED are also connected with the respective ICs in order to indicate there

proper working

There are some voltage regulators

LM7805 for + 5 volts

LM7809 for +9 volts

LM7812 for+12 volts

LM7905 for-5 volts

LM7909 for-9 volts

LM7912 for-12 volts

Fig LM7805 Integrated Circuit Internal Schematic

The LM78XX series of voltage regulators are designed for positive input For

applications requiring negative input the LM79XX series is used

26

Fig Symbol of voltage regulator Fig A LM 7805 regulator

Fig The circuit diagram represents a typical use of a voltage regulator

Note The LM7805 can reliably deliver 1 amp at a constant voltage

Input Voltage

As a general rule the input voltage should be limited to 2 to 3 volts above the output

voltage The LM78XX series can handle up to 30 volts input but the power difference

between the input voltagecurrent ratio and output voltagecurrent ratio appears as heat If

the input voltage is unnecessarily high the regulator will get very hot Unless sufficient

heat sinking is provided the regulator will shut down

27

Parallel Port

Essentials

A first step in exploring the parallel port is learning how to get the most from a port with

your everyday applications and peripherals Things to know include how to find

configure and install a port how and when to use the new bidirectional EPP and ECP

modes and how to handle a system with multiple parallel-port peripherals

Defining the Ports

What is the parallel port In the computer world a port is a set of signal lines that the

microprocessor or CPU uses to exchange data with other components Typical uses for

ports are communicating with printers modems keyboards and displays or just about

any component Most computer ports are digital where each signal or bit is 0 or 1 A

parallel port transfers multiple bits at once while a serial port transfers a bit at a time

(though it may transfer in both directions at once)The ports explained here is about a

specific type of parallel port the one found on just about every Pc or IBM-compatible

personal computer Along with the RS-232 serial port the parallel port is a workhorse of

PC communications On newer PCs you may find other ports such as SCSI USB and

IrDA but the parallel port remains popular because its capable flexible and every PC

has one

The term PC-compatible or PC for short refers to the IBM PC and any of the

many many personal computers derived from it From another angle a PC is any

computer that can run Microsofts MS-DOS operating system and whose expansion bus is

compatible with the ISA bus in the original IBM Pc The category includes the PC XT

AT PS2 and most computers with 80x86 Pentium and compatible CPUs It does not

include the Macintosh Amiga or IBM mainframes though these and other computer

types may have ports that are similar to the parallel port on the Pc The original PCs

parallel port had eight outputs five inputs and four bidirectional lines

These are enough for communicating with many types of peripherals On many

newer PCs the eight outputs can also serve as inputs for faster communications with

scanners drives and other devices that send data to the Pc

28

The parallel port was designed as a printer port and many of the-original names for the

ports signals (PaperEnd AutoLineFeed) reflect that use But these days you can find all

kinds of things besides printers connected to the port The term peripheral or peripheral

device is a catch-all category that includes printers scanners modems and other devices

that connect to a Pc

29

Accessing Ports

Windows DOS C JAVA and Visual Basic provide several ways to read and write to

parallel ports The most direct way is reading and writing to the port registers Most

programming languages include this ability or at least allow you to add it Visual Basic

includes other options including the Printer object the Print Form method and Open

LPT x Windows also has API calls for accessing LPT ports and 16-bit programs can use

BIOS and DOS software interrupts for LPT access This chapter introduces the parallel

ports signals and ways of accessing them in the programs you write

Parallel ports can be used to connect a host of popular computer peripherals

bull Printers

bull Scanners

bull CD burners

bull External hard drives

bull Iomega Zip removable drives

bull Network adapters

bull Tape backup drives

30

Pin Out Diagram Of Parallel Port

31

Parallel Port Basics

Parallel ports were originally developed by IBM as a way to connect a printer to our PC

When IBM was in the process of designing the PC the company wanted the computer to

work with printers offered by Centronics a top printer manufacturer at the time IBM

decided not to use the same port interface on the computer that Centronics used on the

printer

Instead IBM engineers coupled a 25-pin connector DB-25 with a 36-pin Centronics

connector to create a special cable to connect the printer to the computer Other printer

manufacturers ended up adopting the Centronics interface making this strange hybrid

cable an unlikely de facto standard

When a PC sends data to a printer or other device using a parallel port it sends 8 bits of

data (1 byte) at a time These 8 bits are transmitted parallel to each other as opposed to

the same eight bits being transmitted serially (all in a single row) through a serial port

The standard parallel port is capable of sending 50 to 100 kilobytes of data per second

Lets take a closer look at what each pin does when used with a printer

bull Pin 1 carries the strobe signal It maintains a level of between 28 and 5 volts but drops

below 05 volts whenever the computer sends a byte of data This drop in voltage tells

the printer that data is being sent

Pins 2 through 9 are used to carry data To indicate that a bit has a value of 1 a

charge of 5 volts is sent through the correct pin No charge on a pin indicates avalue of

0 This is a simple but highly effective way to transmit digital information over an

analog cable in real-time

bull Pin 10 sends the acknowledge signal from the printer to the computer Like Pin 1 it

maintains a charge and drops the voltage below 05 volts to let the computer know that

the data was received

32

bull If the printer is busy it will charge Pin 11 Then it will drop the voltage below

05 volts to let the computer know it is ready to receive more data

bull The printer lets the computer know if it is out of paper by sending a charge on Pin 12

bull As long as the computer is receiving a charge on Pin 13 it knows that the device

is online

bull The computer sends an auto feed signal to the printer through Pin 14 using a 5-

volt charge

bull If the printer has any problems it drops the voltage to less than 05 volts on Pin

15 to let the computer know that there is an error

bull Whenever a new print job is ready the computer drops the charge on Pin 16 to

initialize the printer

bull Pin 17 is used by the computer to remotely take the printer offline This is

accomplished by sending a charge to the printer and maintaining it as long as you

want the printer offline

bull Pins 18-25 are grounds and are used as a reference signal for the low (below 05

volts) charge

33

Power Supply

Types of Power Supply

There are many types of power supply Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other

devices A power supply can by broken down into a series of blocks each of which

performs a particular function

For example a 5V regulated supply

Each of the blocks is described in more detail below

Transformer - steps down high voltage AC mains to low voltage AC

Rectifier - converts AC to DC but the DC output is varying

Smoothing - smooths the DC from varying greatly to a small ripple

Regulator - eliminates ripple by setting DC output to a fixed voltage

Power supplies made from these blocks are described below with a circuit diagram and a

graph of their output

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Dual Supplies

34

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 16: Self Balancing Robot

Testing an LED

Never connect an LED directly to a battery or power supply

It will be destroyed almost instantly because too much current will pass through and burn

it out

LEDs must have a resistor in series to limit the current to a safe value for quick testing

purposes a 1k resistor is suitable for most LEDs if your supply voltage is 12V or less

Remember to connect the LED the correct way round

Colours of LEDs

LEDs are available in red orange amber yellow green blue and white Blue and white

LEDs are much more expensive than the other colours

The colour of an LED is determined by the semiconductor material not by the colouring

of the package (the plastic body) LEDs of all colours are available in uncoloured

packages which may be diffused (milky) or clear (often described as water clear) The

coloured packages are also available as diffused (the standard type) or transparent

16

Capacitors

Function

Capacitors store electric charge They are used with resistors in timing circuits because it

takes time for a capacitor to fill with charge They are used to smooth varying DC

supplies by acting as a reservoir of charge They are also used in filter circuits because

capacitors easily pass AC (changing) signals but they block DC (constant) signals

Capacitance

This is a measure of a capacitors ability to store charge A large capacitance means that

more charge can be stored Capacitance is measured in farads symbol F However 1F is

very large so prefixes are used to show the smaller values

Three prefixes (multipliers) are used micro (micro) n (nano) and p (pico)

micro means 10-6 (millionth) so 1000000microF = 1F

n means 10-9 (thousand-millionth) so 1000nF = 1microF

p means 10-12 (million-millionth) so 1000pF = 1nF

Capacitor values can be very difficult to find because there are man

types of capacitor with different labeling systems

Capacitor Colour Code

A colour code was used on polyester capacitors for many years It is

now obsolete but of course there are many still around The colours

should be read like the resistor code the top three colour bands giving

the value in pF Ignore the 4th band (tolerance) and 5th band (voltage

rating) For example brown black orange means 10000pF = 10nF =

001microF Note that there are no gaps between the colour bands so 2 identical bands

actually appear as a wide band For example wide red yellow means 220nF = 022microF

Different types of capacitors

Colour Code

Colour Number

Black 0

Brown 1

Red 2

Orange 3

Yellow 4

Green 5

Blue 6

Violet 7

Grey 8

17

Electrolytic Capacitors Ceramic Capacitor

An electrolytic capacitor is a type of capacitor typically with a larger capacitance per

unit volume than other types making them valuable in relatively high-current and low-

frequency electrical circuits This is especially the case in power-supply filters where

they store charge needed to moderate output voltage and current fluctuations in rectifier

output and especially in the absence of rechargeable batteries that can provide similar

low-frequency current capacity They are also widely used as coupling capacitors in

circuits where AC should be conducted but DC should not the large value of the

capacitance allows them to pass very low frequencies

A Ceramic Capacitor is a capacitor constructed of alternating layers of metal and

ceramic with the ceramic material acting as the dielectric Depending on the dielectric

whether Class 1 or Class 2 the degree of temperaturecapacity dependence varies A

ceramic capacitor often has (especially the class 2) high dissipation factor high

frequency coefficient of dissipation Capacity depends on applied voltage and capacity

changes with aging Ceramic capacitors are used extensively in common low-precision

coupling and filtering applications They are suitable for high frequencies

A ceramic capacitor is a two-terminal non-polar device The classical ceramic capacitor

is the disk capacitor This device pre-dates the transistor and was used extensively in

vacuum-tube equipment (eg radio receivers)

Diodes

18

Function

Diodes allow electricity to flow in only one direction The arrow of the circuit symbol

shows the direction in which the current can flow Diodes are the electrical version of a

valve and early diodes were actually called valves

Example Circuit symbol

Forward Voltage Drop

Electricity uses up a little energy pushing its way through the diode rather like a person

pushing through a door with a spring This means that there is a small voltage across a

conducting diode it is called the forward voltage drop and is about 07V for all normal

diodes which are made from silicon The forward voltage drop of a diode is almost

constant whatever the current passing through the diode so they have a very steep

characteristic (current-voltage graph)

Reverse Voltage

When a reverse voltage is applied a perfect diode does not conduct but all real diodes

leak a very tiny current of a few microA or less This can be ignored in most circuits because

it will be very much smaller than the current flowing in the forward direction However

all diodes have a maximum reverse voltage (usually 50V or more) and if this is exceeded

the diode will fail and pass a large current in the reverse direction this is called

breakdown

Ordinary diodes can be split into two types Signal diodes which pass small currents of

100mA or less and Rectifier diodes which can pass large currents In addition there are

LEDs (which have their own page) and Zener diodes (at the bottom of this page)

19

Connecting and soldering

Diodes must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is

marked by a line painted on the body Diodes are labelled with their code in small print

you may need a magnifying glass to read this on small signal diodes Small signal diodes

can be damaged by heat when soldering but the risk is small unless you are using a

germanium diode (codes beginning OA) in which case you should use a heat sink

clipped to the lead between the joint and the diode body A standard crocodile clip can be

used as a heat sink

Rectifier diodes are quite robust and no special precautions are needed for soldering

them

Testing diodes

You can use a multimeter or a simple tester (battery resistor and LED) to check that a

diode conducts in one direction but not the other A lamp may be used to test a

rectifier diode but do NOT use a lamp to test a signal diode because the large current

passed by the lamp will destroy the diode

Signal diodes (small current)

20

Signal diodes are used to process information (electrical signals) in circuits so they are

only required to pass small currents of up to 100mA General purpose signal diodes such

as the 1N4148 are made from silicon and have a forward voltage drop of 07V

Germanium diodes

Such as the OA90 have a lower forward voltage drop of 02V and this makes them

suitable to use in radio circuits as detectors which extract the audio signal from the weak

radio signal

For general use where the size of the forward voltage drop is less important silicon

diodes are better because they are less easily damaged by heat when soldering they have

a lower resistance when conducting and they have very low leakage currents when a

reverse voltage is applied Rectifier diodes are used in power supplies to convert

alternating current (AC) to direct current (DC) a process called rectification They are

also used elsewhere in circuits where a large current must pass through the diode All

rectifier diodes are made from silicon and therefore have a forward voltage drop of 07V

The table shows maximum current and maximum reverse voltage for some popular

rectifier diodes The 1N4001 is suitable for most low voltage circuits with a current of

less than 1A

Bridge rectifiers

DiodeMaximum

Current

Maximum

Reverse

Voltage

1N4001 1A 50V

1N4002 1A 100V

1N4007 1A 1000V

1N5401 3A 100V

1N5408 3A 1000V

21

There are several ways of connecting diodes to make a rectifier to convert AC to

DC The bridge rectifier is one of them and it is available in special packages containing

the four diodes required Bridge rectifiers are rated by their maximum current and

maximum reverse voltage They have four leads or terminals the two DC outputs are

labeled + and - the two AC inputs are labeled

The diagram shows the operation of a bridge rectifier as it converts AC to DC Notice

how alternate pairs of diodes conduct

Transformer

A transformer makes use of Faradays law and the ferromagnetic properties of an iron

core to efficiently raise or lower AC voltages It of course cannot increase power so that

if the voltage is raised the current is proportionally lowered and vice versa

22

Flywheel Energy Storage

Overview

A flywheel in essence is a mechanical battery - simply a mass rotating about an axis

Flywheels store energy mechanically in the form of kinetic energy They take an

electrical input to accelerate the rotor up to speed by using the built-in motor and return

the electrical energy by using this same motor as a generator Flywheels are one of the

oldest and most common mechanical devises in existence They may still prove to serve

us as an important component on tomorrows vehicles and future energy needs Flywheels

are one of the most promising technologies for replacing conventional lead acid batteries

as energy storage systems for a variety of applications including automobiles

economical rural electrification systems and stand-alone remote power units commonly

used in the telecommunications industry Recent advances in the mechanical properties of

composites has rekindled interest in using the inertia of a spinning wheel to store energy

23

In addition to energy density flywheel energy storage systems (FES) also offer several

important advantages over chemical energy storage The rate at which energy can be

exchanged into or out of the battery is limited only by the motor--generator design

Therefore it is possible to withdraw large amounts of energy in a far shorter time than

with traditional chemical batteries Indeed research into exploiting this property of FES

systems to get short intense bursts of energy is ongoing with the most notable projects

being a magnetic tank gun and a fusion ignition system Of course it is also possible to

quickly charge FES batteries making them desirable for application in electric cars where

the charge time could be dropped from a matter of hours to a matter of minutes

Advantages Flywheels store energy very efficiently (high turn-around efficiency) and

have the potential for very high specific power compared with batteries Flywheels have

very high output potential and relatively long life Flywheels are relatively unaffected by

ambient temperature extremes

Disadvantages Current flywheels have low specific energy There are safety concerns

associated with flywheels due to their high speed rotor and the possibility of it breaking

loose and releasing all of its energy in an uncontrolled manner Flywheels are a less

mature technology than chemical batteries and the current cost is too high to make them

competitive in the market

VOLTAGE REGULATOR

24

A Voltage Regulator (also called a regulator) has only three legs and appears to be a

comparatively simple device but it is actually a very complex integrated circuit A

regulator converts varying input voltage and produces a constant regulated output

voltage Voltage regulators are available in a variety of outputs typically 5 volts 9 volts

and 12 volts The last two digits in the name indicate the output voltage

Introduction

It is very easy to get stabilized voltage for ICs by using a three terminal voltage regulator

The three terminal voltage regulator outputs stabilized voltage at a lower level than the

higher input voltage A voltage regulator cannot put out higher voltage than the input

voltage They are similar in appearance to a transistor The 7800 series consists of three-

terminal positive voltage regulators

These ICs are designed as fixed voltage regulators and with adequate heat sinking can

deliver output currents in excess of 1A These ICs are used to provide +5 volts and +12

volts supply Line regulation in these ICs is change in the output voltage for a change in

the input voltage Load regulation is defined as the change in output voltage for a change

in load current If there is any high voltage than 12 volt to 7812 it will convert to 12 V by

this IC If there is any voltage less than 12 volt it allows passing it FAN is used for

cooling the ICs

There are two ICs 7805 and 7812 attached with the Intel-fan heat sink From the base of

7805 IC we get the +5Volt Supply and from the base of 7812 IC we get the 12 Volt

25

supply Two LED are also connected with the respective ICs in order to indicate there

proper working

There are some voltage regulators

LM7805 for + 5 volts

LM7809 for +9 volts

LM7812 for+12 volts

LM7905 for-5 volts

LM7909 for-9 volts

LM7912 for-12 volts

Fig LM7805 Integrated Circuit Internal Schematic

The LM78XX series of voltage regulators are designed for positive input For

applications requiring negative input the LM79XX series is used

26

Fig Symbol of voltage regulator Fig A LM 7805 regulator

Fig The circuit diagram represents a typical use of a voltage regulator

Note The LM7805 can reliably deliver 1 amp at a constant voltage

Input Voltage

As a general rule the input voltage should be limited to 2 to 3 volts above the output

voltage The LM78XX series can handle up to 30 volts input but the power difference

between the input voltagecurrent ratio and output voltagecurrent ratio appears as heat If

the input voltage is unnecessarily high the regulator will get very hot Unless sufficient

heat sinking is provided the regulator will shut down

27

Parallel Port

Essentials

A first step in exploring the parallel port is learning how to get the most from a port with

your everyday applications and peripherals Things to know include how to find

configure and install a port how and when to use the new bidirectional EPP and ECP

modes and how to handle a system with multiple parallel-port peripherals

Defining the Ports

What is the parallel port In the computer world a port is a set of signal lines that the

microprocessor or CPU uses to exchange data with other components Typical uses for

ports are communicating with printers modems keyboards and displays or just about

any component Most computer ports are digital where each signal or bit is 0 or 1 A

parallel port transfers multiple bits at once while a serial port transfers a bit at a time

(though it may transfer in both directions at once)The ports explained here is about a

specific type of parallel port the one found on just about every Pc or IBM-compatible

personal computer Along with the RS-232 serial port the parallel port is a workhorse of

PC communications On newer PCs you may find other ports such as SCSI USB and

IrDA but the parallel port remains popular because its capable flexible and every PC

has one

The term PC-compatible or PC for short refers to the IBM PC and any of the

many many personal computers derived from it From another angle a PC is any

computer that can run Microsofts MS-DOS operating system and whose expansion bus is

compatible with the ISA bus in the original IBM Pc The category includes the PC XT

AT PS2 and most computers with 80x86 Pentium and compatible CPUs It does not

include the Macintosh Amiga or IBM mainframes though these and other computer

types may have ports that are similar to the parallel port on the Pc The original PCs

parallel port had eight outputs five inputs and four bidirectional lines

These are enough for communicating with many types of peripherals On many

newer PCs the eight outputs can also serve as inputs for faster communications with

scanners drives and other devices that send data to the Pc

28

The parallel port was designed as a printer port and many of the-original names for the

ports signals (PaperEnd AutoLineFeed) reflect that use But these days you can find all

kinds of things besides printers connected to the port The term peripheral or peripheral

device is a catch-all category that includes printers scanners modems and other devices

that connect to a Pc

29

Accessing Ports

Windows DOS C JAVA and Visual Basic provide several ways to read and write to

parallel ports The most direct way is reading and writing to the port registers Most

programming languages include this ability or at least allow you to add it Visual Basic

includes other options including the Printer object the Print Form method and Open

LPT x Windows also has API calls for accessing LPT ports and 16-bit programs can use

BIOS and DOS software interrupts for LPT access This chapter introduces the parallel

ports signals and ways of accessing them in the programs you write

Parallel ports can be used to connect a host of popular computer peripherals

bull Printers

bull Scanners

bull CD burners

bull External hard drives

bull Iomega Zip removable drives

bull Network adapters

bull Tape backup drives

30

Pin Out Diagram Of Parallel Port

31

Parallel Port Basics

Parallel ports were originally developed by IBM as a way to connect a printer to our PC

When IBM was in the process of designing the PC the company wanted the computer to

work with printers offered by Centronics a top printer manufacturer at the time IBM

decided not to use the same port interface on the computer that Centronics used on the

printer

Instead IBM engineers coupled a 25-pin connector DB-25 with a 36-pin Centronics

connector to create a special cable to connect the printer to the computer Other printer

manufacturers ended up adopting the Centronics interface making this strange hybrid

cable an unlikely de facto standard

When a PC sends data to a printer or other device using a parallel port it sends 8 bits of

data (1 byte) at a time These 8 bits are transmitted parallel to each other as opposed to

the same eight bits being transmitted serially (all in a single row) through a serial port

The standard parallel port is capable of sending 50 to 100 kilobytes of data per second

Lets take a closer look at what each pin does when used with a printer

bull Pin 1 carries the strobe signal It maintains a level of between 28 and 5 volts but drops

below 05 volts whenever the computer sends a byte of data This drop in voltage tells

the printer that data is being sent

Pins 2 through 9 are used to carry data To indicate that a bit has a value of 1 a

charge of 5 volts is sent through the correct pin No charge on a pin indicates avalue of

0 This is a simple but highly effective way to transmit digital information over an

analog cable in real-time

bull Pin 10 sends the acknowledge signal from the printer to the computer Like Pin 1 it

maintains a charge and drops the voltage below 05 volts to let the computer know that

the data was received

32

bull If the printer is busy it will charge Pin 11 Then it will drop the voltage below

05 volts to let the computer know it is ready to receive more data

bull The printer lets the computer know if it is out of paper by sending a charge on Pin 12

bull As long as the computer is receiving a charge on Pin 13 it knows that the device

is online

bull The computer sends an auto feed signal to the printer through Pin 14 using a 5-

volt charge

bull If the printer has any problems it drops the voltage to less than 05 volts on Pin

15 to let the computer know that there is an error

bull Whenever a new print job is ready the computer drops the charge on Pin 16 to

initialize the printer

bull Pin 17 is used by the computer to remotely take the printer offline This is

accomplished by sending a charge to the printer and maintaining it as long as you

want the printer offline

bull Pins 18-25 are grounds and are used as a reference signal for the low (below 05

volts) charge

33

Power Supply

Types of Power Supply

There are many types of power supply Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other

devices A power supply can by broken down into a series of blocks each of which

performs a particular function

For example a 5V regulated supply

Each of the blocks is described in more detail below

Transformer - steps down high voltage AC mains to low voltage AC

Rectifier - converts AC to DC but the DC output is varying

Smoothing - smooths the DC from varying greatly to a small ripple

Regulator - eliminates ripple by setting DC output to a fixed voltage

Power supplies made from these blocks are described below with a circuit diagram and a

graph of their output

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Dual Supplies

34

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 17: Self Balancing Robot

Capacitors

Function

Capacitors store electric charge They are used with resistors in timing circuits because it

takes time for a capacitor to fill with charge They are used to smooth varying DC

supplies by acting as a reservoir of charge They are also used in filter circuits because

capacitors easily pass AC (changing) signals but they block DC (constant) signals

Capacitance

This is a measure of a capacitors ability to store charge A large capacitance means that

more charge can be stored Capacitance is measured in farads symbol F However 1F is

very large so prefixes are used to show the smaller values

Three prefixes (multipliers) are used micro (micro) n (nano) and p (pico)

micro means 10-6 (millionth) so 1000000microF = 1F

n means 10-9 (thousand-millionth) so 1000nF = 1microF

p means 10-12 (million-millionth) so 1000pF = 1nF

Capacitor values can be very difficult to find because there are man

types of capacitor with different labeling systems

Capacitor Colour Code

A colour code was used on polyester capacitors for many years It is

now obsolete but of course there are many still around The colours

should be read like the resistor code the top three colour bands giving

the value in pF Ignore the 4th band (tolerance) and 5th band (voltage

rating) For example brown black orange means 10000pF = 10nF =

001microF Note that there are no gaps between the colour bands so 2 identical bands

actually appear as a wide band For example wide red yellow means 220nF = 022microF

Different types of capacitors

Colour Code

Colour Number

Black 0

Brown 1

Red 2

Orange 3

Yellow 4

Green 5

Blue 6

Violet 7

Grey 8

17

Electrolytic Capacitors Ceramic Capacitor

An electrolytic capacitor is a type of capacitor typically with a larger capacitance per

unit volume than other types making them valuable in relatively high-current and low-

frequency electrical circuits This is especially the case in power-supply filters where

they store charge needed to moderate output voltage and current fluctuations in rectifier

output and especially in the absence of rechargeable batteries that can provide similar

low-frequency current capacity They are also widely used as coupling capacitors in

circuits where AC should be conducted but DC should not the large value of the

capacitance allows them to pass very low frequencies

A Ceramic Capacitor is a capacitor constructed of alternating layers of metal and

ceramic with the ceramic material acting as the dielectric Depending on the dielectric

whether Class 1 or Class 2 the degree of temperaturecapacity dependence varies A

ceramic capacitor often has (especially the class 2) high dissipation factor high

frequency coefficient of dissipation Capacity depends on applied voltage and capacity

changes with aging Ceramic capacitors are used extensively in common low-precision

coupling and filtering applications They are suitable for high frequencies

A ceramic capacitor is a two-terminal non-polar device The classical ceramic capacitor

is the disk capacitor This device pre-dates the transistor and was used extensively in

vacuum-tube equipment (eg radio receivers)

Diodes

18

Function

Diodes allow electricity to flow in only one direction The arrow of the circuit symbol

shows the direction in which the current can flow Diodes are the electrical version of a

valve and early diodes were actually called valves

Example Circuit symbol

Forward Voltage Drop

Electricity uses up a little energy pushing its way through the diode rather like a person

pushing through a door with a spring This means that there is a small voltage across a

conducting diode it is called the forward voltage drop and is about 07V for all normal

diodes which are made from silicon The forward voltage drop of a diode is almost

constant whatever the current passing through the diode so they have a very steep

characteristic (current-voltage graph)

Reverse Voltage

When a reverse voltage is applied a perfect diode does not conduct but all real diodes

leak a very tiny current of a few microA or less This can be ignored in most circuits because

it will be very much smaller than the current flowing in the forward direction However

all diodes have a maximum reverse voltage (usually 50V or more) and if this is exceeded

the diode will fail and pass a large current in the reverse direction this is called

breakdown

Ordinary diodes can be split into two types Signal diodes which pass small currents of

100mA or less and Rectifier diodes which can pass large currents In addition there are

LEDs (which have their own page) and Zener diodes (at the bottom of this page)

19

Connecting and soldering

Diodes must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is

marked by a line painted on the body Diodes are labelled with their code in small print

you may need a magnifying glass to read this on small signal diodes Small signal diodes

can be damaged by heat when soldering but the risk is small unless you are using a

germanium diode (codes beginning OA) in which case you should use a heat sink

clipped to the lead between the joint and the diode body A standard crocodile clip can be

used as a heat sink

Rectifier diodes are quite robust and no special precautions are needed for soldering

them

Testing diodes

You can use a multimeter or a simple tester (battery resistor and LED) to check that a

diode conducts in one direction but not the other A lamp may be used to test a

rectifier diode but do NOT use a lamp to test a signal diode because the large current

passed by the lamp will destroy the diode

Signal diodes (small current)

20

Signal diodes are used to process information (electrical signals) in circuits so they are

only required to pass small currents of up to 100mA General purpose signal diodes such

as the 1N4148 are made from silicon and have a forward voltage drop of 07V

Germanium diodes

Such as the OA90 have a lower forward voltage drop of 02V and this makes them

suitable to use in radio circuits as detectors which extract the audio signal from the weak

radio signal

For general use where the size of the forward voltage drop is less important silicon

diodes are better because they are less easily damaged by heat when soldering they have

a lower resistance when conducting and they have very low leakage currents when a

reverse voltage is applied Rectifier diodes are used in power supplies to convert

alternating current (AC) to direct current (DC) a process called rectification They are

also used elsewhere in circuits where a large current must pass through the diode All

rectifier diodes are made from silicon and therefore have a forward voltage drop of 07V

The table shows maximum current and maximum reverse voltage for some popular

rectifier diodes The 1N4001 is suitable for most low voltage circuits with a current of

less than 1A

Bridge rectifiers

DiodeMaximum

Current

Maximum

Reverse

Voltage

1N4001 1A 50V

1N4002 1A 100V

1N4007 1A 1000V

1N5401 3A 100V

1N5408 3A 1000V

21

There are several ways of connecting diodes to make a rectifier to convert AC to

DC The bridge rectifier is one of them and it is available in special packages containing

the four diodes required Bridge rectifiers are rated by their maximum current and

maximum reverse voltage They have four leads or terminals the two DC outputs are

labeled + and - the two AC inputs are labeled

The diagram shows the operation of a bridge rectifier as it converts AC to DC Notice

how alternate pairs of diodes conduct

Transformer

A transformer makes use of Faradays law and the ferromagnetic properties of an iron

core to efficiently raise or lower AC voltages It of course cannot increase power so that

if the voltage is raised the current is proportionally lowered and vice versa

22

Flywheel Energy Storage

Overview

A flywheel in essence is a mechanical battery - simply a mass rotating about an axis

Flywheels store energy mechanically in the form of kinetic energy They take an

electrical input to accelerate the rotor up to speed by using the built-in motor and return

the electrical energy by using this same motor as a generator Flywheels are one of the

oldest and most common mechanical devises in existence They may still prove to serve

us as an important component on tomorrows vehicles and future energy needs Flywheels

are one of the most promising technologies for replacing conventional lead acid batteries

as energy storage systems for a variety of applications including automobiles

economical rural electrification systems and stand-alone remote power units commonly

used in the telecommunications industry Recent advances in the mechanical properties of

composites has rekindled interest in using the inertia of a spinning wheel to store energy

23

In addition to energy density flywheel energy storage systems (FES) also offer several

important advantages over chemical energy storage The rate at which energy can be

exchanged into or out of the battery is limited only by the motor--generator design

Therefore it is possible to withdraw large amounts of energy in a far shorter time than

with traditional chemical batteries Indeed research into exploiting this property of FES

systems to get short intense bursts of energy is ongoing with the most notable projects

being a magnetic tank gun and a fusion ignition system Of course it is also possible to

quickly charge FES batteries making them desirable for application in electric cars where

the charge time could be dropped from a matter of hours to a matter of minutes

Advantages Flywheels store energy very efficiently (high turn-around efficiency) and

have the potential for very high specific power compared with batteries Flywheels have

very high output potential and relatively long life Flywheels are relatively unaffected by

ambient temperature extremes

Disadvantages Current flywheels have low specific energy There are safety concerns

associated with flywheels due to their high speed rotor and the possibility of it breaking

loose and releasing all of its energy in an uncontrolled manner Flywheels are a less

mature technology than chemical batteries and the current cost is too high to make them

competitive in the market

VOLTAGE REGULATOR

24

A Voltage Regulator (also called a regulator) has only three legs and appears to be a

comparatively simple device but it is actually a very complex integrated circuit A

regulator converts varying input voltage and produces a constant regulated output

voltage Voltage regulators are available in a variety of outputs typically 5 volts 9 volts

and 12 volts The last two digits in the name indicate the output voltage

Introduction

It is very easy to get stabilized voltage for ICs by using a three terminal voltage regulator

The three terminal voltage regulator outputs stabilized voltage at a lower level than the

higher input voltage A voltage regulator cannot put out higher voltage than the input

voltage They are similar in appearance to a transistor The 7800 series consists of three-

terminal positive voltage regulators

These ICs are designed as fixed voltage regulators and with adequate heat sinking can

deliver output currents in excess of 1A These ICs are used to provide +5 volts and +12

volts supply Line regulation in these ICs is change in the output voltage for a change in

the input voltage Load regulation is defined as the change in output voltage for a change

in load current If there is any high voltage than 12 volt to 7812 it will convert to 12 V by

this IC If there is any voltage less than 12 volt it allows passing it FAN is used for

cooling the ICs

There are two ICs 7805 and 7812 attached with the Intel-fan heat sink From the base of

7805 IC we get the +5Volt Supply and from the base of 7812 IC we get the 12 Volt

25

supply Two LED are also connected with the respective ICs in order to indicate there

proper working

There are some voltage regulators

LM7805 for + 5 volts

LM7809 for +9 volts

LM7812 for+12 volts

LM7905 for-5 volts

LM7909 for-9 volts

LM7912 for-12 volts

Fig LM7805 Integrated Circuit Internal Schematic

The LM78XX series of voltage regulators are designed for positive input For

applications requiring negative input the LM79XX series is used

26

Fig Symbol of voltage regulator Fig A LM 7805 regulator

Fig The circuit diagram represents a typical use of a voltage regulator

Note The LM7805 can reliably deliver 1 amp at a constant voltage

Input Voltage

As a general rule the input voltage should be limited to 2 to 3 volts above the output

voltage The LM78XX series can handle up to 30 volts input but the power difference

between the input voltagecurrent ratio and output voltagecurrent ratio appears as heat If

the input voltage is unnecessarily high the regulator will get very hot Unless sufficient

heat sinking is provided the regulator will shut down

27

Parallel Port

Essentials

A first step in exploring the parallel port is learning how to get the most from a port with

your everyday applications and peripherals Things to know include how to find

configure and install a port how and when to use the new bidirectional EPP and ECP

modes and how to handle a system with multiple parallel-port peripherals

Defining the Ports

What is the parallel port In the computer world a port is a set of signal lines that the

microprocessor or CPU uses to exchange data with other components Typical uses for

ports are communicating with printers modems keyboards and displays or just about

any component Most computer ports are digital where each signal or bit is 0 or 1 A

parallel port transfers multiple bits at once while a serial port transfers a bit at a time

(though it may transfer in both directions at once)The ports explained here is about a

specific type of parallel port the one found on just about every Pc or IBM-compatible

personal computer Along with the RS-232 serial port the parallel port is a workhorse of

PC communications On newer PCs you may find other ports such as SCSI USB and

IrDA but the parallel port remains popular because its capable flexible and every PC

has one

The term PC-compatible or PC for short refers to the IBM PC and any of the

many many personal computers derived from it From another angle a PC is any

computer that can run Microsofts MS-DOS operating system and whose expansion bus is

compatible with the ISA bus in the original IBM Pc The category includes the PC XT

AT PS2 and most computers with 80x86 Pentium and compatible CPUs It does not

include the Macintosh Amiga or IBM mainframes though these and other computer

types may have ports that are similar to the parallel port on the Pc The original PCs

parallel port had eight outputs five inputs and four bidirectional lines

These are enough for communicating with many types of peripherals On many

newer PCs the eight outputs can also serve as inputs for faster communications with

scanners drives and other devices that send data to the Pc

28

The parallel port was designed as a printer port and many of the-original names for the

ports signals (PaperEnd AutoLineFeed) reflect that use But these days you can find all

kinds of things besides printers connected to the port The term peripheral or peripheral

device is a catch-all category that includes printers scanners modems and other devices

that connect to a Pc

29

Accessing Ports

Windows DOS C JAVA and Visual Basic provide several ways to read and write to

parallel ports The most direct way is reading and writing to the port registers Most

programming languages include this ability or at least allow you to add it Visual Basic

includes other options including the Printer object the Print Form method and Open

LPT x Windows also has API calls for accessing LPT ports and 16-bit programs can use

BIOS and DOS software interrupts for LPT access This chapter introduces the parallel

ports signals and ways of accessing them in the programs you write

Parallel ports can be used to connect a host of popular computer peripherals

bull Printers

bull Scanners

bull CD burners

bull External hard drives

bull Iomega Zip removable drives

bull Network adapters

bull Tape backup drives

30

Pin Out Diagram Of Parallel Port

31

Parallel Port Basics

Parallel ports were originally developed by IBM as a way to connect a printer to our PC

When IBM was in the process of designing the PC the company wanted the computer to

work with printers offered by Centronics a top printer manufacturer at the time IBM

decided not to use the same port interface on the computer that Centronics used on the

printer

Instead IBM engineers coupled a 25-pin connector DB-25 with a 36-pin Centronics

connector to create a special cable to connect the printer to the computer Other printer

manufacturers ended up adopting the Centronics interface making this strange hybrid

cable an unlikely de facto standard

When a PC sends data to a printer or other device using a parallel port it sends 8 bits of

data (1 byte) at a time These 8 bits are transmitted parallel to each other as opposed to

the same eight bits being transmitted serially (all in a single row) through a serial port

The standard parallel port is capable of sending 50 to 100 kilobytes of data per second

Lets take a closer look at what each pin does when used with a printer

bull Pin 1 carries the strobe signal It maintains a level of between 28 and 5 volts but drops

below 05 volts whenever the computer sends a byte of data This drop in voltage tells

the printer that data is being sent

Pins 2 through 9 are used to carry data To indicate that a bit has a value of 1 a

charge of 5 volts is sent through the correct pin No charge on a pin indicates avalue of

0 This is a simple but highly effective way to transmit digital information over an

analog cable in real-time

bull Pin 10 sends the acknowledge signal from the printer to the computer Like Pin 1 it

maintains a charge and drops the voltage below 05 volts to let the computer know that

the data was received

32

bull If the printer is busy it will charge Pin 11 Then it will drop the voltage below

05 volts to let the computer know it is ready to receive more data

bull The printer lets the computer know if it is out of paper by sending a charge on Pin 12

bull As long as the computer is receiving a charge on Pin 13 it knows that the device

is online

bull The computer sends an auto feed signal to the printer through Pin 14 using a 5-

volt charge

bull If the printer has any problems it drops the voltage to less than 05 volts on Pin

15 to let the computer know that there is an error

bull Whenever a new print job is ready the computer drops the charge on Pin 16 to

initialize the printer

bull Pin 17 is used by the computer to remotely take the printer offline This is

accomplished by sending a charge to the printer and maintaining it as long as you

want the printer offline

bull Pins 18-25 are grounds and are used as a reference signal for the low (below 05

volts) charge

33

Power Supply

Types of Power Supply

There are many types of power supply Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other

devices A power supply can by broken down into a series of blocks each of which

performs a particular function

For example a 5V regulated supply

Each of the blocks is described in more detail below

Transformer - steps down high voltage AC mains to low voltage AC

Rectifier - converts AC to DC but the DC output is varying

Smoothing - smooths the DC from varying greatly to a small ripple

Regulator - eliminates ripple by setting DC output to a fixed voltage

Power supplies made from these blocks are described below with a circuit diagram and a

graph of their output

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Dual Supplies

34

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 18: Self Balancing Robot

Electrolytic Capacitors Ceramic Capacitor

An electrolytic capacitor is a type of capacitor typically with a larger capacitance per

unit volume than other types making them valuable in relatively high-current and low-

frequency electrical circuits This is especially the case in power-supply filters where

they store charge needed to moderate output voltage and current fluctuations in rectifier

output and especially in the absence of rechargeable batteries that can provide similar

low-frequency current capacity They are also widely used as coupling capacitors in

circuits where AC should be conducted but DC should not the large value of the

capacitance allows them to pass very low frequencies

A Ceramic Capacitor is a capacitor constructed of alternating layers of metal and

ceramic with the ceramic material acting as the dielectric Depending on the dielectric

whether Class 1 or Class 2 the degree of temperaturecapacity dependence varies A

ceramic capacitor often has (especially the class 2) high dissipation factor high

frequency coefficient of dissipation Capacity depends on applied voltage and capacity

changes with aging Ceramic capacitors are used extensively in common low-precision

coupling and filtering applications They are suitable for high frequencies

A ceramic capacitor is a two-terminal non-polar device The classical ceramic capacitor

is the disk capacitor This device pre-dates the transistor and was used extensively in

vacuum-tube equipment (eg radio receivers)

Diodes

18

Function

Diodes allow electricity to flow in only one direction The arrow of the circuit symbol

shows the direction in which the current can flow Diodes are the electrical version of a

valve and early diodes were actually called valves

Example Circuit symbol

Forward Voltage Drop

Electricity uses up a little energy pushing its way through the diode rather like a person

pushing through a door with a spring This means that there is a small voltage across a

conducting diode it is called the forward voltage drop and is about 07V for all normal

diodes which are made from silicon The forward voltage drop of a diode is almost

constant whatever the current passing through the diode so they have a very steep

characteristic (current-voltage graph)

Reverse Voltage

When a reverse voltage is applied a perfect diode does not conduct but all real diodes

leak a very tiny current of a few microA or less This can be ignored in most circuits because

it will be very much smaller than the current flowing in the forward direction However

all diodes have a maximum reverse voltage (usually 50V or more) and if this is exceeded

the diode will fail and pass a large current in the reverse direction this is called

breakdown

Ordinary diodes can be split into two types Signal diodes which pass small currents of

100mA or less and Rectifier diodes which can pass large currents In addition there are

LEDs (which have their own page) and Zener diodes (at the bottom of this page)

19

Connecting and soldering

Diodes must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is

marked by a line painted on the body Diodes are labelled with their code in small print

you may need a magnifying glass to read this on small signal diodes Small signal diodes

can be damaged by heat when soldering but the risk is small unless you are using a

germanium diode (codes beginning OA) in which case you should use a heat sink

clipped to the lead between the joint and the diode body A standard crocodile clip can be

used as a heat sink

Rectifier diodes are quite robust and no special precautions are needed for soldering

them

Testing diodes

You can use a multimeter or a simple tester (battery resistor and LED) to check that a

diode conducts in one direction but not the other A lamp may be used to test a

rectifier diode but do NOT use a lamp to test a signal diode because the large current

passed by the lamp will destroy the diode

Signal diodes (small current)

20

Signal diodes are used to process information (electrical signals) in circuits so they are

only required to pass small currents of up to 100mA General purpose signal diodes such

as the 1N4148 are made from silicon and have a forward voltage drop of 07V

Germanium diodes

Such as the OA90 have a lower forward voltage drop of 02V and this makes them

suitable to use in radio circuits as detectors which extract the audio signal from the weak

radio signal

For general use where the size of the forward voltage drop is less important silicon

diodes are better because they are less easily damaged by heat when soldering they have

a lower resistance when conducting and they have very low leakage currents when a

reverse voltage is applied Rectifier diodes are used in power supplies to convert

alternating current (AC) to direct current (DC) a process called rectification They are

also used elsewhere in circuits where a large current must pass through the diode All

rectifier diodes are made from silicon and therefore have a forward voltage drop of 07V

The table shows maximum current and maximum reverse voltage for some popular

rectifier diodes The 1N4001 is suitable for most low voltage circuits with a current of

less than 1A

Bridge rectifiers

DiodeMaximum

Current

Maximum

Reverse

Voltage

1N4001 1A 50V

1N4002 1A 100V

1N4007 1A 1000V

1N5401 3A 100V

1N5408 3A 1000V

21

There are several ways of connecting diodes to make a rectifier to convert AC to

DC The bridge rectifier is one of them and it is available in special packages containing

the four diodes required Bridge rectifiers are rated by their maximum current and

maximum reverse voltage They have four leads or terminals the two DC outputs are

labeled + and - the two AC inputs are labeled

The diagram shows the operation of a bridge rectifier as it converts AC to DC Notice

how alternate pairs of diodes conduct

Transformer

A transformer makes use of Faradays law and the ferromagnetic properties of an iron

core to efficiently raise or lower AC voltages It of course cannot increase power so that

if the voltage is raised the current is proportionally lowered and vice versa

22

Flywheel Energy Storage

Overview

A flywheel in essence is a mechanical battery - simply a mass rotating about an axis

Flywheels store energy mechanically in the form of kinetic energy They take an

electrical input to accelerate the rotor up to speed by using the built-in motor and return

the electrical energy by using this same motor as a generator Flywheels are one of the

oldest and most common mechanical devises in existence They may still prove to serve

us as an important component on tomorrows vehicles and future energy needs Flywheels

are one of the most promising technologies for replacing conventional lead acid batteries

as energy storage systems for a variety of applications including automobiles

economical rural electrification systems and stand-alone remote power units commonly

used in the telecommunications industry Recent advances in the mechanical properties of

composites has rekindled interest in using the inertia of a spinning wheel to store energy

23

In addition to energy density flywheel energy storage systems (FES) also offer several

important advantages over chemical energy storage The rate at which energy can be

exchanged into or out of the battery is limited only by the motor--generator design

Therefore it is possible to withdraw large amounts of energy in a far shorter time than

with traditional chemical batteries Indeed research into exploiting this property of FES

systems to get short intense bursts of energy is ongoing with the most notable projects

being a magnetic tank gun and a fusion ignition system Of course it is also possible to

quickly charge FES batteries making them desirable for application in electric cars where

the charge time could be dropped from a matter of hours to a matter of minutes

Advantages Flywheels store energy very efficiently (high turn-around efficiency) and

have the potential for very high specific power compared with batteries Flywheels have

very high output potential and relatively long life Flywheels are relatively unaffected by

ambient temperature extremes

Disadvantages Current flywheels have low specific energy There are safety concerns

associated with flywheels due to their high speed rotor and the possibility of it breaking

loose and releasing all of its energy in an uncontrolled manner Flywheels are a less

mature technology than chemical batteries and the current cost is too high to make them

competitive in the market

VOLTAGE REGULATOR

24

A Voltage Regulator (also called a regulator) has only three legs and appears to be a

comparatively simple device but it is actually a very complex integrated circuit A

regulator converts varying input voltage and produces a constant regulated output

voltage Voltage regulators are available in a variety of outputs typically 5 volts 9 volts

and 12 volts The last two digits in the name indicate the output voltage

Introduction

It is very easy to get stabilized voltage for ICs by using a three terminal voltage regulator

The three terminal voltage regulator outputs stabilized voltage at a lower level than the

higher input voltage A voltage regulator cannot put out higher voltage than the input

voltage They are similar in appearance to a transistor The 7800 series consists of three-

terminal positive voltage regulators

These ICs are designed as fixed voltage regulators and with adequate heat sinking can

deliver output currents in excess of 1A These ICs are used to provide +5 volts and +12

volts supply Line regulation in these ICs is change in the output voltage for a change in

the input voltage Load regulation is defined as the change in output voltage for a change

in load current If there is any high voltage than 12 volt to 7812 it will convert to 12 V by

this IC If there is any voltage less than 12 volt it allows passing it FAN is used for

cooling the ICs

There are two ICs 7805 and 7812 attached with the Intel-fan heat sink From the base of

7805 IC we get the +5Volt Supply and from the base of 7812 IC we get the 12 Volt

25

supply Two LED are also connected with the respective ICs in order to indicate there

proper working

There are some voltage regulators

LM7805 for + 5 volts

LM7809 for +9 volts

LM7812 for+12 volts

LM7905 for-5 volts

LM7909 for-9 volts

LM7912 for-12 volts

Fig LM7805 Integrated Circuit Internal Schematic

The LM78XX series of voltage regulators are designed for positive input For

applications requiring negative input the LM79XX series is used

26

Fig Symbol of voltage regulator Fig A LM 7805 regulator

Fig The circuit diagram represents a typical use of a voltage regulator

Note The LM7805 can reliably deliver 1 amp at a constant voltage

Input Voltage

As a general rule the input voltage should be limited to 2 to 3 volts above the output

voltage The LM78XX series can handle up to 30 volts input but the power difference

between the input voltagecurrent ratio and output voltagecurrent ratio appears as heat If

the input voltage is unnecessarily high the regulator will get very hot Unless sufficient

heat sinking is provided the regulator will shut down

27

Parallel Port

Essentials

A first step in exploring the parallel port is learning how to get the most from a port with

your everyday applications and peripherals Things to know include how to find

configure and install a port how and when to use the new bidirectional EPP and ECP

modes and how to handle a system with multiple parallel-port peripherals

Defining the Ports

What is the parallel port In the computer world a port is a set of signal lines that the

microprocessor or CPU uses to exchange data with other components Typical uses for

ports are communicating with printers modems keyboards and displays or just about

any component Most computer ports are digital where each signal or bit is 0 or 1 A

parallel port transfers multiple bits at once while a serial port transfers a bit at a time

(though it may transfer in both directions at once)The ports explained here is about a

specific type of parallel port the one found on just about every Pc or IBM-compatible

personal computer Along with the RS-232 serial port the parallel port is a workhorse of

PC communications On newer PCs you may find other ports such as SCSI USB and

IrDA but the parallel port remains popular because its capable flexible and every PC

has one

The term PC-compatible or PC for short refers to the IBM PC and any of the

many many personal computers derived from it From another angle a PC is any

computer that can run Microsofts MS-DOS operating system and whose expansion bus is

compatible with the ISA bus in the original IBM Pc The category includes the PC XT

AT PS2 and most computers with 80x86 Pentium and compatible CPUs It does not

include the Macintosh Amiga or IBM mainframes though these and other computer

types may have ports that are similar to the parallel port on the Pc The original PCs

parallel port had eight outputs five inputs and four bidirectional lines

These are enough for communicating with many types of peripherals On many

newer PCs the eight outputs can also serve as inputs for faster communications with

scanners drives and other devices that send data to the Pc

28

The parallel port was designed as a printer port and many of the-original names for the

ports signals (PaperEnd AutoLineFeed) reflect that use But these days you can find all

kinds of things besides printers connected to the port The term peripheral or peripheral

device is a catch-all category that includes printers scanners modems and other devices

that connect to a Pc

29

Accessing Ports

Windows DOS C JAVA and Visual Basic provide several ways to read and write to

parallel ports The most direct way is reading and writing to the port registers Most

programming languages include this ability or at least allow you to add it Visual Basic

includes other options including the Printer object the Print Form method and Open

LPT x Windows also has API calls for accessing LPT ports and 16-bit programs can use

BIOS and DOS software interrupts for LPT access This chapter introduces the parallel

ports signals and ways of accessing them in the programs you write

Parallel ports can be used to connect a host of popular computer peripherals

bull Printers

bull Scanners

bull CD burners

bull External hard drives

bull Iomega Zip removable drives

bull Network adapters

bull Tape backup drives

30

Pin Out Diagram Of Parallel Port

31

Parallel Port Basics

Parallel ports were originally developed by IBM as a way to connect a printer to our PC

When IBM was in the process of designing the PC the company wanted the computer to

work with printers offered by Centronics a top printer manufacturer at the time IBM

decided not to use the same port interface on the computer that Centronics used on the

printer

Instead IBM engineers coupled a 25-pin connector DB-25 with a 36-pin Centronics

connector to create a special cable to connect the printer to the computer Other printer

manufacturers ended up adopting the Centronics interface making this strange hybrid

cable an unlikely de facto standard

When a PC sends data to a printer or other device using a parallel port it sends 8 bits of

data (1 byte) at a time These 8 bits are transmitted parallel to each other as opposed to

the same eight bits being transmitted serially (all in a single row) through a serial port

The standard parallel port is capable of sending 50 to 100 kilobytes of data per second

Lets take a closer look at what each pin does when used with a printer

bull Pin 1 carries the strobe signal It maintains a level of between 28 and 5 volts but drops

below 05 volts whenever the computer sends a byte of data This drop in voltage tells

the printer that data is being sent

Pins 2 through 9 are used to carry data To indicate that a bit has a value of 1 a

charge of 5 volts is sent through the correct pin No charge on a pin indicates avalue of

0 This is a simple but highly effective way to transmit digital information over an

analog cable in real-time

bull Pin 10 sends the acknowledge signal from the printer to the computer Like Pin 1 it

maintains a charge and drops the voltage below 05 volts to let the computer know that

the data was received

32

bull If the printer is busy it will charge Pin 11 Then it will drop the voltage below

05 volts to let the computer know it is ready to receive more data

bull The printer lets the computer know if it is out of paper by sending a charge on Pin 12

bull As long as the computer is receiving a charge on Pin 13 it knows that the device

is online

bull The computer sends an auto feed signal to the printer through Pin 14 using a 5-

volt charge

bull If the printer has any problems it drops the voltage to less than 05 volts on Pin

15 to let the computer know that there is an error

bull Whenever a new print job is ready the computer drops the charge on Pin 16 to

initialize the printer

bull Pin 17 is used by the computer to remotely take the printer offline This is

accomplished by sending a charge to the printer and maintaining it as long as you

want the printer offline

bull Pins 18-25 are grounds and are used as a reference signal for the low (below 05

volts) charge

33

Power Supply

Types of Power Supply

There are many types of power supply Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other

devices A power supply can by broken down into a series of blocks each of which

performs a particular function

For example a 5V regulated supply

Each of the blocks is described in more detail below

Transformer - steps down high voltage AC mains to low voltage AC

Rectifier - converts AC to DC but the DC output is varying

Smoothing - smooths the DC from varying greatly to a small ripple

Regulator - eliminates ripple by setting DC output to a fixed voltage

Power supplies made from these blocks are described below with a circuit diagram and a

graph of their output

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Dual Supplies

34

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 19: Self Balancing Robot

Function

Diodes allow electricity to flow in only one direction The arrow of the circuit symbol

shows the direction in which the current can flow Diodes are the electrical version of a

valve and early diodes were actually called valves

Example Circuit symbol

Forward Voltage Drop

Electricity uses up a little energy pushing its way through the diode rather like a person

pushing through a door with a spring This means that there is a small voltage across a

conducting diode it is called the forward voltage drop and is about 07V for all normal

diodes which are made from silicon The forward voltage drop of a diode is almost

constant whatever the current passing through the diode so they have a very steep

characteristic (current-voltage graph)

Reverse Voltage

When a reverse voltage is applied a perfect diode does not conduct but all real diodes

leak a very tiny current of a few microA or less This can be ignored in most circuits because

it will be very much smaller than the current flowing in the forward direction However

all diodes have a maximum reverse voltage (usually 50V or more) and if this is exceeded

the diode will fail and pass a large current in the reverse direction this is called

breakdown

Ordinary diodes can be split into two types Signal diodes which pass small currents of

100mA or less and Rectifier diodes which can pass large currents In addition there are

LEDs (which have their own page) and Zener diodes (at the bottom of this page)

19

Connecting and soldering

Diodes must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is

marked by a line painted on the body Diodes are labelled with their code in small print

you may need a magnifying glass to read this on small signal diodes Small signal diodes

can be damaged by heat when soldering but the risk is small unless you are using a

germanium diode (codes beginning OA) in which case you should use a heat sink

clipped to the lead between the joint and the diode body A standard crocodile clip can be

used as a heat sink

Rectifier diodes are quite robust and no special precautions are needed for soldering

them

Testing diodes

You can use a multimeter or a simple tester (battery resistor and LED) to check that a

diode conducts in one direction but not the other A lamp may be used to test a

rectifier diode but do NOT use a lamp to test a signal diode because the large current

passed by the lamp will destroy the diode

Signal diodes (small current)

20

Signal diodes are used to process information (electrical signals) in circuits so they are

only required to pass small currents of up to 100mA General purpose signal diodes such

as the 1N4148 are made from silicon and have a forward voltage drop of 07V

Germanium diodes

Such as the OA90 have a lower forward voltage drop of 02V and this makes them

suitable to use in radio circuits as detectors which extract the audio signal from the weak

radio signal

For general use where the size of the forward voltage drop is less important silicon

diodes are better because they are less easily damaged by heat when soldering they have

a lower resistance when conducting and they have very low leakage currents when a

reverse voltage is applied Rectifier diodes are used in power supplies to convert

alternating current (AC) to direct current (DC) a process called rectification They are

also used elsewhere in circuits where a large current must pass through the diode All

rectifier diodes are made from silicon and therefore have a forward voltage drop of 07V

The table shows maximum current and maximum reverse voltage for some popular

rectifier diodes The 1N4001 is suitable for most low voltage circuits with a current of

less than 1A

Bridge rectifiers

DiodeMaximum

Current

Maximum

Reverse

Voltage

1N4001 1A 50V

1N4002 1A 100V

1N4007 1A 1000V

1N5401 3A 100V

1N5408 3A 1000V

21

There are several ways of connecting diodes to make a rectifier to convert AC to

DC The bridge rectifier is one of them and it is available in special packages containing

the four diodes required Bridge rectifiers are rated by their maximum current and

maximum reverse voltage They have four leads or terminals the two DC outputs are

labeled + and - the two AC inputs are labeled

The diagram shows the operation of a bridge rectifier as it converts AC to DC Notice

how alternate pairs of diodes conduct

Transformer

A transformer makes use of Faradays law and the ferromagnetic properties of an iron

core to efficiently raise or lower AC voltages It of course cannot increase power so that

if the voltage is raised the current is proportionally lowered and vice versa

22

Flywheel Energy Storage

Overview

A flywheel in essence is a mechanical battery - simply a mass rotating about an axis

Flywheels store energy mechanically in the form of kinetic energy They take an

electrical input to accelerate the rotor up to speed by using the built-in motor and return

the electrical energy by using this same motor as a generator Flywheels are one of the

oldest and most common mechanical devises in existence They may still prove to serve

us as an important component on tomorrows vehicles and future energy needs Flywheels

are one of the most promising technologies for replacing conventional lead acid batteries

as energy storage systems for a variety of applications including automobiles

economical rural electrification systems and stand-alone remote power units commonly

used in the telecommunications industry Recent advances in the mechanical properties of

composites has rekindled interest in using the inertia of a spinning wheel to store energy

23

In addition to energy density flywheel energy storage systems (FES) also offer several

important advantages over chemical energy storage The rate at which energy can be

exchanged into or out of the battery is limited only by the motor--generator design

Therefore it is possible to withdraw large amounts of energy in a far shorter time than

with traditional chemical batteries Indeed research into exploiting this property of FES

systems to get short intense bursts of energy is ongoing with the most notable projects

being a magnetic tank gun and a fusion ignition system Of course it is also possible to

quickly charge FES batteries making them desirable for application in electric cars where

the charge time could be dropped from a matter of hours to a matter of minutes

Advantages Flywheels store energy very efficiently (high turn-around efficiency) and

have the potential for very high specific power compared with batteries Flywheels have

very high output potential and relatively long life Flywheels are relatively unaffected by

ambient temperature extremes

Disadvantages Current flywheels have low specific energy There are safety concerns

associated with flywheels due to their high speed rotor and the possibility of it breaking

loose and releasing all of its energy in an uncontrolled manner Flywheels are a less

mature technology than chemical batteries and the current cost is too high to make them

competitive in the market

VOLTAGE REGULATOR

24

A Voltage Regulator (also called a regulator) has only three legs and appears to be a

comparatively simple device but it is actually a very complex integrated circuit A

regulator converts varying input voltage and produces a constant regulated output

voltage Voltage regulators are available in a variety of outputs typically 5 volts 9 volts

and 12 volts The last two digits in the name indicate the output voltage

Introduction

It is very easy to get stabilized voltage for ICs by using a three terminal voltage regulator

The three terminal voltage regulator outputs stabilized voltage at a lower level than the

higher input voltage A voltage regulator cannot put out higher voltage than the input

voltage They are similar in appearance to a transistor The 7800 series consists of three-

terminal positive voltage regulators

These ICs are designed as fixed voltage regulators and with adequate heat sinking can

deliver output currents in excess of 1A These ICs are used to provide +5 volts and +12

volts supply Line regulation in these ICs is change in the output voltage for a change in

the input voltage Load regulation is defined as the change in output voltage for a change

in load current If there is any high voltage than 12 volt to 7812 it will convert to 12 V by

this IC If there is any voltage less than 12 volt it allows passing it FAN is used for

cooling the ICs

There are two ICs 7805 and 7812 attached with the Intel-fan heat sink From the base of

7805 IC we get the +5Volt Supply and from the base of 7812 IC we get the 12 Volt

25

supply Two LED are also connected with the respective ICs in order to indicate there

proper working

There are some voltage regulators

LM7805 for + 5 volts

LM7809 for +9 volts

LM7812 for+12 volts

LM7905 for-5 volts

LM7909 for-9 volts

LM7912 for-12 volts

Fig LM7805 Integrated Circuit Internal Schematic

The LM78XX series of voltage regulators are designed for positive input For

applications requiring negative input the LM79XX series is used

26

Fig Symbol of voltage regulator Fig A LM 7805 regulator

Fig The circuit diagram represents a typical use of a voltage regulator

Note The LM7805 can reliably deliver 1 amp at a constant voltage

Input Voltage

As a general rule the input voltage should be limited to 2 to 3 volts above the output

voltage The LM78XX series can handle up to 30 volts input but the power difference

between the input voltagecurrent ratio and output voltagecurrent ratio appears as heat If

the input voltage is unnecessarily high the regulator will get very hot Unless sufficient

heat sinking is provided the regulator will shut down

27

Parallel Port

Essentials

A first step in exploring the parallel port is learning how to get the most from a port with

your everyday applications and peripherals Things to know include how to find

configure and install a port how and when to use the new bidirectional EPP and ECP

modes and how to handle a system with multiple parallel-port peripherals

Defining the Ports

What is the parallel port In the computer world a port is a set of signal lines that the

microprocessor or CPU uses to exchange data with other components Typical uses for

ports are communicating with printers modems keyboards and displays or just about

any component Most computer ports are digital where each signal or bit is 0 or 1 A

parallel port transfers multiple bits at once while a serial port transfers a bit at a time

(though it may transfer in both directions at once)The ports explained here is about a

specific type of parallel port the one found on just about every Pc or IBM-compatible

personal computer Along with the RS-232 serial port the parallel port is a workhorse of

PC communications On newer PCs you may find other ports such as SCSI USB and

IrDA but the parallel port remains popular because its capable flexible and every PC

has one

The term PC-compatible or PC for short refers to the IBM PC and any of the

many many personal computers derived from it From another angle a PC is any

computer that can run Microsofts MS-DOS operating system and whose expansion bus is

compatible with the ISA bus in the original IBM Pc The category includes the PC XT

AT PS2 and most computers with 80x86 Pentium and compatible CPUs It does not

include the Macintosh Amiga or IBM mainframes though these and other computer

types may have ports that are similar to the parallel port on the Pc The original PCs

parallel port had eight outputs five inputs and four bidirectional lines

These are enough for communicating with many types of peripherals On many

newer PCs the eight outputs can also serve as inputs for faster communications with

scanners drives and other devices that send data to the Pc

28

The parallel port was designed as a printer port and many of the-original names for the

ports signals (PaperEnd AutoLineFeed) reflect that use But these days you can find all

kinds of things besides printers connected to the port The term peripheral or peripheral

device is a catch-all category that includes printers scanners modems and other devices

that connect to a Pc

29

Accessing Ports

Windows DOS C JAVA and Visual Basic provide several ways to read and write to

parallel ports The most direct way is reading and writing to the port registers Most

programming languages include this ability or at least allow you to add it Visual Basic

includes other options including the Printer object the Print Form method and Open

LPT x Windows also has API calls for accessing LPT ports and 16-bit programs can use

BIOS and DOS software interrupts for LPT access This chapter introduces the parallel

ports signals and ways of accessing them in the programs you write

Parallel ports can be used to connect a host of popular computer peripherals

bull Printers

bull Scanners

bull CD burners

bull External hard drives

bull Iomega Zip removable drives

bull Network adapters

bull Tape backup drives

30

Pin Out Diagram Of Parallel Port

31

Parallel Port Basics

Parallel ports were originally developed by IBM as a way to connect a printer to our PC

When IBM was in the process of designing the PC the company wanted the computer to

work with printers offered by Centronics a top printer manufacturer at the time IBM

decided not to use the same port interface on the computer that Centronics used on the

printer

Instead IBM engineers coupled a 25-pin connector DB-25 with a 36-pin Centronics

connector to create a special cable to connect the printer to the computer Other printer

manufacturers ended up adopting the Centronics interface making this strange hybrid

cable an unlikely de facto standard

When a PC sends data to a printer or other device using a parallel port it sends 8 bits of

data (1 byte) at a time These 8 bits are transmitted parallel to each other as opposed to

the same eight bits being transmitted serially (all in a single row) through a serial port

The standard parallel port is capable of sending 50 to 100 kilobytes of data per second

Lets take a closer look at what each pin does when used with a printer

bull Pin 1 carries the strobe signal It maintains a level of between 28 and 5 volts but drops

below 05 volts whenever the computer sends a byte of data This drop in voltage tells

the printer that data is being sent

Pins 2 through 9 are used to carry data To indicate that a bit has a value of 1 a

charge of 5 volts is sent through the correct pin No charge on a pin indicates avalue of

0 This is a simple but highly effective way to transmit digital information over an

analog cable in real-time

bull Pin 10 sends the acknowledge signal from the printer to the computer Like Pin 1 it

maintains a charge and drops the voltage below 05 volts to let the computer know that

the data was received

32

bull If the printer is busy it will charge Pin 11 Then it will drop the voltage below

05 volts to let the computer know it is ready to receive more data

bull The printer lets the computer know if it is out of paper by sending a charge on Pin 12

bull As long as the computer is receiving a charge on Pin 13 it knows that the device

is online

bull The computer sends an auto feed signal to the printer through Pin 14 using a 5-

volt charge

bull If the printer has any problems it drops the voltage to less than 05 volts on Pin

15 to let the computer know that there is an error

bull Whenever a new print job is ready the computer drops the charge on Pin 16 to

initialize the printer

bull Pin 17 is used by the computer to remotely take the printer offline This is

accomplished by sending a charge to the printer and maintaining it as long as you

want the printer offline

bull Pins 18-25 are grounds and are used as a reference signal for the low (below 05

volts) charge

33

Power Supply

Types of Power Supply

There are many types of power supply Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other

devices A power supply can by broken down into a series of blocks each of which

performs a particular function

For example a 5V regulated supply

Each of the blocks is described in more detail below

Transformer - steps down high voltage AC mains to low voltage AC

Rectifier - converts AC to DC but the DC output is varying

Smoothing - smooths the DC from varying greatly to a small ripple

Regulator - eliminates ripple by setting DC output to a fixed voltage

Power supplies made from these blocks are described below with a circuit diagram and a

graph of their output

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Dual Supplies

34

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 20: Self Balancing Robot

Connecting and soldering

Diodes must be connected the correct way round the diagram may be labelled a or + for

anode and k or - for cathode (yes it really is k not c for cathode) The cathode is

marked by a line painted on the body Diodes are labelled with their code in small print

you may need a magnifying glass to read this on small signal diodes Small signal diodes

can be damaged by heat when soldering but the risk is small unless you are using a

germanium diode (codes beginning OA) in which case you should use a heat sink

clipped to the lead between the joint and the diode body A standard crocodile clip can be

used as a heat sink

Rectifier diodes are quite robust and no special precautions are needed for soldering

them

Testing diodes

You can use a multimeter or a simple tester (battery resistor and LED) to check that a

diode conducts in one direction but not the other A lamp may be used to test a

rectifier diode but do NOT use a lamp to test a signal diode because the large current

passed by the lamp will destroy the diode

Signal diodes (small current)

20

Signal diodes are used to process information (electrical signals) in circuits so they are

only required to pass small currents of up to 100mA General purpose signal diodes such

as the 1N4148 are made from silicon and have a forward voltage drop of 07V

Germanium diodes

Such as the OA90 have a lower forward voltage drop of 02V and this makes them

suitable to use in radio circuits as detectors which extract the audio signal from the weak

radio signal

For general use where the size of the forward voltage drop is less important silicon

diodes are better because they are less easily damaged by heat when soldering they have

a lower resistance when conducting and they have very low leakage currents when a

reverse voltage is applied Rectifier diodes are used in power supplies to convert

alternating current (AC) to direct current (DC) a process called rectification They are

also used elsewhere in circuits where a large current must pass through the diode All

rectifier diodes are made from silicon and therefore have a forward voltage drop of 07V

The table shows maximum current and maximum reverse voltage for some popular

rectifier diodes The 1N4001 is suitable for most low voltage circuits with a current of

less than 1A

Bridge rectifiers

DiodeMaximum

Current

Maximum

Reverse

Voltage

1N4001 1A 50V

1N4002 1A 100V

1N4007 1A 1000V

1N5401 3A 100V

1N5408 3A 1000V

21

There are several ways of connecting diodes to make a rectifier to convert AC to

DC The bridge rectifier is one of them and it is available in special packages containing

the four diodes required Bridge rectifiers are rated by their maximum current and

maximum reverse voltage They have four leads or terminals the two DC outputs are

labeled + and - the two AC inputs are labeled

The diagram shows the operation of a bridge rectifier as it converts AC to DC Notice

how alternate pairs of diodes conduct

Transformer

A transformer makes use of Faradays law and the ferromagnetic properties of an iron

core to efficiently raise or lower AC voltages It of course cannot increase power so that

if the voltage is raised the current is proportionally lowered and vice versa

22

Flywheel Energy Storage

Overview

A flywheel in essence is a mechanical battery - simply a mass rotating about an axis

Flywheels store energy mechanically in the form of kinetic energy They take an

electrical input to accelerate the rotor up to speed by using the built-in motor and return

the electrical energy by using this same motor as a generator Flywheels are one of the

oldest and most common mechanical devises in existence They may still prove to serve

us as an important component on tomorrows vehicles and future energy needs Flywheels

are one of the most promising technologies for replacing conventional lead acid batteries

as energy storage systems for a variety of applications including automobiles

economical rural electrification systems and stand-alone remote power units commonly

used in the telecommunications industry Recent advances in the mechanical properties of

composites has rekindled interest in using the inertia of a spinning wheel to store energy

23

In addition to energy density flywheel energy storage systems (FES) also offer several

important advantages over chemical energy storage The rate at which energy can be

exchanged into or out of the battery is limited only by the motor--generator design

Therefore it is possible to withdraw large amounts of energy in a far shorter time than

with traditional chemical batteries Indeed research into exploiting this property of FES

systems to get short intense bursts of energy is ongoing with the most notable projects

being a magnetic tank gun and a fusion ignition system Of course it is also possible to

quickly charge FES batteries making them desirable for application in electric cars where

the charge time could be dropped from a matter of hours to a matter of minutes

Advantages Flywheels store energy very efficiently (high turn-around efficiency) and

have the potential for very high specific power compared with batteries Flywheels have

very high output potential and relatively long life Flywheels are relatively unaffected by

ambient temperature extremes

Disadvantages Current flywheels have low specific energy There are safety concerns

associated with flywheels due to their high speed rotor and the possibility of it breaking

loose and releasing all of its energy in an uncontrolled manner Flywheels are a less

mature technology than chemical batteries and the current cost is too high to make them

competitive in the market

VOLTAGE REGULATOR

24

A Voltage Regulator (also called a regulator) has only three legs and appears to be a

comparatively simple device but it is actually a very complex integrated circuit A

regulator converts varying input voltage and produces a constant regulated output

voltage Voltage regulators are available in a variety of outputs typically 5 volts 9 volts

and 12 volts The last two digits in the name indicate the output voltage

Introduction

It is very easy to get stabilized voltage for ICs by using a three terminal voltage regulator

The three terminal voltage regulator outputs stabilized voltage at a lower level than the

higher input voltage A voltage regulator cannot put out higher voltage than the input

voltage They are similar in appearance to a transistor The 7800 series consists of three-

terminal positive voltage regulators

These ICs are designed as fixed voltage regulators and with adequate heat sinking can

deliver output currents in excess of 1A These ICs are used to provide +5 volts and +12

volts supply Line regulation in these ICs is change in the output voltage for a change in

the input voltage Load regulation is defined as the change in output voltage for a change

in load current If there is any high voltage than 12 volt to 7812 it will convert to 12 V by

this IC If there is any voltage less than 12 volt it allows passing it FAN is used for

cooling the ICs

There are two ICs 7805 and 7812 attached with the Intel-fan heat sink From the base of

7805 IC we get the +5Volt Supply and from the base of 7812 IC we get the 12 Volt

25

supply Two LED are also connected with the respective ICs in order to indicate there

proper working

There are some voltage regulators

LM7805 for + 5 volts

LM7809 for +9 volts

LM7812 for+12 volts

LM7905 for-5 volts

LM7909 for-9 volts

LM7912 for-12 volts

Fig LM7805 Integrated Circuit Internal Schematic

The LM78XX series of voltage regulators are designed for positive input For

applications requiring negative input the LM79XX series is used

26

Fig Symbol of voltage regulator Fig A LM 7805 regulator

Fig The circuit diagram represents a typical use of a voltage regulator

Note The LM7805 can reliably deliver 1 amp at a constant voltage

Input Voltage

As a general rule the input voltage should be limited to 2 to 3 volts above the output

voltage The LM78XX series can handle up to 30 volts input but the power difference

between the input voltagecurrent ratio and output voltagecurrent ratio appears as heat If

the input voltage is unnecessarily high the regulator will get very hot Unless sufficient

heat sinking is provided the regulator will shut down

27

Parallel Port

Essentials

A first step in exploring the parallel port is learning how to get the most from a port with

your everyday applications and peripherals Things to know include how to find

configure and install a port how and when to use the new bidirectional EPP and ECP

modes and how to handle a system with multiple parallel-port peripherals

Defining the Ports

What is the parallel port In the computer world a port is a set of signal lines that the

microprocessor or CPU uses to exchange data with other components Typical uses for

ports are communicating with printers modems keyboards and displays or just about

any component Most computer ports are digital where each signal or bit is 0 or 1 A

parallel port transfers multiple bits at once while a serial port transfers a bit at a time

(though it may transfer in both directions at once)The ports explained here is about a

specific type of parallel port the one found on just about every Pc or IBM-compatible

personal computer Along with the RS-232 serial port the parallel port is a workhorse of

PC communications On newer PCs you may find other ports such as SCSI USB and

IrDA but the parallel port remains popular because its capable flexible and every PC

has one

The term PC-compatible or PC for short refers to the IBM PC and any of the

many many personal computers derived from it From another angle a PC is any

computer that can run Microsofts MS-DOS operating system and whose expansion bus is

compatible with the ISA bus in the original IBM Pc The category includes the PC XT

AT PS2 and most computers with 80x86 Pentium and compatible CPUs It does not

include the Macintosh Amiga or IBM mainframes though these and other computer

types may have ports that are similar to the parallel port on the Pc The original PCs

parallel port had eight outputs five inputs and four bidirectional lines

These are enough for communicating with many types of peripherals On many

newer PCs the eight outputs can also serve as inputs for faster communications with

scanners drives and other devices that send data to the Pc

28

The parallel port was designed as a printer port and many of the-original names for the

ports signals (PaperEnd AutoLineFeed) reflect that use But these days you can find all

kinds of things besides printers connected to the port The term peripheral or peripheral

device is a catch-all category that includes printers scanners modems and other devices

that connect to a Pc

29

Accessing Ports

Windows DOS C JAVA and Visual Basic provide several ways to read and write to

parallel ports The most direct way is reading and writing to the port registers Most

programming languages include this ability or at least allow you to add it Visual Basic

includes other options including the Printer object the Print Form method and Open

LPT x Windows also has API calls for accessing LPT ports and 16-bit programs can use

BIOS and DOS software interrupts for LPT access This chapter introduces the parallel

ports signals and ways of accessing them in the programs you write

Parallel ports can be used to connect a host of popular computer peripherals

bull Printers

bull Scanners

bull CD burners

bull External hard drives

bull Iomega Zip removable drives

bull Network adapters

bull Tape backup drives

30

Pin Out Diagram Of Parallel Port

31

Parallel Port Basics

Parallel ports were originally developed by IBM as a way to connect a printer to our PC

When IBM was in the process of designing the PC the company wanted the computer to

work with printers offered by Centronics a top printer manufacturer at the time IBM

decided not to use the same port interface on the computer that Centronics used on the

printer

Instead IBM engineers coupled a 25-pin connector DB-25 with a 36-pin Centronics

connector to create a special cable to connect the printer to the computer Other printer

manufacturers ended up adopting the Centronics interface making this strange hybrid

cable an unlikely de facto standard

When a PC sends data to a printer or other device using a parallel port it sends 8 bits of

data (1 byte) at a time These 8 bits are transmitted parallel to each other as opposed to

the same eight bits being transmitted serially (all in a single row) through a serial port

The standard parallel port is capable of sending 50 to 100 kilobytes of data per second

Lets take a closer look at what each pin does when used with a printer

bull Pin 1 carries the strobe signal It maintains a level of between 28 and 5 volts but drops

below 05 volts whenever the computer sends a byte of data This drop in voltage tells

the printer that data is being sent

Pins 2 through 9 are used to carry data To indicate that a bit has a value of 1 a

charge of 5 volts is sent through the correct pin No charge on a pin indicates avalue of

0 This is a simple but highly effective way to transmit digital information over an

analog cable in real-time

bull Pin 10 sends the acknowledge signal from the printer to the computer Like Pin 1 it

maintains a charge and drops the voltage below 05 volts to let the computer know that

the data was received

32

bull If the printer is busy it will charge Pin 11 Then it will drop the voltage below

05 volts to let the computer know it is ready to receive more data

bull The printer lets the computer know if it is out of paper by sending a charge on Pin 12

bull As long as the computer is receiving a charge on Pin 13 it knows that the device

is online

bull The computer sends an auto feed signal to the printer through Pin 14 using a 5-

volt charge

bull If the printer has any problems it drops the voltage to less than 05 volts on Pin

15 to let the computer know that there is an error

bull Whenever a new print job is ready the computer drops the charge on Pin 16 to

initialize the printer

bull Pin 17 is used by the computer to remotely take the printer offline This is

accomplished by sending a charge to the printer and maintaining it as long as you

want the printer offline

bull Pins 18-25 are grounds and are used as a reference signal for the low (below 05

volts) charge

33

Power Supply

Types of Power Supply

There are many types of power supply Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other

devices A power supply can by broken down into a series of blocks each of which

performs a particular function

For example a 5V regulated supply

Each of the blocks is described in more detail below

Transformer - steps down high voltage AC mains to low voltage AC

Rectifier - converts AC to DC but the DC output is varying

Smoothing - smooths the DC from varying greatly to a small ripple

Regulator - eliminates ripple by setting DC output to a fixed voltage

Power supplies made from these blocks are described below with a circuit diagram and a

graph of their output

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Dual Supplies

34

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 21: Self Balancing Robot

Signal diodes are used to process information (electrical signals) in circuits so they are

only required to pass small currents of up to 100mA General purpose signal diodes such

as the 1N4148 are made from silicon and have a forward voltage drop of 07V

Germanium diodes

Such as the OA90 have a lower forward voltage drop of 02V and this makes them

suitable to use in radio circuits as detectors which extract the audio signal from the weak

radio signal

For general use where the size of the forward voltage drop is less important silicon

diodes are better because they are less easily damaged by heat when soldering they have

a lower resistance when conducting and they have very low leakage currents when a

reverse voltage is applied Rectifier diodes are used in power supplies to convert

alternating current (AC) to direct current (DC) a process called rectification They are

also used elsewhere in circuits where a large current must pass through the diode All

rectifier diodes are made from silicon and therefore have a forward voltage drop of 07V

The table shows maximum current and maximum reverse voltage for some popular

rectifier diodes The 1N4001 is suitable for most low voltage circuits with a current of

less than 1A

Bridge rectifiers

DiodeMaximum

Current

Maximum

Reverse

Voltage

1N4001 1A 50V

1N4002 1A 100V

1N4007 1A 1000V

1N5401 3A 100V

1N5408 3A 1000V

21

There are several ways of connecting diodes to make a rectifier to convert AC to

DC The bridge rectifier is one of them and it is available in special packages containing

the four diodes required Bridge rectifiers are rated by their maximum current and

maximum reverse voltage They have four leads or terminals the two DC outputs are

labeled + and - the two AC inputs are labeled

The diagram shows the operation of a bridge rectifier as it converts AC to DC Notice

how alternate pairs of diodes conduct

Transformer

A transformer makes use of Faradays law and the ferromagnetic properties of an iron

core to efficiently raise or lower AC voltages It of course cannot increase power so that

if the voltage is raised the current is proportionally lowered and vice versa

22

Flywheel Energy Storage

Overview

A flywheel in essence is a mechanical battery - simply a mass rotating about an axis

Flywheels store energy mechanically in the form of kinetic energy They take an

electrical input to accelerate the rotor up to speed by using the built-in motor and return

the electrical energy by using this same motor as a generator Flywheels are one of the

oldest and most common mechanical devises in existence They may still prove to serve

us as an important component on tomorrows vehicles and future energy needs Flywheels

are one of the most promising technologies for replacing conventional lead acid batteries

as energy storage systems for a variety of applications including automobiles

economical rural electrification systems and stand-alone remote power units commonly

used in the telecommunications industry Recent advances in the mechanical properties of

composites has rekindled interest in using the inertia of a spinning wheel to store energy

23

In addition to energy density flywheel energy storage systems (FES) also offer several

important advantages over chemical energy storage The rate at which energy can be

exchanged into or out of the battery is limited only by the motor--generator design

Therefore it is possible to withdraw large amounts of energy in a far shorter time than

with traditional chemical batteries Indeed research into exploiting this property of FES

systems to get short intense bursts of energy is ongoing with the most notable projects

being a magnetic tank gun and a fusion ignition system Of course it is also possible to

quickly charge FES batteries making them desirable for application in electric cars where

the charge time could be dropped from a matter of hours to a matter of minutes

Advantages Flywheels store energy very efficiently (high turn-around efficiency) and

have the potential for very high specific power compared with batteries Flywheels have

very high output potential and relatively long life Flywheels are relatively unaffected by

ambient temperature extremes

Disadvantages Current flywheels have low specific energy There are safety concerns

associated with flywheels due to their high speed rotor and the possibility of it breaking

loose and releasing all of its energy in an uncontrolled manner Flywheels are a less

mature technology than chemical batteries and the current cost is too high to make them

competitive in the market

VOLTAGE REGULATOR

24

A Voltage Regulator (also called a regulator) has only three legs and appears to be a

comparatively simple device but it is actually a very complex integrated circuit A

regulator converts varying input voltage and produces a constant regulated output

voltage Voltage regulators are available in a variety of outputs typically 5 volts 9 volts

and 12 volts The last two digits in the name indicate the output voltage

Introduction

It is very easy to get stabilized voltage for ICs by using a three terminal voltage regulator

The three terminal voltage regulator outputs stabilized voltage at a lower level than the

higher input voltage A voltage regulator cannot put out higher voltage than the input

voltage They are similar in appearance to a transistor The 7800 series consists of three-

terminal positive voltage regulators

These ICs are designed as fixed voltage regulators and with adequate heat sinking can

deliver output currents in excess of 1A These ICs are used to provide +5 volts and +12

volts supply Line regulation in these ICs is change in the output voltage for a change in

the input voltage Load regulation is defined as the change in output voltage for a change

in load current If there is any high voltage than 12 volt to 7812 it will convert to 12 V by

this IC If there is any voltage less than 12 volt it allows passing it FAN is used for

cooling the ICs

There are two ICs 7805 and 7812 attached with the Intel-fan heat sink From the base of

7805 IC we get the +5Volt Supply and from the base of 7812 IC we get the 12 Volt

25

supply Two LED are also connected with the respective ICs in order to indicate there

proper working

There are some voltage regulators

LM7805 for + 5 volts

LM7809 for +9 volts

LM7812 for+12 volts

LM7905 for-5 volts

LM7909 for-9 volts

LM7912 for-12 volts

Fig LM7805 Integrated Circuit Internal Schematic

The LM78XX series of voltage regulators are designed for positive input For

applications requiring negative input the LM79XX series is used

26

Fig Symbol of voltage regulator Fig A LM 7805 regulator

Fig The circuit diagram represents a typical use of a voltage regulator

Note The LM7805 can reliably deliver 1 amp at a constant voltage

Input Voltage

As a general rule the input voltage should be limited to 2 to 3 volts above the output

voltage The LM78XX series can handle up to 30 volts input but the power difference

between the input voltagecurrent ratio and output voltagecurrent ratio appears as heat If

the input voltage is unnecessarily high the regulator will get very hot Unless sufficient

heat sinking is provided the regulator will shut down

27

Parallel Port

Essentials

A first step in exploring the parallel port is learning how to get the most from a port with

your everyday applications and peripherals Things to know include how to find

configure and install a port how and when to use the new bidirectional EPP and ECP

modes and how to handle a system with multiple parallel-port peripherals

Defining the Ports

What is the parallel port In the computer world a port is a set of signal lines that the

microprocessor or CPU uses to exchange data with other components Typical uses for

ports are communicating with printers modems keyboards and displays or just about

any component Most computer ports are digital where each signal or bit is 0 or 1 A

parallel port transfers multiple bits at once while a serial port transfers a bit at a time

(though it may transfer in both directions at once)The ports explained here is about a

specific type of parallel port the one found on just about every Pc or IBM-compatible

personal computer Along with the RS-232 serial port the parallel port is a workhorse of

PC communications On newer PCs you may find other ports such as SCSI USB and

IrDA but the parallel port remains popular because its capable flexible and every PC

has one

The term PC-compatible or PC for short refers to the IBM PC and any of the

many many personal computers derived from it From another angle a PC is any

computer that can run Microsofts MS-DOS operating system and whose expansion bus is

compatible with the ISA bus in the original IBM Pc The category includes the PC XT

AT PS2 and most computers with 80x86 Pentium and compatible CPUs It does not

include the Macintosh Amiga or IBM mainframes though these and other computer

types may have ports that are similar to the parallel port on the Pc The original PCs

parallel port had eight outputs five inputs and four bidirectional lines

These are enough for communicating with many types of peripherals On many

newer PCs the eight outputs can also serve as inputs for faster communications with

scanners drives and other devices that send data to the Pc

28

The parallel port was designed as a printer port and many of the-original names for the

ports signals (PaperEnd AutoLineFeed) reflect that use But these days you can find all

kinds of things besides printers connected to the port The term peripheral or peripheral

device is a catch-all category that includes printers scanners modems and other devices

that connect to a Pc

29

Accessing Ports

Windows DOS C JAVA and Visual Basic provide several ways to read and write to

parallel ports The most direct way is reading and writing to the port registers Most

programming languages include this ability or at least allow you to add it Visual Basic

includes other options including the Printer object the Print Form method and Open

LPT x Windows also has API calls for accessing LPT ports and 16-bit programs can use

BIOS and DOS software interrupts for LPT access This chapter introduces the parallel

ports signals and ways of accessing them in the programs you write

Parallel ports can be used to connect a host of popular computer peripherals

bull Printers

bull Scanners

bull CD burners

bull External hard drives

bull Iomega Zip removable drives

bull Network adapters

bull Tape backup drives

30

Pin Out Diagram Of Parallel Port

31

Parallel Port Basics

Parallel ports were originally developed by IBM as a way to connect a printer to our PC

When IBM was in the process of designing the PC the company wanted the computer to

work with printers offered by Centronics a top printer manufacturer at the time IBM

decided not to use the same port interface on the computer that Centronics used on the

printer

Instead IBM engineers coupled a 25-pin connector DB-25 with a 36-pin Centronics

connector to create a special cable to connect the printer to the computer Other printer

manufacturers ended up adopting the Centronics interface making this strange hybrid

cable an unlikely de facto standard

When a PC sends data to a printer or other device using a parallel port it sends 8 bits of

data (1 byte) at a time These 8 bits are transmitted parallel to each other as opposed to

the same eight bits being transmitted serially (all in a single row) through a serial port

The standard parallel port is capable of sending 50 to 100 kilobytes of data per second

Lets take a closer look at what each pin does when used with a printer

bull Pin 1 carries the strobe signal It maintains a level of between 28 and 5 volts but drops

below 05 volts whenever the computer sends a byte of data This drop in voltage tells

the printer that data is being sent

Pins 2 through 9 are used to carry data To indicate that a bit has a value of 1 a

charge of 5 volts is sent through the correct pin No charge on a pin indicates avalue of

0 This is a simple but highly effective way to transmit digital information over an

analog cable in real-time

bull Pin 10 sends the acknowledge signal from the printer to the computer Like Pin 1 it

maintains a charge and drops the voltage below 05 volts to let the computer know that

the data was received

32

bull If the printer is busy it will charge Pin 11 Then it will drop the voltage below

05 volts to let the computer know it is ready to receive more data

bull The printer lets the computer know if it is out of paper by sending a charge on Pin 12

bull As long as the computer is receiving a charge on Pin 13 it knows that the device

is online

bull The computer sends an auto feed signal to the printer through Pin 14 using a 5-

volt charge

bull If the printer has any problems it drops the voltage to less than 05 volts on Pin

15 to let the computer know that there is an error

bull Whenever a new print job is ready the computer drops the charge on Pin 16 to

initialize the printer

bull Pin 17 is used by the computer to remotely take the printer offline This is

accomplished by sending a charge to the printer and maintaining it as long as you

want the printer offline

bull Pins 18-25 are grounds and are used as a reference signal for the low (below 05

volts) charge

33

Power Supply

Types of Power Supply

There are many types of power supply Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other

devices A power supply can by broken down into a series of blocks each of which

performs a particular function

For example a 5V regulated supply

Each of the blocks is described in more detail below

Transformer - steps down high voltage AC mains to low voltage AC

Rectifier - converts AC to DC but the DC output is varying

Smoothing - smooths the DC from varying greatly to a small ripple

Regulator - eliminates ripple by setting DC output to a fixed voltage

Power supplies made from these blocks are described below with a circuit diagram and a

graph of their output

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Dual Supplies

34

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 22: Self Balancing Robot

There are several ways of connecting diodes to make a rectifier to convert AC to

DC The bridge rectifier is one of them and it is available in special packages containing

the four diodes required Bridge rectifiers are rated by their maximum current and

maximum reverse voltage They have four leads or terminals the two DC outputs are

labeled + and - the two AC inputs are labeled

The diagram shows the operation of a bridge rectifier as it converts AC to DC Notice

how alternate pairs of diodes conduct

Transformer

A transformer makes use of Faradays law and the ferromagnetic properties of an iron

core to efficiently raise or lower AC voltages It of course cannot increase power so that

if the voltage is raised the current is proportionally lowered and vice versa

22

Flywheel Energy Storage

Overview

A flywheel in essence is a mechanical battery - simply a mass rotating about an axis

Flywheels store energy mechanically in the form of kinetic energy They take an

electrical input to accelerate the rotor up to speed by using the built-in motor and return

the electrical energy by using this same motor as a generator Flywheels are one of the

oldest and most common mechanical devises in existence They may still prove to serve

us as an important component on tomorrows vehicles and future energy needs Flywheels

are one of the most promising technologies for replacing conventional lead acid batteries

as energy storage systems for a variety of applications including automobiles

economical rural electrification systems and stand-alone remote power units commonly

used in the telecommunications industry Recent advances in the mechanical properties of

composites has rekindled interest in using the inertia of a spinning wheel to store energy

23

In addition to energy density flywheel energy storage systems (FES) also offer several

important advantages over chemical energy storage The rate at which energy can be

exchanged into or out of the battery is limited only by the motor--generator design

Therefore it is possible to withdraw large amounts of energy in a far shorter time than

with traditional chemical batteries Indeed research into exploiting this property of FES

systems to get short intense bursts of energy is ongoing with the most notable projects

being a magnetic tank gun and a fusion ignition system Of course it is also possible to

quickly charge FES batteries making them desirable for application in electric cars where

the charge time could be dropped from a matter of hours to a matter of minutes

Advantages Flywheels store energy very efficiently (high turn-around efficiency) and

have the potential for very high specific power compared with batteries Flywheels have

very high output potential and relatively long life Flywheels are relatively unaffected by

ambient temperature extremes

Disadvantages Current flywheels have low specific energy There are safety concerns

associated with flywheels due to their high speed rotor and the possibility of it breaking

loose and releasing all of its energy in an uncontrolled manner Flywheels are a less

mature technology than chemical batteries and the current cost is too high to make them

competitive in the market

VOLTAGE REGULATOR

24

A Voltage Regulator (also called a regulator) has only three legs and appears to be a

comparatively simple device but it is actually a very complex integrated circuit A

regulator converts varying input voltage and produces a constant regulated output

voltage Voltage regulators are available in a variety of outputs typically 5 volts 9 volts

and 12 volts The last two digits in the name indicate the output voltage

Introduction

It is very easy to get stabilized voltage for ICs by using a three terminal voltage regulator

The three terminal voltage regulator outputs stabilized voltage at a lower level than the

higher input voltage A voltage regulator cannot put out higher voltage than the input

voltage They are similar in appearance to a transistor The 7800 series consists of three-

terminal positive voltage regulators

These ICs are designed as fixed voltage regulators and with adequate heat sinking can

deliver output currents in excess of 1A These ICs are used to provide +5 volts and +12

volts supply Line regulation in these ICs is change in the output voltage for a change in

the input voltage Load regulation is defined as the change in output voltage for a change

in load current If there is any high voltage than 12 volt to 7812 it will convert to 12 V by

this IC If there is any voltage less than 12 volt it allows passing it FAN is used for

cooling the ICs

There are two ICs 7805 and 7812 attached with the Intel-fan heat sink From the base of

7805 IC we get the +5Volt Supply and from the base of 7812 IC we get the 12 Volt

25

supply Two LED are also connected with the respective ICs in order to indicate there

proper working

There are some voltage regulators

LM7805 for + 5 volts

LM7809 for +9 volts

LM7812 for+12 volts

LM7905 for-5 volts

LM7909 for-9 volts

LM7912 for-12 volts

Fig LM7805 Integrated Circuit Internal Schematic

The LM78XX series of voltage regulators are designed for positive input For

applications requiring negative input the LM79XX series is used

26

Fig Symbol of voltage regulator Fig A LM 7805 regulator

Fig The circuit diagram represents a typical use of a voltage regulator

Note The LM7805 can reliably deliver 1 amp at a constant voltage

Input Voltage

As a general rule the input voltage should be limited to 2 to 3 volts above the output

voltage The LM78XX series can handle up to 30 volts input but the power difference

between the input voltagecurrent ratio and output voltagecurrent ratio appears as heat If

the input voltage is unnecessarily high the regulator will get very hot Unless sufficient

heat sinking is provided the regulator will shut down

27

Parallel Port

Essentials

A first step in exploring the parallel port is learning how to get the most from a port with

your everyday applications and peripherals Things to know include how to find

configure and install a port how and when to use the new bidirectional EPP and ECP

modes and how to handle a system with multiple parallel-port peripherals

Defining the Ports

What is the parallel port In the computer world a port is a set of signal lines that the

microprocessor or CPU uses to exchange data with other components Typical uses for

ports are communicating with printers modems keyboards and displays or just about

any component Most computer ports are digital where each signal or bit is 0 or 1 A

parallel port transfers multiple bits at once while a serial port transfers a bit at a time

(though it may transfer in both directions at once)The ports explained here is about a

specific type of parallel port the one found on just about every Pc or IBM-compatible

personal computer Along with the RS-232 serial port the parallel port is a workhorse of

PC communications On newer PCs you may find other ports such as SCSI USB and

IrDA but the parallel port remains popular because its capable flexible and every PC

has one

The term PC-compatible or PC for short refers to the IBM PC and any of the

many many personal computers derived from it From another angle a PC is any

computer that can run Microsofts MS-DOS operating system and whose expansion bus is

compatible with the ISA bus in the original IBM Pc The category includes the PC XT

AT PS2 and most computers with 80x86 Pentium and compatible CPUs It does not

include the Macintosh Amiga or IBM mainframes though these and other computer

types may have ports that are similar to the parallel port on the Pc The original PCs

parallel port had eight outputs five inputs and four bidirectional lines

These are enough for communicating with many types of peripherals On many

newer PCs the eight outputs can also serve as inputs for faster communications with

scanners drives and other devices that send data to the Pc

28

The parallel port was designed as a printer port and many of the-original names for the

ports signals (PaperEnd AutoLineFeed) reflect that use But these days you can find all

kinds of things besides printers connected to the port The term peripheral or peripheral

device is a catch-all category that includes printers scanners modems and other devices

that connect to a Pc

29

Accessing Ports

Windows DOS C JAVA and Visual Basic provide several ways to read and write to

parallel ports The most direct way is reading and writing to the port registers Most

programming languages include this ability or at least allow you to add it Visual Basic

includes other options including the Printer object the Print Form method and Open

LPT x Windows also has API calls for accessing LPT ports and 16-bit programs can use

BIOS and DOS software interrupts for LPT access This chapter introduces the parallel

ports signals and ways of accessing them in the programs you write

Parallel ports can be used to connect a host of popular computer peripherals

bull Printers

bull Scanners

bull CD burners

bull External hard drives

bull Iomega Zip removable drives

bull Network adapters

bull Tape backup drives

30

Pin Out Diagram Of Parallel Port

31

Parallel Port Basics

Parallel ports were originally developed by IBM as a way to connect a printer to our PC

When IBM was in the process of designing the PC the company wanted the computer to

work with printers offered by Centronics a top printer manufacturer at the time IBM

decided not to use the same port interface on the computer that Centronics used on the

printer

Instead IBM engineers coupled a 25-pin connector DB-25 with a 36-pin Centronics

connector to create a special cable to connect the printer to the computer Other printer

manufacturers ended up adopting the Centronics interface making this strange hybrid

cable an unlikely de facto standard

When a PC sends data to a printer or other device using a parallel port it sends 8 bits of

data (1 byte) at a time These 8 bits are transmitted parallel to each other as opposed to

the same eight bits being transmitted serially (all in a single row) through a serial port

The standard parallel port is capable of sending 50 to 100 kilobytes of data per second

Lets take a closer look at what each pin does when used with a printer

bull Pin 1 carries the strobe signal It maintains a level of between 28 and 5 volts but drops

below 05 volts whenever the computer sends a byte of data This drop in voltage tells

the printer that data is being sent

Pins 2 through 9 are used to carry data To indicate that a bit has a value of 1 a

charge of 5 volts is sent through the correct pin No charge on a pin indicates avalue of

0 This is a simple but highly effective way to transmit digital information over an

analog cable in real-time

bull Pin 10 sends the acknowledge signal from the printer to the computer Like Pin 1 it

maintains a charge and drops the voltage below 05 volts to let the computer know that

the data was received

32

bull If the printer is busy it will charge Pin 11 Then it will drop the voltage below

05 volts to let the computer know it is ready to receive more data

bull The printer lets the computer know if it is out of paper by sending a charge on Pin 12

bull As long as the computer is receiving a charge on Pin 13 it knows that the device

is online

bull The computer sends an auto feed signal to the printer through Pin 14 using a 5-

volt charge

bull If the printer has any problems it drops the voltage to less than 05 volts on Pin

15 to let the computer know that there is an error

bull Whenever a new print job is ready the computer drops the charge on Pin 16 to

initialize the printer

bull Pin 17 is used by the computer to remotely take the printer offline This is

accomplished by sending a charge to the printer and maintaining it as long as you

want the printer offline

bull Pins 18-25 are grounds and are used as a reference signal for the low (below 05

volts) charge

33

Power Supply

Types of Power Supply

There are many types of power supply Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other

devices A power supply can by broken down into a series of blocks each of which

performs a particular function

For example a 5V regulated supply

Each of the blocks is described in more detail below

Transformer - steps down high voltage AC mains to low voltage AC

Rectifier - converts AC to DC but the DC output is varying

Smoothing - smooths the DC from varying greatly to a small ripple

Regulator - eliminates ripple by setting DC output to a fixed voltage

Power supplies made from these blocks are described below with a circuit diagram and a

graph of their output

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Dual Supplies

34

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 23: Self Balancing Robot

Flywheel Energy Storage

Overview

A flywheel in essence is a mechanical battery - simply a mass rotating about an axis

Flywheels store energy mechanically in the form of kinetic energy They take an

electrical input to accelerate the rotor up to speed by using the built-in motor and return

the electrical energy by using this same motor as a generator Flywheels are one of the

oldest and most common mechanical devises in existence They may still prove to serve

us as an important component on tomorrows vehicles and future energy needs Flywheels

are one of the most promising technologies for replacing conventional lead acid batteries

as energy storage systems for a variety of applications including automobiles

economical rural electrification systems and stand-alone remote power units commonly

used in the telecommunications industry Recent advances in the mechanical properties of

composites has rekindled interest in using the inertia of a spinning wheel to store energy

23

In addition to energy density flywheel energy storage systems (FES) also offer several

important advantages over chemical energy storage The rate at which energy can be

exchanged into or out of the battery is limited only by the motor--generator design

Therefore it is possible to withdraw large amounts of energy in a far shorter time than

with traditional chemical batteries Indeed research into exploiting this property of FES

systems to get short intense bursts of energy is ongoing with the most notable projects

being a magnetic tank gun and a fusion ignition system Of course it is also possible to

quickly charge FES batteries making them desirable for application in electric cars where

the charge time could be dropped from a matter of hours to a matter of minutes

Advantages Flywheels store energy very efficiently (high turn-around efficiency) and

have the potential for very high specific power compared with batteries Flywheels have

very high output potential and relatively long life Flywheels are relatively unaffected by

ambient temperature extremes

Disadvantages Current flywheels have low specific energy There are safety concerns

associated with flywheels due to their high speed rotor and the possibility of it breaking

loose and releasing all of its energy in an uncontrolled manner Flywheels are a less

mature technology than chemical batteries and the current cost is too high to make them

competitive in the market

VOLTAGE REGULATOR

24

A Voltage Regulator (also called a regulator) has only three legs and appears to be a

comparatively simple device but it is actually a very complex integrated circuit A

regulator converts varying input voltage and produces a constant regulated output

voltage Voltage regulators are available in a variety of outputs typically 5 volts 9 volts

and 12 volts The last two digits in the name indicate the output voltage

Introduction

It is very easy to get stabilized voltage for ICs by using a three terminal voltage regulator

The three terminal voltage regulator outputs stabilized voltage at a lower level than the

higher input voltage A voltage regulator cannot put out higher voltage than the input

voltage They are similar in appearance to a transistor The 7800 series consists of three-

terminal positive voltage regulators

These ICs are designed as fixed voltage regulators and with adequate heat sinking can

deliver output currents in excess of 1A These ICs are used to provide +5 volts and +12

volts supply Line regulation in these ICs is change in the output voltage for a change in

the input voltage Load regulation is defined as the change in output voltage for a change

in load current If there is any high voltage than 12 volt to 7812 it will convert to 12 V by

this IC If there is any voltage less than 12 volt it allows passing it FAN is used for

cooling the ICs

There are two ICs 7805 and 7812 attached with the Intel-fan heat sink From the base of

7805 IC we get the +5Volt Supply and from the base of 7812 IC we get the 12 Volt

25

supply Two LED are also connected with the respective ICs in order to indicate there

proper working

There are some voltage regulators

LM7805 for + 5 volts

LM7809 for +9 volts

LM7812 for+12 volts

LM7905 for-5 volts

LM7909 for-9 volts

LM7912 for-12 volts

Fig LM7805 Integrated Circuit Internal Schematic

The LM78XX series of voltage regulators are designed for positive input For

applications requiring negative input the LM79XX series is used

26

Fig Symbol of voltage regulator Fig A LM 7805 regulator

Fig The circuit diagram represents a typical use of a voltage regulator

Note The LM7805 can reliably deliver 1 amp at a constant voltage

Input Voltage

As a general rule the input voltage should be limited to 2 to 3 volts above the output

voltage The LM78XX series can handle up to 30 volts input but the power difference

between the input voltagecurrent ratio and output voltagecurrent ratio appears as heat If

the input voltage is unnecessarily high the regulator will get very hot Unless sufficient

heat sinking is provided the regulator will shut down

27

Parallel Port

Essentials

A first step in exploring the parallel port is learning how to get the most from a port with

your everyday applications and peripherals Things to know include how to find

configure and install a port how and when to use the new bidirectional EPP and ECP

modes and how to handle a system with multiple parallel-port peripherals

Defining the Ports

What is the parallel port In the computer world a port is a set of signal lines that the

microprocessor or CPU uses to exchange data with other components Typical uses for

ports are communicating with printers modems keyboards and displays or just about

any component Most computer ports are digital where each signal or bit is 0 or 1 A

parallel port transfers multiple bits at once while a serial port transfers a bit at a time

(though it may transfer in both directions at once)The ports explained here is about a

specific type of parallel port the one found on just about every Pc or IBM-compatible

personal computer Along with the RS-232 serial port the parallel port is a workhorse of

PC communications On newer PCs you may find other ports such as SCSI USB and

IrDA but the parallel port remains popular because its capable flexible and every PC

has one

The term PC-compatible or PC for short refers to the IBM PC and any of the

many many personal computers derived from it From another angle a PC is any

computer that can run Microsofts MS-DOS operating system and whose expansion bus is

compatible with the ISA bus in the original IBM Pc The category includes the PC XT

AT PS2 and most computers with 80x86 Pentium and compatible CPUs It does not

include the Macintosh Amiga or IBM mainframes though these and other computer

types may have ports that are similar to the parallel port on the Pc The original PCs

parallel port had eight outputs five inputs and four bidirectional lines

These are enough for communicating with many types of peripherals On many

newer PCs the eight outputs can also serve as inputs for faster communications with

scanners drives and other devices that send data to the Pc

28

The parallel port was designed as a printer port and many of the-original names for the

ports signals (PaperEnd AutoLineFeed) reflect that use But these days you can find all

kinds of things besides printers connected to the port The term peripheral or peripheral

device is a catch-all category that includes printers scanners modems and other devices

that connect to a Pc

29

Accessing Ports

Windows DOS C JAVA and Visual Basic provide several ways to read and write to

parallel ports The most direct way is reading and writing to the port registers Most

programming languages include this ability or at least allow you to add it Visual Basic

includes other options including the Printer object the Print Form method and Open

LPT x Windows also has API calls for accessing LPT ports and 16-bit programs can use

BIOS and DOS software interrupts for LPT access This chapter introduces the parallel

ports signals and ways of accessing them in the programs you write

Parallel ports can be used to connect a host of popular computer peripherals

bull Printers

bull Scanners

bull CD burners

bull External hard drives

bull Iomega Zip removable drives

bull Network adapters

bull Tape backup drives

30

Pin Out Diagram Of Parallel Port

31

Parallel Port Basics

Parallel ports were originally developed by IBM as a way to connect a printer to our PC

When IBM was in the process of designing the PC the company wanted the computer to

work with printers offered by Centronics a top printer manufacturer at the time IBM

decided not to use the same port interface on the computer that Centronics used on the

printer

Instead IBM engineers coupled a 25-pin connector DB-25 with a 36-pin Centronics

connector to create a special cable to connect the printer to the computer Other printer

manufacturers ended up adopting the Centronics interface making this strange hybrid

cable an unlikely de facto standard

When a PC sends data to a printer or other device using a parallel port it sends 8 bits of

data (1 byte) at a time These 8 bits are transmitted parallel to each other as opposed to

the same eight bits being transmitted serially (all in a single row) through a serial port

The standard parallel port is capable of sending 50 to 100 kilobytes of data per second

Lets take a closer look at what each pin does when used with a printer

bull Pin 1 carries the strobe signal It maintains a level of between 28 and 5 volts but drops

below 05 volts whenever the computer sends a byte of data This drop in voltage tells

the printer that data is being sent

Pins 2 through 9 are used to carry data To indicate that a bit has a value of 1 a

charge of 5 volts is sent through the correct pin No charge on a pin indicates avalue of

0 This is a simple but highly effective way to transmit digital information over an

analog cable in real-time

bull Pin 10 sends the acknowledge signal from the printer to the computer Like Pin 1 it

maintains a charge and drops the voltage below 05 volts to let the computer know that

the data was received

32

bull If the printer is busy it will charge Pin 11 Then it will drop the voltage below

05 volts to let the computer know it is ready to receive more data

bull The printer lets the computer know if it is out of paper by sending a charge on Pin 12

bull As long as the computer is receiving a charge on Pin 13 it knows that the device

is online

bull The computer sends an auto feed signal to the printer through Pin 14 using a 5-

volt charge

bull If the printer has any problems it drops the voltage to less than 05 volts on Pin

15 to let the computer know that there is an error

bull Whenever a new print job is ready the computer drops the charge on Pin 16 to

initialize the printer

bull Pin 17 is used by the computer to remotely take the printer offline This is

accomplished by sending a charge to the printer and maintaining it as long as you

want the printer offline

bull Pins 18-25 are grounds and are used as a reference signal for the low (below 05

volts) charge

33

Power Supply

Types of Power Supply

There are many types of power supply Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other

devices A power supply can by broken down into a series of blocks each of which

performs a particular function

For example a 5V regulated supply

Each of the blocks is described in more detail below

Transformer - steps down high voltage AC mains to low voltage AC

Rectifier - converts AC to DC but the DC output is varying

Smoothing - smooths the DC from varying greatly to a small ripple

Regulator - eliminates ripple by setting DC output to a fixed voltage

Power supplies made from these blocks are described below with a circuit diagram and a

graph of their output

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Dual Supplies

34

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 24: Self Balancing Robot

In addition to energy density flywheel energy storage systems (FES) also offer several

important advantages over chemical energy storage The rate at which energy can be

exchanged into or out of the battery is limited only by the motor--generator design

Therefore it is possible to withdraw large amounts of energy in a far shorter time than

with traditional chemical batteries Indeed research into exploiting this property of FES

systems to get short intense bursts of energy is ongoing with the most notable projects

being a magnetic tank gun and a fusion ignition system Of course it is also possible to

quickly charge FES batteries making them desirable for application in electric cars where

the charge time could be dropped from a matter of hours to a matter of minutes

Advantages Flywheels store energy very efficiently (high turn-around efficiency) and

have the potential for very high specific power compared with batteries Flywheels have

very high output potential and relatively long life Flywheels are relatively unaffected by

ambient temperature extremes

Disadvantages Current flywheels have low specific energy There are safety concerns

associated with flywheels due to their high speed rotor and the possibility of it breaking

loose and releasing all of its energy in an uncontrolled manner Flywheels are a less

mature technology than chemical batteries and the current cost is too high to make them

competitive in the market

VOLTAGE REGULATOR

24

A Voltage Regulator (also called a regulator) has only three legs and appears to be a

comparatively simple device but it is actually a very complex integrated circuit A

regulator converts varying input voltage and produces a constant regulated output

voltage Voltage regulators are available in a variety of outputs typically 5 volts 9 volts

and 12 volts The last two digits in the name indicate the output voltage

Introduction

It is very easy to get stabilized voltage for ICs by using a three terminal voltage regulator

The three terminal voltage regulator outputs stabilized voltage at a lower level than the

higher input voltage A voltage regulator cannot put out higher voltage than the input

voltage They are similar in appearance to a transistor The 7800 series consists of three-

terminal positive voltage regulators

These ICs are designed as fixed voltage regulators and with adequate heat sinking can

deliver output currents in excess of 1A These ICs are used to provide +5 volts and +12

volts supply Line regulation in these ICs is change in the output voltage for a change in

the input voltage Load regulation is defined as the change in output voltage for a change

in load current If there is any high voltage than 12 volt to 7812 it will convert to 12 V by

this IC If there is any voltage less than 12 volt it allows passing it FAN is used for

cooling the ICs

There are two ICs 7805 and 7812 attached with the Intel-fan heat sink From the base of

7805 IC we get the +5Volt Supply and from the base of 7812 IC we get the 12 Volt

25

supply Two LED are also connected with the respective ICs in order to indicate there

proper working

There are some voltage regulators

LM7805 for + 5 volts

LM7809 for +9 volts

LM7812 for+12 volts

LM7905 for-5 volts

LM7909 for-9 volts

LM7912 for-12 volts

Fig LM7805 Integrated Circuit Internal Schematic

The LM78XX series of voltage regulators are designed for positive input For

applications requiring negative input the LM79XX series is used

26

Fig Symbol of voltage regulator Fig A LM 7805 regulator

Fig The circuit diagram represents a typical use of a voltage regulator

Note The LM7805 can reliably deliver 1 amp at a constant voltage

Input Voltage

As a general rule the input voltage should be limited to 2 to 3 volts above the output

voltage The LM78XX series can handle up to 30 volts input but the power difference

between the input voltagecurrent ratio and output voltagecurrent ratio appears as heat If

the input voltage is unnecessarily high the regulator will get very hot Unless sufficient

heat sinking is provided the regulator will shut down

27

Parallel Port

Essentials

A first step in exploring the parallel port is learning how to get the most from a port with

your everyday applications and peripherals Things to know include how to find

configure and install a port how and when to use the new bidirectional EPP and ECP

modes and how to handle a system with multiple parallel-port peripherals

Defining the Ports

What is the parallel port In the computer world a port is a set of signal lines that the

microprocessor or CPU uses to exchange data with other components Typical uses for

ports are communicating with printers modems keyboards and displays or just about

any component Most computer ports are digital where each signal or bit is 0 or 1 A

parallel port transfers multiple bits at once while a serial port transfers a bit at a time

(though it may transfer in both directions at once)The ports explained here is about a

specific type of parallel port the one found on just about every Pc or IBM-compatible

personal computer Along with the RS-232 serial port the parallel port is a workhorse of

PC communications On newer PCs you may find other ports such as SCSI USB and

IrDA but the parallel port remains popular because its capable flexible and every PC

has one

The term PC-compatible or PC for short refers to the IBM PC and any of the

many many personal computers derived from it From another angle a PC is any

computer that can run Microsofts MS-DOS operating system and whose expansion bus is

compatible with the ISA bus in the original IBM Pc The category includes the PC XT

AT PS2 and most computers with 80x86 Pentium and compatible CPUs It does not

include the Macintosh Amiga or IBM mainframes though these and other computer

types may have ports that are similar to the parallel port on the Pc The original PCs

parallel port had eight outputs five inputs and four bidirectional lines

These are enough for communicating with many types of peripherals On many

newer PCs the eight outputs can also serve as inputs for faster communications with

scanners drives and other devices that send data to the Pc

28

The parallel port was designed as a printer port and many of the-original names for the

ports signals (PaperEnd AutoLineFeed) reflect that use But these days you can find all

kinds of things besides printers connected to the port The term peripheral or peripheral

device is a catch-all category that includes printers scanners modems and other devices

that connect to a Pc

29

Accessing Ports

Windows DOS C JAVA and Visual Basic provide several ways to read and write to

parallel ports The most direct way is reading and writing to the port registers Most

programming languages include this ability or at least allow you to add it Visual Basic

includes other options including the Printer object the Print Form method and Open

LPT x Windows also has API calls for accessing LPT ports and 16-bit programs can use

BIOS and DOS software interrupts for LPT access This chapter introduces the parallel

ports signals and ways of accessing them in the programs you write

Parallel ports can be used to connect a host of popular computer peripherals

bull Printers

bull Scanners

bull CD burners

bull External hard drives

bull Iomega Zip removable drives

bull Network adapters

bull Tape backup drives

30

Pin Out Diagram Of Parallel Port

31

Parallel Port Basics

Parallel ports were originally developed by IBM as a way to connect a printer to our PC

When IBM was in the process of designing the PC the company wanted the computer to

work with printers offered by Centronics a top printer manufacturer at the time IBM

decided not to use the same port interface on the computer that Centronics used on the

printer

Instead IBM engineers coupled a 25-pin connector DB-25 with a 36-pin Centronics

connector to create a special cable to connect the printer to the computer Other printer

manufacturers ended up adopting the Centronics interface making this strange hybrid

cable an unlikely de facto standard

When a PC sends data to a printer or other device using a parallel port it sends 8 bits of

data (1 byte) at a time These 8 bits are transmitted parallel to each other as opposed to

the same eight bits being transmitted serially (all in a single row) through a serial port

The standard parallel port is capable of sending 50 to 100 kilobytes of data per second

Lets take a closer look at what each pin does when used with a printer

bull Pin 1 carries the strobe signal It maintains a level of between 28 and 5 volts but drops

below 05 volts whenever the computer sends a byte of data This drop in voltage tells

the printer that data is being sent

Pins 2 through 9 are used to carry data To indicate that a bit has a value of 1 a

charge of 5 volts is sent through the correct pin No charge on a pin indicates avalue of

0 This is a simple but highly effective way to transmit digital information over an

analog cable in real-time

bull Pin 10 sends the acknowledge signal from the printer to the computer Like Pin 1 it

maintains a charge and drops the voltage below 05 volts to let the computer know that

the data was received

32

bull If the printer is busy it will charge Pin 11 Then it will drop the voltage below

05 volts to let the computer know it is ready to receive more data

bull The printer lets the computer know if it is out of paper by sending a charge on Pin 12

bull As long as the computer is receiving a charge on Pin 13 it knows that the device

is online

bull The computer sends an auto feed signal to the printer through Pin 14 using a 5-

volt charge

bull If the printer has any problems it drops the voltage to less than 05 volts on Pin

15 to let the computer know that there is an error

bull Whenever a new print job is ready the computer drops the charge on Pin 16 to

initialize the printer

bull Pin 17 is used by the computer to remotely take the printer offline This is

accomplished by sending a charge to the printer and maintaining it as long as you

want the printer offline

bull Pins 18-25 are grounds and are used as a reference signal for the low (below 05

volts) charge

33

Power Supply

Types of Power Supply

There are many types of power supply Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other

devices A power supply can by broken down into a series of blocks each of which

performs a particular function

For example a 5V regulated supply

Each of the blocks is described in more detail below

Transformer - steps down high voltage AC mains to low voltage AC

Rectifier - converts AC to DC but the DC output is varying

Smoothing - smooths the DC from varying greatly to a small ripple

Regulator - eliminates ripple by setting DC output to a fixed voltage

Power supplies made from these blocks are described below with a circuit diagram and a

graph of their output

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Dual Supplies

34

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 25: Self Balancing Robot

A Voltage Regulator (also called a regulator) has only three legs and appears to be a

comparatively simple device but it is actually a very complex integrated circuit A

regulator converts varying input voltage and produces a constant regulated output

voltage Voltage regulators are available in a variety of outputs typically 5 volts 9 volts

and 12 volts The last two digits in the name indicate the output voltage

Introduction

It is very easy to get stabilized voltage for ICs by using a three terminal voltage regulator

The three terminal voltage regulator outputs stabilized voltage at a lower level than the

higher input voltage A voltage regulator cannot put out higher voltage than the input

voltage They are similar in appearance to a transistor The 7800 series consists of three-

terminal positive voltage regulators

These ICs are designed as fixed voltage regulators and with adequate heat sinking can

deliver output currents in excess of 1A These ICs are used to provide +5 volts and +12

volts supply Line regulation in these ICs is change in the output voltage for a change in

the input voltage Load regulation is defined as the change in output voltage for a change

in load current If there is any high voltage than 12 volt to 7812 it will convert to 12 V by

this IC If there is any voltage less than 12 volt it allows passing it FAN is used for

cooling the ICs

There are two ICs 7805 and 7812 attached with the Intel-fan heat sink From the base of

7805 IC we get the +5Volt Supply and from the base of 7812 IC we get the 12 Volt

25

supply Two LED are also connected with the respective ICs in order to indicate there

proper working

There are some voltage regulators

LM7805 for + 5 volts

LM7809 for +9 volts

LM7812 for+12 volts

LM7905 for-5 volts

LM7909 for-9 volts

LM7912 for-12 volts

Fig LM7805 Integrated Circuit Internal Schematic

The LM78XX series of voltage regulators are designed for positive input For

applications requiring negative input the LM79XX series is used

26

Fig Symbol of voltage regulator Fig A LM 7805 regulator

Fig The circuit diagram represents a typical use of a voltage regulator

Note The LM7805 can reliably deliver 1 amp at a constant voltage

Input Voltage

As a general rule the input voltage should be limited to 2 to 3 volts above the output

voltage The LM78XX series can handle up to 30 volts input but the power difference

between the input voltagecurrent ratio and output voltagecurrent ratio appears as heat If

the input voltage is unnecessarily high the regulator will get very hot Unless sufficient

heat sinking is provided the regulator will shut down

27

Parallel Port

Essentials

A first step in exploring the parallel port is learning how to get the most from a port with

your everyday applications and peripherals Things to know include how to find

configure and install a port how and when to use the new bidirectional EPP and ECP

modes and how to handle a system with multiple parallel-port peripherals

Defining the Ports

What is the parallel port In the computer world a port is a set of signal lines that the

microprocessor or CPU uses to exchange data with other components Typical uses for

ports are communicating with printers modems keyboards and displays or just about

any component Most computer ports are digital where each signal or bit is 0 or 1 A

parallel port transfers multiple bits at once while a serial port transfers a bit at a time

(though it may transfer in both directions at once)The ports explained here is about a

specific type of parallel port the one found on just about every Pc or IBM-compatible

personal computer Along with the RS-232 serial port the parallel port is a workhorse of

PC communications On newer PCs you may find other ports such as SCSI USB and

IrDA but the parallel port remains popular because its capable flexible and every PC

has one

The term PC-compatible or PC for short refers to the IBM PC and any of the

many many personal computers derived from it From another angle a PC is any

computer that can run Microsofts MS-DOS operating system and whose expansion bus is

compatible with the ISA bus in the original IBM Pc The category includes the PC XT

AT PS2 and most computers with 80x86 Pentium and compatible CPUs It does not

include the Macintosh Amiga or IBM mainframes though these and other computer

types may have ports that are similar to the parallel port on the Pc The original PCs

parallel port had eight outputs five inputs and four bidirectional lines

These are enough for communicating with many types of peripherals On many

newer PCs the eight outputs can also serve as inputs for faster communications with

scanners drives and other devices that send data to the Pc

28

The parallel port was designed as a printer port and many of the-original names for the

ports signals (PaperEnd AutoLineFeed) reflect that use But these days you can find all

kinds of things besides printers connected to the port The term peripheral or peripheral

device is a catch-all category that includes printers scanners modems and other devices

that connect to a Pc

29

Accessing Ports

Windows DOS C JAVA and Visual Basic provide several ways to read and write to

parallel ports The most direct way is reading and writing to the port registers Most

programming languages include this ability or at least allow you to add it Visual Basic

includes other options including the Printer object the Print Form method and Open

LPT x Windows also has API calls for accessing LPT ports and 16-bit programs can use

BIOS and DOS software interrupts for LPT access This chapter introduces the parallel

ports signals and ways of accessing them in the programs you write

Parallel ports can be used to connect a host of popular computer peripherals

bull Printers

bull Scanners

bull CD burners

bull External hard drives

bull Iomega Zip removable drives

bull Network adapters

bull Tape backup drives

30

Pin Out Diagram Of Parallel Port

31

Parallel Port Basics

Parallel ports were originally developed by IBM as a way to connect a printer to our PC

When IBM was in the process of designing the PC the company wanted the computer to

work with printers offered by Centronics a top printer manufacturer at the time IBM

decided not to use the same port interface on the computer that Centronics used on the

printer

Instead IBM engineers coupled a 25-pin connector DB-25 with a 36-pin Centronics

connector to create a special cable to connect the printer to the computer Other printer

manufacturers ended up adopting the Centronics interface making this strange hybrid

cable an unlikely de facto standard

When a PC sends data to a printer or other device using a parallel port it sends 8 bits of

data (1 byte) at a time These 8 bits are transmitted parallel to each other as opposed to

the same eight bits being transmitted serially (all in a single row) through a serial port

The standard parallel port is capable of sending 50 to 100 kilobytes of data per second

Lets take a closer look at what each pin does when used with a printer

bull Pin 1 carries the strobe signal It maintains a level of between 28 and 5 volts but drops

below 05 volts whenever the computer sends a byte of data This drop in voltage tells

the printer that data is being sent

Pins 2 through 9 are used to carry data To indicate that a bit has a value of 1 a

charge of 5 volts is sent through the correct pin No charge on a pin indicates avalue of

0 This is a simple but highly effective way to transmit digital information over an

analog cable in real-time

bull Pin 10 sends the acknowledge signal from the printer to the computer Like Pin 1 it

maintains a charge and drops the voltage below 05 volts to let the computer know that

the data was received

32

bull If the printer is busy it will charge Pin 11 Then it will drop the voltage below

05 volts to let the computer know it is ready to receive more data

bull The printer lets the computer know if it is out of paper by sending a charge on Pin 12

bull As long as the computer is receiving a charge on Pin 13 it knows that the device

is online

bull The computer sends an auto feed signal to the printer through Pin 14 using a 5-

volt charge

bull If the printer has any problems it drops the voltage to less than 05 volts on Pin

15 to let the computer know that there is an error

bull Whenever a new print job is ready the computer drops the charge on Pin 16 to

initialize the printer

bull Pin 17 is used by the computer to remotely take the printer offline This is

accomplished by sending a charge to the printer and maintaining it as long as you

want the printer offline

bull Pins 18-25 are grounds and are used as a reference signal for the low (below 05

volts) charge

33

Power Supply

Types of Power Supply

There are many types of power supply Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other

devices A power supply can by broken down into a series of blocks each of which

performs a particular function

For example a 5V regulated supply

Each of the blocks is described in more detail below

Transformer - steps down high voltage AC mains to low voltage AC

Rectifier - converts AC to DC but the DC output is varying

Smoothing - smooths the DC from varying greatly to a small ripple

Regulator - eliminates ripple by setting DC output to a fixed voltage

Power supplies made from these blocks are described below with a circuit diagram and a

graph of their output

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Dual Supplies

34

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 26: Self Balancing Robot

supply Two LED are also connected with the respective ICs in order to indicate there

proper working

There are some voltage regulators

LM7805 for + 5 volts

LM7809 for +9 volts

LM7812 for+12 volts

LM7905 for-5 volts

LM7909 for-9 volts

LM7912 for-12 volts

Fig LM7805 Integrated Circuit Internal Schematic

The LM78XX series of voltage regulators are designed for positive input For

applications requiring negative input the LM79XX series is used

26

Fig Symbol of voltage regulator Fig A LM 7805 regulator

Fig The circuit diagram represents a typical use of a voltage regulator

Note The LM7805 can reliably deliver 1 amp at a constant voltage

Input Voltage

As a general rule the input voltage should be limited to 2 to 3 volts above the output

voltage The LM78XX series can handle up to 30 volts input but the power difference

between the input voltagecurrent ratio and output voltagecurrent ratio appears as heat If

the input voltage is unnecessarily high the regulator will get very hot Unless sufficient

heat sinking is provided the regulator will shut down

27

Parallel Port

Essentials

A first step in exploring the parallel port is learning how to get the most from a port with

your everyday applications and peripherals Things to know include how to find

configure and install a port how and when to use the new bidirectional EPP and ECP

modes and how to handle a system with multiple parallel-port peripherals

Defining the Ports

What is the parallel port In the computer world a port is a set of signal lines that the

microprocessor or CPU uses to exchange data with other components Typical uses for

ports are communicating with printers modems keyboards and displays or just about

any component Most computer ports are digital where each signal or bit is 0 or 1 A

parallel port transfers multiple bits at once while a serial port transfers a bit at a time

(though it may transfer in both directions at once)The ports explained here is about a

specific type of parallel port the one found on just about every Pc or IBM-compatible

personal computer Along with the RS-232 serial port the parallel port is a workhorse of

PC communications On newer PCs you may find other ports such as SCSI USB and

IrDA but the parallel port remains popular because its capable flexible and every PC

has one

The term PC-compatible or PC for short refers to the IBM PC and any of the

many many personal computers derived from it From another angle a PC is any

computer that can run Microsofts MS-DOS operating system and whose expansion bus is

compatible with the ISA bus in the original IBM Pc The category includes the PC XT

AT PS2 and most computers with 80x86 Pentium and compatible CPUs It does not

include the Macintosh Amiga or IBM mainframes though these and other computer

types may have ports that are similar to the parallel port on the Pc The original PCs

parallel port had eight outputs five inputs and four bidirectional lines

These are enough for communicating with many types of peripherals On many

newer PCs the eight outputs can also serve as inputs for faster communications with

scanners drives and other devices that send data to the Pc

28

The parallel port was designed as a printer port and many of the-original names for the

ports signals (PaperEnd AutoLineFeed) reflect that use But these days you can find all

kinds of things besides printers connected to the port The term peripheral or peripheral

device is a catch-all category that includes printers scanners modems and other devices

that connect to a Pc

29

Accessing Ports

Windows DOS C JAVA and Visual Basic provide several ways to read and write to

parallel ports The most direct way is reading and writing to the port registers Most

programming languages include this ability or at least allow you to add it Visual Basic

includes other options including the Printer object the Print Form method and Open

LPT x Windows also has API calls for accessing LPT ports and 16-bit programs can use

BIOS and DOS software interrupts for LPT access This chapter introduces the parallel

ports signals and ways of accessing them in the programs you write

Parallel ports can be used to connect a host of popular computer peripherals

bull Printers

bull Scanners

bull CD burners

bull External hard drives

bull Iomega Zip removable drives

bull Network adapters

bull Tape backup drives

30

Pin Out Diagram Of Parallel Port

31

Parallel Port Basics

Parallel ports were originally developed by IBM as a way to connect a printer to our PC

When IBM was in the process of designing the PC the company wanted the computer to

work with printers offered by Centronics a top printer manufacturer at the time IBM

decided not to use the same port interface on the computer that Centronics used on the

printer

Instead IBM engineers coupled a 25-pin connector DB-25 with a 36-pin Centronics

connector to create a special cable to connect the printer to the computer Other printer

manufacturers ended up adopting the Centronics interface making this strange hybrid

cable an unlikely de facto standard

When a PC sends data to a printer or other device using a parallel port it sends 8 bits of

data (1 byte) at a time These 8 bits are transmitted parallel to each other as opposed to

the same eight bits being transmitted serially (all in a single row) through a serial port

The standard parallel port is capable of sending 50 to 100 kilobytes of data per second

Lets take a closer look at what each pin does when used with a printer

bull Pin 1 carries the strobe signal It maintains a level of between 28 and 5 volts but drops

below 05 volts whenever the computer sends a byte of data This drop in voltage tells

the printer that data is being sent

Pins 2 through 9 are used to carry data To indicate that a bit has a value of 1 a

charge of 5 volts is sent through the correct pin No charge on a pin indicates avalue of

0 This is a simple but highly effective way to transmit digital information over an

analog cable in real-time

bull Pin 10 sends the acknowledge signal from the printer to the computer Like Pin 1 it

maintains a charge and drops the voltage below 05 volts to let the computer know that

the data was received

32

bull If the printer is busy it will charge Pin 11 Then it will drop the voltage below

05 volts to let the computer know it is ready to receive more data

bull The printer lets the computer know if it is out of paper by sending a charge on Pin 12

bull As long as the computer is receiving a charge on Pin 13 it knows that the device

is online

bull The computer sends an auto feed signal to the printer through Pin 14 using a 5-

volt charge

bull If the printer has any problems it drops the voltage to less than 05 volts on Pin

15 to let the computer know that there is an error

bull Whenever a new print job is ready the computer drops the charge on Pin 16 to

initialize the printer

bull Pin 17 is used by the computer to remotely take the printer offline This is

accomplished by sending a charge to the printer and maintaining it as long as you

want the printer offline

bull Pins 18-25 are grounds and are used as a reference signal for the low (below 05

volts) charge

33

Power Supply

Types of Power Supply

There are many types of power supply Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other

devices A power supply can by broken down into a series of blocks each of which

performs a particular function

For example a 5V regulated supply

Each of the blocks is described in more detail below

Transformer - steps down high voltage AC mains to low voltage AC

Rectifier - converts AC to DC but the DC output is varying

Smoothing - smooths the DC from varying greatly to a small ripple

Regulator - eliminates ripple by setting DC output to a fixed voltage

Power supplies made from these blocks are described below with a circuit diagram and a

graph of their output

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Dual Supplies

34

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 27: Self Balancing Robot

Fig Symbol of voltage regulator Fig A LM 7805 regulator

Fig The circuit diagram represents a typical use of a voltage regulator

Note The LM7805 can reliably deliver 1 amp at a constant voltage

Input Voltage

As a general rule the input voltage should be limited to 2 to 3 volts above the output

voltage The LM78XX series can handle up to 30 volts input but the power difference

between the input voltagecurrent ratio and output voltagecurrent ratio appears as heat If

the input voltage is unnecessarily high the regulator will get very hot Unless sufficient

heat sinking is provided the regulator will shut down

27

Parallel Port

Essentials

A first step in exploring the parallel port is learning how to get the most from a port with

your everyday applications and peripherals Things to know include how to find

configure and install a port how and when to use the new bidirectional EPP and ECP

modes and how to handle a system with multiple parallel-port peripherals

Defining the Ports

What is the parallel port In the computer world a port is a set of signal lines that the

microprocessor or CPU uses to exchange data with other components Typical uses for

ports are communicating with printers modems keyboards and displays or just about

any component Most computer ports are digital where each signal or bit is 0 or 1 A

parallel port transfers multiple bits at once while a serial port transfers a bit at a time

(though it may transfer in both directions at once)The ports explained here is about a

specific type of parallel port the one found on just about every Pc or IBM-compatible

personal computer Along with the RS-232 serial port the parallel port is a workhorse of

PC communications On newer PCs you may find other ports such as SCSI USB and

IrDA but the parallel port remains popular because its capable flexible and every PC

has one

The term PC-compatible or PC for short refers to the IBM PC and any of the

many many personal computers derived from it From another angle a PC is any

computer that can run Microsofts MS-DOS operating system and whose expansion bus is

compatible with the ISA bus in the original IBM Pc The category includes the PC XT

AT PS2 and most computers with 80x86 Pentium and compatible CPUs It does not

include the Macintosh Amiga or IBM mainframes though these and other computer

types may have ports that are similar to the parallel port on the Pc The original PCs

parallel port had eight outputs five inputs and four bidirectional lines

These are enough for communicating with many types of peripherals On many

newer PCs the eight outputs can also serve as inputs for faster communications with

scanners drives and other devices that send data to the Pc

28

The parallel port was designed as a printer port and many of the-original names for the

ports signals (PaperEnd AutoLineFeed) reflect that use But these days you can find all

kinds of things besides printers connected to the port The term peripheral or peripheral

device is a catch-all category that includes printers scanners modems and other devices

that connect to a Pc

29

Accessing Ports

Windows DOS C JAVA and Visual Basic provide several ways to read and write to

parallel ports The most direct way is reading and writing to the port registers Most

programming languages include this ability or at least allow you to add it Visual Basic

includes other options including the Printer object the Print Form method and Open

LPT x Windows also has API calls for accessing LPT ports and 16-bit programs can use

BIOS and DOS software interrupts for LPT access This chapter introduces the parallel

ports signals and ways of accessing them in the programs you write

Parallel ports can be used to connect a host of popular computer peripherals

bull Printers

bull Scanners

bull CD burners

bull External hard drives

bull Iomega Zip removable drives

bull Network adapters

bull Tape backup drives

30

Pin Out Diagram Of Parallel Port

31

Parallel Port Basics

Parallel ports were originally developed by IBM as a way to connect a printer to our PC

When IBM was in the process of designing the PC the company wanted the computer to

work with printers offered by Centronics a top printer manufacturer at the time IBM

decided not to use the same port interface on the computer that Centronics used on the

printer

Instead IBM engineers coupled a 25-pin connector DB-25 with a 36-pin Centronics

connector to create a special cable to connect the printer to the computer Other printer

manufacturers ended up adopting the Centronics interface making this strange hybrid

cable an unlikely de facto standard

When a PC sends data to a printer or other device using a parallel port it sends 8 bits of

data (1 byte) at a time These 8 bits are transmitted parallel to each other as opposed to

the same eight bits being transmitted serially (all in a single row) through a serial port

The standard parallel port is capable of sending 50 to 100 kilobytes of data per second

Lets take a closer look at what each pin does when used with a printer

bull Pin 1 carries the strobe signal It maintains a level of between 28 and 5 volts but drops

below 05 volts whenever the computer sends a byte of data This drop in voltage tells

the printer that data is being sent

Pins 2 through 9 are used to carry data To indicate that a bit has a value of 1 a

charge of 5 volts is sent through the correct pin No charge on a pin indicates avalue of

0 This is a simple but highly effective way to transmit digital information over an

analog cable in real-time

bull Pin 10 sends the acknowledge signal from the printer to the computer Like Pin 1 it

maintains a charge and drops the voltage below 05 volts to let the computer know that

the data was received

32

bull If the printer is busy it will charge Pin 11 Then it will drop the voltage below

05 volts to let the computer know it is ready to receive more data

bull The printer lets the computer know if it is out of paper by sending a charge on Pin 12

bull As long as the computer is receiving a charge on Pin 13 it knows that the device

is online

bull The computer sends an auto feed signal to the printer through Pin 14 using a 5-

volt charge

bull If the printer has any problems it drops the voltage to less than 05 volts on Pin

15 to let the computer know that there is an error

bull Whenever a new print job is ready the computer drops the charge on Pin 16 to

initialize the printer

bull Pin 17 is used by the computer to remotely take the printer offline This is

accomplished by sending a charge to the printer and maintaining it as long as you

want the printer offline

bull Pins 18-25 are grounds and are used as a reference signal for the low (below 05

volts) charge

33

Power Supply

Types of Power Supply

There are many types of power supply Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other

devices A power supply can by broken down into a series of blocks each of which

performs a particular function

For example a 5V regulated supply

Each of the blocks is described in more detail below

Transformer - steps down high voltage AC mains to low voltage AC

Rectifier - converts AC to DC but the DC output is varying

Smoothing - smooths the DC from varying greatly to a small ripple

Regulator - eliminates ripple by setting DC output to a fixed voltage

Power supplies made from these blocks are described below with a circuit diagram and a

graph of their output

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Dual Supplies

34

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 28: Self Balancing Robot

Parallel Port

Essentials

A first step in exploring the parallel port is learning how to get the most from a port with

your everyday applications and peripherals Things to know include how to find

configure and install a port how and when to use the new bidirectional EPP and ECP

modes and how to handle a system with multiple parallel-port peripherals

Defining the Ports

What is the parallel port In the computer world a port is a set of signal lines that the

microprocessor or CPU uses to exchange data with other components Typical uses for

ports are communicating with printers modems keyboards and displays or just about

any component Most computer ports are digital where each signal or bit is 0 or 1 A

parallel port transfers multiple bits at once while a serial port transfers a bit at a time

(though it may transfer in both directions at once)The ports explained here is about a

specific type of parallel port the one found on just about every Pc or IBM-compatible

personal computer Along with the RS-232 serial port the parallel port is a workhorse of

PC communications On newer PCs you may find other ports such as SCSI USB and

IrDA but the parallel port remains popular because its capable flexible and every PC

has one

The term PC-compatible or PC for short refers to the IBM PC and any of the

many many personal computers derived from it From another angle a PC is any

computer that can run Microsofts MS-DOS operating system and whose expansion bus is

compatible with the ISA bus in the original IBM Pc The category includes the PC XT

AT PS2 and most computers with 80x86 Pentium and compatible CPUs It does not

include the Macintosh Amiga or IBM mainframes though these and other computer

types may have ports that are similar to the parallel port on the Pc The original PCs

parallel port had eight outputs five inputs and four bidirectional lines

These are enough for communicating with many types of peripherals On many

newer PCs the eight outputs can also serve as inputs for faster communications with

scanners drives and other devices that send data to the Pc

28

The parallel port was designed as a printer port and many of the-original names for the

ports signals (PaperEnd AutoLineFeed) reflect that use But these days you can find all

kinds of things besides printers connected to the port The term peripheral or peripheral

device is a catch-all category that includes printers scanners modems and other devices

that connect to a Pc

29

Accessing Ports

Windows DOS C JAVA and Visual Basic provide several ways to read and write to

parallel ports The most direct way is reading and writing to the port registers Most

programming languages include this ability or at least allow you to add it Visual Basic

includes other options including the Printer object the Print Form method and Open

LPT x Windows also has API calls for accessing LPT ports and 16-bit programs can use

BIOS and DOS software interrupts for LPT access This chapter introduces the parallel

ports signals and ways of accessing them in the programs you write

Parallel ports can be used to connect a host of popular computer peripherals

bull Printers

bull Scanners

bull CD burners

bull External hard drives

bull Iomega Zip removable drives

bull Network adapters

bull Tape backup drives

30

Pin Out Diagram Of Parallel Port

31

Parallel Port Basics

Parallel ports were originally developed by IBM as a way to connect a printer to our PC

When IBM was in the process of designing the PC the company wanted the computer to

work with printers offered by Centronics a top printer manufacturer at the time IBM

decided not to use the same port interface on the computer that Centronics used on the

printer

Instead IBM engineers coupled a 25-pin connector DB-25 with a 36-pin Centronics

connector to create a special cable to connect the printer to the computer Other printer

manufacturers ended up adopting the Centronics interface making this strange hybrid

cable an unlikely de facto standard

When a PC sends data to a printer or other device using a parallel port it sends 8 bits of

data (1 byte) at a time These 8 bits are transmitted parallel to each other as opposed to

the same eight bits being transmitted serially (all in a single row) through a serial port

The standard parallel port is capable of sending 50 to 100 kilobytes of data per second

Lets take a closer look at what each pin does when used with a printer

bull Pin 1 carries the strobe signal It maintains a level of between 28 and 5 volts but drops

below 05 volts whenever the computer sends a byte of data This drop in voltage tells

the printer that data is being sent

Pins 2 through 9 are used to carry data To indicate that a bit has a value of 1 a

charge of 5 volts is sent through the correct pin No charge on a pin indicates avalue of

0 This is a simple but highly effective way to transmit digital information over an

analog cable in real-time

bull Pin 10 sends the acknowledge signal from the printer to the computer Like Pin 1 it

maintains a charge and drops the voltage below 05 volts to let the computer know that

the data was received

32

bull If the printer is busy it will charge Pin 11 Then it will drop the voltage below

05 volts to let the computer know it is ready to receive more data

bull The printer lets the computer know if it is out of paper by sending a charge on Pin 12

bull As long as the computer is receiving a charge on Pin 13 it knows that the device

is online

bull The computer sends an auto feed signal to the printer through Pin 14 using a 5-

volt charge

bull If the printer has any problems it drops the voltage to less than 05 volts on Pin

15 to let the computer know that there is an error

bull Whenever a new print job is ready the computer drops the charge on Pin 16 to

initialize the printer

bull Pin 17 is used by the computer to remotely take the printer offline This is

accomplished by sending a charge to the printer and maintaining it as long as you

want the printer offline

bull Pins 18-25 are grounds and are used as a reference signal for the low (below 05

volts) charge

33

Power Supply

Types of Power Supply

There are many types of power supply Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other

devices A power supply can by broken down into a series of blocks each of which

performs a particular function

For example a 5V regulated supply

Each of the blocks is described in more detail below

Transformer - steps down high voltage AC mains to low voltage AC

Rectifier - converts AC to DC but the DC output is varying

Smoothing - smooths the DC from varying greatly to a small ripple

Regulator - eliminates ripple by setting DC output to a fixed voltage

Power supplies made from these blocks are described below with a circuit diagram and a

graph of their output

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Dual Supplies

34

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 29: Self Balancing Robot

The parallel port was designed as a printer port and many of the-original names for the

ports signals (PaperEnd AutoLineFeed) reflect that use But these days you can find all

kinds of things besides printers connected to the port The term peripheral or peripheral

device is a catch-all category that includes printers scanners modems and other devices

that connect to a Pc

29

Accessing Ports

Windows DOS C JAVA and Visual Basic provide several ways to read and write to

parallel ports The most direct way is reading and writing to the port registers Most

programming languages include this ability or at least allow you to add it Visual Basic

includes other options including the Printer object the Print Form method and Open

LPT x Windows also has API calls for accessing LPT ports and 16-bit programs can use

BIOS and DOS software interrupts for LPT access This chapter introduces the parallel

ports signals and ways of accessing them in the programs you write

Parallel ports can be used to connect a host of popular computer peripherals

bull Printers

bull Scanners

bull CD burners

bull External hard drives

bull Iomega Zip removable drives

bull Network adapters

bull Tape backup drives

30

Pin Out Diagram Of Parallel Port

31

Parallel Port Basics

Parallel ports were originally developed by IBM as a way to connect a printer to our PC

When IBM was in the process of designing the PC the company wanted the computer to

work with printers offered by Centronics a top printer manufacturer at the time IBM

decided not to use the same port interface on the computer that Centronics used on the

printer

Instead IBM engineers coupled a 25-pin connector DB-25 with a 36-pin Centronics

connector to create a special cable to connect the printer to the computer Other printer

manufacturers ended up adopting the Centronics interface making this strange hybrid

cable an unlikely de facto standard

When a PC sends data to a printer or other device using a parallel port it sends 8 bits of

data (1 byte) at a time These 8 bits are transmitted parallel to each other as opposed to

the same eight bits being transmitted serially (all in a single row) through a serial port

The standard parallel port is capable of sending 50 to 100 kilobytes of data per second

Lets take a closer look at what each pin does when used with a printer

bull Pin 1 carries the strobe signal It maintains a level of between 28 and 5 volts but drops

below 05 volts whenever the computer sends a byte of data This drop in voltage tells

the printer that data is being sent

Pins 2 through 9 are used to carry data To indicate that a bit has a value of 1 a

charge of 5 volts is sent through the correct pin No charge on a pin indicates avalue of

0 This is a simple but highly effective way to transmit digital information over an

analog cable in real-time

bull Pin 10 sends the acknowledge signal from the printer to the computer Like Pin 1 it

maintains a charge and drops the voltage below 05 volts to let the computer know that

the data was received

32

bull If the printer is busy it will charge Pin 11 Then it will drop the voltage below

05 volts to let the computer know it is ready to receive more data

bull The printer lets the computer know if it is out of paper by sending a charge on Pin 12

bull As long as the computer is receiving a charge on Pin 13 it knows that the device

is online

bull The computer sends an auto feed signal to the printer through Pin 14 using a 5-

volt charge

bull If the printer has any problems it drops the voltage to less than 05 volts on Pin

15 to let the computer know that there is an error

bull Whenever a new print job is ready the computer drops the charge on Pin 16 to

initialize the printer

bull Pin 17 is used by the computer to remotely take the printer offline This is

accomplished by sending a charge to the printer and maintaining it as long as you

want the printer offline

bull Pins 18-25 are grounds and are used as a reference signal for the low (below 05

volts) charge

33

Power Supply

Types of Power Supply

There are many types of power supply Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other

devices A power supply can by broken down into a series of blocks each of which

performs a particular function

For example a 5V regulated supply

Each of the blocks is described in more detail below

Transformer - steps down high voltage AC mains to low voltage AC

Rectifier - converts AC to DC but the DC output is varying

Smoothing - smooths the DC from varying greatly to a small ripple

Regulator - eliminates ripple by setting DC output to a fixed voltage

Power supplies made from these blocks are described below with a circuit diagram and a

graph of their output

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Dual Supplies

34

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 30: Self Balancing Robot

Accessing Ports

Windows DOS C JAVA and Visual Basic provide several ways to read and write to

parallel ports The most direct way is reading and writing to the port registers Most

programming languages include this ability or at least allow you to add it Visual Basic

includes other options including the Printer object the Print Form method and Open

LPT x Windows also has API calls for accessing LPT ports and 16-bit programs can use

BIOS and DOS software interrupts for LPT access This chapter introduces the parallel

ports signals and ways of accessing them in the programs you write

Parallel ports can be used to connect a host of popular computer peripherals

bull Printers

bull Scanners

bull CD burners

bull External hard drives

bull Iomega Zip removable drives

bull Network adapters

bull Tape backup drives

30

Pin Out Diagram Of Parallel Port

31

Parallel Port Basics

Parallel ports were originally developed by IBM as a way to connect a printer to our PC

When IBM was in the process of designing the PC the company wanted the computer to

work with printers offered by Centronics a top printer manufacturer at the time IBM

decided not to use the same port interface on the computer that Centronics used on the

printer

Instead IBM engineers coupled a 25-pin connector DB-25 with a 36-pin Centronics

connector to create a special cable to connect the printer to the computer Other printer

manufacturers ended up adopting the Centronics interface making this strange hybrid

cable an unlikely de facto standard

When a PC sends data to a printer or other device using a parallel port it sends 8 bits of

data (1 byte) at a time These 8 bits are transmitted parallel to each other as opposed to

the same eight bits being transmitted serially (all in a single row) through a serial port

The standard parallel port is capable of sending 50 to 100 kilobytes of data per second

Lets take a closer look at what each pin does when used with a printer

bull Pin 1 carries the strobe signal It maintains a level of between 28 and 5 volts but drops

below 05 volts whenever the computer sends a byte of data This drop in voltage tells

the printer that data is being sent

Pins 2 through 9 are used to carry data To indicate that a bit has a value of 1 a

charge of 5 volts is sent through the correct pin No charge on a pin indicates avalue of

0 This is a simple but highly effective way to transmit digital information over an

analog cable in real-time

bull Pin 10 sends the acknowledge signal from the printer to the computer Like Pin 1 it

maintains a charge and drops the voltage below 05 volts to let the computer know that

the data was received

32

bull If the printer is busy it will charge Pin 11 Then it will drop the voltage below

05 volts to let the computer know it is ready to receive more data

bull The printer lets the computer know if it is out of paper by sending a charge on Pin 12

bull As long as the computer is receiving a charge on Pin 13 it knows that the device

is online

bull The computer sends an auto feed signal to the printer through Pin 14 using a 5-

volt charge

bull If the printer has any problems it drops the voltage to less than 05 volts on Pin

15 to let the computer know that there is an error

bull Whenever a new print job is ready the computer drops the charge on Pin 16 to

initialize the printer

bull Pin 17 is used by the computer to remotely take the printer offline This is

accomplished by sending a charge to the printer and maintaining it as long as you

want the printer offline

bull Pins 18-25 are grounds and are used as a reference signal for the low (below 05

volts) charge

33

Power Supply

Types of Power Supply

There are many types of power supply Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other

devices A power supply can by broken down into a series of blocks each of which

performs a particular function

For example a 5V regulated supply

Each of the blocks is described in more detail below

Transformer - steps down high voltage AC mains to low voltage AC

Rectifier - converts AC to DC but the DC output is varying

Smoothing - smooths the DC from varying greatly to a small ripple

Regulator - eliminates ripple by setting DC output to a fixed voltage

Power supplies made from these blocks are described below with a circuit diagram and a

graph of their output

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Dual Supplies

34

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 31: Self Balancing Robot

Pin Out Diagram Of Parallel Port

31

Parallel Port Basics

Parallel ports were originally developed by IBM as a way to connect a printer to our PC

When IBM was in the process of designing the PC the company wanted the computer to

work with printers offered by Centronics a top printer manufacturer at the time IBM

decided not to use the same port interface on the computer that Centronics used on the

printer

Instead IBM engineers coupled a 25-pin connector DB-25 with a 36-pin Centronics

connector to create a special cable to connect the printer to the computer Other printer

manufacturers ended up adopting the Centronics interface making this strange hybrid

cable an unlikely de facto standard

When a PC sends data to a printer or other device using a parallel port it sends 8 bits of

data (1 byte) at a time These 8 bits are transmitted parallel to each other as opposed to

the same eight bits being transmitted serially (all in a single row) through a serial port

The standard parallel port is capable of sending 50 to 100 kilobytes of data per second

Lets take a closer look at what each pin does when used with a printer

bull Pin 1 carries the strobe signal It maintains a level of between 28 and 5 volts but drops

below 05 volts whenever the computer sends a byte of data This drop in voltage tells

the printer that data is being sent

Pins 2 through 9 are used to carry data To indicate that a bit has a value of 1 a

charge of 5 volts is sent through the correct pin No charge on a pin indicates avalue of

0 This is a simple but highly effective way to transmit digital information over an

analog cable in real-time

bull Pin 10 sends the acknowledge signal from the printer to the computer Like Pin 1 it

maintains a charge and drops the voltage below 05 volts to let the computer know that

the data was received

32

bull If the printer is busy it will charge Pin 11 Then it will drop the voltage below

05 volts to let the computer know it is ready to receive more data

bull The printer lets the computer know if it is out of paper by sending a charge on Pin 12

bull As long as the computer is receiving a charge on Pin 13 it knows that the device

is online

bull The computer sends an auto feed signal to the printer through Pin 14 using a 5-

volt charge

bull If the printer has any problems it drops the voltage to less than 05 volts on Pin

15 to let the computer know that there is an error

bull Whenever a new print job is ready the computer drops the charge on Pin 16 to

initialize the printer

bull Pin 17 is used by the computer to remotely take the printer offline This is

accomplished by sending a charge to the printer and maintaining it as long as you

want the printer offline

bull Pins 18-25 are grounds and are used as a reference signal for the low (below 05

volts) charge

33

Power Supply

Types of Power Supply

There are many types of power supply Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other

devices A power supply can by broken down into a series of blocks each of which

performs a particular function

For example a 5V regulated supply

Each of the blocks is described in more detail below

Transformer - steps down high voltage AC mains to low voltage AC

Rectifier - converts AC to DC but the DC output is varying

Smoothing - smooths the DC from varying greatly to a small ripple

Regulator - eliminates ripple by setting DC output to a fixed voltage

Power supplies made from these blocks are described below with a circuit diagram and a

graph of their output

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Dual Supplies

34

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 32: Self Balancing Robot

Parallel Port Basics

Parallel ports were originally developed by IBM as a way to connect a printer to our PC

When IBM was in the process of designing the PC the company wanted the computer to

work with printers offered by Centronics a top printer manufacturer at the time IBM

decided not to use the same port interface on the computer that Centronics used on the

printer

Instead IBM engineers coupled a 25-pin connector DB-25 with a 36-pin Centronics

connector to create a special cable to connect the printer to the computer Other printer

manufacturers ended up adopting the Centronics interface making this strange hybrid

cable an unlikely de facto standard

When a PC sends data to a printer or other device using a parallel port it sends 8 bits of

data (1 byte) at a time These 8 bits are transmitted parallel to each other as opposed to

the same eight bits being transmitted serially (all in a single row) through a serial port

The standard parallel port is capable of sending 50 to 100 kilobytes of data per second

Lets take a closer look at what each pin does when used with a printer

bull Pin 1 carries the strobe signal It maintains a level of between 28 and 5 volts but drops

below 05 volts whenever the computer sends a byte of data This drop in voltage tells

the printer that data is being sent

Pins 2 through 9 are used to carry data To indicate that a bit has a value of 1 a

charge of 5 volts is sent through the correct pin No charge on a pin indicates avalue of

0 This is a simple but highly effective way to transmit digital information over an

analog cable in real-time

bull Pin 10 sends the acknowledge signal from the printer to the computer Like Pin 1 it

maintains a charge and drops the voltage below 05 volts to let the computer know that

the data was received

32

bull If the printer is busy it will charge Pin 11 Then it will drop the voltage below

05 volts to let the computer know it is ready to receive more data

bull The printer lets the computer know if it is out of paper by sending a charge on Pin 12

bull As long as the computer is receiving a charge on Pin 13 it knows that the device

is online

bull The computer sends an auto feed signal to the printer through Pin 14 using a 5-

volt charge

bull If the printer has any problems it drops the voltage to less than 05 volts on Pin

15 to let the computer know that there is an error

bull Whenever a new print job is ready the computer drops the charge on Pin 16 to

initialize the printer

bull Pin 17 is used by the computer to remotely take the printer offline This is

accomplished by sending a charge to the printer and maintaining it as long as you

want the printer offline

bull Pins 18-25 are grounds and are used as a reference signal for the low (below 05

volts) charge

33

Power Supply

Types of Power Supply

There are many types of power supply Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other

devices A power supply can by broken down into a series of blocks each of which

performs a particular function

For example a 5V regulated supply

Each of the blocks is described in more detail below

Transformer - steps down high voltage AC mains to low voltage AC

Rectifier - converts AC to DC but the DC output is varying

Smoothing - smooths the DC from varying greatly to a small ripple

Regulator - eliminates ripple by setting DC output to a fixed voltage

Power supplies made from these blocks are described below with a circuit diagram and a

graph of their output

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Dual Supplies

34

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 33: Self Balancing Robot

bull If the printer is busy it will charge Pin 11 Then it will drop the voltage below

05 volts to let the computer know it is ready to receive more data

bull The printer lets the computer know if it is out of paper by sending a charge on Pin 12

bull As long as the computer is receiving a charge on Pin 13 it knows that the device

is online

bull The computer sends an auto feed signal to the printer through Pin 14 using a 5-

volt charge

bull If the printer has any problems it drops the voltage to less than 05 volts on Pin

15 to let the computer know that there is an error

bull Whenever a new print job is ready the computer drops the charge on Pin 16 to

initialize the printer

bull Pin 17 is used by the computer to remotely take the printer offline This is

accomplished by sending a charge to the printer and maintaining it as long as you

want the printer offline

bull Pins 18-25 are grounds and are used as a reference signal for the low (below 05

volts) charge

33

Power Supply

Types of Power Supply

There are many types of power supply Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other

devices A power supply can by broken down into a series of blocks each of which

performs a particular function

For example a 5V regulated supply

Each of the blocks is described in more detail below

Transformer - steps down high voltage AC mains to low voltage AC

Rectifier - converts AC to DC but the DC output is varying

Smoothing - smooths the DC from varying greatly to a small ripple

Regulator - eliminates ripple by setting DC output to a fixed voltage

Power supplies made from these blocks are described below with a circuit diagram and a

graph of their output

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Dual Supplies

34

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 34: Self Balancing Robot

Power Supply

Types of Power Supply

There are many types of power supply Most are designed to convert high voltage AC

mains electricity to a suitable low voltage supply for electronics circuits and other

devices A power supply can by broken down into a series of blocks each of which

performs a particular function

For example a 5V regulated supply

Each of the blocks is described in more detail below

Transformer - steps down high voltage AC mains to low voltage AC

Rectifier - converts AC to DC but the DC output is varying

Smoothing - smooths the DC from varying greatly to a small ripple

Regulator - eliminates ripple by setting DC output to a fixed voltage

Power supplies made from these blocks are described below with a circuit diagram and a

graph of their output

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Dual Supplies

34

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 35: Self Balancing Robot

Some electronic circuits require a power supply with positive and negative outputs as

well as zero volts (0V) This is called a dual supply because it is like two ordinary

supplies connected together as shown in the diagram

Dual supplies have three outputs for example a plusmn9V supply has +9V 0V and -9V

outputs

Transformer only

The low voltage AC output is suitable for lamps heaters and special AC motors It is not

suitable for electronic circuits unless they include a rectifier and a smoothing capacitor

Transformer + Rectifier

The varying DC output is suitable for lamps heaters and standard motors It is not

suitable for electronic circuits unless they include a smoothing capacitor

Transformer + Rectifier + Smoothing

35

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 36: Self Balancing Robot

The smooth DC output has a small ripple It is suitable for most electronic circuits

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple It is suitable for all electronic

circuits

Transformer

36

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 37: Self Balancing Robot

Circuit Symbol

Transformers convert AC electricity from one voltage to another with little loss of power

Transformers work only with AC and this is one of the reasons why mains electricity is

AC

Step-up transformers increase voltage step-down transformers reduce voltage Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage (230V in UK) to a safer low voltage

The input coil is called the primary and the output coil is called the secondary There is

no electrical connection between the two coils instead they are linked by an alternating

magnetic field created in the soft-iron core of the transformer The two lines in the middle

of the circuit symbol represent the core

Transformers waste very little power so the power out is (almost) equal to the power in

Note that as voltage is stepped down current is stepped up

The ratio of the number of turns on each coil called the turns ratio determines the ratio

of the voltages A step-down transformer has a large number of turns on its primary

(input) coil which is connected to the high voltage mains supply and a small number of

turns on its secondary (output) coil to give a low output voltage

turns ratio = Vp

= Np

and power out = power in

Vs Ns Vs times Is = Vp times Ip

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

Vs = secondary (output) voltage

Ns = number of turns on secondary coil

Is = secondary (output) current

Rectifier

37

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 38: Self Balancing Robot

There are several ways of connecting diodes to make a rectifier to convert AC to DC The

bridge rectifier is the most important and it produces full-wave varying DC A full-wave

rectifier can also be made from just two diodes if a centre-tap transformer is used but this

method is rarely used now that diodes are cheaper A single diode can be used as a

rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave

varyingDC

Bridge rectifier

A bridge rectifier can be made using four individual diodes but it is also available in

special packages containing the four diodes required It is called a full-wave rectifier

because it uses all the AC wave (both positive and negative sections) 14V is used up in

the bridge rectifier because each diode uses 07V when conducting and there are always

two diodes conducting as shown in the diagram below Bridge rectifiers are rated by the

maximum current they can pass and the maximum reverse voltage they can withstand

(this must be at least three times the supply RMS voltage so the rectifier can withstand

the peak voltages) Please see the Diodes page for more details including pictures of

bridge rectifiers

Bridge rectifierAlternate pairs of diodes

conduct changing over the connections

so the alternating directions of AC are

converted to the one direction of DC

Output full-wave varying DC

(using all the AC wave)

Single diode rectifier

38

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 39: Self Balancing Robot

A single diode can be used as a rectifier but this produces half-wave varying DC which

has gaps when the AC is negative It is hard to smooth this sufficiently well to supply

electronic circuits unless they require a very small current so the smoothing capacitor

does not significantly discharge during the gaps Please see the Diodes page for some

examples of rectifier diodes

Single diode rectifierOutput half-wave varying DC

(using only half the AC wave)

Smoothing

Smoothing is performed by a large value electrolytic capacitor connected across the DC

supply to act as a reservoir supplying current to the output when the varying DC voltage

from the rectifier is falling The diagram shows the unsmoothed varying DC (dotted line)

and the smoothed DC (solid line) The capacitor charges quickly near the peak of the

varying DC and then discharges as it supplies current to the output

39

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 40: Self Balancing Robot

Note that smoothing significantly increases the average DC voltage to almost the peak

value (14 times RMS value) For example 6V RMS AC is rectified to full wave DC of about

46V RMS (14V is lost in the bridge rectifier) with smoothing this increases to almost

the peak value giving 14 times 46 = 64V smooth DC

Smoothing is not perfect due to the capacitor voltage falling a little as it discharges

giving a small ripple voltage For many circuits a ripple which is 10 of the supply

voltage is satisfactory and the equation below gives the required value for the

smoothing capacitor A larger capacitor will give less ripple The capacitor value

must be doubled when smoothing half-wave DC Smoothing capacitor for 10

ripple C =

5 times

Io

Vs

times f

C = smoothing capacitance in farads (F)

Io = output current from the supply in amps (A)

Vs = supply voltage in volts (V) this is the peak value of the unsmoothed DC

f

Regulator

Voltage regulator ICs are available with fixed (typically 5

12 and 15V) or variable output voltages They are also

rated by the maximum current they can pass Negative

voltage regulators are available mainly for use in dual

supplies Most regulators include some automatic

Voltage Regulator

40

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 41: Self Balancing Robot

protection from excessive current (overload protection) and overheating (thermal

protection)

Many of the fixed voltage regulator ICs have 3 leads and look like power transistors such

as the 7805 +5V 1A regulator shown on the right They include a hole for attaching a

heatsink if necessary

CIRCUIT DESIGN AND DISCRIPTION

In this project following circuits are used Power supply circuit Transmitter circuit Receiver circuit

POWER SUPPLY CIRCUIT

A +12V DC supply is needed for our circuit for this we use regulated power supply An

ideal regulated power supply is an electronic circuit designed to provide a predetermined

DC voltage which is independent of current drawn temperature and any variation in line

This circuit comprise of a transformer a bridge rectifier a prod filter and a regulator IC

7812 Also for testing purpose a 5 volt DC regulated power supply is also made by

using regulator IC 7805

41

LED

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 42: Self Balancing Robot

Fig power supply circuit

Values of components are-

C1= 001microF C2 = 2200 microF 35 V C3 = 470 microF 35 V

R = 330 Ω IP = 220 V AC

All diodes are 1N4007

The transformer is used to convert 220 V AC to 12 V AC supply a bridge rectifier circuit

consisting four IN4770 diode used to convert the AC supply to pulsating DC supply A

capacitor C1 in parallel to each diode of bridge circuit is used for spike control A п filter

is used to filter out DC component from pulsating DC supply The filter circuit allowed

only DC component to pass through it at the output A diode and a capacitor parallel to

the choke of filter is used to short the circuit Regulator IC is used to provide a regulated

12V DC supply A capacitor between itrsquos input terminal and common terminal is used for

protection against black out and a capacitor between itrsquos output terminal and common

terminal is used for spike control

To indicate that supply is available at the output terminal or not a LED in series with a

resistance is

VISUAL BASIC

7812

7805

IP

T

C1C1

C1

C1

C2 C2C3

C3 C1

C1

R

R

42

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 43: Self Balancing Robot

Why We use Visual Basic

Visual Basic provides a convenient method for building user interfaces it can interface

with code written in the c for efficiency Other graphical user (GUI) is not as good as VB

is Through VB user can draw pictures buttons text boxes and other user interface

items User adds little snippets of code to handle the user interaction user adds the

initialization code as the last step and user can add more complex function if he wants

but not many

Features of Visual Basic

Compiled and interpreted

Object Oriented

Robust and secure

Distributed

Familiar small and simple

The Visual Basic

The Visual Basic has three distinct states Design Run and Debug The

Current state appears in Visual Basic is title bar This chapter concentrates on the Design

state Wersquoll cover the Debug state later in the book (In the Run state Visual Basic is in

the background while your program runs) Itrsquos the Design state thatrsquos Become complex

over the years and wersquoll lay it bare in this chapter

Visual Basic is composed of these parts

43

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 44: Self Balancing Robot

ldquoThe menu bar

ldquoThe toolbar

ldquoThe Project Explorer

ldquoThe Properties window

ldquoThe Form Layout window

ldquoThe toolbox

ldquoForm designers

ldquoCode windows

The Menu Bar

The menu bar presents the Visual Basic menus Herersquos a list of those menus and

What they do

ldquoFile handling and printing also used to make EXE files

ldquoEdit Standard editing functions undo and searches

ldquoView Displays or hides windows and toolbars

ldquoProject Sets project properties addsremoves forms and modules and

Addsremoves references and components

ldquoFormat Aligns or sizes controls

ldquoDebug Startsstops debugging and stepping through programs

ldquoRun Starts a program or compiles and starts it

ldquoTools Adds procedures starts the Menu Editor sets IDE options

ldquoAdd Ins_Add-in manager lists add-ins like Application Wizard and API Viewer

ldquoWindow Arranges or selects open windows

ldquoHelp Handles Help and the about box

The Toolbar

This toolbar contains buttons matching popular menu items

A form designer and code window

44

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 45: Self Balancing Robot

Form designers are really just windows in which a particular form appears You can place

controls into a form simply by drawing them after clicking the corresponding controlrsquos

tool in the toolbox

Code windows are similarly easy to understand you just place the code you want to

attach to an object in the code window (to open an objectrsquos code in the code

window just double-click that object) There are two drop-down list boxes at the

top of the code window the left list lets you select the object to add code to and the

right list lets you select the procedure to add

Managing Forms In Visual Basic

Setting Title Bar Text

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Adding Toolbars to Forms

Adding Status Bars to Forms

Referring To the Current Form

Redrawing Form Contents

Setting Control Tab Order

Moving and Sizing Controls from Code

Showing and Hiding Controls in a Form

Measurements in Forms

Working with Multiple Forms

Loading Showing And Hiding Forms

Setting the Startup Form

Creating Forms in Code

Using the Multiple Document Interface

Arranging MDI Child Windows

Opening New MDI Child Windows

The Parts of a Form

45

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 46: Self Balancing Robot

Forms are the names for windows in Visual Basic (originally you called windows Under

design forms and the actual result when running a window but common Usage has

named both forms now) and you add controls to forms in the Integrated Development

Environment Wearer designing a form in the Visual Basic IDE and you can see several

aspects of forms there At the top of the form is the title bar which displays The formrsquos

title here that is just Form1 At right in the title bar is the control box including the

minimizingmaximizing buttons and the close button These are Controls the user takes

for granted in most windows although wersquoll see they are Inappropriate in others (such as

dialog boxes) A form under design Under the title bar comes the menu bar if there is

one the form has one menu the File menu

Under the menu bar forms can have toolbars as you see in the IDE itself

The main area of a form the area where everything takes place is called the client Area In

general Visual Basic code works with controls in the client area and leaves The rest of

the form to Visual Basic (in fact the client area is itself a window) In We added a

control a command button to the form

Finally the whole form is surrounded by a border and there are several types of

Borders that you can use

The Parts of an MDI Form

Besides standard forms Visual Basic also supports MDI forms A MDI form

A MDI form

You can see that an MDI form looks much like a standard form with one major

difference of course the client area of an MDI form acts like a kind of corral for other

forms That is an MDI form can display MDI child forms in it

Which is how the multiple document interfaces works we have two documents open in

the MDI form thatrsquos the third type of form you can have in Visual Basic_MDI child

forms

These forms appear in MDI child windows but otherwise are very similar to standard

forms those then are the three types of forms available to us in

46

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 47: Self Balancing Robot

Visual Basic standard forms MDI forms and MDI child forms Wersquoll work with all of

them in this Chapter In fact we are ready to start getting into the details now as we turn

to the Immediate Solutions section of this chapter

Immediate Solutions

Setting Title Bar Text

Yoursquove submitted your project to the user-testing stage and feel smug What could go

wrong Suddenly the phone rings seems they donrsquot like the title in the programrsquos

Title bar Project1

This stymies a lot of Visual Basic programmers because the text in the title

Bar Seems like something that Windows itself manages not the program In fact itrsquos up

To the program and setting the text in the title bar couldnrsquot be easier At design time you

just change the formrsquos Caption property Setting a formrsquos caption

You can also set the Caption property at runtime in code like this

Private Sub Command1_Click ()

Me Caption = Hello from Visual Basic

End Sub

AddingRemoving MinMax Buttons and Setting a Windowrsquos Border

Forms usually come with minimizing and maximizing buttons as well as a close Box at

the upper right However thatrsquos not appropriate in all cases

To remove these buttons you can set the formrsquos Control Box property to False as default

Removing the control box from a form

TIP If you are thinking of designing a dialog box take a look at _Creating Dialog

Boxes_ later in this chapter besides removing the control box you should also set the

dialogrsquos border correctly ads OK and Cancel buttons and take care of a few more

considerations You can also set what buttons are in a form by setting its border type For

47

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 48: Self Balancing Robot

example If you set the border style to a fixed type the minimizing and maximizing

buttons Will disappear

Setting a Formrsquos Border

You set a formrsquos border style with its Border Style property here are the possible

Values for that property

ldquo0_None

ldquo1_Fixed Single

ldquo2_Sizable

ldquo3_Fixed Dialog

ldquo4_Fixed Tool window

ldquo5_Sizable Tool window

Adding Toolbars to Forms

For some reason adding toolbars to forms isnrsquot covered in a lot of Visual Basic books

However users have come to expect toolbars in more complex programs and wersquoll see

how to add them here Toolbars provide Buttons that correspond to menu items and give

the user an easy way to select the commands those items

VISUAL BASIC OBJECTS

Visual Basic programs display a Windows style screen (called a form) with boxes into

which Users type (and edit) information and buttons that they click to initiate actions

The boxes and Buttons are referred to as controls Forms and controls are called objects

In this section we Examine forms and four of the most useful Visual Basic controls

The Menu bar of the Visual Basic screen displays the commands you use to work with

Visual Basic Some of the menus like File Edit View and Window are common to

most Windows applications Others such as Project Format and Debug provide

48

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 49: Self Balancing Robot

commands specificto programming in Visual Basic The Toolbar is a collection of icons

that carry out standard operations when clicked For Example the fifth icon which looks

like a diskette can be used to save the current program To a disk To reveal the function

of a Toolbar icon position the mouse pointer over the icon for a few seconds The large

stippled Form window or form for short becomes a Windows window when A program

is executed Most information displayed by the program appears on the form The

Information usually is displayed in controls that have been placed on the form The Form

Layout window allows you to position the location of the form at run time relative to the

Entire screen using a small graphical representation of the screen

Properties window is used to change how objects look and react

The icons in the Toolbox represent controls that can be placed on the form The four

Controls discussed in this section are text boxes labels command buttons and picture

boxes

Text boxes You use a text box primarily to get information referred to as input from the

User

Labels You place a label to the left of a text box to tell the user what type of information

to enter into the text box You also use labels to display output

Command buttons The user clicks a command button to initiate an action

Picture boxes You use a picture box to display text or graphics output

CODING

49

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 50: Self Balancing Robot

Dim a As Integer

Dim p As Integer

Dim q As Integer

Dim b As Integer

Private Sub Command1_Click()

Call PortOut(888 0)

Unload Me

End Sub

Private Sub Form_Load()

a = 1

b = 1

Call PortOut(ampH37A 192)

Call PortOut(888 0)

End Sub

Private Sub Timer1_Timer()

p = PortIn(ampH379)

q = PortIn(ampH378)

Text1Text = p

Text2Text = q

If p = 56 Then

a = 1

Call PortOut(888 2)

b = 2

Text3ForeColor = ampHFFamp

Text3Text = Moving Clockwise

End If

If p = 88 Then

a = 1

Call PortOut(888 0)

b = 0

50

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 51: Self Balancing Robot

Text3ForeColor = ampHFF00amp

Text3Text = Center Aligned

End If

If p = 248 Then

a = 1

Call PortOut(888 1)

b = 1

Text3ForeColor = ampHFF0000

Text3Text = Moving Anti-Clockwise

End If

If p = 120 Then

Call PortOut(888 b)

a = a + 1

End If

If a = 100 Then

a = 0

b = b + 1

If b = 3 Then

b = 1

End If

End If

End Sub

51

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 52: Self Balancing Robot

CONCLUSION

In our project balancing is achieved by laser mesh where flap or bot can balance in 2 axis

where 3 laser meshes give respond whenever flap obstacle been detected Respect to this

in our algorithm program will respond to motor where it is rotate clockwise anti-

clockwise If there any obstacle still lying in the path of laser mesh it will give mal-

function that generate an error message This project contain motor driving circuit power

supply with regulated output Laser transmitter and receptor circuit amp mechanical section

contains ball bearings Acrylic sheet amp few of nut Bolts

Its some of the global applications are Sky high building balancing and Precision

balancing system and is expected to be a technology to b used globally in future

The field of robotics has been around nearly as long as Artificial Intelligence - but the

field has made little progress This is only natural since the field not only attempts to

conquer intelligence but also the body that embodies it - a formidable task indeed

Robotics though is not just about humanoid robots but also about their commercial

applications in manufacturing safety and hundreds of other fields

52

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 53: Self Balancing Robot

REFERENCES

1 Richard Alami Rachid Alami Raja Chatila Hajime Asama ldquoDistributed Autonomous

Robotic Systems 6rdquo Published by Springer 2007

2 ldquoDesigning Autonomous Mobile Robots Inside the Mind of an Intelligent Machinerdquo

by John M Holland Newnes Pres 2003

3 ldquoIntroduction to Autonomous Mobile Robotsrdquo by Roland Siegwart and Illah R

Nourbakhsh MIT Press 2004

4 ldquoBoylestad and Nashelsky ldquoElectronic Devices and Circuit Theoryrdquo Pearson

Education Eighth Edition

5 ldquo Microsoft Visual Basic 60 developers workshoprdquo by John Clark Craig Jeff Webb

Edition 5 published by Wombat Technology 1998

6 ldquo Visual Basic 6 from the Ground Uprdquo by Gary Cornell published by McGraw-Hill

Professional 1998

7 ldquoBeginning Visual Basic 6 Database Programmingrdquo by John Connell Edition 2

published by Apress 2003

53

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 54: Self Balancing Robot

APPENDIX

L293DQUADRUPLE HALF-H DRIVERS

1048576 Featuring Unitrode L293 and L293D

Products Now From Texas Instruments

1048576 Wide Supply-Voltage Range 45 V to 36 V

1048576 Separate Input-Logic Supply

1048576 Internal ESD Protection

1048576 Thermal Shutdown

1048576 High-Noise-Immunity Inputs

1048576 Functional Replacements for SGS L293 and

SGS L293D

1048576 Output Current 1 A Per Channel

(600 mA for L293D)

1048576 Peak Output Current 2 A Per Channel

(12 A for L293D)

1048576 Output Clamp Diodes for Inductive

Transient Suppression (L293D)

Description

The L293 and L293D are quadruple high-current half-H drivers The L293 is designed to

provide bidirectional drive currents of up to 1 A at voltages from 45 V to 36 V The

L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages

from 45 V to 36 V Both devices are designed to drive inductive loads such as relays

solenoids dc and bipolar stepping motors as well as other high-currenthigh-voltage

loads in positive-supply applications All inputs are TTL compatible Each output is a

complete totem-pole drive circuit with a Darlington transistor sink and a pseudo-

Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 12EN

and drivers 3 and 4 enabled by 34EN When an enable input is high the associated

54

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 55: Self Balancing Robot

drivers are enabled and their outputs are active and in phase with their inputs When the

enable input is low those drivers are disabled and their outputs are off and in the high-

impedance state With the proper data inputs each pair of drivers forms a full-H (or

bridge) reversible drive suitable for solenoid or motor applications On the L293 external

high-speed output clamp diodes should be used for inductive transient suppression A

VCC1 terminal separate from VCC2 is provided for the logic inputs to minimize device

power dissipation The L293and L293D are characterized for operation from 0degC to

70degC

Block Diagram

NOTE Output diodes are internal in L293D

55

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 56: Self Balancing Robot

Logic Diagram

Schematics of Inputs and Outputs (L293D)

56

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 57: Self Balancing Robot

57

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 58: Self Balancing Robot

LM324

QUADRUPLE OPERATIONAL AMPLIFIER

2-kV ESD Protection (K-Suffix Devices) Wide Supply Range

-Single Supply 3 V to 32 V (26 V for LM2902) or Dual Supplies 15 V to 16 V

-(13 V for LM2902) Low Supply-Current Drain Independent of Supply Voltage 08 mA Typ Common-Mode Input Voltage Range Includes Ground Allowing Direct Sensing Near Ground Low Input Bias and Offset Parameters

-Input Offset Voltage 3 mV Typ A Versions 2 mV Typ -Input Offset Current 2 nA Typ -Input Bias Current 20 nA Typ A Versions 15 nA Typ Differential Input Voltage Range Equal to Maximum-Rated Supply Voltage 32 V (26 V for LM2902) Open-Loop Differential Voltage Amplification 100 VmV Typ Internal Frequency Compensation

58

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 59: Self Balancing Robot

DescriptionOrdering InformationThese devices consist of four independent high-gain frequency-compensated operational

amplifiers that are designed specifically to operate from a single supply over a wide range

of voltages Operation from split supplies also is possible if the difference between the

two supplies is 3 V to 32 V (3 V to 26 V for the LM2902) and VCC is at least 15 V

more positive than the input common-mode voltage The low supply-current drain is

independent of the magnitude of the supply voltage Applications include transducer

amplifiers dc amplification blocks and all the conventional operational-amplifier circuits

that now can be more easily implemented in single-supply-voltage systems For example

the LM124 can be operated directly from the standard 5-V supply that is used in digital

systems and easily provides the required interface electronics without requiring additional

plusmn15-V supplies

59

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 60: Self Balancing Robot

symbol (each amplifier)

60

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 61: Self Balancing Robot

61

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 62: Self Balancing Robot

62

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 63: Self Balancing Robot

63

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 64: Self Balancing Robot

64

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 65: Self Balancing Robot

65

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 66: Self Balancing Robot

ULN 2003

High Voltage High Current Darlington Amplifiers

66

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 67: Self Balancing Robot

67

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 68: Self Balancing Robot

68

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 69: Self Balancing Robot

69

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 70: Self Balancing Robot

70

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 71: Self Balancing Robot

71

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 72: Self Balancing Robot

72

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 73: Self Balancing Robot

73

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 74: Self Balancing Robot

74

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 75: Self Balancing Robot

75

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 76: Self Balancing Robot

76

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 77: Self Balancing Robot

77

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 78: Self Balancing Robot

78

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator
Page 79: Self Balancing Robot

79

  • COMPONENT DESCRIPTION
  • Resistors
  • Function
  • Resistors restrict the flow of electric current for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED
  • Connecting and soldering
  • Resistors may be connected either way round They are not damaged by heat when soldering
  • Resistor values - the resistor colour code
    • Small value resistors (less than 10 ohm)
    • Tolerance of resistors (fourth band of colour code)
      • Transistors
        • Function
        • Connecting
        • Soldering
        • Heat sinks
        • Darlington pair
        • Connecting and soldering
        • Colours of LEDs
          • Capacitors
            • Function
              • Capacitor Colour Code
                • Function
                • Diodes allow electricity to flow in only one direction The arrow of the circuit symbol shows the direction in which the current can flow Diodes are the electrical version of a valve and early diodes were actually called valves
                  • Forward Voltage Drop
                  • Electricity uses up a little energy pushing its way through the diode rather like a person pushing through a door with a spring This means that there is a small voltage across a conducting diode it is called the forward voltage drop and is about 07V for all normal diodes which are made from silicon The forward voltage drop of a diode is almost constant whatever the current passing through the diode so they have a very steep characteristic (current-voltage graph)
                  • Reverse Voltage
                    • Connecting and soldering
                    • Bridge rectifiers
                      • Transformer
                        • Types of Power Supply
                        • Dual Supplies
                        • Transformer + Rectifier
                        • Transformer + Rectifier + Smoothing
                        • Transformer + Rectifier + Smoothing + Regulator
                        • Transformer
                        • Rectifier
                          • Single diode rectifier
                            • Smoothing
                            • Regulator