final pnd

99
INTRODUCTION It is microcontroller based application by using microcontroller we can develop application like autonomous robots, electronic projects and other embedded system applications. We are making pick n drop robot. We controlling this robot with remote. We can use this for picking object from one place and move it to another place and place it on other place.it is one of the embedded application. Embedded System: Microcontroller are widely used in Embedded System products. An Embedded product uses the microprocessor(or microcontroller) to do one task & one task only. A printer is an example of Embedded system since the processor inside it perform one task only namely getting the data and printing it. Contrast this with Pentium based PC. A PC can be used for any no. of applications such as word processor, print server, bank teller terminal, video game player, network server or internet terminal. Software for variety of applications can be loaded and run. Of course the reason a PC can perform multiple task is that it has RAM memory and an operating system that loads the application software into RAM & lets the CPU run it. In and Embedded system there is only one application software that is typically burn into ROM. An x86PC Contain or its connected to various Embedded Products such as keyboard, printer, modem, Disc controller, Sound card, CD-Rom 1

Upload: chi005

Post on 24-Apr-2015

45 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: final pnd

INTRODUCTION

It is microcontroller based application by using microcontroller we can develop

application like autonomous robots, electronic projects and other embedded system applications.

We are making pick n drop robot. We controlling this robot with remote. We can use this for

picking object from one place and move it to another place and place it on other place.it is one of

the embedded application.

Embedded System:

Microcontroller are widely used in Embedded System products. An Embedded product

uses the microprocessor(or microcontroller) to do one task & one task only. A printer is an

example of Embedded system since the processor inside it perform one task only namely getting

the data and printing it. Contrast this with Pentium based PC. A PC can be used for any no. of

applications such as word processor, print server, bank teller terminal, video game player,

network server or internet terminal. Software for variety of applications can be loaded and run.

Of course the reason a PC can perform multiple task is that it has RAM memory and an

operating system that loads the application software into RAM & lets the CPU run it. In and

Embedded system there is only one application software that is typically burn into ROM. An

x86PC Contain or its connected to various Embedded Products such as keyboard, printer,

modem, Disc controller, Sound card, CD-Rom Driver, Mouse & so on. Each one of these

peripherals as a microcontroller inside it that performs only one task. For example inside every

mouse there is microcontroller to perform the task of finding the mouse position and sending it to

PC.

Although microcontroller are preferred choice for many Embedded systems, There are

times that a microcontroller is inadequate for the task. For this reason in recent years many

manufactures of general purpose microprocessors such as INTEL, Motorolla, AMD & Cyrix

have targeted their microprocessors for the high end of Embedded market. While INTEL, AMD,

Cyrix push their x86 processors for both the embedded and desktop pc market, Motorolla is

determined to keep the 68000 families alive by targeting it mainly for high end of embedded

system.

1

Page 2: final pnd

One of the most critical needs of the embedded system is to decrease power

consumptions and space. This can be achieved by integrating more functions into the CPU chips.

All the embedded processors based on the x86 and 680x0 have low power consumptions in

additions to some forms of I/O, Com port & ROM all on a single chip. In higher performance

Embedded system the trend is to integrate more & more function on the CPU chip & let the

designer decide which feature he/she wants to use.

1.1 MICROPROCESSOR (MPU)

A microprocessor is a general-purpose digital computer central processing unit (CPU).

Although popularly known as a “computer on a chip” is in no sense a complete digital

computer. The block diagram of a microprocessor CPU is shown, which contains an

arithmetic and logical unit (ALU), a program counter (PC), a stack pointer (SP),some working

registers, a clock timing circuit, and interrupt circuits.

BLOCK DIAGRAM OF A MICROPROCESSOR

2

Page 3: final pnd

1.2 MICROCONTROLLERS (MCU)

Figure shows the block diagram of a typical microcontroller, which is a true computer on

a chip. The design incorporates all of the features found in micro-processor CPU: ALU, PC,

SP, and registers. It also added the other features needed to make a complete computer: ROM,

RAM, parallel I/O, serial I/O, counters, and clock circuit.

BLOCK DIAGRAM OF A MICROCONTROLLER

3

Page 4: final pnd

1.3 COMPARISON BETWEEN MICROPROCESSORS AND

MICROCONTROLLERS

PIN CONFIGURATIONS MPU MCU

Total pins 40 40

Address pins 16(fixed) 16

Data pins 8(fixed) 8

Interrupt pins 2(fixed) 2

I/O pins 0 32

ARCHITECTURE

8-bit registers 20 34

16-bit registers 4 2

Stack size 64 128

Internal ROM 0 4K

Internal RAM 0 128

External memory 64K 128K

Timers 0 2

Flags 6 4

The microprocessor must have many additional parts to be operational as a computer

whereas microcontroller requires no additional external digital parts.

The prime use of microprocessor is to read data, perform extensive calculations on that

data and store them in the mass storage device or display it. The prime functions of

microcontroller is to read data, perform limited calculations on it, control its environment

based on these data. Thus the microprocessor is said to be general-purpose digital

computers whereas the microcontroller are intend to be special purpose digital controller.

Microprocessor need many opcodes for moving data from the external memory to the

CPU, microcontroller may require just one or two, also microprocessor may have one or

two types of bit handling instructions whereas microcontrollers have many.

4

Page 5: final pnd

Thus microprocessor is concerned with the rapid movement of the code and data from the

external addresses to the chip, microcontroller is concerned with the rapid movement of

the bits within the chip.

Lastly, the microprocessor design accomplishes the goal of flexibility in the hardware

configuration by enabling large amounts of memory and I/O that could be connected to

the address and data pins on the IC package. The microcontroller design uses much more

limited set of single and double byte instructions to move code and data from internal

memory to ALU.

WHAT IS ROBOTIES?

Whenever we talk about robot two questions come to our mind

What is a Robot ?

What does it do?

“What is a robot?”

The word robot comes from the Czech word Robota, which means obligatory work or

servitude or forced labour.

The word robot was first used in 1921by Karl Capek in a Czech play called R.U.R.

