Sei sulla pagina 1di 54

HBeonLab s Off. No.

46, 1st Floor, Kadamba Complex Gamma-I, Greater Noida (India) - 201308 Contact us:

+91-1204298000 +919212314779

info@hbeonlabs.co m

training@hbeonlabs.co m www. hbeonlabs.com

TABLE OF CONTENTS

CHAPTER INTRODUCTION 1.1 Introduction 1.2 CIRCUIT DIAGRAM CHAPTER TWO: CONSTRUCTION 2.1 Component List 2.2 Power supply 2.2.1 Transformer 2.2.2 Diode 2.2.3 Regulator 2.2.4 filter Capacitor

ONE:

DESIGN

AND

2.2.5 Circuit diagram power supply 2.3 LDR 2.4 LED 2.5 Registers 2.6 Capacitors CHAPTERTHREE: SIMULATOR, BURNE R 3.1 Communication 3.1.1 DCE 3.1.1 232 DTE and RSSERIAL COMMUNICATION, PROGRAMMER,

Serial

3.1.3 Handshaking

RTS/CTS

3.1.4 Specifying Baud Rate, Parity & Stop bits 3.1.5 DCE Baud Rates 3.1.6 Testing a DB-9 RS-232 serial port in HyperTerminal 3.1.7 Making loopback a

3.1.8 Initializations 3.1.9 Serial transfer using TI and RI flags

3.2 Programmer 3.3 Simulator 3.4 Burner

CHAPTER FOUR: CONCLUSION 4. Conclusion 1 4.2 Problems Encountered

RECOMMENDATION

AND

REFERENCE S APPENDIX FLOWCODE

C:

PROGRAM

CHAPTER ONE:

PRINCIPLE OF OPERATION
The circuit is powered by a 12V automatic power supply which changes over automatically to a backup power source when there is power outage on the main A.C. supply. The circuit uses a popular timer I C LM358 which is connected as a comparator with pin-6 connected with positive rail; the output goes high (1) when the trigger pin 3 is lower than voltage level at pin no 2. Conversely the output goes low (0) when it is above pin no 2 level. So a small change in the voltage of pin-2 is enough to change the level of output (pin-1) from 1 to 0 and 0 to 1. This change in the output level of the I.C. LM 358 is due to the sensing ability of the light dependent resistor which senses the presence of light. The output has only two states high and low and cannot remain in any intermediate stage. The comparator goes high (1) when it becomes dark and the microcontroller sends a switching signal to the relay and the security lights are turned ON. In the event of power outage in the A.C. mains an automatic changeover to the backup power source occurs immediately. After a period of delay the microcontroller sends an alarm signal to the buzzer and at the restoration of power supply the alarm stops. approach used in the design of this project is the modular approach where the overall design was broken into functional block diagrams and each block in the diagram represents a section of the circuit that carries out a specific function and these functions are laid out by the system flow chart. The system was designed using five functional blocks, as shown in the diagram below.

The

POWER SUPPLY

CONTROL UNIT SWITCHING UNIT LOAD

Figure 1.1 System block diagram

Circuit Diagram of the Project:

CHAPTER DESIGN
2.1 LIST:

TWO:

CONSTRUCTION

AND

COMPONENT

2.2 POWER SUPPLY: Power supply is a reference to a source of electrical power. A device or system that supplies electrical or other types of energy to an output load or group of loads is power supply called a PSU . The term is most commonly applied to electrical energy supplies, less uni or t often and rarely to mechanical ones, to others. Here in our application we need a 5v DC power supply for all electronics involvedThis requires step down transformer, rectifier, voltage regulator, and filter project. in the circuit for of 5v DC power. Here a brief description of all the components are given as generation follows: 2.2.1 TRANSFORMER: A transformer is a device that transfers electrical energy from one circuit to another through inductively coupled conductors the transformer's coils or "windings". Except for air-core transformers, the conductors are commonly wound around a single iron-rich core, or around but magnetically-coupled cores. A varying current in the first or "primary" separate winding a varying magnetic field in the core (or cores) of the transformer. This varying creates magnetic field induces a varying electromotive force (EMF) or "voltage" in the "secondary" winding. is called mutual This effect induction.

A primary coil or winding. A secondary coil or winding. that supports the coils or A core windings.

A diode is a semiconductor device which allows current to flow through it in only one dir ection. Although a transistor is also a semiconductor device, it does not operate the way a diode does. A diode is specifically made to allow current to flow through it in only one direction. Some ways in which the diode can be used are listed here.

