adaptive light system

Upload: aliza-khan

Post on 05-Apr-2018

224 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/31/2019 Adaptive Light System

    1/54

    HBeonLabs

    Off. No. 46, 1st Floor, Kadamba Complex

    Gamma-I, Greater Noida (India) - 201308

    Contact us:

    +91-120-4298000+91-9212314779

    [email protected]

    [email protected]

    m

    www.

    hbeonlabs.com

  • 7/31/2019 Adaptive Light System

    2/54

  • 7/31/2019 Adaptive Light System

    3/54

    TABLE OF CONTENTS

    CHAPTER ONE:

    INTRODUCTION

    1.1Introduction1.2 CIRCUITDIAGRAM

    CHAPTER TWO: DESIGN AND

    CONSTRUCTION

    2.1 ComponentList

    2.2 Power supply

    2.2.1

    Transformer2.2.2Diode

    2.2.3Regulator

    2.2.4 Capacitorfilter

    2.2.5 Circuit diagram powersupply

    2.3LDR

    2.4LED

    2.5Registers

    2.6Capacitors

    CHAPTERTHREE: SERIAL COMMUNICATION, PROGRAMMER,

    SIMULATOR,BURNE

    R

    3.1 Ser ia lCommunication

    3.1.1 DTE andDCE

    3.1.1 RS-232

  • 7/31/2019 Adaptive Light System

    4/54

    3.1.3 RTS/CTSHandshaking

    3.1.4 Specifying Baud Rate, Parity &Stop bits

    3.1.5 DCE BaudRates

    3.1.6 Testing a DB-9 RS-232 serial port inHyperTerminal

    3.1.7 Making aloopback

    3.1.8Initializations

    3.1.9 Serial transfer using TI and RIflags

    3.2Programmer

    3.3Simulator

    3.4Burner

    CHAPTER FOUR: RECOMMENDATION AND

    CONCLUSION

    4.

    1

    Conclusion

    4.2 ProblemsEncountered

    REFERENCE

    S

    APP EN DI X C: P ROG RAM

    FLOWCODE

  • 7/31/2019 Adaptive Light System

    5/54

    CHAPTER ONE:

    PRINCIPLE OF OPERATION

    The circuit is powered by a 12V automatic power supply which changes overautomatically to a

    backup power source when there is power outage on the main A.C. supply. The circuituses a

    popular timer I C LM358 which is connected as a comparator with pin-6connected with

    positive rail; the output goes high (1) when the trigger pin 3 is lower than voltagelevel at pin

    no 2. Conversely the output goes low (0) when it is above pin no 2 level. So a smallchange in

    the voltage of pin-2 is enough to change the level of output (pin-1) from 1 to 0 and0 to 1.

    This change in the output level of the I.C. LM 358 is due to the sensing ability ofthe light

    dependent resistor which senses the presence of light. The output has only two stateshigh 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 thesecurity

    lights are turned ON. In the event of power outage in the A.C. mains an automaticchangeover

    to the backup power source occurs immediately. After a period of delay themicrocontroller

    sends an alarm signal to the buzzer and at the restoration of power supply thealarm stops.

    The

    approach used in the design of this project is the modular approach where the overalldesign

    was broken into functional block diagrams and each block in the diagram represents asection of

    the circuit that carries out a specific function and these functions are laid out by thesystem flow

    chart. The system was designed using five functional blocks, as shown in thediagram below.

  • 7/31/2019 Adaptive Light System

    6/54

    POWER SUPPLY

    CONTROL UNIT SWITCHING UNIT LOAD

    Figure 1.1 System block diagram

    .

    Circuit Diagram of the Project:

  • 7/31/2019 Adaptive Light System

    7/54

    CHAPTER TWO: CONSTRUCTION AND

    DESIGN2.1 COMPONENT

    LIST:

  • 7/31/2019 Adaptive Light System

    8/54

    2.2 POWER

    SUPPLY:

    Power supply is a reference to a source of electrical power. A device or system thatsupplieselectrical or other types of energy to an output load or group of loads is

    called apower supply

    uni

    t

    or PSU . The term is most commonly applied to electrical energy supplies, lessoften tomechanical ones, and rarely to

    others.

    Here in our application we need a 5v DC power supply for all electronicsinvolved in theproject. This requires step down transformer, rectifier, voltage regulator, and filtercircuit forgeneration of 5v DC power. Here a brief description of all the components are given asfollows:

    2.2.1

    TRANSFORMER:

    A transformer is a device that transfers electrical energy from one circuit to anotherthroughinductively coupled conductors the transformer's coils or "windings". Except for

    air-coretransformers, the conductors are commonly wound around a single iron-rich core, oraroundseparate but magnetically-coupled cores. A varying current in the first or "primary"windingcreates a varying magnetic field in the core (or cores) of the transformer. This varyingmagneticfield induces a varying electromotive force (EMF) or "voltage" in the "secondary"winding. Thiseffect is called mutualinduction.

  • 7/31/2019 Adaptive Light System

    9/54

    A primary coi l or winding.

    A secondary coil orwinding.

    A core that supports the coils orwindings.

  • 7/31/2019 Adaptive Light System

    10/54

  • 7/31/2019 Adaptive Light System

    11/54

  • 7/31/2019 Adaptive Light System

    12/54

  • 7/31/2019 Adaptive Light System

    13/54

    A diode is a semiconductor device which allows current to flow through it in only one direction.Although a transistor is also a semiconductor device, it does not operate the way a diodedoes. Adiode is specifically made to allow current to flow through it in only one direction. Someways inwhich the diode can be used are listedhere.

  • 7/31/2019 Adaptive Light System

    14/54

    A diode can be used as a rectifier that converts AC (Alternating Current) to DC(Direct

    diode can be used as a rectifier that converts AC (Alternating Current) to DC (Directdiode can be used as a rectifier that converts AC (Alternating Current) to DC (Direct

    Current) for a power supply device.Current) for a power supply device.

    Diodes can be used to separate thesignal fro

    Diodes can be used to separate the signal from radiofrequencies.

    Diodes can be used as an on/off switch that controlscurrent.

    Diodes can be used as an on/off switch that controlscurrent.

    Fig. 2.26 DiodeSymbol

    This symbol is used to indicate a diode in a circuit diagram. The meaning of thesymbol is

    s used to indicate a diode in a circuit diagram. The meaning of the symbol iss used to indicate a diode in a circuit diagram. The meaning of the symbol is

    (Anode)(Cathode).

    Current flows from the anode side to the cathodeside.

    anode side to the cathodeside.

    lthough all diodes operate with the same general principle, there are different types suited tolthough all diodes operate with the same general principle, there are different types suited tolthough all diodes operate with the same general principle, there are different types suited todifferent applications. For example, the following devices are best used for the applications

    different applications. For example, the following devices are best used for the applicationsdifferent applications. For example, the following devices are best used for the applicationsnote

    d.

    Voltage regulation diode(Zener Diode)

    (Zener Diode)The circuit symbol is.

    It is used to regulate voltage, by taking advantage of the fact that Zener diodes tend to stabilize atIt is used to regulate voltage, by taking advantage of the fact that Zener diodes tend to stabilize atIt is used to regulate voltage, by taking advantage of the fact that Zener diodes tend to stabilize ata certain voltage when that voltage is applied in the opposite direction.a certain voltage when that voltage is applied in the opposite direction.

    Light emitting

    diode

    The circuit symbol is.

    This type of diode emits light when current flows through it in the forward direction. (ForwardThis type of diode emits light when current flows through it in the forward direction. (ForwardThis type of diode emits light when current flows through it in the forward direction. (Forwardbiase

    d)

  • 7/31/2019 Adaptive Light System

    15/54

    Characteristics of Diode

    The graph above shows the electrical characteristics of a typical diode. When a smallvoltage isapplied to the diode in the forward direction, current flows easily. Because thediode has acertain amount of resistance, the voltage will drop slightly as current flows through thediode. Atypical diode causes a voltage drop of about 0.6 -1V (V

    ) (In the case of silicon diode,almost

    F

    0.6V)

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

    When voltage is applied in the reverse direction through a diode, the diode willhave a greatresistance to current flow. Different diodes have different characteristics whenreverse-biased. Agiven diode should be selected depending on how it will be used in the circuit. Thecurrent thatwill flow through a diode biased in the reverse direction will vary from several mA tojust A,which i s verysmall.

  • 7/31/2019 Adaptive Light System

    16/54

    The limiting voltages and currents permissible must be considered on a case by case basis. ForThe limiting voltages and currents permissible must be considered on a case by case basis. ForThe limiting voltages and currents permissible must be considered on a case by case basis. Forexample, when using diodes for rectification, part of the timexample, when using diodes for rectification, part of the time they will be required to withstand a

    e they will be required towithstand a

    everse voltage. If the diodes are not chosen carefully, they will break down.everse voltage. If the diodes are not chosen carefully, they will break down.everse voltage. If the diodes are not chosen carefully, they will break down.

    2.2.3 REGULATOR IC

    (78XX

    .2.3 REGULATOR IC

    (78XX

    )

    It is a three pin IC used as a voltage regulator. It converts unregulated DC current intoregulated

    IC used as a voltage regulator. It converts unregulated DC current into regulatedIC used as a voltage regulator. It converts unregulated DC current into regulated

    DC current.

  • 7/31/2019 Adaptive Light System

    17/54

    Normally we get fixed output by connecting the voltage regulator at the output of thefiltered

    DC (see in above diagram). It can also be used in circuits to get a low DC voltagefrom a high

    DC voltage (for example we use 7805 to get 5V from 12V). There are two types ofvoltage

    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 voltageregulators. The

    most commonly used ones are 7805 and 7812. 7805 gives fixed 5V DC voltage ifinput voltage

    is in (7.5V,20V).

  • 7/31/2019 Adaptive Light System

    18/54

  • 7/31/2019 Adaptive Light System

    19/54

  • 7/31/2019 Adaptive Light System

    20/54

  • 7/31/2019 Adaptive Light System

    21/54

  • 7/31/2019 Adaptive Light System

    22/54

  • 7/31/2019 Adaptive Light System

    23/54

  • 7/31/2019 Adaptive Light System

    24/54

    3.2.5

    CIRCUIT DIAGRAM OF POWER

    SUPPLY

    2.3 LDR

    A photoresistor or light dependent resistor (LDR) is

    a

    resistor whose resistance decreases

    with increasing incident light intensity; in other words, it exhibits photoconductivity . It can also

    bereferred to as

    aphotoconductor or CdS device, from "cadmium sulfide," which is the material

    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 isofhigh enough frequency , photons absorbed by the semiconductor give

    bound

    elect rons enough

    energy to jump into the conduction band . The resulting f ree electron (andits

    hole partner)

    conduct electricity, thereby lowering resistance .

  • 7/31/2019 Adaptive Light System

    25/54

    The symbol for a photoresisto A light dependent resistorThe symbol for a photoresisto A light dependent resistorThe symbol for a photoresisto A light dependent resistor

    photoelectric device can be eit her intrinsic or extrinsic. An intrinsic semiconductor has its

    photoelectric device can be eit her intrinsic or extrinsic. An intrinsic semiconductor has itsphotoelectric device can be eit her intrinsic or extrinsic. An intrinsic semiconductor has its

    own charge carriers and is not an efficient semiconductor, e.g. silicon. In intrinsic devicesthe

    and is not an efficient semiconductor, e.g. silicon. In intrinsic devices theand is not an efficient semiconductor, e.g. silicon. I n intrinsic devices theonly available electrons are in theonly available electrons are in the

    valenceband

    , and hence the photon must have enough, and hence the photon must have enoughenergy to excite the electron across the entire

    energy to excite the electron across the entire

    bandga

    p

    . Extrinsic devices have impurit ies, also

    . Extrinsic devices have impurities, alsocalled dopants, added whose ground state energy is closer to the conduction band; since the

    , added whose ground state energy is closer to the conduction band; since the, added whose ground state energy is closer to the conduction band; since theelectrons do not have as far to jump, lower energy photons (i.e., longer wavelengt hs and lowerelectrons do not have as far to jum p, lower energy photons (i.e., longer wavelengt hs and lower

    electrons do not have as far to jum p, lower energy photons (i.e., longer wavelengths and lowerfrequencies) are sufficient to trigger the device. If

    frequencies) are sufficient to trigger the device. If a sample of silicon has some of its atoms

    a sample of silicon has some of its atoms

    eplaced by phosphorus atoms (impurities), there will be extra electrons available for

    eplaced by phosphorus atoms (impurities), there will be extra electrons available for

    eplaced by phosphorus atoms (impurities), there will be extra electrons available for

    conduction. This is an example of an extrinsic semiconductor. Photoresistors are basicallyconduction. This is an example of an extrinsic semiconductor. Photoresistors are basically

    conduction. This is an example of an extrinsic semiconductor. Photoresistors are basicallyphotocells

    Application

    sPhotoresistors come in many diff erent types. InexpensivePhotoresistors come in many diff erent types. Inexpensivecadmium sulphidecadmium sulphide

    cells can be found

    n many consumer items such as camera light m eters, street light s, clock radios,n many consumer items such as camera light m eters, street lights, clock radios,

    n many consumer items such as camera light meters, street lights, clock radios,

    alarm devices ,

    and outdoor clocks.

    They are also used in somedynamic compressordynamic compressors

    together with a smallncandescentncandescent lam p or light emitting diode to control gainto control gain reduction.

    Lead

    sulphide

    (PbS)

    and

    ndium antimonide

    ndium antimonide

    (InSb) LDRs (light dependent resistor)

    are

    (InSb) LDRs (light dependent resistor) are used

    for

    the mid infrared spectral region.the mid infrared spectral region.

    Ge :Cuphotoconductors are among the best farphotoconductors are among the best far-

    , and are used for, and are used for

    infraredastronomy

    and

    nfrarednfrared

    infrared det ectors

    availablespectroscopy

  • 7/31/2019 Adaptive Light System

    26/54

    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.LDRs or Light Dependent Resistors are ver y useful especially in light/dark sensor circuits.ormally the resistance of an LDR is very high, sometimes as high as 1000 000 ohms,

    ormally the resistance of an LDR is very high, sometimes as high as 1000 000 ohms,ormally the resistance of an LDR is very high, sometimes as high as 1000 000 ohms, but when

    they are illuminated with light resistance drops dramaticallythey are illuminated with light resistance drops dramatically

    Light Dependent

    Resistor

  • 7/31/2019 Adaptive Light System

    27/54

    2.4

    LED

    1 Watt LEDFull intensity 350mA, Maximum current500mA

    2.8V Vol t drop @350mA

    3 Watt LEDFull intensity 700mA, Maximum current1A

    4.3V Vol t drop @700mA

    5 Watt LED (multi-die package)Full intensity 700mA, Maximumcurrent 1A

    7.1V Vol t drop @700mA

    5 Watt LED (single-die)Full intensity1.5A

    Forward Voltage (VF) drop across LEDDiodes are currentdriven!

  • 7/31/2019 Adaptive Light System

    28/54

    Wavelength variationsCrystal and junction growthdefects

    Brightness variationsCrystal defects resulting formation of phonons andnon-radiation energy

    transfer

    Temperature Junction temperatureof the device affects each of theparametersabov

    e

    2.5 Resistors

    The resistor's function is to reduce the flow of electric current. There are two classes ofresistors;fixed resistors and the variable resistors. They are also classified according to thematerial fromwhich they are made. The typical resistor is made of either carbon film or metal film.There areother types as well, but these are the most common. The resistance value of the resistor isnot theonly thing to consider when selecting a resistor for use in a circuit. The "tolerance"and theelectric power ratings of t he resistor are also important. The tolerance of a resistordenotes howclose it is to the actual rated resistence value. For example, a 5% tolerance wouldindicate aresistor that is within 5% of the specified resistancevalue.

    Fixed Resistors

    A fixed resistor is one in which the value of its r esistance cannotchange.

    Carbon film

    resistors

  • 7/31/2019 Adaptive Light System

    29/54

    This is the most general purpose, cheap resistor. Usually the tolerance of the resiThis is the most general purpose, cheap resistor. Usually the tolerance of the resiThis is the most general purpose, cheap resistor. Usually the tolerance of the resistance value is5%. Power ratings of 1/8W, 1/4W and 1/2W are frequently used.5%. Power ratings of 1/8W, 1/4W and 1/2W are frequently used.5%. Power ratings of 1/8W, 1/4W and 1/2W are frequently used.Carbon film resistors have a disadvantage; they tend to be electrically noisy. Metal film resistorsCarbon film resistors have a disadvantage; they tend to be electrically noisy. Metal film resistorsCarbon film resistors have a disadvantage; they tend to be electrically noisy. Metal film resistorsare recommended for use in analog circuits. However, I have never experiencedare recommended for use in analog circuits. However, I have never experiencedare recommended for use in analog circuits. However, I have never experienced any problemsith this noise. The physical size of the different resistors is as follows.

    ith this noise. The physical size of the different resistors is as follows.

    Rough size

    Rating powerThickness

    Thickness

    Lengt

    h(W)(mm)

    (mm)

    (mm

    )From the top of the photographFrom the top of the photograph 1/8

    23

    1/8W1/4W

    1/4 2 6

    1/2W

    1/2 3 9

    The physical size of the different

    resistors

    The physical size of the different

    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 resistorThere are two general ways in which variable resistors are used. One is the variable resistorhich value is easily changed, like the volume adjustment of Radio. The other is semi

    hich value is easily changed, like the volume adjustment of Radio. The other is semihich value is easily changed, like the volume adjustment of Radio. The other is semi-fixedresistor that is not meant to be adjusted by anyone but a technician. It is used to

    adjust the

    stor that is not meant to be adjusted by anyone but a technician. It is used to adjust thestor that is not meant to be adjusted by anyone but a technician. It is used to adjust theoperating condition of the circuit by the technician. Semioperating condition of the circuit by the technician. Semi-fixed resistors are used to compensate

    fixed resistors are used tocompensate

    for the inaccuracies of the resistors, and to finefor the inaccuracies of the resistors, and to fine-tune a circuit. The rotation angle of the variable

    The rotation angle of thevariable

  • 7/31/2019 Adaptive Light System

    30/54

    resistor is usually about 300 degrees. Some variable resistors must be turned manytimes to usethe whole range of resistance they offer. This allows for very precise adjustments oftheir value.

    These are called "Potentiometers" or "TrimmerPotentiometers."

    Variable Resistors

    In the photograph to the left, the variable r esistor typically used for volume controls cane seenon the far right. Its value is very easy to adjust. The four resistors at the center of thephotographare the semi-fixed type. These ones are mounted on the printed circuit board. The tworesistorson the lef t a re the t rimmer potentiometers.

  • 7/31/2019 Adaptive Light System

    31/54

    Resistance value Vs. Rotation Angle

    There are three ways in which a variable resistor's value canThere are three ways in which a variable resistor's value can change according to the rotation

    angle of itsaxis.

    second half of its axis, it changes very quickly. The "A" type variable resistor is typically usedsecond half of its axis, it changes very quickly. The "A" type variable resistor is typically usedsecond half of its axis, it changes very quickly. The "A" type variable resistor is typically usedume control of a radio, for example. It is well suited to adjust a low sound subtly. Itume 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 vosmall 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.

    elated. The rate of change is the same, or linear, througelated. 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.

    ay to type "A". In the early stages of theay to type "A". In the early stages of the rotation of the axis, the resistance value changes

    apidly, and in the second half, the change occurs more slowly. This type isn't too much used. Itapidly, and in the second half, the change occurs more slowly. This type isn't too much used. Itapidly, and in the second half, the change occurs more slowly. This type isn't too much used. It

  • 7/31/2019 Adaptive Light System

    32/54

    Color Value Multiplier

    Tolerance (%)

    Black 0 0-

    Brown 1 1 1Example1(Brown=1),(Black=0),(Orange=3) Red 2 2 210 x 10 = 10k ohm3

    Tolerance(Gold) =5% Orange 3 3

    0.05

    Yello

    w

    4 4-

    Green 5 50.5

    Blue 6 60.25

    Viole

    t

    7 70.1

    8 8-

    Gray

    9 9-

    Whit

    eExample2(Yellow=4),(Violet=7),(Black=0),(Red=2) - -1

    5Gold

    470 x 10 = 47k ohm2

    Tolerance(Brown) =1% Silver - -2

    10

    Non

    e- -20

  • 7/31/2019 Adaptive Light System

    33/54

    Resistor color code

    2.6 Capacitors

    The capacitor's function is to store electricity, or electrical energy. The capacitor alsofunctionsas a filter, passing alternating current (AC), and blocking direct current (DC). Thissymbol F isused to indicate a capacitor in a circuit diagram. The capacitor is constructed with twoelectrodeplates facing each other, but separated by an insulator. When DC voltage isapplied to thecapacitor,

    an electric charge is stored on each electrode. While the capacitor ischarging up,

    current flows. The current will stop flowing when the capacitor has fullycharged.

    Types of Capacitor

    Types of Capacitor

  • 7/31/2019 Adaptive Light System

    34/54

    Breakdown voltage

    when using a capacitor, we must pay attention to the maximum voltage which can beused. Thisis the "breakdown voltage." The breakdown voltage depends on the kind of capacitorbeing used.We must be especially careful with electrolytic capacitors because the breakdownvoltage iscomparatively low. The breakdown voltage of electrolytic capacitors is displayed asWorkingVoltage. The breakdown voltage is the voltage that when exceeded will cause thedielectric(insulator) inside the capacitor to break down and conduct. When this happens, thefailure can becatastrophic.

    Electrolytic Capacitors (Electrochemical type

    capacitors)

    Aluminum is used for the electrodes by using a thin oxidizationmembrane.Large values of capacitance can be obtained in comparison with the size of thecapacitor,because the dielectric used is very thin. The most important characteristic ofelectrolyticcapacitors 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 thecapacitor issubjected to voltage exceeding its working voltage, or if it is connected with incorrectpolarity, itmay burst. It is extremely dangerous, because it can quite literally explode. Makeabsolutely nomistakes. 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 thistype ofcapacitor is used as a ripple filter in a power supply circuit, or as a filter to bypass lowfrequencysignals, etc. Because this type of capacitor is comparatively similar to the nature of acoil inconstruction, it isn't possible to use for high-frequency circuits. (It is said that thefrequencycharacteristic isbad.)The photograph on the left is an example of the different values of electrolytic

    capacitors inwhich the capacitance and voltagediffer.

  • 7/31/2019 Adaptive Light System

    35/54

    Electrolytic Capacitors

    From the left toright:

    1 F (50V) [diameter 5 mm, high 12mm]

    47 F (16V) [diameter 6 mm, high 5mm]

    100F (25V) [diameter 5 mm, high 11mm]

    220F (25V) [diameter 8 mm, high 12mm]

    1000 F (50V) [diameter 18 mm, high 40mm]

    The size of the capacitor sometimes depends on the manufacturer. So the sizes shownhere onthis page are jus texamples.

    Ceramic Capacitors

    Ceramic capacitors are constructed with materials such as titanium acid barium usedas thedielectric. Internally, these capacitors are not constructed as a coil, so they can be usedin highfrequency applications. Typically, they are used in circuits which bypass high frequencysignals

    to ground. These capacitors have the shape of a disk. Their capacitance iscomparatively small.The capacitor on the left is a 100pF capacitor with a diameter of about 3 mm. Thecapacitor onthe right side is printed with 103, so 10 x10

    pF becomes 0.01 F. The diameter of thedisk is

    3

  • 7/31/2019 Adaptive Light System

    36/54

    about 6 mm. Ceramic capacitors have no polarity. Ceramic capacitors should not beused foranalog circuits, because they can distort thesignal.

    Ceramic Capacitors

    Variable Capacitors

    Variable capacitors are used for adjustment etc. of frequency mainly. On theleft in thephotograph is a "trimmer," which uses ceramic as the dielectric. Next to it on the right isone thatuses polyester film for the dielectric. The pictured components are meant to bemounted on aprinted circuitboard.

    Variable Capacitors

  • 7/31/2019 Adaptive Light System

    37/54

    When adjusting the value of a variable capacitor, it is advisable to be careful.One of thecomponent's leads is connected to the adjustment screw of the capacitor. This meansthat thevalue of the capacitor can be affected by the capacitance of the screwdriver in yourhand. It isbetter to use a special screwdriver to adjust thesecomponents.

    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

    signalcoming 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 t he high power required to directly control an electric motor or

    other loads is calleda

    contactor . Solid-staterelays

    control power circuits with no moving parts ,

    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 " protective relays "

    Basic design and operation

  • 7/31/2019 Adaptive Light System

    38/54

    Simple elect romechanical relay.

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

    relay'sarmat ure.

    A simple electromagnetic relay consists of a coil of wire wrapped around a soft iron core , an ironyoke which provides a low reluctance path for magnetic flux, a movable 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

    energized there is an air gap in the magnetic

    circuit.a spring so t hat when the relay is

    de-

  • 7/31/2019 Adaptive Light System

    39/54

    In this condition, one of the two sets of contacts in the relay pictured isclosed, andthe other set is open. Other relays may have more or fewer sets of

    contactsdepending on their function. The relay in the picture also has a wireconnecting thearmature to the yoke. This ensures continuity of the circuit between themovingcontacts on the armature, and the circuit track on

    the

    printed circuit

    board

    (PCB)

    viathe yoke, which is soldered to thePCB.Whenan

    electriccurrent

    is passed through the coil itgenerates a

    magneticfield

    that

    activates the armature, and the consequent movement of the movablecontact(s)either makes or breaks (depending upon construction) a connection with a

    fixedcontact. If the set of contacts was closed when the relay was de-energized,

    then themovement opens the contacts and breaks the connection, and viceversa if thecontacts were open. When the current to the coil is switched off, the

    armature isreturned by a force, approximately half as strong as the magnetic force,to itsrelaxed position. Usually this force is provided by a spring, but gravity is

    also usedcommonly in industrial motor starters. Most relays are manufactured to

    operatequickly. In a low-voltage application this reduces noise; in a high voltage orcurrentapplica tion i treduces

    arcing .

    When the coil is energizedwith

    directcurrent

    , a diode is often placed across thecoilto dissipate the energy from the collapsing magnetic field at

    deactivation, whichwould otherwise

    generate a

    voltage

    spike

    dangerous

    to

    semiconductor circuit

    components. Some automotive relays include a diode inside the relay

    case.Alternatively, a contact protection network consisting of a capacitor andresistor inseries

    (

    snubber circuit) may absorb the surge. If the coil is designed to be

    energizedwith

    alternatingcurrent

    (AC), a small copper "shading ring" can be crimped tothe

    end of the solenoid, creating a small out-of-phase current whichincreases theminimum pull on the armature during the ACcycle.

    [1]

    A solid-state relay uses

    a

    thyristo

    r

    or other solid-state switching device,

    activated bythe control signal, to switch the controlled load, instead of a

    solenoid.Anoptocouple

    r(a light-emitting

    diode(LED) coupled witha

    phototransistor

    ) can be

    used to isolate control and controlled

    circuits

  • 7/31/2019 Adaptive Light System

    40/54

    3.1 Serial Communication

    3.1.1 DTE and

    DCE

    The terms DTE and DCE are very common in the data communications market. DTE isshort for

    Data Terminal Equipment and DCE stands for Data Communications Equipment. Asthe full

    DTE name indicates this is a piece of device that ends a communication line, whereasthe DCE

    provides a path for communication. Let's say I have a computer on which wants tocommunicate

    with the Internet through a modem and a dial-up connection. To get to the Internet Itell my

    modem to dial the number of my provider. After my modem has dialed the number, themodem

    of the provider will answer my call and I will hear a lot of noise. Then it becomes quietand I see

    my login prompt or my dialing program tells me the connection is established. Now Ihave a

    connection with the server from my provider and I can surf the Internet[13].

    3.1.1 RS-

    232

    In telecommunications, RS-232 is a standard for serial binary data signals connectingbetween a

    DTE (Data terminal equipment)and a

    DCE (Data Circuit-terminating Equipment)[14].It is

    commonly used in computer serialports

    . In RS-232, data is sent as a time-series of bits.Both

    synchronous and asynchronous transmissions are supported by the standard. Inaddition to the

    data circuits, the standard defines a number of control circuits used to manage theconnection

    between the DTE and DCE [14]. Each data or control circuit only operates in onedirection that

    is, signaling f rom a DTE to the attached DCE or the reverse. Since transmit data andreceive data

    are separate circuits, the interface can operate in a full duplex manner, supportingconcurrent

    data flow in both directions [15]. The standard does not define character framingwithin the data

    stream, or characterencoding.

  • 7/31/2019 Adaptive Light System

    41/54

    Female 9 pinplug

    3.1.3 RTS/CTS

    Handshaking

    The standard RS-232 use of the RTS and CTS lines is asymmetrical. The DTE assertsRTS to

    indicate a desire to transmit and the DCE asserts CTS in response to grantpermission. 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 non-standard

    symmetrical alternative is widely used: CTS indicates permission from the DCE for theDTE 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 signalingprotocol

    for flow control for data transmitted from DTE to DCE. The standard has no provisionfor flow

    control in the other direction. In practice, most hardware seems to have repurposedthe RTS

    signal for this function [18]. A minimal 3-wire RS-232 connection consisting only oftransmits

    data, receives data and ground, and is commonly used when the full facilities of RS-232 are not

    required. When only flow control is required, the RTS and CTS lines are added ina 5-wire

    version.

    3.1.4 Specifying Baud Rate, Parity & Stop

    bits

  • 7/31/2019 Adaptive Light System

    42/54

    Serial communication using RS-232 requires four parameters: the baud rate of thetransmission,

    the number of data bits encoding a character, the sense of the optionalparity bit

    , and thenumber

    of stop bits. Each transmitted character is packaged in a character frame that consists ofa 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 shownhere.

    I specified the parameters as baud rate 9600 bps, 8 data bits, no parity, and1 stop bit

    (9600-

    8

    N-

    1).

    This was set in pre-operational phase while setting up the modem through thehyper

    terminal, as per the serial transmission standards in 8051microcontroller [19].

    3.1.5 DCE Baud Rates

    110,300,1200,2400,

    480

    0

    ,9600,19200,38400,57600,

    115200 ,230400,460800,921600(Possible

    Baud Rates) Baud Rate Used Power ondefault rate

    3.1.6

    Testing a DB-9 RS-232 ser ia l port in

    HyperTerminal

    This procedure explains how to troubleshoot a COM card using HyperTerminal. Beforetesting

    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 aretwo ports

    connectedtogether.

    3.1.7

    Making a loopback

  • 7/31/2019 Adaptive Light System

    43/54

    Steps

    V Turn off thecomputer.

    VConnect RXD (pin 2) and TXD (pin 3) of the serialport.

    Use a loop-back connector if

    available, or any kind of conductive wire, even a paper clip[21].

    V Turn on thecomputer.

    I am now ready to test theport.

    DB9interface

    RunningHyperTerminal

    Step Pr ocedureDescription

    VLaunch HyperTerminal. In Windows, select Programs/Accessories/

    Communications/HyperTerminal.

    V Cr ea te a n ewsession.

    When prompted, give the session any name Iwish.

    VSelect the COM # associated with thecomputer,

    I am now set up to test theport.

    VWith the session open, type any text. If the text I type is echoed on the screen, theport is

    functioningproperly.

    V Close thesession.

    VRepeat all above steps to test additional you will first need to connect the

    Loopback Ports[22]. On the other ports using the stepsabove.

    3.1.8

    Initializations

  • 7/31/2019 Adaptive Light System

    44/54

    The baud rate of the modem was set to be 9600 bps using the HyperTerminal, TheECHO from

    the modem was turned off using the command ATE0 at the HyperTerminal. Forserial

    transmission and reception to be possible both the DTE and DCE should have sameoperational

    baud rates. Hence to set the microcontroller at a baud rate of 9600bps, I set terminalcount of

    Timer 1 at 0FFh (clock frequency = 1.8432). The TCON and SCON registerswere 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 totransmit and

    receive data in form of characters. Transmission is done when TI flag is set andsimilarly data is

    known to be received when the Rx flag is set. The microcontroller then sends an ATcommand to

    the modem in form of string of characters serially just when the TI flag is set. Afterreception of

    a character in the SBUF register of the microcontroller (response of MODEM withthe read

    message in its default format or ERROR message or OK message), the RI flag is setand 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 themachinecapability we are using, and we can do it by studying the internal hardware design

    (devicesarchitecture), and also to know about the size, number and the size of theregisters.

    A microcontroller is a single chip that contains the processor (the CPU), non-volatilememory forthe program (ROM or flash), volatile memory for input and output (RAM), a clock andan I/Ocontrol unit. Also called a "computer on a chip," billions of microcontroller units(MCUs) are

  • 7/31/2019 Adaptive Light System

    45/54

    embedded each year in a myriad of products from toys to appliances toautomobiles. Forexample, a single vehicle can use 70 or more microcontrollers. The following picturedescribes age ne ra l b loc k d ia gr am of microcontroller.

    89S52: The AT89S52 is a low-power, high-performance CMOS 8-bit microcontrollerwith 8Kbytes of in-system programmable Flash memory. The device is manufactured using

    Atmelshigh-density nonvolatile memory technology and is compatible with the industry-standard 80C51instruction set and pin out. The on-chip Flash allows the program memory to bereprogrammedin-system or by a conventional nonvolatile memory pro-grammar. By combining aversatile 8-bitCPU with in-system programmable Flash on a monolithic chip, the AtmelAT89S52 is apowerful microcontroller, which provides a highly flexible and cost-effective solution tomany,embedded control applications. The AT89S52 provides the following standardfeatures: 8K bytesof Flash, 256 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers,three 16-bittimer/counters, a six-vector two-level interrupt architecture, a full duplex serial port,on-chiposcillator, and clock circuitr y. In addition, the AT89S52 is designed with staticlogic foroperation down to zero frequency and supports two software selectable power savingmodes. TheIdle Mode stops the CPU while allowing the RAM, timer/counters, serial port, andinterruptsystem to continue functioning. The Power-down mode saves the RAM con-tents butfreezes theoscillator, disabling all other chip functions until the nextinterrupt

  • 7/31/2019 Adaptive Light System

    46/54

    The hardware is driven by a set of program instructions, or software. Oncefamiliar with

    ardware is driven by a set of program instructions, or software. Once familiar withardware is driven by a set of program instructions, or software. Once familiar withardware and software, the user can then apply the microcontroller to the problems easily.ardware and software, the user can then apply the microcontroller to the problems easily.ardware 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 microcoThe pin diagram of the 8051 shows all of the input/output pins unique to microcoThe pin diagram of the 8051 shows all of the input/output pins unique to microcontrollers:

  • 7/31/2019 Adaptive Light System

    47/54

    The following are some of the capabilities of 8051microcontroller.

    VInternal ROM andRAMVI/O ports with programmablepinsV Timers andcountersV Serial datacommunication

    The 8051 architecture consists of these specificfeatures:

    16 bit PC &data pointer(DPTR)8 bit program status word(PSW)8 bit stack pointer(SP)Internal ROM4kInternal RAM of 128bytes. 4 register banks, each containing 8registers80 bits of general purpose data

    memory 32 input/output pins arranged as four 8 bit ports:P0-P3 Two 16 bit timer/counters: T0-T1 Two external and three internal interrupt sourcesOscillator and clock

    circuits.

    3.3

    Simulator

    KEIL Micro Vision is an integrated development environment used to create softwareto be runon embedded systems (like a microcontroller). It allows for such software to be writteneither inassembly or C programming languages and for that software to be simulated on acomputerbefore being loaded onto the microcontroller. The software used is cprogramming

  • 7/31/2019 Adaptive Light System

    48/54

    Keil Vision3 is an IDE (Integrated Development Environment) that helpswrite,

    compile, and debug embedded programs. It encapsulates the followingcomponents:

    A projectmanager.

    A makefacility.

    Toolconfiguration.

    Editor.

    A powerfuldebugger.

    To create a RFID BASED ANIMAL IDENTIFICATION SYSTEM FOR DAIRYFORMS

    project in

    uVision3:

    1. Select Project - NewProject.

    2. Select a directory and enter the name of theproject file.

    3. Select Project Select Device and select a device from DeviceDatabase.

    4. Create source files to add to theproject

    5. Select Project - Targets, Groups, and Files. Add/Files, select Source Group1,and add the

    Source files to theproject.

    6. Select Project - Options and set the tool options. Note that when the targetdevice is

    selected from the Device Database all-special options are set automatically.Defaultmemory model settings are optimal for mostapplications.

    7. Select Project - Rebuild all target files or Buildtarget.

    To create a new project, simply start micro vision and select Project=>NewProject

    from the pulldown menus. In the file dialog that appears, a filename anddirectory waschosen for the project. It is recommended that a new directory be created for eachproject, as

    several files will be generated. Once the project has been named, the dialogshown in thefigure below will appear, prompting the user to select a target device. The chipbeing used isthe AT89S52, which is listed under the headingAtmel.

  • 7/31/2019 Adaptive Light System

    49/54

    Next, Micro Vision was instructed to generate a HEX file upon programcompilation. A

    HEX file is a standard file format for storing executable code that is to be loadedonto themicrocontroller. In the Project Workspace pane at the left, rightclick on Target 1 andselectOptions for Target 1 .Under the Output tab of the resulting options dialog, ensurethat boththe Create Executable and Create HEX File options are checked. Then clickOK.

    Next, a file must be added to the project that will contain the project code. Todo this,

    expand the Target 1 heading, rightclick on the Source Group 1 folder, andselect Addfiles Create a new blank file (the file name should end in .c), select it, and clickAdd. Thenew file should now appear in the Project Workspace pane under the Source Group 1folder.Double-click on the newly created file to open it in the editor. To compile the program,first saveall source files by clicking on the Save All button, and then click on the Rebuild AllTargetFiles to compile the program as shown in the figure below. If any errors or warningsoccurduring compilation, they will be displayed in the output window at the bottom of thescreen. Allerrors and warnings will reference the line and column number in which they occur alongwith adescription of the problem so that they can be easilylocated [23].

    When the program has been successfully compiled, it can be simulatedusing the

    integrated debugger in Keil Micro Vision. To start the debugger, selectDebug=>Start/StopDebug Session from the pulldownmenus.

    At the left side of the debugger window, a table is displayed containingseveral key

    parameters about the simulated microcontroller, most notably the elapsed time (circledin thefigure below). Just above that, there are several buttons that control code execution.The Runbutton will cause the program to run continuously until a breakpoint is reached,whereas theStep Into button will execute the next line of code and then pause (the currentposition in theprogram is indicated by a yellow arrow to the left of thecode).

    3.4 PRO51 BURNER

    SOFTWARE

    PRO51 BURNER provides you with software burning tools for 8051 basedMicrocontrollers intheir Flash memory. The 51 BURNER tools, you can burn AT89C/SXXXX series ofATMEL

  • 7/31/2019 Adaptive Light System

    50/54

    microcontrollers .

    A vie w o f PRO 5 1

  • 7/31/2019 Adaptive Light System

    51/54

    4.1

    Conclusion

    The circuit is powered by a 12V automatic power supply which changes overautomatically to abackup power source when there is power outage on the main A.C. supply. The circuituses apopular timer I C LM358 which is connected as a comparator with pin-6 connected withpositiverail; the output goes high (1) when the trigger pin 3 is lower than voltage level atpin no 2.Conversely the output goes low (0) when it is above pin no 2 level. So a smallchange in thevoltage of pin-2 is enough to change the level of output (pin-1) from 1 to 0 and 0 to1. Thischange in the output level of the I.C. LM 358 is due to the sensing ability of the lightdependentresistor which senses the presence of light. The output has only two states high andlow andcannot remain in an y intermediate stage. The comparator goes high (1) when itbecomes darkand the microcontroller sends a switching signal to the relay and the security lights areturnedON. In the event of power outage in t he A.C. mains an automatic changeover to the

    backuppower source occurs immediately. After a period of delay the microcontroller sends analarmsignal to the buzzer and at the restoration of power supply thealarm stops

    4. 2 P robl em

    Encountered

    During soldering, many of the connection become short cktd. So wedesolder theconnection and did soldering

    again. A leg of the crystal oscillator was broken during mounting. So it has to bereplaced. LED`s get damaged when we switched ON the supply so we replace it by thenew one. Care should be taken while soldering. There should be no shortingof joints. Proper power supply shouldmaintain.

    4.3

    References:

    1. 8051 and embedded system by Mazidi and

    Mazidi

    2. All datasheets from www.datasheetcatalog.com

    3. About AT89s8252 from

    www.atmel.com

  • 7/31/2019 Adaptive Light System

    52/54

    4. And

    www.triindia.co.in

    5. About D S1820 f rom

    www.dallas.com

    APPENDIX

    A

    APPENDIX

    A

    PROGRAM

    FLOW

    #include

    sbit

    s1=P3^2;

    sbit

    RELAY=P1^0;

    void

    main()

    {

    while(0

    )

    {

    If(s1==1

    )

    {

    RELAY=1

    ;

  • 7/31/2019 Adaptive Light System

    53/54

    }

    else

    {

    RELAY=0

    ;

    }

    }

    }

  • 7/31/2019 Adaptive Light System

    54/54