(Rossum's Universal Robots) .The play depicts a race of humanoid robots that turn on their

masters and destroy them.

A theme that robots will take control of their creators seems always to be associated with

robots.

What does it do?

As stated by the Robot Institute of America.

“A robot is a programmable multi functional manipulator designed to move material,

parts, tools or specialized devices through variable programmed motions for the performance of

a variety of tasks.”

The modern definition of a robot classifies it as a system which has :

One or more sensors to interact with the environment

5

Page 6: final pnd

A program that processes the inputs received from the environment

A decision maker, who on the basis of processed inputs decides what action to be

performed , also in charge of overall operations

A mechanical assemblage like an arm, hand, or other moving part to perform the

intended function like lifting, assembling, or moving something .

An electrical assemblage which provides the motive force to the mechanical parts

In short

A robot is a machine designed to execute one or more tasks repeatedly, with speed and

precision Issac Asimov , Russian science fiction writer, coined the word Robotics in his story

“Runaround” ( 1942) , to denote the science devoted to the study of robots.

LAWS OF ROBOTICS

Issac Asimov conceived the robots as humanoids, devoid of feelings'

His robots were well-designed, fail-safe machines, whose brains were programmed by

human beings. Anticipating the dangers and havoc such a device could cause, he postulated

three rules of Robotics , and they are:

A robot should not injure a human being or, through inaction, allow a human to be

harmed A robot must obey orders given by humans except when that conflicts with the First law

A robot must protect its own existence unless that conflict with the First or Second law Later,

Asimov added the "zeroth" law:

A robot may not injure humanity, or, through inaction, allow humanity to come to harm.

Japan's ministry guidelines require manufacturers

To install a sufficient number of sensors to keep robots from running into people.

To use Lighter or softer materials prevent injury.

To provide Emergency shut-off buttons prominently placed for easy access by concerned

humans for controlling out-of-control machines

First Generation

The first generation robots arc repeating, non servo, pick-and- place, or point to- point

kind. First-generation robots date from the 1970s and consist of stationary, nonprogrammable,

electromechanical devices without sensors.

They were mostly in automobile industry for welding and assembly work in factories.

6

Page 7: final pnd

The technology is fully developed and at present about 80% robots in use in the industry are of

this kind. It is predicted that these will continue to be in use for a long time.

Second Generation

Second-generation robots were developed in the 1980s

They have sensors and programmable controllers.

The addition of sensing devices and enabling the robot to alter its movements in response

to sensory feedback These robots exhibit path-control capabilities. This technological

breakthrough came around 1980s

Third Generation

The third generation is marked with robots having human like intelligence. Third-

generation robots were developed between approximately 1990 and the present.

The growth in computers led to high-speed processing of information and, thus, robots

also acquired artificial intelligence, self-learning, on-line computations and control and

conclusion drawing capabilities by past experiences.

These machines can be stationary or mobile, autonomous or insect type, with

sophisticated programming, speech recognition and/or synthesis, and other advanced features.

The technology is still in infancy and has to go a long way.

Fourth Generation

This is futuristic and may be a reality only during the millennium. Prediction about its

features is difficult, if not impossible. It may be a true android or an artificial biological robot or

a super humanoid capable of producing its own clones. This might provide for fifth and higher

generation robots.

Androids are advanced kind of Robo because of their superficial resemblance to human

beings. Androids are mobile, usually moving around on wheels or a track drive not look or

behave anything like humans. The ultimate in robotic intelligence and sophistication might take

on forms yet to be imagined.

An android is a robot designed to look and act human.

The word derives from Greek

7

Page 8: final pnd

Though the word derives from a gender-specific root, its usage in English is usually

gender neutral. The term "android" appears in US patents as early as 1863 in reference to

miniature humanlike toy automations.

  Gynoid is a term used to describe a robot designed to look like a human female, as

compared to an android modeled after a male. The term is not common, however, with android

often being used to refer to both "genders" of robot.

An android is a robot designed to look and act human.

8

Page 9: final pnd

HARDWARE AND SOFTWARE REQUIREMENTS

Hardware Component list

Name Quantity1. Microcontroller PIC16f877A 01

2. DC geared motor 03

3. Servo motor 01

4. L293D 02

5. ILQ74 02

6. IR Sensor 01

7. Crystal oscillator 01

8. Voltage regulator(7805) 01

9. Capacitor 08

10. Resistor 18

11. Light emitting diode 01

12. Switch(3 pin) 01

13. Push button 01

14. Battery(12v) 01

15. Chassis Board 01

16. Tyre 04

17. Track 04

18. Screws/nut/bolts ---

19. Sony TV Remote 01

20. Wooden Sheet 01

21. IC BASE 05

9

Page 10: final pnd

COMPONENT DESCRIPTION

Motors

Electrical Motor

Converts electrical energy into mechanical energy. There are two types of electrical

motors.

AC motors designed to run on AC electric power.

DC motor designed to run on DC electric power.

For our study we would be focusing on learning of DC motors

Types of DC motors

1. Brushed DC motors

2. Brushless DC motors

3. Servo motors

4. Stepper DC

All DC motors require two magnetic fields:

One produced by the stationary part of the motor (the stator, or field), Second and one by

the rotating part (the rotor, or armature).

These are produced either by a winding of coils carrying a current, or by permanent

magnets.

If the field is a coil of wire, this may be connected in a variety of ways, which produces

different motor characteristics.

We will learn DC motors where:

Magnetic field is produced by permanent magnets – STATOR

Armature has set of coils which produces magnetic field when current passes through the

coils ---- Rotor

10

Page 11: final pnd

RELATIVE ARRANGEMENTS OF COMPONENTS OF A DC MOTOR

Stator

The stator generates a stationary magnetic field that surrounds the rotor. This field is

generated by either permanent magnets or electromagnetic windings. Rotor, also called the

armature, Made up of one or more windings. When these windings are energized they produce a

magnetic field. The magnetic poles of This rotor field will be attracted to the opposite poles

generated by the stator, causing the rotor to turn.

As the motor turns, the windings are constantly being energized in a different sequence

so that the magnetic poles generated by the rotor do not overrun the poles generated in the stator.

This switching of the field in the rotor windings is called commutation.

11

Page 12: final pnd

12

Page 13: final pnd

Permanent Magnet Brushed DC (PMDC)

Most common motors

Permanent magnets produce the stator field.

PMDC motors are generally used in applications involving FHP

The drawback is that the magnets lose their magnetic properties over time.

The performance curve (voltage vs. speed), is very linear

BASIC DRIVE CIRCUITS

Drive circuits are used in applications where a controller is being used and speed

control is required.

The purpose of a drive circuit is to give the controller a way to vary the current in the

windings of the BDC motor.

In our application, the drive circuits are based on pulse width modulation of the voltage

supplied to a BDC motor.

In terms of power consumption, this method of speed control is a far more efficient way

to vary the speed of a BDC motor compared to traditional analog control methods.

BDC motors are driven in a variety of ways.

Brushes and Commutator

Unlike other electric motor (i.e., brushless DC, AC induction), BDC motors do not

require a controller to switch current in the motor windings.

Instead, the commutation of the windings of a BDC motor is done Mechanically.

13

Page 14: final pnd

A segmented copper sleeve, called a commutator, resides on the axle of a BDC motor. As

the motor turns, carbon brushes slide over the commutator, coming in contact with

different segments of the commutator. The segments are attached to different rotor

windings, therefore, a dynamic magnetic field is generated inside the motor when a

voltage is applied across the brushes of the motor.

Prone to wear

To run the motor in forward direction

To run the motor in reverse direction

Servos motors:

Gearing and feedback control loop circuitry (No motor drivers required)

Most servo motors can rotate about 90 to 180 degrees.

Some rotate through a full 360 degrees

However, servos are unable to continually rotate (unless modified),

Precision positioning makes them ideal for robot arms and legs, rack and pinion steering,

and sensor scanners

14

Page 15: final pnd

To connect a servo,

All servos have three wires:

Black or Brown is for ground.

Red is for power (~4.8-6V).

Yellow, Orange, or White is the signal wire (3-5V).

To operate a servo

Servos can be programmed for direction of rotation

By varying the square wave pulse width from 1-2ms for controlling position/velocity

L293d

The L293 is an integrated circuit motor driver used for:

Simultaneous, bi-directional control of two small motors.

Sourcing capacity is limited to 600 mA

Use heat sinking to keep the case temperature down.

L293 comes in a standard 16-pin, dual-in line IC package.

L293D has built in fly-back diodes to minimize inductive voltage spikes. ,

15

Page 16: final pnd

16

Page 17: final pnd

Arrangement for

Two motors in one direction

One motor in both directions

17

Page 18: final pnd

ILQ74 Optocoupler, Phototransistor Output:

IL74/ILD74/ILQ74 is an optically coupled pair with a

GaAIAs infrared LED and a silicon NPN phototransistor.

18

Page 19: final pnd

Signal information, including a DC level, can be transmitted

by the device while maintaining a high degree of electrical isolation between input and

output.

It can be used to replace relays and transformers in many digital interface applications, as

well as analog applications

The LQ74 has four isolated channels per package

Treat an optocoupler as a device with two components:

The input LED

Output transistor

As the two are electrically isolated, we have flexibility of connecting them into circuit.

All we really have to do is work out a convenient way of turning the input LED on and

off Turning on and off LED will be used for switching of the phototransistor to generate an

output waveform or logic

19

Page 20: final pnd

Switches

Selecting a Switch

There are three important features to consider when selecting a switch:

Contacts (e.g. single pole, double throw)

Ratings (maximum voltage and current)

Method of Operation (toggle, slide, key etc.)

SWITCH CONTACTS

Several terms are used to describe switch contacts:

Pole - number of switch contact sets.

Throw - number of conducting positions, single or double.

Way - number of conducting positions, three or more.

Momentary - switch returns to its normal position when released.

Open - off position, contacts not conducting.

Closed - on position, contacts conducting, there may be several on positions.

Circuit symbol for a

simple on-off switch

20

Page 21: final pnd

For example: the simplest on-off switch has one set of contacts (single pole) and one

switching position which conducts (single throw). The switch mechanism has two positions:

open (off) and closed (on), but it is called 'single throw' because only one position conducts.

Switch Contact Ratings

Switch contacts are rated with a maximum voltage and current, and there may be

different ratings for AC and DC. The AC values are higher because the current falls to zero many

times each second and an arc is less likely to form across the switch contacts.

For low voltage electronics projects the voltage rating will not matter, but you may need

to check the current rating. The maximum current is less for inductive loads (coils and motors)

because they cause more sparking at the contacts when switched off.

STANDARD SWITCHES

Type of Switch Circuit Symbol Example

21

Page 22: final pnd

ON-OFF

Single Pole, Single Throw = SPST

A simple on-off switch. This type can

be used to switch the power supply to a

circuit.

When used with mains electricity this

type of switch must be in the live wire, but it

is better to use a DPST switch to isolate both

live and neutral.

SPST toggle switch

(ON)-OFF

Push-to-make = SPST Momentary

A push-to-make switch returns to its

normally open (off) position when you

release the button, this is shown by the

brackets around ON. This is the standard

doorbell switch.

Push-to-make switch

ON-(OFF)

Push-to-break = SPST Momentary

A push-to-break switch returns to its

normally closed (on) position when you

release the button. Push-to-break switch

ON-ON

Single Pole, Double Throw = SPDT

This switch can be on in both

positions, switching on a separate device in

each case. It is often called a changeover

switch. For example, a SPDT switch can be

used to switch on a red lamp in one position

SPDT toggle switch

22

Page 23: final pnd

and a green lamp in the other position.

A SPDT toggle switch may be used as

a simple on-off switch by connecting to COM

and one of the A or B terminals shown in the

diagram. A and B are interchangeable so

switches are usually not labelled.

ON-OFF-ON

SPDT Centre Off

A special version of the standard

SPDT switch. It has a third switching position

in the centre which is off. Momentary (ON)-

OFF-(ON) versions are also available where

the switch returns to the central off position

when released.

SPDT slide switch

(PCB mounting)

SPDT rocker switch

Dual ON-OFF

Double Pole, Single Throw = DPST

A pair of on-off switches which operate

together (shown by the dotted line in the

circuit symbol).

A DPST switch is often used to switch mains

electricity because it can isolate both the live

and neutral connections.

DPST rocker switch

23

Page 24: final pnd

Dual ON-ON

Double Pole, Double Throw = DPDT

A pair of on-on switches which

operate together (shown by the dotted line in

the circuit symbol).

A DPDT switch can be wired up as a

reversing switch for a motor as shown in the

diagram.

ON-OFF-ON

DPDT Centre Off

A special version of the standard

SPDT switch. It has a third switching position

in the centre which is off. This can be very

useful for motor control because you have

forward, off and reverse positions.

Momentary (ON)-OFF-(ON) versions are

also available where the switch returns to the

central off position when released.

DPDT slide switch

 

Wiring for Reversing

Switch

24

Page 25: final pnd

SPECIAL SWITCHES

Type of Switch Example

Push-Push Switch (e.g. SPST = ON-OFF)

This looks like a momentary action push switch but it is a

standard on-off switch: push once to switch on, push again to

switch off. This is called a latching action.

Microswitch (usually SPDT = ON-ON)

Microswitches are designed to switch fully open or closed in

response to small movements. They are available with levers and

rollers attached.

Keyswitch

A key operated switch. The example shown is SPST.

Tilt Switch (SPST)

Tilt switches contain a conductive liquid and when tilted this

bridges the contacts inside, closing the switch. They can be used

as a sensor to detect the position of an object. Some tilt switches

contain mercury which is poisonous.

Reed Switch (usually SPST)

The contacts of a reed switch are closed by bringing a small

magnet near the switch. They are used in security circuits, for

example to check that doors are closed. Standard reed switches

are SPST (simple on-off) but SPDT (changeover) versions are

also available.

25

Page 26: final pnd

Warning: reed switches have a glass body which is easily

broken! For advice on handling please see the

Electronics   in   Meccano website.

DIP Switch (DIP = Dual In-line Parallel)

This is a set of miniature SPST on-off switches, the example

shown has 8 switches. The package is the same size as a standard

DIL (Dual In-Line) integrated circuit.

This type of switch is used to set up circuits, e.g. setting the code

of a remote control.

Multi-pole Switch

The picture shows a 6-pole double throw switch, also known as a

6-pole changeover switch. It can be set to have momentary or

latching action. Latching action means it behaves as a push-push

switch, push once for the first position, push again for the second

position etc.

Multi-way Switch

Multi-way switches have 3 or more conducting positions. They

may have several poles (contact sets). A popular type has a rotary

action and it is available with a range of contact arrangements

from 1-pole 12-way to 4-pole 3 way.

The number of ways (switch positions) may be reduced by

adjusting a stop under the fixing nut. For example if you need a 2-

pole 5-way switch you can buy the 2-pole 6-way version and

adjust the stop.

Contrast this multi-way switch (many switch positions) with the

multi-pole switch (many contact sets) described above.

Multi-way rotary switch

1-pole 4-way switch symbol

26

Page 27: final pnd

27

Page 28: final pnd

RESISTORS

Colour Code | Tolerance | Real Values (E6 & E12 series) | Power Rating

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 .

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

28

Page 29: final pnd

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.

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.

Find out how to make your own Resistor Colour Code Calculator

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 × 0.1 and silver which

means × 0.01. The first and second bands represent the digits as normal.

For example:

red, violet, gold bands represent 27 × 0.1 = 2.7 

green, blue, silver bands represent 56 × 0.01 = 0.56 

Tolerance of resistors (fourth band of colour code)

29

Page 30: final pnd

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 ±10% 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 ±10%,   gold ±5%,   red ±2%,   brown ±1%.

If no fourth band is shown the tolerance is ±20%.

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

required.

RESISTOR SHORTHAND

Resistor values are often written on circuit diagrams using a code system which avoids

using a decimal point because it is easy to miss the small dot. Instead the letters R, K and M are

used in place of the decimal point. To read the code: replace the letter with a decimal point, then

multiply the value by 1000 if the letter was K, or 1000000 if the letter was M. The letter R means

multiply by 1.

For example:

560R means 560

2K7  means 2.7 k = 2700

39K  means 39 k

1M0  means 1.0 M = 1000 k

Real resistor values (the E6 and E12 series)

You may have noticed that resistors are not available with every possible value, for

example 22k and 47k are readily available, but 25k and 50k are not!

Why is this? Imagine that you decided to make resistors every 10 giving 10, 20, 30, 40,

50 and so on. That seems fine, but what happens when you reach 1000? It would be pointless to

30

Page 31: final pnd

make 1000, 1010, 1020, 1030 and so on because for these values 10 is a very small difference,

too small to be noticeable in most circuits. In fact it would be difficult to make resistors

sufficiently accurate.

To produce a sensible range of resistor values you need to increase the size of the 'step' as

the value increases. The standard resistor values are based on this idea and they form a series

which follows the same pattern for every multiple of ten.

The E6 series (6 values for each multiple of ten, for resistors with 20% tolerance)

10, 15, 22, 33, 47, 68, ... then it continues 100, 150, 220, 330, 470, 680, 1000 etc.

Notice how the step size increases as the value increases. For this series the step (to the next

value) is roughly half the value.

The E12 series (12 values for each multiple of ten, for resistors with 10% tolerance)

10, 12, 15, 18, 22, 27, 33, 39, 47, 56, 68, 82, ... then it continues 100, 120, 150 etc.

Notice how this is the E6 series with an extra value in the gaps.

The E12 series is the one most frequently used for resistors. It allows you to choose a

value within 10% of the precise value you need. This is sufficiently accurate for almost all

projects and it is sensible because most resistors are only accurate to ±10% (called their

'tolerance'). For example a resistor marked 390 could vary by ±10% × 390 = ±39 , so it

could be any value between 351 and 429 .

Resistors in Series and Parallel

For information on resistors connected in series and parallel

please see the Resistance page,

Power Ratings of Resistors

Electrical energy is converted to heat when current flows

through a resistor. Usually the effect is negligible, but if the

resistance is low (or the voltage across the resistor high) a

large current may pass making the resistor become

High power resistors

(5W top, 25W bottom)

Photographs © Rapid Electronics

31

Page 32: final pnd

noticeably warm. The resistor must be able to withstand the heating effect and resistors have

power ratings to show this.

Power ratings of resistors are rarely quoted in parts lists because for most circuits the standard

power ratings of 0.25W or 0.5W are suitable. For the rare cases where a higher power is required

it should be clearly specified in the parts list, these will be circuits using low value resistors

(less than about 300 ) or high voltages (more than 15V).

32

Page 33: final pnd

The power, P, developed in a resistor is given by:

P = I² × R

or

P = V² / R

where: P = power developed in the resistor in watts (W)

I  = current through the resistor in amps (A)

R = resistance of the resistor in ohms ( )

V = voltage across the resistor in volts (V)

Examples:

A 470 resistor with 10V across it, needs a power rating P = V²/R = 10²/470 = 0.21W.

In this case a standard 0.25W resistor would be suitable.

A 27 resistor with 10V across it, needs a power rating P = V²/R = 10²/27 = 3.7W.

A high power resistor with a rating of 5W would be suitable.

33

Page 34: final pnd

CAPACITORS

Function

Capacitors store electric charge. They are used with resistors in timing circuit 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 capacitor's 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), n (nano) and p (pico):

µ means 10-6 (millionth), so 1000000µF = 1F

n means 10-9 (thousand-millionth), so 1000nF = 1µF

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

Capacitor values can be very difficult to find because there are many types of capacitor

with different labelling systems!

There are many types of capacitor but they can be split into two groups, polarised and

unipolarised Each group has its own circuit symbol.

34

Page 35: final pnd

Polarised capacitors (large values, 1µF +)

Examples:        Circuit symbol:   

Electrolytic Capacitors

Electrolytic capacitors are polarised and they must be connected the correct way round, at

least one of their leads will be marked + or -. They are not damaged by heat when soldering.

There are two designs of electrolytic capacitors; axial where the leads are attached to each end

(220µF in picture) and radial where both leads are at the same end (10µF in picture). Radial

capacitors tend to be a little smaller and they stand upright on the circuit board.

It is easy to find the value of electrolytic capacitors because they are clearly printed with their

capacitance and voltage rating. The voltage rating can be quite low (6V for example) and it

should always be checked when selecting an electrolytic capacitor. If the project parts list does

not specify a voltage, choose a capacitor with a rating which is greater than the project's power

supply voltage. 25V is a sensible minimum for most battery circuits.

Tantalum Bead Capacitors

Tantalum bead capacitors are polarised and have low voltage ratings like electrolytic capacitors.

They are expensive but very small, so they are used where a large capacitance is needed in a

small size.

Modern tantalum bead capacitors are printed with their capacitance, voltage and polarity in full.

However older ones use a colour-code system which has two stripes (for the two digits) and a

spot of colour for the number of zeros to give the value in µF. The standard colour code is used,

but for the spot, grey is used to mean × 0.01 and white means × 0.1 so that values of less than

10µF can be shown. A third colour stripe near the leads shows the voltage (yellow 6.3V, black

35

Page 36: final pnd

10V, green 16V, blue 20V, grey 25V, white 30V, pink 35V). The positive (+) lead is to the right

when the spot is facing you: 'when the spot is in sight, the positive is to the right'.

For example:   blue, grey, black spot   means 68µF

For example:   blue, grey, white spot   means 6.8µF

For example:   blue, grey, grey spot   means 0.68µF

Unpolarised capacitors (small values, up to 1µF)

Examples:        Circuit symbol:   

Small value capacitors are unpolarised and may be connected either way round. They are

not damaged by heat when soldering, except for one unusual type (polystyrene). They have high

voltage ratings of at least 50V, usually 250V or so. It can be difficult to find the values of these

small capacitors because there are many types of them and several different labelling systems!

Many small value capacitors have their value printed but without a multiplier, so

you need to use experience to work out what the multiplier should be!

For example 0.1 means 0.1µF = 100nF.

Sometimes the multiplier is used in place of the decimal point:

For example:   4n7 means 4.7nF.

Capacitor Number Code

A number code is often used on small capacitors where printing is difficult:

the 1st number is the 1st digit,

the 2nd number is the 2nd digit,

the 3rd number is the number of zeros to give the capacitance in pF.

36

Page 37: final pnd

Ignore any letters - they just indicate tolerance and voltage rating.

For example:   102   means 1000pF = 1nF   (not 102pF!)

For example:   472J means 4700pF = 4.7nF (J means 5% tolerance).

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 = 0.01µF.

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 = 0.22µF.

Polystyrene Capacitors

This type is rarely used now. Their value (in pF) is normally

printed without units. Polystyrene capacitors can be damaged by heat

when soldering (it melts the polystyrene!) so you should use a heat sink (such as a crocodile

clip). Clip the heat sink to the lead between the capacitor and the joint.

Real capacitor values (the E3 and E6 series)

Colour Code

Colour Number

Black 0

Brown 1

Red 2

Orange 3

Yellow 4

Green 5

Blue 6

Violet 7

Grey 8

White 9

37

Page 38: final pnd

You may have noticed that capacitors are not available with every possible value, for example

22µF and 47µF are readily available, but 25µF and 50µF are not!

Why is this? Imagine that you decided to make capacitors every 10µF giving 10, 20, 30, 40, 50

and so on. That seems fine, but what happens when you reach 1000? It would be pointless to

make 1000, 1010, 1020, 1030 and so on because for these values 10 is a very small difference,

too small to be noticeable in most circuits and capacitors cannot be made with that accuracy.

To produce a sensible range of capacitor values you need to increase the size of the 'step' as the

value increases. The standard capacitor values are based on this idea and they form a series

which follows the same pattern for every multiple of ten.

The E3 series (3 values for each multiple of ten)

10, 22, 47, ... then it continues 100, 220, 470, 1000, 2200, 4700, 10000 etc.

Notice how the step size increases as the value increases (values roughly double each time).

The E6 series (6 values for each multiple of ten)

10, 15, 22, 33, 47, 68, ... then it continues 100, 150, 220, 330, 470, 680, 1000 etc.

Notice how this is the E3 series with an extra value in the gaps.

The E3 series is the one most frequently used for capacitors because many types cannot be made

with very accurate values.

38

Page 39: final pnd

VARIABLE CAPACITORS

Variable capacitors are mostly used in radio tuning

circuits and they are sometimes called 'tuning capacitors'. They

have very small capacitance values, typically between 100pF and

500pF (100pF = 0.0001µF). The type illustrated usually has

trimmers built in (for making small adjustments - see below) as

well as the main variable capacitor.

Many variable capacitors have very short spindles

which are not suitable for the standard knobs used for variable resistors and rotary switches. It

would be wise to check that a suitable knob is available before ordering a variable capacitor.

Variable capacitors are not normally used in timing circuits because their capacitance is

too small to be practical and the range of values available is very

limited. Instead timing circuits use a fixed capacitor and a variable

resistor if it is necessary to vary the time period.

Trimmer capacitors

Trimmer capacitors (trimmers) are miniature variable

capacitors. They are designed to be mounted directly onto the

circuit board and adjusted only when the circuit is built.

A small screwdriver or similar tool is required to adjust

trimmers. The process of adjusting them requires patience because the presence of your hand and

the tool will slightly change the capacitance of the circuit in the region of the trimmer!

Trimmer capacitors are only available with very small capacitances, normally less than

100pF. It is impossible to reduce their capacitance to zero, so they are usually specified by their

minimum and maximum values, for example 2-10pF. Trimmers are the capacitor equivalent of

preset which are miniature variable resistors.

ICS (CHIPS)

Variable Capacitor Symbol

Variable Capacitor

Trimmer Capacitor Symbol

Trimmer Capacitor

39

Page 40: final pnd

ICs (chips) are easily damaged by heat when soldering and their short pins

cannot be protected with a heat sink. Instead we use an IC holder, strictly called a

DIL socket (DIL = Dual In-Line), which can be safely soldered onto the circuit board. The IC is

pushed into the holder when all soldering is complete.

IC holders are only needed when soldering so they are not used on breadboards.

Commercially produced circuit boards often have ICs soldered directly to the board

without an IC holder, usually this is done by a machine which is able to work very quickly.

Please don't attempt to do this yourself because you are likely to destroy the IC and it will be

difficult to remove without damage by de-soldering.

Removing an IC from its holder

If you need to remove an IC it can be gently prised out of the holder with a small flat-

blade screwdriver. Carefully lever up each end by inserting the screwdriver blade between the IC

and its holder and gently twisting the screwdriver. Take care to start lifting at both ends before

you attempt to remove the IC, otherwise you will bend and possibly break the pins.

CONNECTORS

40

Page 41: final pnd

Connectors:  Battery clips | Terminal blocks | Croc clips | 4mm & 2mm | DC power

Audio & communication:  Jack | Phono | Coax | BNC | DIN | D | IDC & RJ45

Battery clips and holders

The standard battery clip fits a 9V PP3 battery and many battery holders such as the 6 × AA cell

holder shown. Battery holders are also available with wires attached, with pins for PCB

mounting, or as a complete box with lid, switch and wires.

Many small electronic projects use a 9V PP3 battery but if you wish to use the project for long

periods a better choice is a battery holder with 6 AA cells. This has the same voltage but a much

longer battery life and it will work out cheaper in the long run.

Larger battery clips fit 9V PP9 batteries but these

are rarely used now.

Terminal blocks and PCB terminals

PCB

terminal

block

Terminal block

41

Page 42: final pnd

Terminal blocks are usually supplied in 12-way lengths but they can be cut into smaller blocks

with a sharp knife, large wire cutters or a junior hacksaw. They are sometimes called 'chocolate

blocks' because of the way they can be easily cut to size.

PCB mounting terminal blocks provide an easy way of making semi-permanent

connections to PCBs. Many are designed to interlock to provide more connections.

Crocodile clips

The 'standard'

crocodile clip

has no cover and

a screw contact.

However,

miniature insulated crocodile clips are more

suitable for many purposes including test leads.

They have a solder contact and lugs which fold

down to grip the cable's insulation, increasing the

strength of the joint. Remember to feed the cable

through the plastic cover before soldering! Add

and remove the cover by fully opening the clip, a piece

of wood can be used to hold the jaws open.

4mm plugs, sockets and terminals

Crocodile clips

 

 

4mm terminal

and solder tag

42

Page 43: final pnd

These are the standard single pole connectors used on meters and other electronic equipment.

They are capable of passing high currents (typically 10A) and most designs are very robust.

Shrouded plugs and sockets are available for use with high voltages where there is a risk of

electric shock. A wide variety of colours is available from most suppliers.

Plugs

Plugs may have a screw or solder terminal to hold the cable. Check if you need to thread the

cable through the cover before connecting it. Some plugs, such as those illustrated, are 'stackable'

which means that they include a socket to accept another plug, allowing several plugs to be

connected to the same point - a very useful feature for test leads.

43

Page 44: final pnd

Sockets

These are usually described as 'panel mounting' because they are designed to be fitted to a case.

Most sockets have a solder contact but the picture shows other options. Fit the socket in the case

before attaching the wire otherwise you will be unable to add the mounting nut.

Terminals

In addition to a socket these have provision for attaching a wire by threading it through a hole (or

wrapping it around the post) and tightening the top nut by

hand. They usually have a threaded stud to fit a solder tag

inside the case.

2mm plugs and sockets

These are smaller versions of the 4mm plugs and sockets

described above, but terminals are not readily available. The plugs illustrated are stackable.

Despite their small size these connectors can pass large

DC power plugs and sockets

These 2-pole plugs and sockets ensure that the polarity of a

DC supply cannot be accidentally reversed. The standard

sizes are 2.1 and 2.5mm plug diameter. Standard plugs

have a 10mm shaft, 'long' plugs have a 14mm shaft.

Sockets are available for PCB or chassis mounting and

most include a switch on the outer contact which is

normally used to disconnect an internal battery when a plug is inserted.

Miniature versions with a 1.3mm diameter plug are used where small size is essential,

such as for personal cassette players.

44

Page 45: final pnd

Jack plugs and sockets

These are intended for audio signals so

mono and stereo versions are available.

The sizes are determined by the plug

diameter: ¼" (6.3mm), 3.5mm and 2.5mm.

The 2.5mm size is only available for

mono.

Screened plugs have metal bodies

connected to the COM contact. Most

connections are soldered, remember to

thread cables through plug covers before

soldering! Sockets are designed for PCB

or chassis mounting.

¼" plug connections are similar to those

for 3.5mm plugs shown below. ¼" socket connections are COM, R and L in that order from the

mounting nut, ignore R for mono use. Most ¼" sockets have switches on all contacts which open

as the plug is inserted so they can be used to isolate internal speakers for example.

The connections for 3.5mm plugs and sockets are shown below. Plugs have a lug which should

be folded down to grip the cable's insulation and increase the strength of the joint. 3.5mm mono

sockets have a switch contact which can be used to switch off an internal speaker as the plug is

inserted. Ignore this contact if you do not require the switching action.

¼" (6.3mm) jack plug and socket

 

3.5mm jack plug and socket

 

3.5mm jack line socket

(for fitting to a cable)

45

Page 46: final pnd

L = left channel signal

R = right channel signal

COM = common (0V,

screen)

Do not use jack plugs for power supply

connections because the contacts may be briefly

shorted as the plug is inserted. Use DC power

connectors for this.

Phono plugs and sockets

These are used for screened cables carrying audio and video signals. Stereo connections are

made using a pair of phono plugs and sockets. The centre contact is for the signal and the outer

contact for the screen (0V, common). Screened plugs have metal bodies connected to the outer

contact to give the signal additional protection from electrical noise. Sockets are available for

PCB or chassis mounting, singly for mono, or in pairs for stereo. Line sockets are available for

making extension leads.

3.5mm jack plug and socket connections

(the R connection is not present on mono plugs)

Construction of a screened cable

46

Page 47: final pnd

Coax plugs and sockets

These are similar to the phono plugs and sockets described above but

they are designed for use with screened cables

carrying much higher frequency signals, such as TV

aerial leads. They provide better screening because at

high frequencies this is essential to reduce electrical

noise.

BNC plugs and sockets

These are designed for screened cables carrying high

frequency signals where an undistorted and noise free signal is

essential, for example oscilloscope leads. BNC plugs are connected

with a push and twist action, to disconnect you need to twist and

pull.

Plugs and sockets are rated by their impedance (50 or 75 ) which

must be the same as the cable's impedance. If the connector and

cable impedances are not matched the signal will be distorted

because it will be partly reflected at the connection, this is the

electrical equivalent of the weak reflection which occurs when light

passes through a glass window.

DIN plugs and sockets

These are intended for audio signals but they can be used for other

low-current purposes where a multi-way connector is required. They

are available from 3 way to 8 way. 5 way is used for stereo audio

connections. The contacts are numbered on the connector, but they

are not in numerical order! For audio use the 'common' (0V) wire is connected to contact 2. 5

way plugs and sockets are available in two versions: 180° and 270° (the angle refers to the arc

formed by the contacts).

BNC plug

DIN plug

 

5 way 180° DIN socket

(chassis mounting)

 

47

Page 48: final pnd

Plastic covers of DIN plugs (and line sockets) are removed by depressing the retaining lug with a

small screwdriver. You may also need small pliers to extract the body from the cover but do not

pull on the pins themselves to avoid damage. Remember to thread the cable through the cover

before starting to solder the connections!

Soldering DIN plugs is easier if you clamp the insert with the pins. Wires should be pushed into

the hollow pins - first 'tin' the wires (coat them with a thin layer of solder) then melt a little

solder into the hollow pin and insert the wire while keeping the solder molten. Take care to avoid

melting the plastic base, stop and allow the pin to cool if necessary.

Mini-DIN connectors are used for computer equipment such as

keyboards and mice but they are not a good choice for general use

unless small size is essential.

D connectors

These are multi-pole connectors with provision for screw fittings to make semi-permanent

connections, for example on computer equipment. The D shape prevents incorrect connection.

Standard D-connectors have 2 rows of contacts (top picture); 9, 15 and 25-way versions are the

most popular. High Density D-connectors have 3 rows of contacts (bottom picture); a 15-way

version is used to connect computer monitors for example.

Note that covers (middle picture) are usually sold separately because both plugs and sockets can

be fitted to cables by fitting a cover to a chassis mounted connector. PCB mounting versions of

48

Page 49: final pnd

plugs and sockets are also available. The contacts are usually numbered on the body of the

connector, although you may need a magnifying glass

to see the very small markings. Soldering D-connectors

requires a steady hand due to the closeness of the

contacts, it is easy to accidently unsolder a contact you

have just completed while attempting to solder the next

one!

IDC communication connectors

These multi-pole insulation displacement connectors are used for computer and

telecommunications equipment. They automatically cut through the insulation on wires when

installed and special tools are required to fit them. They are available as 4, 6 and 8-way versions.

The 8-way RJ45 is the standard connector for modern computer networks. If you regularly use

these you may be interested in our network   lead   tester project.

Standard UK telephone connectors are similar in style but a slightly different shape. They are

called BT (British Telecom) connectors.

TOOLS REQUIRED FOR ELECTRONICS

Soldering iron

For electronics work the best type is

one powered by mains electricity (230V in the

UK), it should have a heatproof cable for

49

Page 50: final pnd

safety. The iron's power rating should be 15 to 25W and it should be fitted with a small bit of 2

to 3mm diameter.

Photograph © Rapid Electronics

Other types of soldering iron

Low voltage soldering irons are available, but their extra safety is undermined if you

have a mains lead to their power supply! Temperature controlled irons are excellent for

frequent use, but not worth the extra expense if you are a beginner. Gas-powered irons are

designed for use where no mains supply is available and are not suitable for everyday use. Pistol

shaped solder guns are far too powerful and cumbersome for normal electronics use.

Soldering iron stand

You must have a safe place to put the iron when you are not

holding it. The stand should include a sponge which can be

dampened for cleaning the tip of the iron.

Photograph © Rapid Electronics

Desoldering pump (solder sucker)

A tool for removing solder when desoldering a

joint to correct a mistake or replace a component.

Photograph © Rapid Electronics

Solder remover wick (copper braid)

50

Page 51: final pnd

This is an alternative to the desoldering pump shown above.

Photograph © Rapid Electronics

Solder Wire

The best size for electronics is 22swg (swg = standard wire gauge).

Photograph © Rapid Electronics

Side cutters

For trimming component leads close to the circuit board.

Photograph © Rapid Electronics

Wire strippers

Most designs include a cutter as well, but they are not suitable

for trimming component leads.

Small pliers

Usually called 'snipe nose' pliers, these are for bending

component leads etc. If you put a strong rubber band across the

handles the pliers make a convenient holder for parts such as

switches while you solder the contacts.

51

Page 52: final pnd

Small flat-blade screwdriver

For scraping away excess flux and dirt between tracks, as well as driving screws!

The following tool is only required if you are using stripboard:

Track cutter

A 3mm drill bit can be used instead, in fact the tool is usually just a 3mm drill bit

with a proper handle fitted.

Small electric drill

Ideally this should be mounted in a drill stand. You will need a range of

small drill bits, but for most holes a 1mm bit is suitable. Larger holes can be

drilled with a hand drill but 1mm bits are too fragile to use reliably in a hand

drill.

52

Page 53: final pnd

HOW TO SOLDER

First a few safety precautions

Never touch the element or tip of the soldering iron.

They are very hot (about 400°C) and will give you a nasty burn.

Take great care to avoid touching the mains flex with the tip of the iron.

The iron should have a heatproof flex for extra protection. An ordinary plastic flex will

melt immediately if touched by a hot iron and there is a serious risk of burns and electric

shock.

Always return the soldering iron to its stand when not in use.

Never put it down on your workbench, even for a moment!

Work in a well-ventilated area.

The smoke formed as you melt solder is mostly from the flux and quite irritating. Avoid

breathing it by keeping you head to the side of, not above, your work.

Wash your hands after using solder.

53

Page 54: final pnd

Solder contains lead which is a poisonous metal.

If you are unlucky (or careless!) enough to burn yourself please read the First Aid section.

PREPARING THE SOLDERING IRON Place the soldering iron in its stand and plug in.

The iron will take a few minutes to reach its operating temperature of about 400°C.

Dampen the sponge in the stand.

The best way to do this is to lift it out the stand and hold it under a cold tap for a moment,

then squeeze to remove excess water. It should be damp, not dripping wet.

Wait a few minutes for the soldering iron to warm up.

You can check if it is ready by trying to melt a little solder on the tip.

Wipe the tip of the iron on the damp sponge.

This will clean the tip.

Melt a little solder on the tip of the iron.

This is called 'tinning' and it will help the heat to flow from the iron's tip to the joint. It

only needs to be done when you plug in the iron, and occasionally while soldering if you

need to wipe the tip clean on the sponge.

You are now ready to start soldering

Hold the soldering iron like a pen, near the base of the handle.

Imagine you are going to write your

name! Remember to never touch the hot

element or tip.

Touch the soldering iron onto the

joint to be made.

Make sure it touches both the

component lead and the track.

Hold the tip there for a few seconds and...

Feed a little solder onto the joint.

54

Page 55: final pnd

It should flow smoothly onto the lead and track to form a volcano shape as shown in the

diagram. Apply the solder to the joint, not the iron.

Remove the solder, then the iron, while keeping the joint still.

Allow the joint a few seconds to cool before you move the circuit board.

Inspect the joint closely.

It should look shiny and have a 'volcano' shape. If not, you will need to reheat it and feed

in a little more solder. This time ensure that both the lead and track are heated fully

before applying solder.

If you are unlucky (or careless!) enough to burn

yourself please read the First Aid section.

Using a heat sink

Some components, such as 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 component body. You can buy a

special tool, but a standard crocodile clip works just as well and is cheaper.

Further information

For a much more detailed guide to soldering, including troubleshooting, please see the

Basic Soldering Guide on the Everyday Practical Electronics Magazine website.

Soldering Advice for Components

It is very tempting to start soldering components onto the circuit board straight away, but

please take time to identify all the parts first. You are much less likely to make a mistake if you

do this!

1. Stick all the components onto a sheet of paper using

sticky tape.

2. Identify each component and write its name or value beside

it.

3. Add the code (R1, R2, C1 etc.) if necessary.

Many projects from books and magazines label the

Crocodile clip

Photograph © Rapid Electronics

55

Page 56: final pnd

components with codes (R1, R2, C1, D1 etc.) and you should use the project's parts list to

find these codes if they are given.

4. Resistor values can be found using the resistor colour code which is explained on our

Resistors page. You can print out and make your own Resistor Colour Code Calculator to

help you.

5. Capacitor values can be difficult to find because there are many types with different

labelling systems! The various systems are explained on our Capacitors page.

Some components require special care when soldering. Many must be placed the correct way

round and a few are easily damaged by the heat from soldering. Appropriate warnings are given

in the table below, together with other advice which may be useful when soldering.

For more detail on specific components please see the Components page or click on the

component name in the table.

For most projects it is best to put the components onto the board in the order given below:

  Components Pictures Reminders and Warnings

1 IC Holders

(DIL sockets)

Connect the correct way round by

making sure the notch is at the correct

end. Do NOT put the ICs (chips) in yet.

2 Resistors No special precautions are needed with

resistors.

3 Small value

capacitors

(usually less than 1µF)

These may be connected either way

round. Take care with polystyrene

capacitors because they are easily

damaged by heat.

4 Electrolytic

capacitors

(1µF and greater)

Connect the correct way round. They

will be marked with a + or - near one

lead.

5 Diodes Connect the correct way round.

Take care with germanium diodes (e.g.

56

Page 57: final pnd

OA91) because they are easily damaged

by heat.

6 LEDs Connect 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.

7 Transistors Connect the correct way round.

Transistors have 3 'legs' (leads) so extra

care is needed to ensure the connections

are correct.

Easily damaged by heat.

8 Wire Links between

points on the circuit

board.

single core wire

Use single core wire, this is one solid

wire which is plastic-coated.

If there is no danger of touching other

parts you can use tinned copper wire,

this has no plastic coating and looks just

like solder but it is stiffer.

9 Battery clips, buzzers

and other parts with

their own wires

Connect the correct way round.

10 Wires to parts off the

circuit board, including

switches, relays,

variable resistors and

loudspeakers.

stranded wire

You should use stranded wire which is

flexible and plastic-coated.

Do not use single core wire because this

will break when it is repeatedly flexed.

11 ICs (chips) Connect the correct way round.

Many ICs are static sensitive.

Leave ICs in their antistatic packaging

57

Page 58: final pnd

until you need them, then

earth your hands by touching

a metal water pipe or

window frame before

touching the ICs.

Carefully insert ICs in

their holders: make sure all

the pins are lined up with the

socket then push down

firmly with your thumb.

What is solder?

Solder is an alloy (mixture) of tin and lead, typically 60% tin

and 40% lead. It melts at a temperature of about 200°C. Coating a

surface with solder is called 'tinning' because of the tin content of

solder. Lead is poisonous and you should always wash your hands after using solder.

Solder for electronics use contains tiny cores of flux, like the wires inside a mains flex.

The flux is corrosive, like an acid, and it cleans the metal surfaces as the solder melts. This is

why you must melt the solder actually on the joint, not on the iron tip. Without flux most joints

would fail because metals quickly oxidise and the solder itself will not flow properly onto a

dirty, oxidised, metal surface.

The best size of solder for electronics is 22swg (swg = standard wire gauge).

Desoldering

At some stage you will probably need

to desolder a joint to remove or re-position a

wire or component. There are two ways to

remove the solder:

1.  With a desoldering pump (solder

sucker)

Reels of solder

Using a desoldering pump (solder sucker)58

Page 59: final pnd

Set the pump by pushing the spring-loaded plunger down until it locks.

Apply both the pump nozzle and the tip of your soldering iron to the joint.

Wait a second or two for the solder to melt.

Then press the button on the pump to release the plunger and suck the molten solder into

the tool.

Repeat if necessary to remove as much solder as possible.

The pump will need emptying occasionally by unscrewing the

nozzle.

2.  With solder remover wick (copper braid)

Apply both the end of the wick and the tip of your soldering iron

to the joint.

As the solder melts most of it will flow onto the wick, away from the joint.

Remove the wick first, then the soldering iron.

Cut off and discard the end of the wick coated with solder.

After removing most of the solder from the joint(s) you may be able to remove the wire

or component lead straight away (allow a few seconds for it to cool). If the joint will not come

apart easily apply your soldering iron to melt the remaining traces of solder at the same time as

pulling the joint apart, taking care to avoid burning yourself.

First Aid for Burns

Most burns from soldering are likely to be minor and treatment is simple:

Immediately cool the affected area under gently running cold water

Keep the burn in the cold water for at least 5 minutes (15 minutes is recommended). If ice

is readily available this can be helpful too, but do not delay the initial cooling with cold

water.

Do not apply any creams or ointments.

The burn will heal better without them. A dry dressing, such as a clean handkerchief, may

be applied if you wish to protect the area from dirt.

Seek medical attention if the burn covers an area bigger than your hand.

Solder remover wick

59

Page 60: final pnd

To reduce the risk of burns:

Always return your soldering iron to its stand immediately after use.

Allow joints and components a minute or so to cool down before you touch them.

Never touch the element or tip of a soldering iron unless you are certain it is cold.

SOFTWARE REQUIREMENT

Mplab software

Pic programmer

SYSTEM DESCRIPTION

It is microcontroller based application by using microcontroller we

can develop application like autonomous robots, electronic projects and

other embedded system applications.

We are making pick n drop robot. We controlling this robot with

remote. We can use this for picking object from one place and move it to

another place and place it on other place. it is one of the embedded

application.

60

Page 61: final pnd

SOFTWARE DESCRIPTION

Mplab Software

mplab software is compiler(for convert high level language into

machine level language) for pic family microcontroller. In this we can

write the program in assembly as well as in c language. we used this

software for generating machine file of assembly program

Pic Programmer

Pic programmer is used for writing the machine file into

microcontroller room.

61

Page 62: final pnd

MAIN PROGAM IN ASSEMBLY LANGUAGE

;**********************************************************************

list p=16f877A ; list directive to define processor#include <p16f877A.inc> ; processor specific variable definitions

; __CONFIG _CP_OFF & _WDT_OFF & _BODEN_ON & _PWRTE_ON & _XT_OSC & _LVP_OFF

; '__CONFIG' directive is used to embed configuration data within .asm file.; The lables following the directive are located in the respective .inc file.; See respective data sheet for additional information on configuration word.

;***** VARIABLE DEFINITIONSw_temp EQU 0x30 ; variable used for context saving status_temp EQU 0x31 ; variable used for context savingirerror EQU 0x32 ; variable used for possible errors while receivingirtimer EQU 0x33 ; variable to save the bitlenght timeircounter EQU 0x34 ; variable used as a counter for the bitsIRCMD EQU 0x35 ; variable wich hold the received commandIRADR EQU 0x36 ; variable wich hold the received addressirtemp EQU 0x37 ; variable used for calc ircommand to utputsdelay1 EQU 0x38delay2 EQU 0x39

LED EQU 0x01 ; variable to assign LED outputIR EQU 0x00 ; variable to assign IR inputBANK3 EQU 020h

CBLOCK BANK3 DEL1 DEL2 COUNT COUNT2 hold ENDC

#DEFINE status STATUS

;**********************************************************************ORG 0x000 ; processor reset vector

goto main ; go to beginning of program

ORG 0x004 ; interrupt vector locationmovwf w_temp ; save off current W register contentsmovf STATUS,w ; move status register into W registermovwf status_temp ; save off contents of STATUS register

; isr code can go here or be located as a call subroutine elsewhere BTFSC PIR1,TMR1IF

62

Page 63: final pnd

GOTO INTRE BTFSC PIR1,CCP1IF GOTO FROMCCP GOTO EXIT INTRE MOVLW 0XB1 MOVWF TMR1H MOVLW 0XDF MOVWF TMR1L BCF PIR1,TMR1IF bsf PORTC,7 GOTO EXITFROMCCP BCF PIR1,CCP1IF BCF PORTC,7 GOTO EXIT

EXIT movf status_temp,w ; retrieve copy of STATUS registermovwf STATUS ; restore pre-isr STATUS register contentsswapf w_temp,fswapf w_temp,w ; restore pre-isr W register contentsretfie ; return from interrupt

init;/////////////////////////////////BSF INTCON, PEIEBANKSEL PIE1CLRF TRISCBSF PIE1,TMR1IEBSF PIE1,CCP1IE BANKSEL T1CON CLRF T1CONMOVLW 0XB1MOVWF TMR1HMOVLW 0XDFMOVWF TMR1LBCF PIR1,TMR1IF MOVLW 0X09MOVWF CCP1CONMOVLW 0XB5MOVWF CCPR1H MOVLW 0XC7MOVWF CCPR1LBSF PORTC,7

63

Page 64: final pnd

;/////////////////////////////// CLRF PORTA clrf hold ;Initialize PORTA by setting

CLRF PORTBCLRF PORTD ;output data latchesBSF PORTA,LED

; bsf hold,0 ; bsf PORTA,0; testing; MOVLW 0X07 ;Turn comparators off and; MOVWF CMCON ;enable pins for I/O

;functions; BCF STATUS, RP1; BSF STATUS, RP0 BANKSEL TRISA CLRF TRISD MOVLW B'00000110'

MOVWF ADCON1

;Select Bank1MOVLW b'11111101' ;Value used to initialize

;data directionMOVWF TRISA ;Set RA<1> as output

; clrf TRISCMOVLW b'00000000' ;Value used to initialize

;data directionMOVWF TRISB ;Set Rb<7:0> as outputsCLRF TRISBBCF STATUS, RP0 ;Select bank 0return ;return from subroutine

read_sony BSF irerror,0 ;Set the errorbit (will be cleared later when receiving a good code) BCF INTCON,GIE ;Disable interupts temporary CLRWDT ;Clear the watchdog timer BSF STATUS,RP0 ;Select bank1 MOVLW b'10000101' ;Sets the prescaler and timer 1:64 MOVWF OPTION_REG BCF STATUS,RP0 ;Select bank0 BANKSEL PORTABTFSC PORTA,0 ;If it was just a short parasite on the ir line skip reading code with error. GOTO end_sony CLRF TMR0 ;Clear timer to measure startbit lenghtsony_st1 BTFSS PORTA,IR ;Measure the startbit, WAIT UNTIL FIRST UP DETECTED GOTO sony_st1 MOVF TMR0,0 ;move value of bitlength to irtimer MOVWF irtimer MOVLW d'32' ;If startbit lenght less then 2ms then end reading code with error. SUBWF irtimer,0 BTFSS STATUS,C GOTO end_sony MOVLW d'213' ;If startbit was longer then 2,6ms then end reading ;code with error. ADDWF irtimer,0 ;Because when not valid startbit ir code is not sony protocol BTFSC STATUS,C ;So startbit must be between 2ms and 2,6ms. GOTO end_sony MOVLW d'7' ;Set ir counter to receive 7 commandbits.

64

Page 65: final pnd

MOVWF ircounterrd_sony_cmd CLRF TMR0 ;Measure the first part of the bitlength: If it ;is not between 300 and

900µssony_prt1_c BTFSC PORTA,IR ;Then exit inmediatly the routine with an error GOTO sony_prt1_c MOVF TMR0,0 MOVWF irtimer

MOVLW d'5' SUBWF irtimer,0 BTFSS STATUS,C GOTO end_sony

MOVLW d'241'

ADDWF irtimer,0 BTFSC STATUS,C GOTO end_sony CLRF TMR0

CLRWDT ;Clear the watchdogsony_prt2_c BTFSS PORTA,IR ;Measure part2 of the command bits and test

;if the length is between 300 and 1600µs GOTO sony_prt2_c ;If between these ranges test if second ;

bitpart is shorter or longer than 900µs MOVF TMR0,0 MOVWF irtimer MOVLW d'5' SUBWF irtimer,0 BTFSS STATUS,C GOTO end_sony MOVLW d'230' ADDWF irtimer,0 BTFSC STATUS,C GOTO end_sony MOVLW d'241' ADDWF irtimer,0 BTFSC STATUS,C GOTO sony_its_1sony_its_0 BCF STATUS,C ;if shorter than 900 µs the received bit is a zero RRF IRCMD,1 GOTO nxt_sony_cmdsony_its_1 BSF STATUS,C RRF IRCMD,1nxt_sony_cmd DECFSZ ircounter,1 ;test if all command bits are processed if not receive

;next GOTO rd_sony_cmd ;if longer than 900µs the received bit is a one BCF STATUS,C RRF IRCMD,1;Rotate ircmd one position to become correct

;command

MOVLW d'5' ;set ircounter to receive 5 address bits MOVWF ircounterrd_sony_adr CLRF TMR0sony_prt1_a BTFSC PORTA,IR ;measure firtst bitlenght if shorter than 300

;µs or longer than 900µs GOTO sony_prt1_a ;then exit inmediatly with error MOVF TMR0,0

65

Page 66: final pnd

MOVWF irtimer MOVLW d'5' SUBWF irtimer,0 BTFSS STATUS,C GOTO end_sony MOVLW d'241' ADDWF irtimer,0 BTFSC STATUS,C GOTO end_sony CLRF TMR0 CLRWDT ;clear watchdog timersony_prt2_a BTFSS PORTA,IR

GOTO sony_prt2_a ;measure second bitlenght if shorter than 300µs or longer than 1600µs MOVF TMR0,0 ;then exit with error MOVWF irtimer ;If between these ranges test if the bit is a one or zero (shorter or longer than 900µs) MOVLW d'5' SUBWF irtimer,0 BTFSS STATUS,C GOTO end_sony MOVLW d'230' ADDWF irtimer,0 BTFSC STATUS,C GOTO end_sony MOVLW d'241' ADDWF irtimer,0 BTFSC STATUS,C GOTO sony_its_1_asony_its_0_a BCF STATUS,C ;if second bitpart was shorter than 900µs it's a 0 RRF IRADR,1 GOTO nxt_sony_adrsony_its_1_a BSF STATUS,C ;if second bitpart was longer than 900µs it's a 1 RRF IRADR,1nxt_sony_adr DECFSZ ircounter,1 ;Test if all bits are processed if not receive next GOTO rd_sony_adr BCF STATUS,C ;Rotate tree time the iradr to become the correct

;address RRF IRADR,1 BCF STATUS,C RRF IRADR,1 BCF STATUS,C RRF IRADR,1 CLRF irerror ;Because every bitlength was measured between

;correct limits no errors occuredbcf PORTA,LED

end_sony BCF INTCON,T0IF ;Clear timer0 interrupt flag to avoid an interrupt BSF STATUS,RP0 MOVLW b'00000101' MOVWF OPTION_REG BCF STATUS,RP0 BTFSS hold,0 return BSF T1CON,TMR1ON ; INTERRUPT ENABLED FOR SERVO SOFT PWM BSF INTCON,GIE ;; RETURN

66

Page 67: final pnd

ir_to_outp movf IRCMD,W ;Save ircmd in irtemp to prevent loosing the ;received code

movwf irtempsublw d'90' ;Check if ir command is higher or

;equal then 10 if so exit and do nothingbtfss STATUS,Cgoto end_output

movf irtemp,W ;Check if ir command is 9 (bn 0) if so clear all outputssublw d'9'btfss status,Zgoto not_button0clrf PORTBCLRF PORTD ; STOPgoto end_output

not_button0 movf irtemp,W ;Check if ir command is 0 (bn1) if so toggle bit 0btfss status,Zgoto not_button1MOVLW B'00001010' ; forward

MOVWF PORTDmovlw b'00000010'xorwf PORTB,1goto end_output

not_button1 movf irtemp,W ;Check if ir command is 1 (bn2) if so toggle bit 1sublw d'1'btfss status,Zgoto not_button2movlw b'00000101' ;reversemovwf PORTDmovlw b'00000001'xorwf PORTB,1goto end_output

not_button2 movf irtemp,W ;Check if ir command is 2 (bn3) if so toggle bit 2

sublw d'2' btfss status,Zgoto not_button3

MOVLW B'00001001' ; LEFT MOVWF PORTD

call delayrout1 ; call delayrout1 CLRF PORTD

; movlw b'00000100'; xorwf PORTB,1

goto end_outputnot_button3 movf irtemp,W ;Check if ir command is 3 (bn4) if so toggle bit 3

sublw d'3'btfss status,Zgoto not_button4

MOVLW B'00000110' ; RIGHT MOVWF PORTD call delayrout1 ; call delayrout1 CLRF PORTD

67

Page 68: final pnd

movlw b'00001000'xorwf PORTB,1goto end_output

not_button4 movf irtemp,W ;Check if ir command is 4 (button5) if so toggle bit 4sublw d'4'btfss status,Zgoto not_button5

MOVLW B'10000000' ; UP MOVWF PORTD call delayrout1 call delayrout1 ; call delayrout1 ; call delayrout1 CLRF PORTD

movlw b'00010000'xorwf PORTB,1goto end_output

not_button5 movf irtemp,W ;Check if ir command is 5 (button6) if so toggle bit 5sublw d'5'btfss status,Zgoto not_button6MOVLW B'01000000' ; DOWN

MOVWF PORTD call delayrout1 call delayrout1 ; call delayrout1 ; call delayrout1 clrf PORTD

movlw b'00100000'xorwf PORTB,1goto end_output

not_button6 movf irtemp,W ;Check if ir command is 6 (button7) if so toggle bit 6sublw d'6'btfss status,Zgoto not_button7movlw b'01000000'xorwf PORTB,1goto end_output

not_button7 movf irtemp,W ;Check if ir command is 7 (button8) if so toggle bit 7sublw d'7'btfss status,Zgoto not_inchmovlw b'10000000'xorwf PORTB,1goto end_output

not_inch movf irtemp,W ;Check if ir command is 7 (button8) if so toggle bit 7sublw 0x3Bbtfss status,Zgoto not_prog_pbuttonMOVLW B'00000110'MOVWF PORTDCALL UTURNCLRF PORTDgoto end_output

68

Page 69: final pnd

not_prog_pbuttonmovf irtemp,W ;Check if ir command is 7 (button8) if so

toggle bit 7sublw 0x10btfss status,Zgoto not_prog_nbutton

bsf hold,0

goto end_output

not_prog_nbuttonmovf irtemp,W ;Check if ir command is 7 (button8) if so

toggle bit 7sublw 0x11btfss status,Zgoto end_outputCALL UNHOLDBCF hold,0goto end_output

end_output return

delayrout1 movlw d'255'movwf delay2

looping2 movlw d'255'movwf delay1

looping1 nopnopdecfsz delay1,1goto looping1decfsz delay2,1goto looping2return

MS1_DELAY

MOVLW .44MOVWF DEL1MOVLW .5MOVWF DEL2

DECFSZ DEL2, FGOTO $-1DECFSZ DEL1, FGOTO $-5MOVLW .50MOVWF DEL2DECFSZ DEL2, FGOTO $-1RETURN

main call inittest

69

Page 70: final pnd

call read_sony

; BTFSC hold,0 ; CALL HOLD

; BSF INTCON,GIEbtfsc irerror,0

goto test;BTFSC hold,0

; CALL HOLD call ir_to_outpcall delayrout1

;////////////////////////////////////////////////////////////////; btfsc hold,0 ; CALL HOLD

HOLDBSF INTCON,GIE

BSF INTCON, PEIEBANKSEL PIE1CLRF TRISCBSF PIE1,TMR1IEBSF PIE1,CCP1IE BANKSEL T1CON CLRF T1CONMOVLW 0XB1MOVWF TMR1HMOVLW 0XDFMOVWF TMR1LBCF PIR1,TMR1IF MOVLW 0X09MOVWF CCP1CONMOVLW 0XB5MOVWF CCPR1H MOVLW 0XC7MOVWF CCPR1LBSF PORTC,7BSF PIR1,TMR1ON

RETURN

UNHOLD MOVLW 0X80 MOVWF PORTC CALL MS1_DELAY CALL MS1_DELAY CALL MS1_DELAY CLRF PORTC

70

Page 71: final pnd

UTURN MOVLW .24 MOVWF COUNT CALL MS1_DELAY DECFSZ COUNT,F GOTO $-2 ; DECFSZ COUNT2,F ;GOTO UNHOLD RETURN INCH_OPEN MOVLW 0X80 MOVWF PORTC CALL MS1_DELAY CALL MS1_DELAY CALL MS1_DELAY CLRF PORTC MOVLW .10 MOVWF COUNT CALL MS1_DELAY DECFSZ COUNT,F GOTO $-2 ; DECFSZ COUNT2,F ; GOTO UNHOLD RETURN ; remaining code goes here

END ; directive 'end of program'

71

Page 72: final pnd

CIRCUIT DIAGRAM

72

Page 73: final pnd

PHOTOGRAPH OF PROJECT

73

Page 74: final pnd

FUTURE SCOPE

This is useful project .we can enlarge this project for industrial uses. This

project is like a jcb machine where we need a human power but this Project is

controlled by remote so one man can controlled more than one machine without

any physical exercise.

74