A diode can be used as a diode can be converts AC (Alternating Current) to (Alternating Current) to DC A rectifier that used as a rectifier that converts AC DC (Direct A diode can be used as (Direct a rectifier that converts AC (Alternating Current) to DC (Direct Current) for a power supply device. Current) for a power supply device. Diodes can bebe used toseparate the signal from radio Diodes can used to separate the signal fro frequencies. Diodes can be be used as an on/off switch that controls Diodes can used as an on/off switch that controls current. current.

Fig. 2.26 Symbol

Diode

is used to indicateThis symbol circuit diagram. The a diode in athe symbol is a diode in a is used to indicate meaning of circuit diagram. The meaning of the is used to indicatesymbol is a circuit diagram. The meaning of the symbol is a diode in (Anode) (Cathode). Current flows from the anode side to the cathode anode side to the cathode side. side.

Although all diodes operate with the same general principle, there are different types suited to Although all diodes operate with the same general principle, there are different types suited to different all diodes operate with the same general principle, there used for the types suited Althoughapplications. For example, the following devices are best are different applications to different applications. For example, the following devices are best used for the applications note different applications. For example, the following devices are best used for the applications d.

(Zener Diode) (Zener Diode)

Voltage regulation diode

The circuit symbol is . It is used to regulate voltage, by taking advantage of the fact that Zener diodes tend to stabilize at It is used to regulate voltage, by taking advantage of the fact that Zener diodes tend to stabilize at a is used to regulate voltage, by taking advantage of the fact direction. It certain voltage when that voltage is applied in the opposite that Zener diodes tend to stabilize at a certain voltage when that voltage is applied in the opposite direction. Light diode emitting

The circuit symbol is . This type of diode emits light when current flows through it in the forward direction. (Forward This type of diode emits light when current flows through it in the forward direction. (Forward biase This type of diode emits light when current flows through it in the forward direction. (Forward d)

Characteristics of Diode

The graph above shows the electrical characteristics of a typical diode. When a small voltage is applied to the diode in the forward direction, current flows easily. Because the diode has a certain amount of resistance, the voltage will drop slightly as current flows through the diode. A typical diode causes a voltage drop of about 0.6 ) (In the case of silicon diode, F 1V (V almost 0.6V )

This voltage drop needs to be taken into consideration in a circuit which uses many diodes in series. Also, the amount of current passing through the diodes must be considered.

When voltage is applied in the reverse direction through a diode, the diode will have a great resistance to current flow. Different diodes have different characteristics when reverse-biased. A given diode should be selected depending on how it will be used in the circuit. The current that will flow through a diode biased in the reverse direction will vary from several mA to just A, which is very small.

The limiting voltages and currents permissible must be considered on a case by case basis. For The limiting voltages and currents permissible must be considered on a case by case basis. For example, when using diodescurrents permissible must be considered on a case by ecase basis. Forbe required to they will The limiting voltages and for rectification, part of the tim example, when using diodes for rectification, part of the time they will be required to withstand a reverse voltage. If the diodes are not chosen carefully, they will break down. reverse voltage. If the diodes are not chosen carefully, they will break down. reverse voltage. If the diodes are not chosen carefully, they will break down.

2.2.3 .2.3 REGULATOR IC REGULATOR IC ) (78XX (78XX IC used as a voltageis a three pinconverts unregulated DC current It converts unregulated DC current into It regulator. It IC used as a voltage regulator. into regulated IC used as a voltage regulator. It converts unregulated DC current into regulated regulated

DC current.

Normally we get fixed output by connecting the voltage regulator at the output of the filtered DC (see in above diagram). It can also be used in circuits to get a low DC voltage from a high DC voltage (for example we use 7805 to get 5V from 12V). There are two types of voltage regulators 1. fixed voltage regulators (78xx, 79xx) 2. variable voltage regulators (LM317) In fixed voltage regulators there is another classification 1. +ve voltage regulators 2. -ve voltage regulators POSITIVE VOLTAGE REGULATORS This include 78xx voltage regulators. The most commonly used ones are 7805 and 7812. 7805 gives fixed 5V DC voltage if input voltage is in (7.5V, 20V).

3.2. CIRCUIT 5 SUPPLY

DIAGRAM

OF

POWER

2.3 LDR
A photoresistor or light dependent resistor (LDR) is resistor whose resistance decreases with increasing incident light intensity; in other words, itaexhibits photoconductivity . It can also be referred to as photoconductor or CdS device, from "cadmium sulfide," which is the material a from which the device is made and that actually exhibits the variation in resistance with light level. Note that CdS is not a semiconductor in the usual sense of the word (not doped silicon). A photoresistor is made of a high resistance semiconductor . If light f alling on the device is of give high enough frequency , photons absorbed by the semiconductor elect rons enough bound energy to jump into the conduction band . The resulting f ree electron (and hole partner) its conduct electricity, thereby lowering resistance .

The symbol for a photoresisto The symbol for a photoresisto The symbol for a photoresisto

A photoelectric device can be eit her intrinsic or extrinsic. An intrinsic semiconductor has its A photoelectric devicesemiconductor,intrinsic or isIn intrinsic devices the and is not an efficient can be eitcarriers silicon. not an An intrinsic semiconductor has its own charge her e.g. and extrinsic. efficient semiconductor, e.g. silicon. In intrinsic devices A photoelectric device can be eit her intrinsic or extrinsic. An devices the intrinsic semiconductor has its and not an efficient must have , and available photonsemiconductor, e.g. the onlyishence theelectrons are in the enough silicon. I n intrinsic valence , Extrinsic the the electron across only hence devices have impurit the entire band . and available electrons are haveies, also energy to excitephoton mustin the enough bandga . Extrinsic devices have impurities, the energy whose ground state energy alsoentire electron across , added to excite thecalled dopantsis closer to the conduction band; since the p , added whose ground as far to jump, lower to the photons (i.e., longer wavelengt hs and lower electrons do not have state energy is closer energyconduction band; since the , added whose ground state energy is closer to the conduction band; since the electrons do are have as far trigger the device. If frequencies) not sufficient toto jum p, lower energy photons (i.e., longer wavelengt sample lower a hs and of silicon has some of its atoms electrons do not sufficient toto jum p, lower energy photonsof silicon has wavelengthsatoms (i.e., longer some of frequencies) are have as far trigger the device. If will be extra electrons availableits and lower replaced by phosphorus atoms (impurities), there a sample for replaced by phosphorus atoms of an extrinsic semiconductor. electrons available for conduction. This is an example (impurities), there will be extraPhotoresistors are basically replaced by This is an example (impurities), there will be extraPhotoresistors are basically phosphorus atoms of an extrinsic semiconductor. electrons available for conduction. photocells conduction. This is an example of an extrinsic semiconductor. Photoresistors are basically

A light dependent resistorlight dependent resistor A A light dependent resistor

Application s

cadmium sulphide Photoresistors come in many diff erent types. Inexpensive cadmiumconsumer items such as erent types. Inexpensive Photoresistors come in many diffcamera light m eters, street light s, clock radios, in many sulphide in many consumer items such as camera light m eters, street lights, clock radios, and outdoor clocks. in many consumer items such as camera light meters, street lights, clock radios, incandescent dynamic compressor They are also used in some together with a small incandescent dynamic compressors p or light emitting diode lam to control gain reduction. to control gain indium antimonide Lead (PbS) indium antimonide sulphide and the mid infrared spectral region. the mid infraredfor infrared det spectral region. infrared , and are used ectors available infrared , and are used for spectroscop

cells can be found alarm devices

(InSb) LDRs (light dependent resistor) are used (InSb) LDRs (light are for Ge :Cu photoconductors are among the best far photoconductors are among the best far-

infrared astronomy

an d

LDRs or Light Dependent Resistors are ver y useful especially in light/dark sensor circuits. LDRs or Light Dependent Resistors are ver y useful especially in light/dark sensor circuits. Normally the resistance of an LDR is very ver y useful especially in as 1000 000sensor circuits. LDRs or Light Dependent Resistors are high, sometimes as high light/dark ohms, Normally the resistance of an LDR is very high, sometimes as high as 1000 000 ohms, they are illuminated withof an LDR is very high, sometimes as high as 1000 000 ohms, but when Normally the resistance light resistance drops dramatically they are illuminated with light resistance drops dramatically

Light Resistor

Dependent

2.4 LED

1 Watt LEDFull intensity 350mA, Maximum current 500mA 2.8V Volt drop @ 350mA

3 Watt LEDFull intensity 700mA, Maximum current 1A 4.3V Volt drop @ 700mA

5 Watt LED (multi-die package)Full intensity 700mA, Maximum current 1A 7.1V Volt drop @ 700mA

5 Watt LED (single-die)Full intensity 1.5A

Forward Voltage (VF) drop across LEDDiodes are current driven!

Wavelength variationsCrystal and junction growth defects Brightness variationsCrystal defects resulting formation of phonons and nonradiation energy transfer Temperature Junction temperatureof the device affects each of the parameters abov e

2.5 Resistors The resistor's function is to reduce the flow of electric current. There are two classes of resistors; fixed resistors and the variable resistors. They are also classified according to the material from which they are made. The typical resistor is made of either carbon film or metal film. There are other types as well, but these are the most common. The resistance value of the resistor is not the only thing to consider when selecting a resistor for use in a circuit. The "tolerance" and the electric power ratings of the resistor are also important. The tolerance of a resistor denotes how close it is to the actual rated resistence value. For example, a 5% tolerance would indicate a resistor that is within 5% of the specified resistance value. Fixed Resistors A fixed resistor is one in which the value of its r esistance cannot change. Carbon resistors film

This is the most general purpose, cheap resistor. Usually the tolerance of the resi This is the most general purpose, cheap resistor. Usually the tolerance of the resi 5%. is the most general1/8W, 1/4W andresistor. are frequently used. of the resistance value is This Power ratings of purpose, cheap 1/2W Usually the tolerance 5%. Power ratings of 1/8W, 1/4W and 1/2W are frequently used. Carbon film resistors of 1/8W, 1/4W and they tend to be electrically noisy. Metal film resistors 5%. Power ratings have a disadvantage; 1/2W are frequently used. Carbon film resistors have a disadvantage; they tend to be electrically noisy. Metal film resistors are recommended forhave ain analog circuits. However, Ielectrically noisy. Metal film resistors Carbon film resistors use disadvantage; they tend to be have never experienced are recommended for use in analog circuits. However, I have never experienced withrecommended for use in analog circuits. However,isIas follows. experienced any problems are this noise. The physical size of the different resistors have never with this noise. The physical size of the different resistors is as follows.

Rough size Thickness Thickness (mm) (mm) From the top of the photograph From the top of the photograph Rating power (W) 1/8 2 1/4 2 1/2 3 3 6 9 Lengt h (mm )

1/8 W 1/4W 1/2W

The physical size of the different The physical size of the different resistors resistors Variable Resistors There are two general ways in which variable resistors are used. One is the variable resistor There are two general ways in which variable resistors are used. One is the variable resistor which value is easily ways in which volume adjustment used. One is other is semi There are two general changed, like thevariable resistors are of Radio. The the variable resistor which value is easily changed, like the volume adjustment of Radio. The other is semi stor that is is meant tothat adjusted byvolume but a technician. It The a to adjust It resistor be is not the to be adjusted of Radio. but other is semi-fixed which value not easily changed, like meantanyone adjustment by anyone is used technician. the is used to stor that is not meant to be adjusted by anyone but a technician. It is used to adjust the adjust the operating condition of the circuit by the technician. Semi fixed resistors are used to operating condition of the circuit by the technician. Semi-fixed resistors are used to compensate compensate for the inaccuracies of the resistors, and to fine The rotation angle of the for the inaccuracies of the resistors, and to fine-tune a circuit. The rotation angle of the variable variable

resistor is usually about 300 degrees. Some variable resistors must be turned many times to use the whole range of resistance they offer. This allows for very precise adjustments of their value. These are called Potentiometers." "Potentiometers" or "Trimmer

Variable Resistors

In the photograph to the left, the variable resistor typically used for volume controls can e seen on the far right. Its value is very easy to adjust. The four resistors at the center of the photograph are the semi-fixed type. These ones are mounted on the printed circuit board. The two resistors on the left are the trimmer potentiometers.

Resistance value Vs. Rotation Angle

There are three ways in which a variable resistor's value can There are three ways in which a variable resistor's value can change according to the rotation angle of its axis.

second half of its axis, it changes very quickly. The "A" type variable resistor is typically used second half of its axis, it changes very quickly. The "A" type variable resistor is typically used lume control of a axis, it for example. Itquickly. The "A" type variable resistorsubtly. It second half of its radio, changes very is well suited to adjust a low sound is typically used lume control of a radio, for example. It is well suited to adjust a low sound subtly. It small changes in loud sounds. A larger change is needed as the vo small changes in loud sounds. A larger change is needed as the volume is increased. These "A" type variable resistors are sometimes called "audio taper" potentiometers. type variable resistors are sometimes called "audio taper" potentiometers.

related. The rate of change is the same, or linear, throug related. The rate of change is the same, or linear, throughout the sweep of the axis. This type suits a resistance value adjustment in a circuit, a balance circuit and so on. suits a resistance value adjustment in a circuit, a balance circuit and so on.

way to way to rapidly, rapidly, rapidly,

type type and and and

"A". In the early stages of the "A". In the early stages of the rotation of the axis, the resistance value changes in the second half, the change occurs more slowly. This type isn't too much used. It in the second half, the change occurs more slowly. This type isn't too much used. It in the second half, the change occurs more slowly. This type isn't too much used. It

Color Value Tolerance

Multiplier

(% )

Black

0 -

Example 1 (Brown=1),(Black=0), (Orange=3) 10 x 10 3 = 10k ohm Tolerance(Gold) 5% =

Brown

1 1 1

Red

2 2 2

Orange

3 0.05 4 5 0.5 6 0.25 7 0.1 8 9 5 10 20 8 4

Yello w Green

Blue

Viole t Gray

Example 2 (Yellow=4),(Violet=7),(Black=0), (Red=2) 2 470 x 10 = 47k ohm Tolerance(Brown) 1% =

Whit e Gold

-1

Silver

-2

Non e

Resistor color code 2.6 Capacitors The capacitor's function is to store electricity, or electrical energy. The capacitor also functions as a filter, passing alternating current (AC), and blocking direct current (DC). This symbol F is used to indicate a capacitor in a circuit diagram. The capacitor is constructed with two electrode plates facing each other, but separated by an insulator. When DC voltage is applied to the capacitor an electric charge is stored on each electrode. While the capacitor is , charging up, current flows. The current will stop flowing when the capacitor has fully charged.

Types of Capacitor

Types of Capacitor

Breakdown voltage when using a capacitor, we must pay attention to the maximum voltage which can be used. This is the "breakdown voltage." The breakdown voltage depends on the kind of capacitor being used. We must be especially careful with electrolytic capacitors because the breakdown voltage is comparatively low. The breakdown voltage of electrolytic capacitors is displayed as Working Voltage. The breakdown voltage is the voltage that when exceeded will cause the dielectric (insulator) inside the capacitor to break down and conduct. When this happens, the failure can be catastrophic .

Electrolytic capacitors)

Capacitors

(Electrochemical

type

Aluminum is used for the electrodes by using a thin oxidization membrane. Large values of capacitance can be obtained in comparison with the size of the capacitor, because the dielectric used is very thin. The most important characteristic of electrolytic capacitors is that they have polarity. They have a positive and a negative electrode. [Polarised] This means that it is very important which way round they are connected. If the capacitor is subjected to voltage exceeding its working voltage, or if it is connected with incorrect polarity, it may burst. It is extremely dangerous, because it can quite literally explode. Make absolutely no mistakes. Generally, in the circuit diagram, the positive side is indicated by a "+" (plus) symbol. Electrolytic capacitors range in value from about 1 F to thousands of F. Mainly this type of capacitor is used as a ripple filter in a power supply circuit, or as a filter to bypass low frequency signals, etc. Because this type of capacitor is comparatively similar to the nature of a coil in construction, it isn't possible to use for high-frequency circuits. (It is said that the frequency characteristic is bad.) The photograph on the left is an example of the different values of electrolytic capacitors in which the capacitance and voltage differ.

Electrolytic Capacitors From the left to right: 1 F (50V) [diameter 5 mm, high 12 mm] 47 F (16V) [diameter 6 mm, high 5 mm] 100F (25V) [diameter 5 mm, high 11 mm] 220F (25V) [diameter 8 mm, high 12 mm] 1000 F (50V) [diameter 18 mm, high 40 mm] The size of the capacitor sometimes depends on the manufacturer. So the sizes shown here on this page are just examples.

Ceramic Capacitors Ceramic capacitors are constructed with materials such as titanium acid barium used as the dielectric. Internally, these capacitors are not constructed as a coil, so they can be used in high frequency applications. Typically, they are used in circuits which bypass high frequency signals to ground. These capacitors have the shape of a disk. Their capacitance is comparatively small. The capacitor on the left is a 100pF capacitor with a diameter of about 3 mm. The capacitor on 3 the right side is printed with 103, so 10 x pF becomes 0.01 F. The diameter of the 10 disk is

about 6 mm. Ceramic capacitors have no polarity. Ceramic capacitors should not be used for analog circuits, because they can distort the signal.

Ceramic Capacitors

Variable Capacitors Variable capacitors are used for adjustment etc. of frequency mainly. On the left in the photograph is a "trimmer," which uses ceramic as the dielectric. Next to it on the right is one that uses polyester film for the dielectric. The pictured components are meant to be mounted on a printed circuit board.

Variable Capacitors

When adjusting the value of a variable capacitor, it is advisable to be careful. One of the component's leads is connected to the adjustment screw of the capacitor. This means that the value of the capacitor can be affected by the capacitance of the screwdriver in your hand. It is better to use a special screwdriver to adjust these components.

Relay
A relay is an electrically operated switch . Many relays use an electromagnet to operate a

switching mechanism mechanically, but other operating principles are also used. Relays are used where it is necessary to control a circuit by a low-power signal (with complete electrical isolation between control and controlled circuits), or where several circuits must be controlled by one signal. The first relays were used in long distance telegraph circuits, repeating the signal coming in from one circuit and re-transmitting it to another. Relays were used extensively in telephone exchanges and early computers to perform logical operations. A type of relay that can handle the high power required to directly control an electric motor or other loads is called contactor . Solid-state control power circuits with no a relays instead using a semiconductor device to perform switching. Relays with calibrated operating characteristics and sometimes multiple operating coils are used to protect electrical circuits from overload or faults; in modern electric power systems these functions are performed by digital instruments still called " Basic design and operation protective relays " moving parts ,

Simple elect romechanical relay.

Small "cradle" relay often used in electronics. The "cradle" term refers to the shape of the relay's armat ure.

A simple electromagnetic relay consists of a yoke which provides a low reluctance

coil of wire wrapped around a path for magnetic flux, a movable iron

soft iron core

, an iron

armature , and one

or more sets of contacts (there are two in the relay pictured). The armature is hinged to the yoke and mechanically linked to one or more sets of moving contacts. It is held in place by a spring so t hat when the relay is de-

energized there is an air gap in the magnetic circuit.

In this condition, one of the two sets of contacts in the relay pictured is closed, and is open. Other relays may have more or fewer sets of the other set contacts depending on their function. The relay in the picture also has a wire connecting the yoke. This ensures continuity of the circuit between the armature to the moving contacts on the armature, and the circuit track on printed the yoke, which is soldered to the board the PCB. When electric is passed through the coil it an current generates a activates the armature, and the consequent movement of the movable contact(s) or breaks (depending upon construction) a connection with a either makes fixed If the set of contacts was closed when the relay was de-energized, contact. then the opens the contacts and breaks the connection, and vice movement versa if the contacts were open. When the current to the coil is switched off, the armatureby a force, approximately half as strong as the magnetic force, returned is to its position. Usually this force is provided by a spring, but gravity is relaxed also used in industrial motor starters. Most relays are manufactured to commonly operate In a low-voltage application this reduces noise; in a high voltage or quickly. current application it arcing . reduces When the coil is energized direct , a diode is often placed across the with coil to dissipate the energy from thecurrent collapsing magnetic field at deactivation, which would otherwise voltage dangerous semiconductor circuit generate a spike to components. Some automotive relays include a diode inside the relay case. Alternatively, a contact protection network consisting of a capacitor and resistor in series snubber circuit) may absorb the surge. If the coil is designed to be ( wit alternating energized (AC), a small copper "shading ring" can be crimped to h of the solenoid, creating a small out-of-phase current which the end current increases pull [1] minimumthe on the armature during the AC cycle. A solid-state relay uses thyristo or other solid-state switching a r activated by the control signal, to switch the controlled load, instead of a solenoid. An optocouple (a light-emitting r diode used to isolate control and controlled circuits (LED) coupled with a circuit (PCB) via that

magnetic field

device, ) can be

photo transistor

3.1 Serial Communication


3.1.1 DTE and DCE The terms DTE and DCE are very common in the data communications market. DTE is short for Data Terminal Equipment and DCE stands for Data Communications Equipment. As the full DTE name indicates this is a piece of device that ends a communication line, whereas the DCE provides a path for communication. Let's say I have a computer on which wants to communicate with the Internet through a modem and a dial-up connection. To get to the Internet I tell my modem to dial the number of my provider. After my modem has dialed the number, the modem of the provider will answer my call and I will hear a lot of noise. Then it becomes quiet and I see my login prompt or my dialing program tells me the connection is established. Now I have a connection with the server from my provider and I can surf the Internet [13]. 3.1.1 RS232 In telecommunications, RS-232 is a standard for serial binary data signals connecting between a DTE (Data terminal equipment) DCE (Data Circuit-terminating Equipment)[14]. and a It is commonly used in computer serial . In RS-232, data is sent as a time-series of bits. ports Both synchronous and asynchronous transmissions are supported by the standard. In addition to the data circuits, the standard defines a number of control circuits used to manage the connection between the DTE and DCE [14]. Each data or control circuit only operates in one direction that is, signaling f rom a DTE to the attached DCE or the reverse. Since transmit data and receive data are separate circuits, the interface can operate in a full duplex manner, supporting concurrent data flow in both directions [15]. The standard does not define character framing within the data stream, or character encoding.

Female plug

pin

3.1.3 RTS/CTS Handshaking The standard RS-232 use of the RTS and CTS lines is asymmetrical. The DTE asserts RTS to indicate a desire to transmit and the DCE asserts CTS in response to grant permission. This allows for half-duplex modems that disable their transmitters when not required, and must transmit a synchronization preamble to the receiver when they are re enabled [16]. There is no way for the DTE to indicate that it is unable to accept data from the DCE. A nonstandard symmetrical alternative is widely used: CTS indicates permission from the DCE for the DTE to transmit, and RTS indicates permission from the DTE for the DCE to transmit [17]. The "request to transmit" is implicit and continuous. The standard defines RTS/CTS as the signaling protocol for flow control for data transmitted from DTE to DCE. The standard has no provision for flow control in the other direction. In practice, most hardware seems to have repurposed the RTS signal for this function [18]. A minimal 3-wire RS-232 connection consisting only of transmits data, receives data and ground, and is commonly used when the full facilities of RS232 are not required. When only flow control is required, the RTS and CTS lines are added in a 5-wire version .

3.1.4 Specifying Baud Rate, Parity & Stop bits

Serial communication using RS-232 requires four parameters: the baud rate of the transmission, the number of data bits encoding a character, the sense of the optional , and parity bit number of stop bits. Each transmitted character is packaged in a character frame that consists of a single start bit followed by the data bits, the optional parity bit, and the stop bit or bits. A typical character frame encoding the letter "m" is shown here.

the

I specified the parameters as baud rate 9600 bps, 8 data bits, no parity, and 1 stop bit NThis was set in pre-operational phase while setting up the modem through the 1). hyper terminal, as per the serial transmission standards in 8051 microcontroller [19]. 3.1.5 DCE Baud Rates 110,300,1200,2400 480 , 115200 ,230400,460800,921600 , 0 9600,19200,38400,5760 (Possible 0, Baud Rates) Baud Rate Used Power on default rate 3.1. Testing a DB-9 RS-232 serial port in 6 HyperTerminal This procedure explains how to troubleshoot a COM card using HyperTerminal. Before testing my serial ports, I first hook up a loopback. A loopback connects the output signal (TXD) to the input signal (RXD) in a single serial port connector to make it seem like there are two ports connected together. 3.1. Making a loopback 7

(96008

Step s V Turn off the computer. V Connect RXD (pin 2) and TXD (pin 3) of the serial port. available, or any kind of conductive wire, even a paper clip [21]. V Turn on the I am now ready to test the computer. port.

Use a loop-back connector if

DB9 interface Running HyperTerminal Step Procedure Description V Launch HyperTerminal. In Windows, select Programs/ Accessories/ Communications/HyperTermina l. V Create a new When prompted, give the session any name I session. wish. V Select the COM # associated with the I am now set up to test the computer, port. V With the session open, type any text. If the text I type is echoed on the screen, the port is functioning properly. V Close the session. V Repeat all above steps to test additional you will first need to connect the Loopback Ports [22]. On the other ports using the steps above. 3.1.8 Initializations

The baud rate of the modem was set to be 9600 bps using the HyperTerminal, The ECHO from the modem was turned off using the command ATE0 at the HyperTerminal. For serial transmission and reception to be possible both the DTE and DCE should have same operational baud rates. Hence to set the microcontroller at a baud rate of 9600bps, I set terminal count of Timer 1 at 0FFh (clock frequency = 1.8432). The TCON and SCON registers were set accordingly . 3.1.9 Serial transfer using TI and RI flags After setting the baud rates of the two devices both the devices are now ready to transmit and receive data in form of characters. Transmission is done when TI flag is set and similarly data is known to be received when the Rx flag is set. The microcontroller then sends an AT command to the modem in form of string of characters serially just when the TI flag is set. After reception of a character in the SBUF register of the microcontroller (response of MODEM with the read message in its default format or ERROR message or OK message), the RI flag is set and the received character is moved into the physical memory of the microcontroller [22].

3.2

Programmer

When we have to learn about a new computer we have to familiarize about the machine we are using, and we can do it by studying the internal hardware design capability (devices architecture), and also to know about the size, number and the size of the registers. A microcontroller is a single chip that contains the processor (the CPU), non-volatile memory for the program (ROM or flash), volatile memory for input and output (RAM), a clock and an I/O unit. Also called a "computer on a chip," billions of microcontroller units control (MCUs) are

embedded each year in a myriad of products from toys to appliances to automobiles. single vehicle can use 70 or more microcontrollers. The following picture example, a For describes a block general diagram of microcontroller. 89S52: The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of in-system programmable Flash memory. The device is manufactured using Atmels high-density nonvolatile memory technology and is compatible with the industrystandard 80C51 and pin out. The on-chip Flash allows the program memory to be instruction set reprogrammedby a conventional nonvolatile memory pro-grammar. By combining a in-system or versatile 8-bit CPU with in-system programmable Flash on a monolithic chip, the Atmel AT89S52 microcontroller, which provides a highly flexible and cost-effective solution to powerful is a many, embedded control applications. The AT89S52 provides the following standard features: 8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters, a six-vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitr y. In addition, the AT89S52 is designed with static logic for down to zero frequency and supports two software selectable power saving operation modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port, and interrupt to continue functioning. The Power-down mode saves the RAM con-tents but system freezes the disabling all other chip functions until the next oscillator, interrupt

hardware is driven byhardware program instructions, or software. Once familiar withsoftware. Once The a set of is driven by a set of program instructions, or hardware anddriven by thewithof program instructions, or software.the problems easily. familiar user hardware is software, a set can then apply the microcontroller to Once familiar with hardware and software, the user can then apply the microcontroller to the problems easily. hardware and software, the user can then apply the microcontroller to the problems easily. The pin diagram of the 8051 shows all of the input/output pins unique to microco The pin diagram of the 8051 shows all of the input/output pins unique to microco The pin diagram of the 8051 shows all of the input/output pins unique to microcontrollers:

The following are some of the capabilities of 8051 microcontroller. V Internal ROM and V RAM I/O ports with programmable V pins Timers and V counters Serial data communication The 8051 architecture consists of these specific features: 16 bit PC &data pointer (DPTR)program status word 8 bit (PSW) stack pointer 8 bit (SP) Internal ROM 4k Internal RAM of 128 bytes. 4 register banks, each containing 8 registers of general purpose data 80 bits memory 32 input/output pins arranged as four 8 bit ports: P0-P3 bit timer/counters: T0Two 16 T1 Two external and three internal interrupt Oscillator and clock circuits.

sources

3.3 Simulator KEIL Micro Vision is an integrated development environment used to create software to be run on embedded systems (like a microcontroller). It allows for such software to be written either in assembly or C programming languages and for that software to be simulated on a computer before being loaded onto the microcontroller. The software used is c programming

Keil Vision3 is an IDE (Integrated Development Environment) that helps write, compile, and debug embedded programs. It encapsulates the following components: A project manager. A make facility. Tool configuration. Editor . A powerful debugger. To create a RFID BASED ANIMAL IDENTIFICATION SYSTEM FOR DAIRY FORMS project in uVision3: 1. Select Project - New Project. 2. Select a directory and enter the name of the project file. 3. Select Project Select Device and select a device from Device Database. 4. Create source files to add to the project 5. Select Project - Targets, Groups, and Files. Add/Files, select Source Group1, and add the Source files to the project. 6. Select Project - Options and set the tool options. Note that when the target device is selected from the Device Database all-special options are set automatically. Default memory model settings are optimal for most applications. 7. Select Project - Rebuild all target files or Build target. To create a new project, simply start micro vision and select Project=>New Project from the pulldown menus. In the file dialog that appears, a filename and directory was chosen for the project. It is recommended that a new directory be created for each project, as several files will be generated. Once the project has been named, the dialog shown in the figure below will appear, prompting the user to select a target device. The chip being used is the AT89S52, which is listed under the heading Atmel.

Next, Micro Vision was instructed to generate a HEX file upon program compilation. A HEX file is a standard file format for storing executable code that is to be loaded onto the microcontroller. In the Project Workspace pane at the left, rightclick on Target 1 and select Options for Target 1 .Under the Output tab of the resulting options dialog, ensure that both the Create Executable and Create HEX File options are checked. Then click OK. Next, a file must be added to the project that will contain the project code. To do this, expand the Target 1 heading, rightclick on the Source Group 1 folder, and select Add files Create a new blank file (the file name should end in .c), select it, and click Add. The new file should now appear in the Project Workspace pane under the Source Group 1 folder. Double-click on the newly created file to open it in the editor. To compile the program, first save all source files by clicking on the Save All button, and then click on the Rebuild All Target Files to compile the program as shown in the figure below. If any errors or warnings occur during compilation, they will be displayed in the output window at the bottom of the screen. All errors and warnings will reference the line and column number in which they occur along with a description of the problem so that they can be easily located [23]. When the program has been successfully compiled, it can be simulated using the integrated debugger in Keil Micro Vision. To start the debugger, select Debug=>Start/Stop Debug Session from the pulldown menus. At the left side of the debugger window, a table is displayed containing several key parameters about the simulated microcontroller, most notably the elapsed time (circled in the figure below). Just above that, there are several buttons that control code execution. The Run button will cause the program to run continuously until a breakpoint is reached, whereas the Step Into button will execute the next line of code and then pause (the current position in the program is indicated by a yellow arrow to the left of the code). 3.4 PRO51 BURNER SOFTWARE PRO51 BURNER provides you with software burning tools for 8051 based Microcontrollers in their Flash memory. The 51 BURNER tools, you can burn AT89C/SXXXX series of ATMEL

microcontrollers .

A vie w o f PRO 5 1

4.1 Conclusion The circuit is powered by a 12V automatic power supply which changes over automatically to a backup power source when there is power outage on the main A.C. supply. The circuit uses a timer I C LM358 which is connected as a comparator with pin-6 connected with popular positive rail; the output goes high (1) when the trigger pin 3 is lower than voltage level at pin no 2. the output goes low (0) when it is above pin no 2 level. So a small Conversely change in the voltage of pin-2 is enough to change the level of output (pin-1) from 1 to 0 and 0 to 1. This in the output level of the I.C. LM 358 is due to the sensing ability of the light change dependent resistor which senses the presence of light. The output has only two states high and low and cannot remain in an y intermediate stage. The comparator goes high (1) when it becomes dark and the microcontroller sends a switching signal to the relay and the security lights are turned the event of power outage in the A.C. mains an automatic changeover to the ON. In backupsource occurs immediately. After a period of delay the microcontroller sends an power alarm signal to the buzzer and at the restoration of power supply the alarm stops

4.2 Problem Encountered During soldering, many of the connection become short cktd. So desolder the and did soldering connection A again. the crystal oscillator was broken during mounting. So it has to be leg of replaced. damaged when we switched ON the supply so we replace it by the LED`s get new one. Care should be taken while soldering. There should be no shorting of joints. power supply should Proper maintain.

we

4. References: 3 1. 8051 and embedded system by Mazidi and Mazidi 2. All datasheets from www.datasheetcatalog.com

3. About www.atmel.com

AT89s8252

from

4. www.triindia.co.in 5. About www.dallas.com APPENDIX A APPENDIX A PROGRAM FLOW #include<reg51.h>

And

DS1820

from

sbit s1=P3^2;

sbit RELAY=P1^0;

void main() { while(0 ) { If(s1==1 ) { RELAY=1 ;

} else {

RELAY=0 ;

} }

Potrebbero piacerti anche