This action might not be possible to undo. Are you sure you want to continue?
1) Acknowledgement 2) Certficate 3) Abstract 4) Introduction 5) Concept 6) About Project 7) Hardware Part 8) Circuit Diagrams 9) Component Description a) Resistors b) Capacitor c) Diode d) Light emitting diode e) Transistor f) Battery g) Crystal oscillator h) Power supply i) Relay j) Transformer k) Microcontroller (8051/8052) l) Infrared remote control m) Photodiode n) Phototransistor 10) Software part a) Transmitter program b) Receiver program 11) Bibliography
The HomeAutomation is a wireless home automation system that is supposed to be implemented in existing home environments, without any changes in the infrastructure. HomeAutomation let the user to control the home from his or her computer and assign actions that should happen depending on time or other sensor readings such as light, temperature or sound from any device in the HomeAutomation network.
This report is describing our group project in the Ubiquitous Computing course. It is containing the design process of the project, starting with brainstorming we had to get the final product idea and finishing with the prototyping within home alike environment. The original problem was to design and implement a larger ubiquitous computing project into a home environment. The report is describing what kind of design process, hardware and software have been used to build up the prototype for that product design that we had chosen as our final goal.
Most advanced home automation systems in existence today require a big and expensive change of infrastructure. This means that it often is not feasible to install a home automation system in an existing building. The HomeAutomation is a wireless home automation system that is supposed to be implemented in existing home environments, without any changes in the existing infrastructure. HomeAutomation lets the user to control his home from his or her computer. In the computer program the user can create actions what should happen with electrical
devices in the network depending on the sensors sensing surrounding environment.
Every HomeAutomation box is a stand-alone device. It is connected to the mains and controls the power outlet of the electrical device that is plugged into it. There will be a receiver and transmitter in each of the box, so they can exchange information with the master (a computer). People can control power supply of electrical devices in order to create an interactive home environment to facilitate the control without changing any home appliance. People can enjoy the high technology and simplicity modern life style. Each device will be with standard setup and while adding it into network; it can be given an address and tasks to do. All the setting will be easily resettable to default value, so people can move the devices between different electrical devices and networks. HomeAutomation boxes will be put into different rooms at home, depending on the needed functionality. Various different sensors could be attached to the boxes. The sensors are used as triggers for actions, that user can set up in the computer program.
Home automation systems, or smart home technologies, are systems and devices that can control elements of your home environment — lighting, appliances, telephones, home security and mechanical, entry and safety systems. Home automation systems can be operated by electricity or a computer chip using a range of different types of switches. A simple device, such as a light can be activated by a signal from a motion detector, or can be part of a computerized home automation system. As a very basic definition, we tend to refer to home automation as anything that gives you remote or automatic control of things around the home.
DESCRIPTION Home automation (also called domotics) may designate an emerging practice of increased automation of household appliances and features in residential dwellings, particularly through electronic means that allow for things impracticable, overly expensive or simply not possible in recent past decades. The term may be used in contrast to the more mainstream "building automation," which refers to industrial settings and the automatic or semi-automatic control of lighting, climate doors and windows, and security and surveillance systems. The techniques employed in home automation include those in building automation as well as the control of home entertainment systems, houseplant watering, pet feeding, "scenes" for different
events (such as dinners or parties), and the use of domestic robots. Typically, it is easier to more fully outfit a house during construction due to the accessibility of the walls, outlets, and storage rooms, and the ability to make design changes specifically to accommodate certain technologies. Wireless systems are commonly installed when outfitting a pre-existing house, as they obviate the need to make major structural changes. These communicate via radio or infrared signals with a central controller.
WHAT CAN HOME AUTOMATION DO?
Home automation can: Increase your independence and give you greater control of your home environment. Make it easier to communicate with your family. Save you time and effort. Improve your personal safety. Reduce your heating and cooling costs. Increase your home’s energy efficiency. Alert you audibly and visually to emergency situations. Allow you to monitor your home while you are away.
THE PRIMARY ELEMENTS OF A HOME AUTOMATION SYSTEM
The operating system (for example, a computer, security system, a telephone or electricity). The device being operated (for example, a light or furnace) The interface, or link, between the user and the device. An interface can be a button, a keypad, a motion sensor and so on. For example, a thermostat equipped with a computer chip can be controlled by an interface such as a push button, which sends a signal to the furnace to adjust the temperature for different times of the day and night.
HOW CAN WE CONTROL THEM?
Remote control Remote control gives you the convenience of controlling lighting, appliances, security systems and consumer electronics from wherever you happen to be at the time, like your couch, car or even in your bed. There are several different "methods" of controlling devices remotely.
Automatic control Automatic control adds even more convenience by making things happen automatically, without any effort being necessary. Examples include having your lights turn on at dusk and off at your desired time, having your whole home theater turn on and tune to the desired station after one press of a button on your remote.
Simple, small and handy remote control made up of IC 556 ( or two IC 555) Micro-controller(89c51) based receiving unit Multi functional, programmable receiving unit Application specific programming of micro-controller for industrial purpose It's multi functional unit so can be attached to any application It can be used in industries to control/operate any application/device remotely It can be used in homes/offices to operate any appliance remotely like fan, bulb, air cooler, table lamp etc.
WHY WE USE MICROCONTROLLER?
It is a multi channel IR remote control so you can perform not just single but many functions with this remote control. Microcontroller 89c52 is used in receiver part so its programmable remote control. You can program it to perform specific task or for specific application. Some applications that I have developed are "remote control for home appliances", "remotely operated dc motor controller", “remotely operated stepper motor controller".
Remote control Receiving circuit Power supply Microcontroller unit Relay circuit Fire alarm system
List of things control by system Appliances • Fan • Tubes • A.C. • T.V. • Sockets • Lightings Doors and windows Blinds/Curtains Water Fire and life safety
P a g e | 10
CIRCUIT AND BLOCK DIAGRAMS
P a g e | 11
P a g e | 12
Block diagram of home automation system
P a g e | 13
A resistor is a two-terminal electronic component that produces a voltage across its terminals that is proportional to the electric current passing through it in accordance with ohm's law: V = I*R Resistors are elements of electrical networks and electronic circuits and are ubiquitous in most electronic equipment. Practical resistors can be made of various compounds and films, as well as resistance wire (wire made of a high-resistivity alloy, such as nickel/chrome). The primary characteristics of a resistor are the resistance, the tolerance, maximum working voltage and the power rating. Other characteristics include temperature coefficient, noise, and inductance. Less well-known is critical resistance, the value below which power dissipation limits the maximum permitted current flow, and above which the limit is applied voltage. Critical resistance depends upon the materials constituting the resistor as well as its physical dimensions; it's determined by design. Resistors can be integrated into hybrid and printed circuits, as well as integrated circuits. Size, and position of leads (or terminals) are relevant to equipment designers; resistors must be physically large enough not to overheat when dissipating their power. Units The ohm (symbol: ω) is a si-driven unit of electrical resistance, named after George Simon Ohm. Commonly used multiples and submultiples in electrical and electronic usage are the milliohm (1x10−3), kilohm (1x103), and megohm (1x106).
P a g e | 14
Theory of operation
Ohm's law The behavior of an ideal resistor is dictated by the relationship specified in ohm's law: V = I*R Ohm's law states that the voltage (v) across a resistor is proportional to the current (i) through it where the constant of proportionality is the resistance (r). Series and parallel resistors Resistors in a parallel configuration each have the same potential difference (voltage). To find their total equivalent resistance (req):
The parallel property can be represented in equations by two vertical lines "||" (as in geometry) to simplify equations. For two resistors,
The current through resistors in series stays the same, but the voltage across each resistor can be different. The sum of the potential differences (voltage) is equal to the total voltage. To find their total resistance:
P a g e | 15
A resistor network that is a combination of parallel and series can be broken up into smaller parts that are either one or the other. For instance,
However, many resistor networks cannot be split up in this way. Consider a cube, each edge of which has been replaced by a resistor. For example, determining the resistance between two opposite vertices requires additional transforms, such as the y-δ transform, or else matrix methods must be used for the general case. However, if all twelve resistors are equal, the corner-tocorner resistance is 5⁄6 of any one of them. The practical application to resistors is that a resistance of any non-standard value can be obtained by connecting standard values in series or in parallel.
The power dissipated by a resistor (or the equivalent resistance of a resistor network) is calculated using the following:
All three equations are equivalent. The first is derived from joule's first law. Ohm’s law derives the other two from that. The total amount of heat energy released is the integral of the power over time:
P a g e | 16
If the average power dissipated is more than the resistor can safely dissipate, the resistor may depart from its nominal resistance and may become damaged by overheating. Excessive power dissipation may raise the temperature of the resistor to a point where it burns out, which could cause a fire in adjacent components and materials. There are flameproof resistors that fail (open circuit) before they overheat dangerously. Note that the nominal power rating of a resistor is not the same as the power that it can safely dissipate in practical use. Air circulation and proximity to a circuit board, ambient temperature, and other factors can reduce acceptable dissipation significantly. Rated power dissipation may be given for an ambient temperature of 25 °c in free air. Inside an equipment case at 60 °c, rated dissipation will be significantly less; if we are dissipating a bit less than the maximum figure given by the manufacturer we may still be outside the safe operating area, and courting premature failure.
Resistor Color Code Chart
P a g e | 17
P a g e | 18
A capacitor or condenser is a passive electronic component consisting of a pair of conductors separated by a dielectric (insulator). When a potential difference (voltage) exists across the conductors, an electric field is present in the dielectric. This field stores energy and produces a mechanical force between the conductors. The effect is greatest when there is a narrow separation between large areas of conductor; hence capacitor conductors are often called plates. An ideal capacitor is characterized by a single constant value, capacitance, which is measured in farads. This is the ratio of the electric charge on each conductor to the potential difference between them. In practice, the dielectric between the plates passes a small amount of leakage current. The conductors and leads introduce an equivalent series resistance and the dielectric has an electric field strength limit resulting in a breakdown voltage. Capacitors are widely used in electronic circuits to block the flow of direct current while allowing alternating current to pass, to filter out interference, to smooth the output of power supplies, and for many other purposes. They are used in resonant circuits in radio frequency equipment to select particular frequencies from a signal with many frequencies.
Theory of operation
A capacitor consists of two conductors separated by a nonconductive region. The non-conductive substance is called the dielectric medium, although this may also mean a vacuum or a semiconductor depletion region chemically identical to the conductors. A capacitor is assumed to be self-contained and isolated, with no net electric charge and no influence from an external electric field. The conductors thus contain equal and opposite charges on their facing surfaces, and the dielectric contains an electric field. The capacitor is a reasonably general model for electric fields within electric circuits.
P a g e | 19
An ideal capacitor is wholly characterized by a constant capacitance c, defined as the ratio of charge ±q on each conductor to the voltage v between them:
Sometimes charge buildup affects the mechanics of the capacitor, causing the capacitance to vary. In this case, capacitance is defined in terms of incremental changes:
In si units, a capacitance of one farad means that one coulomb of charge on each conductor causes a voltage of one volt across the device. Energy storage Work must be done by an external influence to move charge between the conductors in a capacitor. When the external influence is removed, the charge separation persists and energy is stored in the electric field. If charge is later allowed to return to its equilibrium position, the energy is released. The work done in establishing the electric field, and hence the amount of energy stored, is given by:
Current-voltage relation The current i(t) through a component in an electric circuit is defined as the rate of change of the charge q(t) that has passed through it. Physical charges cannot pass through the dielectric layer of a capacitor, but rather build up in equal and opposite quantities on the electrodes: as each electron accumulates on the negative plate, one leaves the positive plate. Thus the accumulated charge on the electrodes is equal to the integral of
P a g e | 20
the current, as well as being proportional to the voltage (as discussed above). As with any antiderivative, a constant of integration is added to represent the initial voltage v (t0). This is the integral form of the capacitor equation,
. Taking the derivative of this, and multiplying by c, yields the derivative form, . The dual of the capacitor is the inductor, which stores energy in the magnetic field rather than the electric field. Its currentvoltage relation is obtained by exchanging current and voltage in the capacitor equations and replacing c with the inductance l. D.C. Circuits
A simple resistor-capacitor circuit demonstrates charging of a capacitor. A series circuit containing only a resistor, a capacitor, a switch and a constant dc source of voltage v0 is known as a charging circuit. If the capacitor is initially uncharged while the switch is open, and the switch is closed at t = 0, it follows from Kirchhoff’s voltage law that
P a g e | 21
Taking the derivative and multiplying by c, gives a first-order differential equation,
At t = 0, the voltage across the capacitor is zero and the voltage across the resistor is v0. The initial current is then i(0) =v0 /r. With this assumption, the differential equation yields
Where τ0 = rc is the time constant of the system. As the capacitor reaches equilibrium with the source voltage, the voltage across the resistor and the current through the entire circuit decay exponentially. The case of discharging a charged capacitor likewise demonstrates exponential decay, but with the initial capacitor voltage replacing v0 and the final voltage being zero. A.C. circuits Impedance, the vector sum of reactance and resistance, describes the phase difference and the ratio of amplitudes between sinusoidally varying voltage and sinusoidally varying current at a given frequency. Fourier analysis allows any signal to be constructed from a spectrum of frequencies, whence the circuit's reaction to the various frequencies may be found. The reactance and impedance of a capacitor are respectively
P a g e | 22
Where j is the imaginary unit and ω is the angular velocity of the sinusoidal signal. The - j phase indicates that the ac voltage v = z*i lags the ac current by 90°: the positive current phase corresponds to increasing voltage as the capacitor charges; zero current corresponds to instantaneous constant voltage, etc. Note that impedance decreases with increasing capacitance and increasing frequency. This implies that a higher-frequency signal or a larger capacitor results in a lower voltage amplitude per current amplitude—an ac "short circuit" or ac coupling. Conversely, for very low frequencies, the reactance will be high, so that a capacitor is nearly an open circuit in ac analysis—those frequencies have been "filtered out".
P a g e | 23
Parallel plate model
Dielectric is placed between two conducting plates, each of area A and with a separation of d. The simplest capacitor consists of two parallel conductive plates separated by a dielectric with permittivity ε (such as air). The model may also be used to make qualitative predictions for other device geometries. The plates are considered to extend uniformly over an area A and a charge density ±ρ = ±q/A exists on their surface. Assuming that the width of the plates is much greater than their separation d, the electric field near the centre of the device will be uniform with the magnitude e = ρ/ε. The voltage is defined as the line integral of the electric field between the plates
Solving this for c = q/v reveals that capacitance increases with area and decreases with separation . The capacitance is therefore greatest in devices made from materials with a high permittivity.
P a g e | 24
Several capacitors in parallel.
For capacitors in parallel Capacitors in a parallel configuration each have the same applied voltage. Their capacitances add up. Charge is apportioned among them by size. Using the schematic diagram to visualize parallel plates, it is apparent that each capacitor contributes to the total surface area.
For capacitors in series
Several capacitors in series.
Connected in series, the schematic diagram reveals that the separation distance, not the plate area, adds up. The capacitors each store instantaneous charge build-up equal to that of every other capacitor in the series. The total voltage difference from end to end is apportioned to each capacitor according to the inverse of its capacitance. The entire series acts as a capacitor smaller than any of its components.
P a g e | 25
Capacitors are combined in series to achieve a higher working voltage, for example for smoothing a high voltage power supply. The voltage ratings, which are based on plate separation, add up. In such an application, several series connections may in turn be connected in parallel, forming a matrix. The goal is to maximize the energy storage utility of each capacitor without overloading it. Applications Capacitors have many uses in electronic and electrical systems. They are so common that it is a rare electrical product that does not include at least one for some purpose. Energy storage A capacitor can store electric energy when disconnected from its charging circuit, so it can be used like a temporary battery. Capacitors are commonly used in electronic devices to maintain power supply while batteries are being changed. (This prevents loss of information in volatile memory.) Conventional electrostatic capacitors provide less than 360 joules per kilogram of energy density, while capacitors using developing technologies can provide more than 2.52 kilojoules per kilogram. In car audio systems, large capacitors store energy for the amplifier to use on demand. Also for a flash tube a capacitor is used to hold the high voltage. In ceiling fans, capacitors play the important role of storing electrical energy to give the fan enough torque to start spinning. Pulsed power and weapons Groups of large, specially constructed, low-inductance highvoltage capacitors (capacitor banks) are used to supply huge pulses of current for many pulsed power applications. These include electromagnetic forming, Marx generators, pulsed lasers (especially tea lasers), pulse forming networks, radar, fusion research, and particle accelerators.
P a g e | 26
Large capacitor banks (reservoir) are used as energy sources for the explodingbridgewire detonators or slapper detonators in nuclear weapons and other specialty weapons. Experimental work is under way using banks of capacitors as power sources for electromagnetic armor and electromagnetic railguns and coilguns.
P a g e | 27
A 10,000 microfarad capacitor in a trm-800 amplifier Reservoir capacitors are used in power supplies where they smooth the output of a full or half wave rectifier. They can also be used in charge pump circuits as the energy storage element in the generation of higher voltages than the input voltage. Capacitors are connected in parallel with the power circuits of most electronic devices and larger systems (such as factories) to shunt away and conceal current fluctuations from the primary power source to provide a "clean" power supply for signal or control circuits. Audio equipment, for example, uses several capacitors in this way, to shunt away power line hum before it gets into the signal circuitry. The capacitors act as a local reserve for the dc power source, and bypass ac currents from the power supply. This is used in car audio applications, when a stiffening capacitor compensates for the inductance and resistance of the leads to the lead-acid car battery. Power factor correction In electric power distribution, capacitors are used for power factor correction. Such capacitors often come as three capacitors connected as a three phase load. Usually, the values of these capacitors are given not in farads but rather as a reactive power in volt-amperes reactive (var). The purpose is to counteract
P a g e | 28
inductive loading from devices like electric motors and transmission lines to make the load appear to be mostly resistive. Individual motor or lamp loads may have capacitors for power factor correction, or larger sets of capacitors (usually with automatic switching devices) may be installed at a load center within a building or in a large utility substation. Suppression and coupling Signal coupling Because capacitors pass ac but block dc signals (when charged up to the applied dc voltage), they are often used to separate the ac and dc components of a signal. This method is known as ac coupling or "capacitive coupling". Here, a large value of capacitance, whose value need not be accurately controlled, but whose reactance is small at the signal frequency, is employed. Decoupling A decoupling capacitor is a capacitor used to protect one part of a circuit from the effect of another, for instance to suppress noise or transients. Noise caused by other circuit elements is shunted through the capacitor, reducing the effect they have on the rest of the circuit. It is most commonly used between the power supply and ground. An alternative name is bypass capacitor as it is used to bypass the power supply or other high impedance component of a circuit. Noise filters and snubbers When an inductive circuit is opened, the current through the inductance collapses quickly, creating a large voltage across the open circuit of the switch or relay. If the inductance is large enough, the energy will generate a spark, causing the contact points to oxidize, deteriorate, or sometimes weld together, or destroying a solid-state switch. A snubber capacitor across the newly opened circuit creates a path for this impulse to bypass the contact points, thereby preserving their life; these were commonly found in contact breaker ignition systems, for instance.
P a g e | 29
Similarly, in smaller scale circuits, the spark may not be enough to damage the switch but will still radiate undesirable radio frequency interference (rfi), which a filter capacitor absorbs. Snubber capacitors are usually employed with a low-value resistor in series, to dissipate energy and minimize rfi. Such resistorcapacitor combinations are available in a single package. Capacitors are also used in parallel to interrupt units of a highvoltage circuit breaker in order to equally distribute the voltage between these units. In this case they are called grading capacitors. In schematic diagrams, a capacitor used primarily for dc charge storage is often drawn vertically in circuit diagrams with the lower, more negative, plate drawn as an arc. The straight plate indicates the positive terminal of the device, if it is polarized (see electrolytic capacitor).
In single phase squirrel cage motors, the primary winding within the motor housing is not capable of starting a rotational motion on the rotor, but is capable of sustaining one. To start the motor, a secondary winding is used in series with a non-polarized starting capacitor to introduce a lag in the sinusoidal current through the starting winding. When the secondary winding is placed at an angle with respect to the primary winding, a rotating electric field is created. The force of the rotational field is not constant, but is sufficient to start the rotor spinning. When the rotor comes close to operating speed, a centrifugal switch (or current-sensitive relay in series with the main winding) disconnects the capacitor. The start capacitor is typically mounted to the side of the motor housing. These are called capacitor-start motors, which have relatively high starting torque. There are also capacitor-run induction motors which have a permanently-connected phase-shifting capacitor in series with a second winding. The motor is much like a two-phase induction motor.
P a g e | 30
Motor-starting capacitors are typically non-polarized electrolytic types, while running capacitors are conventional paper or plastic film dielectric types.
The energy stored in a capacitor can be used to represent information, either in binary form, as in drams, or in analogue form, as in analog sampled filters and ccds. Capacitors can be used in analog circuits as components of integrators or more complex filters and in negative feedback loop stabilization. Signal processing circuits also use capacitors to integrate a current signal.
Capacitors and inductors are applied together in tuned circuits to select information in particular frequency bands. For example, radio receivers rely on variable capacitors to tune the station frequency. Speakers use passive analog crossovers, and analog equalizers use capacitors to select different audio bands. The resonant frequency f of a tuned circuit is a function of the inductance (l) and capacitance (c) in series, and is given by:
Where l is in henries and c is in farads.
Most capacitors are designed to maintain a fixed physical structure. However, various factors can change the structure of the capacitor, and the resulting change in capacitance can be used to sense those factors.
Changing the dielectric:
P a g e | 31
The effects of varying the physical and/or electrical characteristics of the dielectric can be used for sensing purposes. Capacitors with an exposed and porous dielectric can be used to measure humidity in air. Capacitors are used to accurately measure the fuel level in airplanes; as the fuel covers more of a pair of plates, the circuit capacitance increases.
Changing the distance between the plates:
Capacitors with a flexible plate can be used to measure strain or pressure. Industrial pressure transmitters used for process control use pressure-sensing diaphragms, which form a capacitor plate of an oscillator circuit. Capacitors are used as the sensor in condenser microphones, where one plate is moved by air pressure, relative to the fixed position of the other plate. Some accelerometers use mems capacitors etched on a chip to measure the magnitude and direction of the acceleration vector. They are used to detect changes in acceleration, e.g. as tilt sensors or to detect free fall, as sensors triggering airbag deployment, and in many other applications. Some fingerprint sensors use capacitors. Additionally, a user can adjust the pitch of a theremin musical instrument by moving his hand since this changes the effective capacitance between the user's hand and the antenna.
P a g e | 32
In electronics, a diode is a two-terminal electronic component that conducts electric current in only one direction. The term usually refers to a semiconductor diode, the most common type today, which is a crystal of semiconductor connected to two electrical terminals, a p-n junction. A vacuum tube diode, now little used, is a vacuum tube with two electrodes; a plate and a cathode. The most common function of a diode is to allow an electric current in one direction (called the diode's forward direction) while blocking current in the opposite direction (the reverse direction). Thus, the diode can be thought of as an electronic version of a check valve. This unidirectional behavior is called rectification, and is used to convert alternating current to direct current, and extract modulation from radio signals in radio receivers. However, diodes can have more complicated behavior than this simple on-off action, due to their complex non-linear electrical characteristics, which can be tailored by varying the construction of their p-n junction. These are exploited in special purpose diodes that perform many different functions. Diodes are used to regulate voltage (zener diodes), electronically tune radio and T.V. receivers (varactor diodes), generate radio frequency oscillations (tunnel diodes), and produce light (light emitting diodes). Diodes were the first semiconductor electronic devices. The discovery of crystals' rectifying abilities was made by German physicist Ferdinand Braun in 1874. The first semiconductor diodes, called cat's whisker diodes were made of crystals of minerals such as galena. Today most diodes are made of silicon, but other semiconductors such as germanium are sometimes used.
A modern semiconductor diode is made of a crystal of semiconductor like silicon that has impurities added to it to create
P a g e | 33
a region on one side that contains negative charge carriers (electrons), called n-type semiconductor, and a region on the other side that contains positive charge carriers (holes), called ptype semiconductor. The diode's terminals are attached to each of these regions. The boundary within the crystal between these two regions, called a pn junction, is where the action of the diode takes place. The crystal conducts conventional current in a direction from the p-type side (called the anode) to the n-type side (called the cathode), but not in the opposite direction. Another type of semiconductor diode, the Schottky diode, is formed from the contact between a metal and a semiconductor rather than by a p-n junction.
A semiconductor diode’s behavior in a circuit is given by its current–voltage characteristic, or i–v graph (see graph at right). The shape of the curve is determined by the transport of charge carriers through the so-called depletion layer or depletion region that exists at the p-n junction between differing semiconductors. When a p-n junction is first created, conduction band (mobile) electrons from the n-doped region diffuse into the p-doped region where there is a large population of holes (vacant places for electrons) with which the electrons “recombine”. When a mobile electron recombines with a hole, both hole and electron vanish, leaving behind an immobile positively charged donor (dopant) on the n-side and negatively charged acceptor (dopant) on the pside. The region around the p-n junction becomes depleted of charge carriers and thus behaves as an insulator. However, the width of the depletion region (called the depletion width) cannot grow without limit. For each electron-hole pair that recombines, a positively-charged dopant ion is left behind in the n-doped region, and a negatively charged dopant ion is left behind in the p-doped region. As recombination proceeds more ions are created, an increasing electric field develops through the depletion zone which acts to slow and then finally stop recombination. At this point, there is a “built-in” potential across the depletion zone.
P a g e | 34
If an external voltage is placed across the diode with the same polarity as the built-in potential, the depletion zone continues to act as an insulator, preventing any significant electric current flow (unless electron/hole pairs are actively being created in the junction by, for instance, light. See photodiode). This is the reverse bias phenomenon. However, if the polarity of the external voltage opposes the built-in potential, recombination can once again proceed, resulting in substantial electric current through the p-n junction (i.e. Substantial numbers of electrons and holes recombine at the junction).. For silicon diodes, the built-in potential is approximately 0.6 v. Thus, if an external current is passed through the diode, about 0.6 v will be developed across the diode such that the p-doped region is positive with respect to the n-doped region and the diode is said to be “turned on” as it has a forward bias.
Figure: I–V characteristics of a p-n junction diode (not to scale). A diode’s I–V characteristic' can be approximated by four regions of operation (see the figure at right). At very large reverse bias, beyond the peak inverse voltage or piv, a process called reverse breakdown occurs which causes a large increase in current (i.e. a large number of electrons and holes are created at, and move away from the pn junction) that usually damages the device permanently. The avalanche diode is deliberately designed for use in the avalanche region. In the zener diode, the concept of piv is not applicable. A zener diode contains a heavily doped p-n junction allowing electrons to tunnel from the
P a g e | 35
valence band of the p-type material to the conduction band of the n-type material, such that the reverse voltage is “clamped” to a known value (called the zener voltage), and avalanche does not occur. Both devices, however, do have a limit to the maximum current and power in the clamped reverse voltage region. Also, following the end of forward conduction in any diode, there is reverse current for a short time. The device does not attain its full blocking capability until the reverse current ceases. The second region, at reverse biases more positive than the piv, has only a very small reverse saturation current. In the reverse bias region for a normal p-n rectifier diode, the current through the device is very low (in the µa range). However, this is temperature dependent, and at sufficiently high temperatures, a substantial amount of reverse current can be observed (ma or more). The third region is forward but small bias, where only a small forward current is conducted. As the potential difference is increased above an arbitrarily defined “cut-in voltage” or “on-voltage” or “diode forward voltage drop (vd)”, the diode current becomes appreciable (the level of current considered “appreciable” and the value of cut-in voltage depends on the application), and the diode presents a very low resistance. The current–voltage curve is exponential. In a normal silicon diode at rated currents, the arbitrary “cut-in” voltage is defined as 0.6 to 0.7 volts. The value is different for other diode types — schottky diodes can be rated as low as 0.2 v and red or blue lightemitting diodes (LEDs) can have values of 1.4 v and 4.0 v respectively. At higher currents the forward voltage drop of the diode increases. A drop of 1 v to 1.5 v is typical at full rated current for power diodes.
Shockley diode equation
P a g e | 36
The Shockley ideal diode equation or the diode law (named after transistor co-inventor William Bradford Shockley, not to be confused with tetrode inventor Walter h. Schottky) gives the i–v characteristic of an ideal diode in either forward or reverse bias (or no bias). The equation is:
Where I is the diode current, Is is the reverse bias saturation current, Vd is the voltage across the diode, Vt is the thermal voltage, and N is the emission coefficient, also known as the ideality factor. The emission coefficient n varies from about 1 to 2 depending on the fabrication process and semiconductor material and in many cases is assumed to be approximately equal to 1 (thus the notation n is omitted). The thermal voltage vt is approximately 25.85 mv at 300 k, a temperature close to “room temperature” commonly used in device simulation software. At any temperature it is a known constant defined by:
Where k is the Boltzmann constant, t is the absolute temperature of the p-n junction, and q is the magnitude of charge on an electron (the elementary charge). The Shockley ideal diode equation or the diode law is derived with the assumption that the only processes giving rise to the current in the diode are drift (due to electrical field), diffusion, and thermal recombination-generation. It also assumes that the
P a g e | 37
recombination-generation (r-g) current in the depletion region is insignificant. This means that the Shockley equation doesn’t account for the processes involved in reverse breakdown and photon-assisted r-g. Additionally, it doesn’t describe the “leveling off” of the i–v curve at high forward bias due to internal resistance. Under reverse bias voltages (see figure 5) the exponential in the diode equation is negligible, and the current is a constant (negative) reverse current value of −is. The reverse breakdown region is not modeled by the Shockley diode equation. For even rather small forward bias voltages (see figure 5) the exponential is very large because the thermal voltage is very small, so the subtracted ‘1’ in the diode equation is negligible and the forward diode current is often approximated as
P a g e | 38
A light-emitting diode (led) is a semiconductor light source. LEDs are used as indicator lamps in many devices, and are increasingly used for lighting. Introduced as a practical electronic component in 1962, early LEDs emitted low-intensity red light, but modern versions are available across the visible, ultraviolet and infrared wavelengths, with very high brightness. The led is based on the semiconductor diode. When a diode is forward biased (switched on), electrons are able to recombine with holes within the device, releasing energy in the form of photons. This effect is called electroluminescence and the color of the light (corresponding to the energy of the photon) is determined by the energy gap of the semiconductor. A led is usually small in area (less than 1 mm2), and integrated optical components are used to shape its radiation pattern and assist in reflection. LEDs present many advantages over incandescent light sources including lower energy consumption, longer lifetime, improved robustness, smaller size, faster switching, and greater durability and reliability. However, they are relatively expensive and require more precise current and heat management than traditional light sources. Current led products for general lighting are more expensive to buy than fluorescent lamp sources of comparable output. They also enjoy use in applications as diverse as replacements for traditional light sources in automotive lighting (particularly indicators) and in traffic signals. Airbus uses led lighting in their a320 enhanced since 2007, and Boeing plans its use in the 787. The compact size of LEDs has allowed new text and video displays and sensors to be developed, while their high switching rates are useful in advanced communications technology.
P a g e | 39
Efficiency: LEDs produce more light per watt than incandescent bulbs. Their efficiency is not affected by shape and size unlike fluorescent light bulbs or tubes. Color: LEDs can emit light of an intended color without the use of color filters that traditional lighting methods require. This is more efficient and can lower initial costs. Size: LEDs can be very small (smaller than 2 mm2) and are easily populated onto printed circuit boards. On/off time: LEDs light up very quickly. A typical red indicator led will achieve full brightness in microseconds. LEDs used in communications devices can have even faster response times. Cycling: LEDs are ideal for use in applications that are subject to frequent on-off cycling, unlike fluorescent lamps that burn out more quickly when cycled frequently, or hid lamps that require a long time before restarting. Dimming: LEDs can very easily be dimmed either by pulsewidth modulation or lowering the forward current. Cool light: in contrast to most light sources, LEDs radiate very little heat in the form of IR that can cause damage to sensitive objects or fabrics. Wasted energy is dispersed as heat through the base of the led.
P a g e | 40
Slow failure: LEDs mostly fail by dimming over time, rather than the abrupt burn-out of incandescent bulbs. Lifetime: LEDs can have a relatively long useful life. One report estimates 35,000 to 50,000 hours of useful life, though time to complete failure may be longer. Fluorescent tubes typically are rated at about 10,000 to 15,000 hours, depending partly on the conditions of use, and incandescent light bulbs at 1,000–2,000 hours. Shock resistance: LEDs, being solid state components, are difficult to damage with external shock, unlike fluorescent and incandescent bulbs which are fragile. Focus: the solid package of the led can be designed to focus its light. Incandescent and fluorescent sources often require an external reflector to collect light and direct it in a usable manner. Toxicity: LEDs do not contain mercury, unlike fluorescent lamps.
Some fluorescent lamps can be more efficient. High initial price: LEDs are currently more expensive, price per lumen, on an initial capital cost basis, than most conventional lighting technologies. The additional expense partially stems from the relatively low lumen output and the drive circuitry and power supplies needed. Temperature dependence: led performance largely depends on the ambient temperature of the operating environment. Over-driving the led in high ambient temperatures may result in overheating of the led package, eventually leading to device failure. Adequate heat-sinking is required to maintain long life. This is especially important when considering automotive, medical, and military applications where the device must operate over a large range of temperatures, and is required to have a low failure rate.
P a g e | 41
Voltage sensitivity: LEDs must be supplied with the voltage above the threshold and a current below the rating. This can involve series resistors or current-regulated power supplies. Light quality: most cool-white LEDs have spectra that differ significantly from a black body radiator like the sun or an incandescent light. The spike at 460 nm and dip at 500 nm can cause the color of objects to be perceived differently under cool-white led illumination than sunlight or incandescent sources, due to metamerism, red surfaces being rendered particularly badly by typical phosphor based cool-white LEDs. However, the color rendering properties of common fluorescent lamps are often inferior to what is now available in state-of-art white LEDs. Area light source: LEDs do not approximate a “point source” of light, but rather a lambertian distribution. So LEDs are difficult to use in applications requiring a spherical light field. LEDs are not capable of providing divergence below a few degrees. This is contrasted with lasers, which can produce beams with divergences of 0.2 degrees or less. Blue hazard: there is a concern that blue LEDs and coolwhite LEDs are now capable of exceeding safe limits of the so-called blue-light hazard as defined in eye safety specifications such as ansi/iesna rp-27.1-05: recommended practice for photo biological safety for lamp and lamp systems. Blue pollution: because cool-white LEDs (i.e., LEDs with high color temperature) emit proportionally more blue light than conventional outdoor light sources such as high-pressure sodium lamps, the strong wavelength dependence of Raleigh scattering means that cool-white LEDs can cause more light pollution than other light sources. The international dark-sky association discourages the use of white light sources with correlated color temperature above 3,000 k.
In electronics, the basic led circuit is an electric power circuit used to power a light-emitting diode or led. It consists of a voltage source powering two components connected in series: a current
P a g e | 42
limiting resistor, and an led. Optionally, a switch may be introduced to open and close the circuit. The switch may be replaced with another component or circuit to form a continuity tester. The led used will have a voltage drop, specified at the intended operating current. Ohm's law and Kirchhoff’s circuit laws are used to calculate the resistor that is used to attain the correct current. The resistor value is computed by subtracting the led voltage drop from the supply voltage, and then dividing by the desired led operating current. If the supply voltage is equal to the LED's voltage drop, no resistor is needed.
Simple led circuit diagram
Simple resistance formula brightness of the led
The formula to calculate the correct resistance to use is:
Power supply voltage (vs) is the voltage of the power supply e.g. a 9 volt battery. Led voltage drop (vf) is the voltage drop across the led (typically about 1.8 - 3.3 volts; this varies by the color of the led) 1.8 volts for red and its gets higher as the spectrum increases to 3.3 volts for blue.
P a g e | 43
Led current rating (if) is the manufacturer rating of the led (usually given in mill amperes such as 20 ma)
Analysis using Kirchhoff’s laws
The formula can be explained considering the led as a resistance, and applying the kvl (r is the unknown quantity):
The name is transistor derived from ‘transfer resistors’ indicating a solid state semiconductor device. In addition to conductor and insulators, there is a third class of material that exhibits proportion of both. Under some conditions, it acts as an insulator, and under other conditions it’s a conductor. This phenomenon is called semi-conducting and allows a variable control over electron flow. So, the transistor is semi conductor device used in electronics for amplitude. Transistor has three terminals, one is the collector, one is the base and other is the emitter, (each lead must be connected in the circuit correctly and only then the transistor will function). Electrons are emitted via one terminal and collected on another terminal, while the third terminal acts as a control element. Each transistor has a number marked on its body. Every number has its own specifications. There are mainly two types of transistor (i) NPN & (ii) PnP
When a positive voltage is applied to the base, the transistor begins to conduct by allowing current to flow through the
P a g e | 44
collector to emitter circuit. The relatively small current flowing through the base circuit causes a much greater current to pass through the emitter / collector circuit. The phenomenon is called current gain and it is measure in beta.
It also does exactly same thing as above except that it has a negative voltage on its collector and a positive voltage on its emitter.
Transistor is a combination of semi-conductor elements allowing a controlled current flow. Germanium and silicon is the two semiconductor elements used for making it. There are two types of transistors such as point contact and junction transistors. Point contact construction is defective so is now out of use. Junction triode transistors are in many respects analogous to triode electron tube. A junction transistor can function as an amplifier or oscillator as can a triode tube, but has the additional advantage of long life, small size, ruggedness and absence of cathode heating power.
Operation of pnp transistor:A pnp transistor is made by sand witching two pn germanium or silicon diodes, placed back to back. The centre of n-type portion is extremely thin in comparison to p region. The p region of the left is connected to the positive terminal and n-region to the negative terminal i.e. pn is biased in the forward direction while p region of right is biased negatively i.e. in the reverse direction as shown in fig. The p region in the forward biased circuit is called the emitter
P a g e | 45
and p region on the right, biased negatively is called collector. The centre is called base.
The majority carriers (holes) of p region (known as emitter) move to n region as they are repelled by the positive terminal of battery while the electrons of n region are attracted by the positive terminal. The holes overcome the barrier and cross the emitter junction into n region. As the width of base region is extremely thin, two to five percent of holes recombine with the free electrons of n-region which result in a small base current while the remaining holes (95% to 98%) reach the collector junction. The collector is biased negatively and the negative collector voltage aids in sweeping the hole into collector region. As the p region at the right is biased negatively, a very small current should flow but the following facts are observed:
A substantial current flows through it when the emitter junction is biased in a forward direction. The current flowing across the collector is slightly less than that of the emitter, and The collector current is a function of emitter current i.e. with the decrease or increase in the emitter current a corresponding change in the collector current is observed.
The facts can be explained as follows:As already discussed that 2 to 5% of the holes are lost in recombination with the electron n base region, which result in a
P a g e | 46
small base current and hence the collector current is slightly less than the emitter current. The collector current increases as the holes reaching the collector junction are attracted by negative potential applied to the collector. When the the base emitter is voltage in emitter current increases , most holes are injected into region increasing the collector current. In this way analogous to the control of plate current by small grid a vacuum triode
Hence we can say that when the emitter is forward biased and collector is negatively biased, a substantial current flows in both the circuits. Since a small emitter voltage of about 0.1 to 0.5 volts permits the flow of an appreciable emitter current the input power is very small. The collector voltage can be as high as 45 volts.
The transistor as a switch
When used as an ac signal amplifier, the transistors base biasing voltage is applied so that it operates within its "active" region and the linear part of the output characteristics curves are used. However, both the npn & pnp type bipolar transistors can be made to operate as an "on/off" type solid state switch for controlling high power devices such as motors, solenoids or lamps. If the circuit uses the transistor as a switch, then the biasing is arranged to operate in the output characteristics curves seen previously in the areas known as the "saturation" and "cutoff" regions as shown below. Transistor curves
P a g e | 47
The pink shaded area at the bottom represents the "cut-off" region. Here the operating conditions of the transistor are zero input base current (ib), zero output collector current (IC) and maximum collector voltage (vce) which results in a large depletion layer and no current flows through the device. The transistor is switched "fully-off". The lighter blue area to the left represents the "saturation" region. Here the transistor will be biased so that the maximum amount of base current is applied, resulting in maximum collector current flow and minimum collector emitter voltage which results in the depletion layer being as small as possible and maximum current flows through the device. The transistor is switched "fully-on". Then we can summarize this as:
Cut-off region - both junctions are reverse-biased, base current is zero or very small resulting in zero collector current flowing, and the device is switched fully "off". Saturation region - both junctions are forward-biased, base current is high enough to give a collector-emitter voltage of 0v resulting in maximum collector current flowing, the device is switched fully "on".
An example of an NPN transistor as a switch being used to operate a relay is given below. With inductive loads such as relays or solenoids a flywheel diode is placed across the load to dissipate the back emf generated by the inductive load when the transistor switches "off" and so protect the transistor from damage. If the load is of a very high current or voltage nature, such as motors, heaters etc, then the load current can be controlled via a suitable relay as shown.
P a g e | 48
Transistor switching circuit
The circuit resembles that of the common emitter circuit we looked at in the previous tutorials. The difference this time is that to operate the transistor as a switch the transistor needs to be turned either fully "off" (cut-off) or fully "on" (saturated). An ideal transistor switch would have an infinite resistance when turned "off" resulting in zero current flow and zero resistance when turned "on", resulting in maximum current flow. In practice when turned "off", small leakage currents flow through the transistor and when fully "on" the device has a low resistance value causing a small saturation voltage (vce) across it. In both the cut-off and saturation regions the power dissipated by the transistor is at its minimum. To make the base current flow, the base input terminal must be made more positive than the emitter by increasing it above the 0.7 volts needed for a silicon device. By varying the base-emitter voltage vbe, the base current is altered and which in turn controls the amount of collector current flowing through the transistor as previously discussed. When maximum collector current flows the transistor is said to be saturated. The value of the base resistor determines how much input voltage is required and corresponding base current to switch the transistor fully "on". Example no. 1. For example, using the transistor values from the previous tutorials of: β = 200, IC = 4ma and ib = 20ua, find the value of
P a g e | 49
the base resistor (rb) required to switch the load "on" when the input terminal voltage exceeds 2.5v.
Example no. 2. Again using the same values, find the minimum base current required to turn the transistor fully "on" (saturated) for a load that requires 200ma of current.
Transistor switches are used for a wide variety of applications such as interfacing large current or high voltage devices like motors, relays or lamps to low voltage digital logic IC's or gates like and gates or gates. Here, the output from a digital logic gate is only +5v but the device to be controlled may require a 12 or even 24 volts supply. Or the load such as a dc motor may need to have its speed controlled using a series of pulses (pulse width modulation) and transistor switches will allow us to do this faster and more easily than with conventional mechanical switches.
Digital logic transistor switch
The base resistor, rb is required to output current of the logic gate.
How batteries work
P a g e | 50
A battery is a device that converts chemical energy directly to electrical energy. It consists of a number of voltaic cells; each voltaic cell consists of two half cells connected in series by a conductive electrolyte containing anions and cations. One half-cell includes electrolyte and the electrode to which anions (negatively-charged ions) migrate, i.e. The anode or negative electrode; the other half-cell includes electrolyte and the electrode to which cations (positively-charged ions) migrate, i.e. The cathode or positive electrode. In the redox reaction that powers the battery, reduction (addition of electrons) occurs to cations at the cathode, while oxidation (removal of electrons) occurs to anions at the anode. The electrodes do not touch each other but are electrically connected by the electrolyte. Many cells use two half-cells with different electrolytes. In that case each half-cell is enclosed in a container, and a separator that is porous to ions but not the bulk of the electrolytes prevents mixing. Each half cell has an electromotive force (or emf), determined by its ability to drive electric current from the interior to the exterior of the cell. The net emf of the cell is the difference between the emfs of its half-cells, as first recognized by Volta. Therefore, if the electrodes have emfs and , then the net emf is ; in other words, the net emf is the difference between the reduction potentials of the half-reactions. The electrical driving force or across the terminals of a cell is known as the terminal voltage (difference) and is measured in volts. The terminal voltage of a cell that is neither charging nor discharging is called the open-circuit voltage and equals the emf of the cell. Because of internal resistance, the terminal voltage of a cell that is discharging is smaller in magnitude than the opencircuit voltage and the terminal voltage of a cell that is charging exceeds the open-circuit voltage. An ideal cell has negligible internal resistance, so it would maintain a constant terminal voltage of until exhausted, then dropping to zero. If such a cell maintained 1.5 volts and stored a charge of one coulomb then on complete discharge it would perform 1.5 joule of work. In actual cells, the internal resistance increases under discharge, and the open circuit voltage also decreases under discharge. If the
P a g e | 51
voltage and resistance are plotted against time, the resulting graphs typically are a curve; the shape of the curve varies according to the chemistry and internal arrangement employed. As stated above, the voltage developed across a cell's terminals depends on the energy release of the chemical reactions of its electrodes and electrolyte. Alkaline and carbon-zinc cells have different chemistries but approximately the same emf of 1.5 volts; likewise nicd and nimh cells have different chemistries, but approximately the same emf of 1.2 volts. On the other hand the high electrochemical potential changes in the reactions of lithium compounds give lithium cells emfs of 3 volts or more.
P a g e | 52
What are crystal oscillators?
Crystal oscillators are oscillators where the primary frequency determining element is a quartz crystal. Because of the inherent characteristics of the quartz crystal the crystal oscillator may be held to extreme accuracy of frequency stability. Temperature compensation may be applied to crystal oscillators to improve thermal stability of the crystal oscillator. Crystal oscillators are usually, fixed frequency oscillators where stability and accuracy are the primary considerations. For example it is almost impossible to design a stable and accurate LC oscillator for the upper H.F. and higher frequencies without resorting to some sort of crystal control. Hence the reason for crystal oscillators. The frequency of older ft-243 crystals can be moved upward by crystal grinding. I won't be discussing frequency synthesizers and direct digital synthesis (dds) here. They are particularly interesting topics to be covered later. A crystal oscillator is an electronic circuit that uses the mechanical resonance of a vibrating crystal of piezoelectric material to create an electrical signal with a very precise frequency. This frequency is commonly used to keep track of time (as in quartz wristwatches), to provide a stable clock signal for digital integrated circuits, and to stabilize frequencies for radio transmitters and receivers. The most common type of piezoelectric resonator used is the quartz crystal, so oscillator circuits designed around them were called "crystal oscillators". Quartz crystals are manufactured for frequencies from a few tens of kilohertz to tens of megahertz. More than two billion (2×109) crystals are manufactured annually. Most are small devices for consumer devices such as wristwatches, clocks, radios,
P a g e | 53
computers, and cell phones. Quartz crystals are also found inside test and measurement equipment, such as counters, signal generators, and oscilloscopes.
A crystal is a solid in which the constituent atoms, molecules, or ions are packed in a regularly ordered, repeating pattern extending in all three spatial dimensions. Almost any object made of an elastic material could be used like a crystal, with appropriate transducers, since all objects have natural resonant frequencies of vibration. For example, steel is very elastic and has a high speed of sound. It was often used in mechanical filters before quartz. The resonant frequency depends on size, shape, elasticity, and the speed of sound in the material. High-frequency crystals are typically cut in the shape of a simple, rectangular plate. Low-frequency crystals, such as those used in digital watches, are typically cut in the shape of a tuning fork. For applications not needing very precise timing, a low-cost ceramic resonator is often used in place of a quartz crystal. When a crystal of quartz is properly cut and mounted, it can be made to distort in an electric field by applying a voltage to an electrode near or on the crystal. This property is known as piezoelectricity. When the field is removed, the quartz will generate an electric field as it returns to its previous shape, and this can generate a voltage. The result is that a quartz crystal behaves like a circuit composed of an inductor, capacitor and resistor, with a precise resonant frequency. (see rlc circuit.) Quartz has the further advantage that its elastic constants and its size change in such a way that the frequency dependence on temperature can be very low. The specific characteristics will depend on the mode of vibration and the angle at which the quartz is cut (relative to its crystallographic axes). therefore, the
P a g e | 54
resonant frequency of the plate, which depends on its size, will not change much, either. This means that a quartz clock, filter or oscillator will remain accurate. For critical applications the quartz oscillator is mounted in a temperature-controlled container, called a crystal oven, and can also be mounted on shock absorbers to prevent perturbation by external mechanical vibrations.
P a g e | 55
Electronic symbol for a piezoelectric crystal resonator
Schematic symbol and equivalent circuit for a quartz crystal in an oscillator A quartz crystal can be modeled as an electrical network with a low impedance (series) and a high impedance (parallel) resonance point spaced closely together. Mathematically (using the Laplace transform) the impedance of this network can be written as:
P a g e | 56
Where s is the complex frequency (s = jω), ωs is the series resonant frequency in radians per second and ωp is the parallel resonant frequency in radians per second. Adding additional capacitance across a crystal will cause the parallel resonance to shift downward. This can be used to adjust the frequency at which a crystal oscillator oscillates. Crystal manufacturers normally cut and trim their crystals to have a specified resonance frequency with a known 'load' capacitance added to the crystal. For example, a 6 pf 32 kHz crystal has a parallel resonance frequency of 32,768 Hz when a 6.0 pf capacitor is placed across the crystal. Without this capacitance, the resonance frequency is higher than 32,768 Hz.
A quartz crystal provides both series and parallel resonance. The series resonance is a few kilohertz lower than the parallel one. Crystals below 30 MHz are generally operated between series and parallel resonance, which means that the crystal appears as an inductive reactance in operation. Any additional circuit capacitance will thus pull the frequency down. For a parallel resonance crystal to operate at its specified frequency, the electronic circuit has to provide a total parallel capacitance as specified by the crystal manufacturer. Crystals above 30 MHz (up to >200 MHz) are generally operated at series resonance where the impedance appears at its minimum and equal to the series resistance. For these crystals the series resistance is specified (<100 ω) instead of the parallel capacitance. To reach higher frequencies, a crystal can be made to vibrate at one of its overtone modes, which occur at multiples of the fundamental resonant frequency. Only odd numbered overtones are used. Such a crystal is referred to as a 3rd, 5th, or even 7th overtone crystal. To accomplish this, the oscillator circuit usually includes additional LC circuits to select the wanted overtone.
P a g e | 57
A crystal's frequency characteristic depends on the shape or 'cut' of the crystal. A tuning fork crystal is usually cut such that its frequency over temperature is a parabolic curve centered around 25 °c. This means that a tuning fork crystal oscillator will resonate close to its target frequency at room temperature, but will slow down when the temperature either increases or decreases from room temperature. A common parabolic coefficient for a 32 kHz tuning fork crystal is −0.04 ppm/°c².
In a real application, this means that a clock built using a regular 32 kHz tuning fork crystal will keep good time at room temperature, lose 2 minutes per year at 10 degrees Celsius above (or below) room temperature and lose 8 minutes per year at 20 degrees Celsius above (or below) room temperature due to the quartz crystal.
P a g e | 58
In alternating current the electron flow is alternate, i.e. the electron flow increases to maximum in one direction, decreases back to zero. It then increases in the other direction and then decreases to zero again. Direct current flows in one direction only. Rectifier converts alternating current to flow in one direction only. When the anode of the diode is positive with respect to its cathode, it is forward biased, allowing current to flow. But when its anode is negative with respect to the cathode, it is reverse biased and does not allow current to flow. This unidirectional property of the diode is useful for rectification. A single diode arranged back-to-back might allow the electrons to flow during positive half cycles only and suppress the negative half cycles. Double diodes arranged back-to-back might act as full wave rectifiers as they may allow the electron flow during both positive and negative half cycles. Four diodes can be arranged to make a full wave bridge rectifier. Different types of filter circuits are used to smooth out the pulsations in amplitude of the output voltage from a rectifier. The property of capacitor to oppose any change in the voltage applied across them by storing energy in the electric field of the capacitor and of inductors to oppose any change in the current flowing through them by storing energy in the magnetic field of coil may be utilized. To remove pulsation of the direct current obtained from the rectifier, different types of combination of capacitor, inductors and resistors may be also be used to increase to action of filtering. Need of Power Supply Perhaps all of you are aware that a ‘power supply’ is a primary requirement for the ‘test bench’ of a home experimenter’s mini lab. A battery eliminator can eliminate or replace the batteries of solid-state electronic equipment and the equipment thus can be operated by 230v A.C. mains instead of the batteries or dry cells. Nowadays, the use of commercial battery eliminator or power supply unit has become increasingly popular as power source for
P a g e | 59
household appliances like transceivers, record player, cassette players, digital clock etc.
Use of diodes in rectifiers: Electric energy is available in homes and industries in India, in the form of alternating voltage. The supply has a voltage of 220v (rms) at a frequency of 50 Hz. In USA, it is 110v at 60 Hz. For the operation of most of the devices in electronic equipment, a dc voltage is needed. For instance, a transistor radio requires a dc supply for its operation. Usually, this supply is provided by dry cells. But sometime we use a battery eliminator in place of dry cells. The battery eliminator converts the ac voltage into dc voltage and thus eliminates the need for dry cells. Nowadays, almost all-electronic equipment includes a circuit that converts ac voltage of mains supply into dc voltage. This part of the equipment is called power supply. In general, at the input of the power supply, there is a power transformer. It is followed by a diode circuit called rectifier. The output of the rectifier goes to a smoothing filter, and then to a voltage regulator circuit. The rectifier circuit is the heart of a power supply. Rectification Rectification is a process of rendering an alternating current or voltage into a unidirectional one. The component used for rectification is called ‘rectifier’. A rectifier permits current to flow only during the positive half cycles of the applied ac voltage by eliminating the negative half cycles or alternations of the applied ac voltage. Thus pulsating dc is obtained. To obtain smooth dc power, additional filter circuits are required. A diode can be used as rectifier. There are various types of diodes. But, semiconductor diodes are very popularly used as rectifiers. A semiconductor diode is a solid-state device consisting of two elements is being an electron emitter or cathode, the other an electron collector or anode. Since electrons in a semiconductor diode can flow in one direction only-from emitter to collector- the
P a g e | 60
diode provides the unilateral conduction necessary for rectification. Out of the semiconductor diodes, copper oxide and selenium rectifier are also commonly used. Full wave rectifier It is possible to rectify both alternations of the input voltage by using two diodes in the circuit arrangement. Assume 6.3 v rms (18 v p-p) is applied to the circuit. Assume further that two equalvalued series-connected resistors R are placed in parallel with the ac source. The 18 v p-p appears across the two resistors connected between points ac and cb, and point c is the electrical midpoint between a and b. Hence 9 v p-p appears across each resistor. At any moment during a cycle of vin, if point a is positive relative to c, point b is negative relative to c. When a is negative to c, point b is positive relative to c. The effective voltage in proper time phase which each diode "sees" is in fig. The voltage applied to the anode of each diode is equal but opposite in polarity at any given instant. When a is positive relative to c, the anode of d1 is positive with respect to its cathode. Hence d1 will conduct but d2 will not. During the second alternation, b is positive relative to c. The anode of d2 is therefore positive with respect to its cathode, and d2 conducts while d1 is cut off. There is conduction then by either d1 or d2 during the entire input-voltage cycle. Since the two diodes have a common-cathode load resistor rl, the output voltage across rl will result from the alternate conduction of d1 and d2. The output waveform vout across rl, therefore has no gaps as in the case of the half-wave rectifier. The output of a full-wave rectifier is also pulsating direct current. In the diagram, the two equal resistors r across the input voltage are necessary to provide a voltage midpoint c for circuit
P a g e | 61
connection and zero reference. Note that the load resistor rl is connected from the cathodes to this center reference point c. An interesting fact about the output waveform vout is that its peak amplitude is not 9 v as in the case of the half-wave rectifier using the same power source, but is less than 4½ v. The reason, of course, is that the peak positive voltage of a relative to c is 4½ v, not 9v, and part of the 4½ v is lost across r. Though the full wave rectifier fills in the conduction gaps, it delivers less than half the peak output voltage that results from half-wave rectification.
A more widely used full-wave rectifier circuit is the bridge rectifier. It requires four diodes instead of two, but avoids the need for a centre-tapped transformer. During the positive halfcycle of the secondary voltage, diodes d2 and d4 are conducting and diodes d1 and d3 are non-conducting. Therefore, current flows through the secondary winding, diode d2, load resistor rl and diode d4. During negative half-cycles of the secondary voltage, diodes d1 and d3 conduct, and the diodes d2 and d4 do not conduct. The current therefore flows through the secondary winding, diode d1, load resistor rl and diode d3. In both cases, the current passes through the load resistor in the same direction. Therefore, a fluctuating, unidirectional voltage is developed across the load.
The rectifier circuits we have discussed above deliver an output voltage that always has the same polarity: but however, this output is not suitable as dc power supply for solid-state circuits. This is due to the pulsation or ripples of the output voltage. This should be removed out before the output voltage can be supplied to any circuit. This smoothing is done by incorporating filter networks. The filter network consists of inductors and capacitors. The inductors or choke coils are generally connected in series
P a g e | 62
with the rectifier output and the load. The inductors oppose any change in the magnitude of a current flowing through them by storing up energy in a magnetic field. An inductor offers very low resistance for dc whereas; it offers very high resistance to ac. Thus, a series connected choke coil in a rectifier circuit helps to reduce the pulsations or ripples to a great extent in the output voltage. The fitter capacitors are usually connected in parallel with the rectifier output and the load. As, ac can pass through a capacitor but dc cannot, the ripples are thus limited and the output becomes smoothed. When the voltage across its plates tends to rise, it stores up energy back into voltage and current. Thus, the fluctuations in the output voltage are reduced considerable. Filter network circuits may be of two types in general:
Choke input filter
If a choke coil or an inductor is used as the ‘first- components’ in the filter network, the filter is called ‘choke input filter’. The d.c. along with ac pulsation from the rectifier circuit at first passes through the choke (l). It opposes the ac pulsations but allows the dc to pass through it freely. Thus ac pulsations are largely reduced. The further ripples are by passed through the parallel capacitor c. But, however, a little nipple remains unaffected, which are considered negligible. This little ripple may be reduced by incorporating a series a choke input filters.
Capacitor input filter
If a capacitor is placed before the inductors of a choke-input filter network, the filter is called capacitor input filter. The d.c. along with ac ripples from the rectifier circuit starts charging the capacitor c. To about peak value. The ac ripples are then diminished slightly. Now the capacitor c, discharges through the inductor or choke coil, which opposes the ac ripples, except the dc. The second capacitor c by passes the further ac ripples. A small ripple is still present in the output of dc, which may be reduced by adding additional filter network in series. Circuit diagram
P a g e | 63
P a g e | 64
Relay is a common, simple application of electromagnetism. It uses an electromagnet made from an iron rod wound with hundreds of fine copper wire. When electricity is applied to the wire, the rod becomes magnetic. A movable contact arm above the rod is then pulled toward the rod until it closes a switch contact. When the electricity is removed, a small spring pulls the contract arm away from the rod until it closes a second switch contact. By means of relay, a current circuit can be broken or closed in one circuit as a result of a current in another circuit. Relays can have several poles and contacts. The types of contacts could be normally open and normally closed. One closure of the relay can turn on the same normally open contacts; can turn off the other normally closed contacts. Relay requires a current through their coils, for which a voltage is applied. This voltage for a relay can be d.c. low voltages upto 24v or could be 240v A.C.
A relay is an electrical switch that opens and closes under control of another electrical circuit. In the original form, the switch is operated by an electromagnet to open or close one or many sets of contacts. It was invented by Joseph Henry in 1835. Because a relay is able to control an output circuit of higher power than the
P a g e | 65
input circuit, it can be considered, in a broad sense, to be a form of electrical amplifier. These contacts can be either normally open (no), normally closed (nc), or change-over contacts. Normally-open contacts connect the circuit when the relay is activated; the circuit is disconnected when the relay is inactive. It is also called form a contact or "makes" contact. Form a contact is ideal for applications that require switching a high-current power source from a remote device. Normally-closed contacts disconnect the circuit when the relay is activated; the circuit is connected when the relay is inactive. It is also called form b contact or "break" contact. Form b contact is ideal for applications that require the circuit to remain closed until the relay is activated. Change-over contacts control two circuits: one normally-open contact and one normally-closed contact with a common terminal. It is also called form c contact. A relay is an electrically operated switch. Many relays use an electromagnet to operate a switching mechanism, but other operating principles are also used. Relays find applications where it is necessary to control a circuit by a low-power signal, 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 found extensive use in telephone exchanges and early computers to perform logical operations. A type of relay that can handle the high power required to directly drive an electric motor is called a contactor. Solid-state relays 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 "protection relays".
P a g e | 66
Basic design and operation
A simple electromagnetic relay, such as the one taken from a car in the first picture, is an adaptation of an electromagnet. It consists of a coil of wire surrounding a soft iron core, an iron yoke, which provides a low reluctance path for magnetic flux, a movable iron armature, and a set, or sets, of contacts; two in the relay pictured. The armature is hinged to the yoke and mechanically linked to a moving contact or contacts. It is held in place by a spring so that 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 the other set is open. Other relays may have more or fewer sets of contacts depending on their function. The relay in the picture also has a wire connecting the armature to the yoke. This ensures continuity of the circuit between the moving contacts on the armature, and the circuit track on the printed circuit board (pcb) via the yoke, which is soldered to the pcb. When an electric current is passed through the coil, the resulting magnetic field attracts the armature and the consequent movement of the movable contact or contacts either makes or breaks a connection with a fixed contact. If the set of contacts were closed when the relay was de-energized, then the movement opens the contacts and breaks the connection, and vice versa if the contacts were open. When the current to the coil is switched off, the armature is returned by a force, approximately half as strong as the magnetic force, to its relaxed position. Usually this force is provided by a spring, but gravity is also used commonly in industrial motor starters. Most relays are manufactured to operate quickly. In a low voltage application, this is to reduce noise. In a high voltage or high current application, this is to reduce arcing. When the coil is energized with direct current a diode is often placed across the coil, to dissipate the energy from the collapsing magnetic field at deactivation, which would otherwise generate a voltage spike dangerous to circuit components. Some automotive relays already include a diode inside the relay case. Alternatively a contact protection network, consisting of a capacitor and
P a g e | 67
resistor in series, may absorb the surge. If the coil is designed to be energized with alternating current (ac), a small copper ring can be crimped to the end of the solenoid. This "shading ring" creates a small out-of-phase current, which increases the minimum pull on the armature during the ac cycle. By analogy with functions of the original electromagnetic device, a solid-state relay is made with a thyristor or other solid-state switching device. To achieve electrical isolation an optocoupler can be used which is a light-emitting diode (led) coupled with a photo transistor. Relays are devices which allow low power circuits to switch a relatively high current/voltage on/off. For a relay to operate a suitable pull-in & holding current should be passed through its coil. Generally relay coils are designed to operate from a particular voltage often its 5v or 12v. The function of relay driver circuit is to provide the necessary current (typically 25 to 70ma) to energize the relay coil.
Figure Figure shows the basic relay driver circuit. As you can see an npn transistor bc547 is being used to control the relay. The transistor is driven into saturation (turned on) when logic 1 is written on the port pin thus turning on the relay. The relay is turned off by
P a g e | 68
writing logic 0 on the port pin. A diode (1n4007/1n4148) is connected across the relay coil; this is done so as to protect the transistor from damage due to the back emf generated in the relay's inductive coil when the transistor is turned off. When the transistor is switched off the energy stored in the inductor is dissipated through the diode & the internal resistance of the relay coil. As you can see we have used a pull up resistor at the base of the transistor. At8951/52/55 has an internal pull up resistor of 10k so when the pin is pulled high the current flows through this resistor so the maximum output current is 5v/10k = 0.5ma, the dc current gain of bc547 is 100 so the maximum collector current we can get is 0.5ma x 100 = 50ma, but most of the relays require more than 70ma-130ma current depending on the relay that we have used, 0.5ma of base current is not suitable enough for turning on the relay, so we have used an external pull up resistor. When the controller pin is high current flows through the controller pin i.e. 5v/10k=0.5ma as well as through the pull up resistor. We have used 4.7k pull up resistor so 5v/4.7k=1.1ma so maximum base current can be 0.5ma + 1.1ma=1.6ma i.e. Collector current =1.6ma x 100 = 160ma which is enough to turn on most of the relays.
this relay driver circuit is to be used only with controllers for using this circuit with other digital IC's like lm 555 use a resistor should be used between that IC's output & the base of transistor. No need of pull up resistor in that case.
Relays are used to and for:
Control a high-voltage circuit with a low-voltage signal, as in some types of modems or audio amplifiers,
P a g e | 69
Control a high-current circuit with a low-current signal, as in the starter solenoid of an automobile, Detect and isolate faults on transmission and distribution lines by opening and closing circuit breakers (protection relays), Isolate the controlling circuit from the controlled circuit when the two are at different potentials, for example when controlling a mains-powered device from a low-voltage switch. The latter is often applied to control office lighting as the low voltage wires are easily installed in partitions, which may be often moved as needs change. They may also be controlled by room occupancy detectors in an effort to conserve energy, Logic functions. For example, the Boolean and function is realized by connecting normally open relay contacts in series, the or function by connecting normally open contacts in parallel. The change-over or form c contacts perform the xor (exclusive or) function. Similar functions for nand and nor are accomplished using normally closed contacts. The ladder programming language is often used for designing relay logic networks.
Early computing. Before vacuum tubes and transistors, relays were used as logical elements in digital computers. See arra (computer), Harvard mark ii, zuse z2, and zuse z3. • Safety-critical logic. Because relays are much more resistant than semiconductors to nuclear radiation, they are widely used in safety-critical logic, such as the control panels of radioactive waste-handling machinery.
Time delay functions. Relays can be modified to delay opening or delay closing a set of contacts. A very short (a fraction of a second) delay would use a copper disk between the armature and moving blade assembly. Current flowing in the disk maintains magnetic field for a short time, lengthening release time. For a slightly longer (up to a minute) delay, a dashpot is used. A dashpot is a piston filled with fluid that is allowed to escape slowly. The time period
P a g e | 70
can be varied by increasing or decreasing the flow rate. For longer time periods, a mechanical clockwork timer is installed.
A transformer is a device that transfers electrical energy from one circuit to another through inductively coupled conductors—the transformer's coils. A varying current in the first or primary winding creates a varying magnetic flux in the transformer's core, and thus a varying magnetic field through the secondary winding. This varying magnetic field induces a varying electromotive force (emf) or "voltage" in the secondary winding. This effect is called mutual induction.
P a g e | 71
If a load is connected to the secondary, an electric current will flow in the secondary winding and electrical energy will be transferred from the primary circuit through the transformer to the load. In an ideal transformer, the induced voltage in the secondary winding (vs) is in proportion to the primary voltage (vp), and is given by the ratio of the number of turns in the secondary (ns) to the number of turns in the primary (np) as follows:
By appropriate selection of the ratio of turns, a transformer thus allows an alternating current (ac) voltage to be "stepped up" by making ns greater than np, or "stepped down" by making ns less than np. In the vast majority of transformers, the windings are coils wound around a ferromagnetic core, air-core transformers being a notable exception. Transformers range in size from a thumbnail-sized coupling transformer hidden inside a stage microphone to huge units weighing hundreds of tons used to interconnect portions of power grids. All operate with the same basic principles, although the range of designs is wide. While new technologies have eliminated the need for transformers in some electronic circuits, transformers are still found in nearly all electronic devices designed for household ("mains") voltage. Transformers are essential for high voltage power transmission, which makes long distance transmission economically practical.
The transformer is based on two principles: firstly, that an electric current can produce a magnetic field (electromagnetism) and secondly that a changing magnetic field within a coil of wire
P a g e | 72
induces a voltage across the ends of the coil (electromagnetic induction). Changing the current in the primary coil changes the magnetic flux that is developed. The changing magnetic flux induces a voltage in the secondary coil.
An ideal transformer
An ideal transformer is shown in the adjacent figure. Current passing through the primary coil creates a magnetic field. The primary and secondary coils are wrapped around a core of very high magnetic permeability, such as iron, so that most of the magnetic flux passes through both the primary and secondary coils.
The voltage induced across the secondary coil may be calculated from faraday's law of induction, which states that:
Where vs is the instantaneous voltage, ns is the number of turns in the secondary coil and φ equals the magnetic flux through one turn of the coil. If the turns of the coil are oriented perpendicular to the magnetic field lines, the flux is the product of the magnetic flux density b and the area a through which it cuts. The area is constant, being equal to the cross-sectional area of the transformer core, whereas the magnetic field varies with time
P a g e | 73
according to the excitation of the primary. Since the same magnetic flux passes through both the primary and secondary coils in an ideal transformer, the instantaneous voltage across the primary winding equals
Taking the ratio of the two equations for vs and vp gives the basic equation for stepping up or stepping down the voltage
Ideal power equation
The ideal transformer as a circuit element If the secondary coil is attached to a load that allows current to flow, electrical power is transmitted from the primary circuit to the secondary circuit. Ideally, the transformer is perfectly efficient; all the incoming energy is transformed from the primary circuit to the magnetic field and into the secondary circuit. If this condition is met, the incoming electric power must equal the outgoing power. Pincoming = ipvp = poutgoing = isvs Giving the ideal transformer equation
P a g e | 74
Transformers normally have high efficiency, so this formula is a reasonable approximation. If the voltage is increased, then the current is decreased by the same factor. The impedance in one circuit is transformed by the square of the turns ratio. For example, if an impedance zs is attached across the terminals of the secondary coil, it appears to the primary circuit to have an impedance of . This relationship is reciprocal, so that the impedance zp of the primary circuit appears to the secondary to be .
The simplified description above neglects several practical factors, in particular the primary current required to establish a magnetic field in the core, and the contribution to the field due to current in the secondary circuit. Models of an ideal transformer typically assume a core of negligible reluctance with two windings of zero resistance. When a voltage is applied to the primary winding, a small current flows, driving flux around the magnetic circuit of the core. The current required to create the flux is termed the magnetizing current; since the ideal core has been assumed to have near-zero reluctance, the magnetizing current is negligible, although still required to create the magnetic field. The changing magnetic field induces an electromotive force (emf) across each winding. Since the ideal windings have no impedance, they have no associated voltage drop, and so the voltages vp and vs measured at the terminals of the transformer, are equal to the corresponding emfs. The primary emf, acting as it does in opposition to the primary voltage, is sometimes termed the "back emf". This is due to Lenz’s law which states that the
P a g e | 75
induction of emf would always be such that it will oppose development of any such change in magnetic field.
A major application of transformers is to increase voltage before transmitting electrical energy over long distances through wires. Wires have resistance and so dissipate electrical energy at a rate proportional to the square of the current through the wire. By transforming electrical power to a high-voltage (and therefore low-current) form for transmission and back again afterward, transformers enable economic transmission of power over long distances. Consequently, transformers have shaped the electricity supply industry, permitting generation to be located remotely from points of demand. All but a tiny fraction of the world's electrical power has passed through a series of transformers by the time it reaches the consumer. Transformers are also used extensively in electronic products to step down the supply voltage to a level suitable for the low voltage circuits they contain. The transformer also electrically isolates the end user from contact with the supply voltage. signal and audio transformers are used to couple stages of amplifiers and to match devices such as microphones and record players to the input of amplifiers. Audio transformers allowed telephone circuits to carry on a two-way conversation over a single pair of wires. A balun transformer converts a signal that is referenced to ground to a signal that has balanced voltages to ground, such as between external cables and internal circuits. The principle of open-circuit (unloaded) transformer is widely used for characterization of soft magnetic materials, for example in the internationally standardized Epstein frame method
P a g e | 76
compatible with mcs-51™ products 8-bit microcontroller with 4k bytes flash 4k bytes of in-system reprogrammable flash memory endurance: 1,000 write/erase cycles fully static operation: 0 Hz to 24 mhz three-level program memory lock 128 x 8-bit internal ram 32 programmable i/o lines two 16-bit timer/counters six interrupt sources programmable serial channel low-power idle and power-down modes
The at89c51 is a low-power, high-performance cmos 8-bit microcomputer with 4k bytes of flash programmable and erasable read only memory (perom). The device is manufactured using Atmel’s high-density nonvolatile memory technology and is compatible with the industry-standard mcs-51 instruction set insystem or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit cpu with flash on a monolithic chip, the Atmel at89c51 is a powerful microcomputer which provides a highly-flexible and cost-effective solution to many embedded control applications and pinout. The on-chip flash reprogrammed allows the program memory to be
P a g e | 77
The at89c51 provides the following standard features: 4k bytes of flash, 128 bytes of ram, 32 i/o lines, two 16-bit timer/counters, a
five vector two-level interrupt architecture, full duplex serial port, on-chip oscillator and clock circuitry. In addition, the at89c51 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The idle mode stops the cpu while allowing the ram, timer/counters, serial port and interrupt system to continue functioning. The power-down mode saves the ram contents but freezes the oscillator disabling all other chip functions until the next
P a g e | 78
Vcc :-Supply voltage. Gnd:-Ground. Port 0 Port 0 is an 8-bit open-drain bi-directional i/o port. As an output port, each pin can sink eight ttl inputs. When 1s are written to port 0 pins, the pins can be used as high impedance inputs. Port 0 may also be configured to be the multiplexed low order address/data bus during accesses to external program and data memory. In this mode p0 has internal pull-ups. Port 0 also receives the code bytes during flash programming, And outputs the code bytes during program Verification. External pull-ups are required during program Port 1 Port 1 is an 8-bit bi-directional i/o port with internal pull-ups. The port 1 output buffers can sink/source four ttl inputs. When 1s are written to port 1 pins they are pulled high by the internal pull-ups and can be used as inputs. As inputs, port 1 pins that are externally being pulled low will source current (ail) because of the internal pull-ups. Port 1 also receives the low-order address bytes during flash programming and verification.
P a g e | 79
Port 2 Port 2 is an 8-bit bi-directional i/o port with internal pull-ups. The port 2 output buffers can sink/source four ttl inputs. When 1s are written to port 2 pins they are pulled high by the internal pull-ups and can be used as inputs. As inputs, port 2 pins that are externally being pulled low will source current (ail) because of the internal pull-ups. Port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that use 16-bit addresses (movx @dptr). In this application, it uses strong internal pull-ups when emitting 1s. During accesses to external data memory that use 8-bit addresses (movx @ ri), port 2 emits the contents of the p2 special function register. Port 2 also receives the high-order address bits and some control signals during flash programming and verification. Port 3 Port 3 is an 8-bit bi-directional i/o port with internal pull-ups. The port 3 output buffers can sink/source four ttl inputs. When 1s are written to port 3 pins they are pulled high by the internal pull-ups and can be used as inputs. As inputs, port 3 pins that are externally being pulled low will source current (ail) because of the pull-ups. Port 3 also serves the functions of various special features of the at89c51 as listed below: Port 3 also receives some control signals for flash programming and verification.
P a g e | 80
RST Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device. ALE/PROG Address latch enable output pulse for latching the low byte of the address during accesses to external memory. This pin is also the program pulse input (prog) during flash programming. In normal operation ale is emitted at a constant rate of 1/6 the oscillator frequency, and may be used for external timing or clocking purposes. Note, however, that one ale pulse is skipped during each access to external data memory. If desired, ale operation can be disabled by setting bit 0 of sfr location 8eh. With the bit set, ale is active only during a movx or movc instruction. Otherwise, the pin is weakly pulled high. Setting the ale-disable bit has no effect if the microcontroller is in external execution mode. PSEN Program store enable is the read strobe to external program memory. When the at89c51 is executing code from external program memory, psen is activated twice each machine cycle, except that two psen activations are skipped during each access to external data memory.
P a g e | 81
EA/VPP External access enable. Ea must be strapped to gnd in order to enable the device to fetch code from external program memory locations starting at 0000h up to ffffh. Note, however, that if lock bit 1 is programmed, ea will be internally latched on reset. Ea should be strapped to vcc for internal program executions.
P a g e | 82
Xtal1 and xtal2 are the input and output, respectively, of an inverting amplifier which can be configured for use as an on-chip oscillator, as shown in figure 1. Either a quartz crystal or ceramic resonator may be used. To drive the device from an external clock source, xtal2 should be left unconnected while xtal1 is driven as shown in figure 2. There are no requirements on the duty cycle of the external clock signal, since the input to the internal clocking circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high and low time specifications must be observed.
In idle mode, the cpu puts itself to sleep while all the on chip peripherals remain active. The mode is invoked by software. The content of the on-chip ram and all the special functions registers remain unchanged during this mode. The idle mode can be terminated by any enabled interrupt or by a hardware reset. It should be noted that when idle is terminated by a hard ware reset, the device normally resumes program execution, from where it left off, up to two machine cycles before the internal reset algorithm takes control. On-chip hardware inhibits access to internal ram in this event, but access to the port pins is not inhibited. To eliminate the possibility of an unexpected write to a port pin when idle is terminated by reset, the instruction following the one that invokes idle should not be one that writes to a port pin or to external memory.
In the power-down mode, the oscillator is stopped, and the instruction that invokes power-down is the last instruction executed. The on-chip ram and special function registers retain their values until the power-down mode is terminated. The only
P a g e | 83
exit from power-down is a hardware reset. Reset redefines the sfrs but does not change the on-chip ram. The reset should not be activated before vcc is restored to its normal operating level and must be held active long enough to allow the oscillator to restart and stabilize.
Program memory lock bits on the chip are three lock bits which can be left unprogrammed (u) or can be programmed (p) to obtain the additional features listed in the table below. When lock bit 1 is programmed, the logic level at the ea pin is sampled and latched during reset. If the device is powered up without a reset, the latch initializes to a random value, and holds that value until reset is activated. It is necessary that the latched value of ea be in agreement with the
P a g e | 84
current logic level at that pin in order for the device to function properly.
Programming the flash
The at89c51 is normally shipped with the on-chip flash memory array in the erased state (that is, contents = ffh) and
ready to be programmed. The programming interface accepts either a high-voltage (12-volt) or a low-voltage (vcc) program enable signal. The low-voltage programming mode provides a convenient way to program the at89c51 inside the user’s system, while the high-voltage programming mode is compatible with conventional third party flash or eprom programmers. The at89c51 is shipped with either the high-voltage or low-voltage programming mode enabled. The respective top-side marking and device signature codes are listed in the following table. The at89c51 code memory array is programmed byte by byte in either programming mode. To program any nonblank byte in the on-chip flash memory, the entire memory must be erased using the chip erase mode.
P a g e | 85
Programming algorithm: before programming the at89c51, the address, data and control signals should be set up according to the flash programming mode table . To program the at89c51, take the following steps. Input the desired memory location on the address lines. Input the appropriate data byte on the data lines. Activate the correct combination of control signals. Raise ea/app. to 12v for the high-voltage programming mode. Pulse ale/prog once to program a byte in the flash array or the Lock bits. The byte-write cycle is self-timed and typically takes no More than 1.5 ms. Repeat steps 1 through 5, changing the address and data for the entire array or until the end of the object file is reached.
The at89c51 features data polling to indicate the end of a write cycle. During a write cycle, an attempted read of the last byte written will result in the complement of the written datum on po.7. Once the write cycle has been completed, true data are valid on all outputs, and the next cycle may begin. Data polling may begin any time after a write cycle has been initiated.
The progress of byte programming can also be monitored by the dribs output signal. P3.4 is pulled low after ale goes high during programming to indicate busy. P3.4 is pulled high again when programming is done to indicate ready. Program verify: if lock bits lb1 and lb2 have not been programmed, the programmed code data can be read back via the address and data lines for verification. The lock bits cannot be
P a g e | 86
verified directly. Verification of the lock bits is achieved by observing that their features are enabled. Chip erase: the entire flash array is erased electrically by using the proper combination of control signals and by holding ale/prog low for 10 ms. The code array is written with all “1”s. The chip erase operation must be executed before the code memory can be re-programmed. Reading the signature bytes: the signature bytes are read by the same procedure as a normal verification of locations 030h, 031h, and 032h, except that p3.6 and p3.7 must be pulled to a logic low. The values returned are as follows. (030h) = 1eh indicates manufactured by Atmel (031h) = 51h indicates 89c51 (032h) = ffh indicates 12v programming (032h) = 05h indicates 5v programming
Every code byte in the flash array can be written and the entire array can be erased by using the appropriate combination of control signals. The write operation cycle is self timed and once initiated, will automatically time itself to completion. All major programming vendors offer worldwide support for the Atmel microcontroller series. Please contact your local programming vendor for the appropriate software revision.
P a g e | 87
INFRARED REMOTE CONTROL
What is infrared?
Infrared is a energy radiation with a frequency below our eyes sensitivity, so we can not see it even that we can not "see" sound frequencies, we know that it exist, we can listen them.
Even that we can not see or hear infrared, we can feel it at our skin temperature sensors. When you approach your hand to fire or warm element, you will "feel" the heat, but you can't see it. You can see the fire because it emits other types of radiation, visible to your eyes, but it also emits lots of infrared that you can only feel in your skin. Infrared radiation (IR) is electromagnetic radiation with a wavelength between 0.7 and 300 micrometers, which equates to a frequency range between approximately 1 and 430 THz. Its wavelength is longer (and the frequency lower) than that of visible light, but the wavelength is shorter (and the frequency higher) than that of terahertz radiation microwaves. Bright sunlight provides an irradiance of just over 1 kilowatt per square meter at sea level. Of this energy, 527 watts is infrared radiation, 445 watts is visible light, and 32 watts is ultraviolet radiation.
P a g e | 88
Infrared in electronics Infra-red is interesting, because it is easily generated and doesn't suffer electromagnetic interference, so it is nicely used to communication and control, but it is not perfect, some other light emissions could contains infrared as well, and that can interfere in this communication. The sun is an example, since it emits a wide spectrum or radiation. The adventure of using lots of infra-red in tv/vcr remote controls and other applications, brought infra-red diodes (emitter and receivers) at very low cost at the market. From now on you should think as infrared as just a "red" light. This light can means something to the receiver, the "on or off" radiation can transmit different meanings. Lots of things can generate infrared, anything that radiate heat do it, including out body, lamps, stove, oven, friction your hands together, even the hot water at the faucet. To allow a good communication using infra-red, and avoid those "fake" signals, it is imperative to use a "key" that can tell the receiver what is the real data transmitted and what is fake. As an analogy, looking eye naked to the night sky you can see hundreds of stars, but you can spot easily a far away airplane just by its
P a g e | 89
flashing strobe light. That strobe light is the "key", the "coding" element that alerts us. Similar to the airplane at the night sky, our T.V. room may have hundreds of tinny IR sources, our body, the lamps around, even the hot cup of tea. A way to avoid all those other sources, is generating a key, like the flashing airplane. So, remote controls use to pulsate its infrared in a certain frequency. The IR receiver module at the T.V., VCR or stereo "tunes" to this certain frequency and ignores all other IR received. The best frequency for the job is between 30 and 60khz, the most used is around 36khz. So, remote controls use the 36khz (or around) to transmit information. Infrared light emitted by IR diodes is pulsated at 36 thousand times per second, when transmitting logic level "1" and silence for "0". To generate a 36khz pulsating infrared is quite easy, more difficult is to receive and identify this frequency. This is why some companies produce infrared receives, that contains the filters, decoding circuits and the output shaper, that delivers a square wave, meaning the existence or not of the 36khz incoming pulsating infrared. It means that those 3 dollars small units, have an output pin that goes high (+5v) when there is a pulsating 36khz infrared in front of it, and zero volts when there is not this radiation. A square wave of approximately 27us (microseconds) injected at the base of a transistor, can drive an infrared led to transmit this pulsating light wave. Upon its presence, the commercial receiver will switch its output to high level (+5v). If you can turn on and off this frequency at the transmitter, your receiver's output will indicate when the transmitter is on or off.
P a g e | 90
Those IR demodulators have inverted logic at its output, when a burst of IR is sensed it drives its output to low level, meaning logic level = 1. The T.V., VCR, and audio equipment manufacturers for long use infra-red at their remote controls. My first color T.V. in 1976 used an ultrasound (not infrared) remote control. To avoid a Philips remote control to change channels in a Panasonic T.V., they use different codification at the infrared, even that all of them use basically the same transmitted frequency, from 36 to 50khz. So, all of them use a different combination of bits or how to code the transmitted data to avoid interference. Some standards were created. As illustrative material, we will only show one of them, the one used by Philips, even that we can cover the other ones in the future. First of all, Philips adopted or created the rc5 standard that uses fixed bit length and fixed quantity of bits. Each time you press a button at the Philips remote control, it sends a train of 14 bits, 1.728ms per bit, the whole train is repeated every 130ms if you keep the button pressed Each bit is sliced in two halves. The left and right half has opposed levels. If the bit to be transmitted is one (1), its left side is zero while its right side is one. If the bit to be transmitted is zero (0), its left side is one while the right side is zero.
P a g e | 91
(this is the right logic, reversed from what you can see at the IR receiver output.) It means that the second half of the bit is actually the same meaning of the bit to be transmitted, as you can see at the shaded blue right side of the bit as on, means bit transmitted = 1. If you want to measure the correct logic level directly from the receiver output, you should measure at the first half of the bit. The correct interpretation is that it changes level exactly at the middle of bit time. At the IR receiver output a bit zero changes level from low to up, while a bit one changes level from up to low. There are a minimum quantity of incoming 27µs pulses to the demodulator understand it is at the right frequency and then drop its output. The quantity of pulses used at the Philips remotes are 32 pulses per each half of the bit, 64 pulses per bit. So, a bit "0" to be transmitted it means 32 square pulses of 27µs each, then 32 x 27µs of silence. The bit "1" is the opposite, 32 x 27µs of silence followed by 32 square pulses of 27µs. Our job here will be to decode the receiving of the waveform at the demodulator output. We could observe the direction of the changing at the middle of the bit, if going down, means bit 0, going up, and means bit 1. But it is easy to sample the middle of the first half of the bit, so it directly tells us what is the bit state, as we will see next in this text.
RC5 for Remote Control
What is RC5? Most infrared remote controls communicate using an identical Infrared carrier scheme. This IR is modulated at the transmitter by a 36Khz, 38Khz or 40Khz square wave which in turn is
P a g e | 92
modulated/gated by the data stream of about 1Kbps. The resulting signal is fed to one or more infrared emitters. The most efficient pulse duty cycle is 50%. The receiver circuit consists of a photodiode, a preamplifier, and a demodulator circuit. This combination is commercially available as the TEMIC IR receiver. The preamplifier contains a band pass filter which limits the receiver’s sensitivity to about +/- 2 KHz, near the centre frequency. An AGC circuit adjusts the incoming level to the demodulator, which explains the presence of a long leading pulse in many of the protocols. This allows the receiver to stabilize its AGC circuit, prior to the reception of the bit stream. The output of the receiver is a binary bit stream, corresponding to the original modulation signal at the transmitter. It is often an open collector pull-down. Note that this signal is active low, so that "ones" in terms of the carrier signal appear as "zeros" at the demodulator. Infrared Transmission
Normal infrared signal used by many remote controls has three layers. Since there are no standard names for the three layers, in this application note they are named as the IR carrier, IR modulation, and the IR data. The IR carrier is the media of transmission. Infrared appears just above the color Red in the light spectrum. IR beam is invisible to the human eye even though its behavior is same as visible light. The IR modulation layer may have a modulation frequency between 32Khz and 56KHz to suppress the effect of the ambient
P a g e | 93
light. The frequency selection is based on the IR receiver module. The IR data layer is the serial data stream that is transmitted. The RC5 code The RC5 code set was developed by Phillips and allows 2048 commands to be transmitted divided into 32 addressable groups of 64 commands each. The transmitted code consists of a 14 bit data word of the following structure. 2 1 5 6 run-in bits to adjust the AGC level in the receiver IC check bit system address bits command bits.
P a g e | 94
The basic timing is derived from a 36KHZ oscillator. The code is transmitted in biphase format. In this system, logic 1 is transmitted as a half bit time without signal, followed by a half bit time with signal. Logic 0 has exactly the opposite structure. Each half bit consists of 32 shorter pulses. Each transmitted bit has a length of 1.778 msec, the shorter pulses have a pulse width of 6.9444 usec on time and 20.8332 usec off time. A complete data word has a length of 24.889 msec, and is always transmitted completely. If the key is held pressed the code is repeated in intervals of 64 bit times (i.e. 113.778 msec). Bits are transmitted on a trailing edge. Each RC-5 code word is 14 bits, in the following format: 2 start bits, the first is always 1, the second is a field bit denoting
P a g e | 95
command codes 0-63 (logical 1) or 64-127 (logical 0). 1 control bit which toggles after each key release and initiates a new transmission (i.e., if you type 5, 5 on the first five this will be z, on the second !z, to differentiate the second keystroke from just a retransmission of the first), 5 system address bits for selecting one of 32 possible systems listed in table 1. 6 command bits representing one of the 128 possible RC-5 commands listed in the tables at the end of the publication. "Before transmission via the IR LED, the HIGH period of each 1.778ms symbol is modulated at 36 kHz with a duty factor of 0.25. Each half-symbol period which is HICH therefore contains 32 pulses with an on-time of 6.944us and a repetition period of 27.777us." Infrared Receiver This is a 3 pin device incorporating surface mount IC which has the following blocks:
Photo detector Preamplifier Filter Demodulator
The functional block diagram of the same is given below
P a g e | 96
Two pins are for +5v supply and ground while the third pin is for data output. The Infrared Receiver is designed for demodulating the frequency of 30khz to 40khz, for example, TSOP1738 is designed for demodulating frequency of 38khz which is used in our project. The IR receiver module receives the data sent by remote handset, amplifies, demodulates and converts it to MCU compatible voltage format and outputs it on its data output pin.
Available types for different carrier frequencies
Interfacing the keyboard to 8051 microcontroller
P a g e | 97
The key board here we are interfacing is a matrix keyboard. This key board is designed with a particular rows and columns. These rows and columns are connected to the microcontroller through its ports of the micro controller 8051. We normally use 8*8 matrix keyboard. So only two ports of 8051 can be easily connected to the rows and columns of the key board. When ever a key is pressed, a row and a column gets shorted through that pressed key and all the other keys are left open. When a key is pressed only a bit in the port goes high. Which indicates microcontroller that the key is pressed? By this high on the bit key in the corresponding column is identified. Once we are sure that one of key in the key board is pressed next our aim is to identify that key. To do this we firstly check for particular row and then we check the corresponding column the key board. To check the row of the pressed key in the keyboard, one of the rows is made high by making one of bit in the output port of 8051 high. This is done until the row is found out. Once we get the row next out job is to find out the column of the pressed key. The column is detected by contents in the input ports with the help of a counter. The content of the input port is rotated with carry until the carry bit is set. The contents of the counter is then compared and displayed in the display. This display is designed using a seven segment display and a BCD to seven segment decoder IC 7447. The BCD equivalent number of counter is sent through output part of 8051 displays the number of pressed key.
Circuit diagram of interfacing key board to 8051.
P a g e | 98
The programming algorithm, program and the circuit diagram is as follows. Here program is explained with comments.
Circuit diagram of interfacing key board to 8051. Keyboard is organized in a matrix of rows and columns as shown in the figure. The microcontroller accesses both rows and columns through the port. 1. The 8051 has 4 i/o ports p0 to p3 each with 8 i/o pins, p0.0 to p0.7,p1.0 to p1.7, p2.0 to p2.7, p3.0 to p3.7. The one of the port p1 (it understood that p1 means p1.0 to p1.7) as an i/p port for microcontroller 8051, port p0 as an o/p port of microcontroller 8051 and port p2 is used for displaying the number of pressed key. 2. Make all rows of port p0 high so that it gives high signal when key is pressed. 3. See if any key is pressed by scanning the port p1 by checking all columns for non zero condition. 4. If any key is pressed, to identify which key is pressed make one row high at a time. 5. Initiate a counter to hold the count so that each key is counted. 6. Check port p1 for nonzero condition. If any nonzero number is there in [accumulator], start column scanning by following step 9. 7. Otherwise make next row high in port p1. 8. Add a count of 08h to the counter to move to the next row by repeating steps from step 6. 9. If any key pressed is found, the [accumulator] content is rotated right through the carry until carry bit sets, while
P a g e | 99
doing this increment the count in the counter till carry is found. 10. Move the content in the counter to display in data field or to memory location 11. To repeat the procedures go to step 2.
P a g e | 100
A photodiode is a semiconductor diode that functions as a photo detector. Photodiodes are packaged with either a window or optical fiber connection, in order to let in the light to the sensitive part of the device. They may also be used without a window to detect vacuum UV or x-rays. A phototransistor is in essence nothing more than a bipolar transistor that is encased in a transparent case so that light can reach the base-collector junction. The phototransistor works like a photodiode, but with a much higher sensitivity for light, because the electrons that are generated by photons in base-collector junction are injected into the base, this current is then amplified by the transistor operation. A phototransistor has a slower response time than a photodiode however.
Principle of operation: A photodiode is a p-n junction or p-i-n structure. When light with sufficient photon energy strikes a semiconductor, photons can be absorbed, resulting in generation of a mobile electron and electron hole. If the absorption occurs in the junction's depletion region, these carriers are swept from the junction by the built-in field of the depletion region, producing a photocurrent. Photodiodes can be used in either zero bias or reverse bias. In zero bias, light falling on the diode causes a voltage to develop across the device, leading to a current in the forward bias direction. This is called the photovoltaic effect, and is the basis for solar cells — in fact; a solar cell is just a large number of big, cheap photodiodes. Diodes usually have extremely high resistance when reverse biased. This resistance is reduced when light of an appropriate frequency shines on the junction. Hence, a reverse biased diode can be used as a detector by monitoring the current running through it. Circuits based on this effect are more sensitive to light than ones based on the photovoltaic effect.
P a g e | 101
Avalanche photodiodes have a similar structure; however they are operated with much higher reverse bias. This allows each photogenerated carrier to be multiplied by avalanche breakdown, resulting in internal gain within the photodiode, which increases the effective responsively of the device.
Materials: The material used to make a photodiode is critical to defining its properties, because only photons with sufficient energy to excite an electron across the material's bandgap will produce significant photocurrents. Materials commonly used to produce photodiodes:
Material Silicon Germanium Indium arsenide Lead sulfide gallium
Wavelength range (nm) 190–1100 800–1700 800–2600 <1000-3500
Because of their greater bandgap, silicon-based photodiodes generate less noise than germanium-based photodiodes, but germanium photodiodes must be used for wavelengths longer than approximately 1 µm.
Features: Critical performance metrics of a photodiode include: -
The ratio of generated photocurrent to incident light power, typically expressed in a/w when used in photoconductive mode.
P a g e | 102
The responsivity may also be expressed as quantum efficiency, or the ratio of the number of photo generated carriers to incident photons, thus a unit less quantity.
The current through the photodiode in the absence of any input optical signal, when it is operated in photoconductive mode. The dark current includes photocurrent generated by background radiation and the saturation current of the semiconductor junction. Dark current must be accounted for by calibration if a photodiode is used to make an accurate optical power measurement, and it is also a source of noise when a photodiode is used in an optical communication system.
(N.E.P.) the minimum input optical power to generate photocurrent equal to the rms noise current in 1 hertz bandwidth. The related characteristic detectivity (d) is the inverse of N.E.P., 1/nep; and the specific detectivity ( ) is the detectivity normalized to the area (a) of the photo detector, . The N.E.P. is roughly the minimum detectable input power of a photodiode. When a photodiode is used in an optical communication system, these parameters contribute to the sensitivity of the optical receiver, which is the minimum input power required for the receiver to achieve a specified bit error ratio.
Applications: P-n photodiodes are used in similar applications to other photo detectors, such as photoconductors, charge-coupled devices, and photomultiplier tubes.
P a g e | 103
Photodiodes are used in consumer electronics devices such as compact disc players smoke detectors, and the receivers for remote controls in vcrs and televisions. In other consumer items such as camera light meters, clock radios (the ones that dim the display when its dark) and street lights, photoconductors are often used rather than photodiodes, although in principle either could be used. Photodiodes are often used for accurate measurement of light intensity in science and industry. They generally have a better, more linear response than photoconductors. They are also widely used in various medical applications, such as detectors for computed tomography (coupled with scintillators) or instruments to analyze samples (immunoassay). They are also used in blood gas monitors. Pin diodes are much faster and more sensitive than ordinary p-n junction diodes, and hence are often used for optical communications. P-n photodiodes are not used to measure extremely low light intensities. Instead, if high sensitivity is needed, avalanche photodiodes, intensified charge-coupled devices or photomultiplier tubes are used for applications such as astronomy, spectroscopy, night-vision equipment and laser range finding.
P a g e | 104
Phototransistors are solid-state light detectors with internal gain that are used to provide analog or digital signals. They detect visible, ultraviolet and near-infrared light from a variety of sources and are more sensitive than photodiodes, semiconductor devices that require a pre-amplifier. Phototransistors feed a photocurrent output into the base of a small signal transistor. For each illumination level, the area of the exposed collector-base junction and the dc current gain of the transistor define the output. The base current from the incident photons is amplified by the gain of the transistor, resulting in current gains that range from hundreds to several thousands. Response time is a function of the capacitance of the collector-base junction and the value of the load resistance. Photodarlingtons, a common type of phototransistor, have two stages of gain and can provide net gains greater than 100,000. Because of their ease of use, low cost and compatibility with transistor-transistor logic (ttl), phototransistors are often used in applications where more than several hundred nanowatts (nw) of optical power are available. Selecting phototransistors requires an analysis of performance specifications. Collector current is the total amount of current that flows into the collector terminal. Collector dark current is the amount of collector current for which there is no optical input. Typically, both collector current and collector dark current are measured in milliamps (ma). Peak wavelength, the wavelength at which phototransistors are most responsive, is measured in nanometers (nm). Rise time, the time that elapses when a pulse waveform increases from 10% to 90% of its maximum value, is expressed in nanoseconds (ns). Collector-emitter breakdown voltage is the voltage at which phototransistors conduct a specified (nondestructive) current when biased in the normal direction without optical or electrical inputs to the base. Power dissipation, a measure of total power consumption, is measured in milliwatts (mw).
P a g e | 105
Other performance specifications for phototransistors include spectral range, fall time, acceptance angle, and operating temperature. Phototransistors vary in terms of mounting and features. Surface mount technology (smt) adds components to a printed circuit board (pcb) by soldering component leads or terminals to the top surface of the board. Typically, the pcb pad is coated with a paste-like formulation of solder and flux. Elevated temperatures, usually from an infrared oven, melt the paste and solder the component leads to the pcb pads. Through hole technology (tht), another commonly used mounting style, mounts components by inserting component leads through holes in the board and then soldering the leads in place on the opposite side of the board. In terms of features, some phototransistors include a cutoff filter that blocks visible light. Others have an anti-reflective coating to improve light detection. Devices with a rounded dome lens instead of a flat lens are also available.
P a g e | 106
Program for remote control (transmitter) unit
keyport equ P2 col1 equ P2.0 col2 equ P2.1 col3 equ P2.2 col4 equ P2.3 ;Keypad port connected here ;Column 1 ;Column 2 ;Column 3 ;Column 4
keyval equ 30H pressed bit 0H
;To store key number ;Flag
key_init: mov keyport,#0FH ret ;Make rows as o/p and col as i/p
get_key: mov keyval,#0 mov keyport,#7FH acall read_col ;reset the number ;make Row1 low ;read columns
P a g e | 107
jb pressed, done
;check if flag is set
mov keyval,#4 mov keyport,#0BFH acall read_col
;if not then read next row ;make Row2 low
jb pressed, done
;check if flag is set
mov keyval,#8 mov keyport,#0DFH acall read_col
;if not then read next row ;make row3 low
jb pressed, done
;check if flag is set
mov keyval,#12 mov keyport,#0EFH acall read_col
;if not read row4 ;make row4 low
P a g e | 108
read_col: clr pressed
;read columns routine ;reset the flag
jb col1, nextcol jnb col1,$ setb pressed ret
;check if first key is pressed ;if yes then wait for key release ;set the flag
nextcol: jb col2, nextcol1 jnb col2,$ inc keyval setb pressed ret
;read col2 ;check if second key is pressed ;if yes then wait for key release ;its key number 2 ;set the flag
nextcol1: jb col3, nextcol2 jnb col3,$ inc keyval inc keyval
;read col3 ;check if third key is pressed ;if yes then wait for key release ;its key 3
P a g e | 109
setb pressed ret
;set the flag
nextcol2: jb col4, exit jnb col4,$ inc keyval inc keyval inc keyval setb pressed ret exit: clr pressed clr keyval ret end
;read column 4 ;check if fourth key pressed ;if yes then wait for key release ;its key 4
;set the flag
;if no key is pressed ;clr the flag ;reset the number
P a g e | 110
Program for receiving circuit
VAR1 TEMP COUNT ADDR
equ r7 equ 10H equ 11H equ 12H
CMD equ 13H FLIP bit 00H TOG bit 01H IR equ P3.2 ;IR Receiver connected to this pin ;Switch 1 connected here ;Switch 2 connected here ;Switch 3 connected here ;Switch 4 connected here ;Switch 5 connected here ;Switch 6 connected here ;Switch 7 connected here ;Switch 8 connected here ;Port at which switches are
SW1 equ P1.0 SW2 equ P1.1 SW3 equ P1.2 SW4 equ P1.3 SW5 equ P1.4 SW6 equ P1.5 SW7 equ P1.6 SW8 equ P1.7 SWport equ P1 connected
P a g e | 111
org 00H mov SWport,#00H mov sp,#50H clr TOG
main: jb IR,$ mov VAR1,#255 djnz VAR1,$ mov VAR1,#255 djnz VAR1,$ mov VAR1,#255 djnz VAR1,$ mov VAR1,#255 djnz VAR1,$ mov VAR1,#255 djnz VAR1,$ mov VAR1,#100 djnz VAR1,$ mov c,IR mov FLIP,c
P a g e | 112
clr A mov COUNT,#5 fadd: mov VAR1,#255 djnz VAR1,$ mov VAR1,#255 djnz VAR1,$ mov VAR1,#255 djnz VAR1,$ mov VAR1,#4 djnz VAR1,$ mov c,IR rlc a djnz COUNT,fadd mov ADDR,A clr a mov COUNT,#6 fcmd: mov VAR1,#255 djnz VAR1,$ mov VAR1,#255
P a g e | 113
djnz VAR1,$ mov VAR1,#255 djnz VAR1,$ mov VAR1,#4 djnz VAR1,$ mov c,IR rlc a djnz COUNT,fcmd mov TEMP,CMD mov CMD,a mov a,ADDR cjne a,#00,nvalid mov a,TEMP cjne a,CMD,valid nvalid: ljmp main valid: clr a mov c,FLIP rlc a mov TEMP,a
P a g e | 114
clr a mov c,TOG rlc a cjne a,TEMP,valid1 sjmp nvalid valid1: mov c,FLIP mov TOG,c mov a,CMD clr c cjne a,#1,skip1 jb SW1,isset1 setb SW1 ljmp main isset1: clr SW1 ljmp main skip1: cjne a,#2,skip2 jb SW2,isset2 setb SW2 ;Check for SW2 ;Check for SW1
P a g e | 115
ljmp main isset2: clr SW2 ljmp main skip2: cjne a,#3,skip3 jb SW3,isset3 setb SW3 ljmp main isset3: clr SW3 ljmp main skip3: cjne a,#4,skip4 jb SW4,isset4 setb SW4 ljmp main isset4: clr SW4 ljmp main skip4: ;Check for SW4 ;Check for SW3
P a g e | 116
cjne a,#5,skip5 jb SW5,isset5 setb SW5 ljmp main isset5: clr SW5 ljmp main skip5: cjne a,#6,skip6 jb SW6,isset6 setb SW6 ljmp main isset6: clr SW6 ljmp main skip6: cjne a,#7,skip7 jb SW7,isset7 setb SW7 ljmp main isset7:
;Check for SW5
P a g e | 117
clr SW7 ljmp main skip7: cjne a,#8,skip8 jb SW8,isset8 setb SW8 ljmp main isset8: clr SW8 ljmp main skip8: cjne a,#0CH,exit mov SWport,#00H ljmp main exit: ljmp main END
P a g e | 118
The HomeAutomation could be developed further by making it more stable and put more effort on the visual design of the product. We could reduce the size of the product by replacing the power supply module and Arduino microcontroller with much smaller pieces. All the devices could be equipped with IR receiver to control the electrical devices at home that support the IR communication. More sophisticated actions and scenarios can be created with this. IR commands enable larger variety for controlling electrical devices that only the power outlet. A lot of improvements could be done in the computer program as well. It should be more customizable for an end user and it should have some password protection for security reasons. It would be also nice to make it web-based so that users can control their home remotely.
P a g e | 119
HomeAutomation is undeniably a resource which can make a home environment automated. People can control their electrical devices via these HomeAutomation devices and set up the controlling actions in the computer. We think this product have high potential for marketing in the future. At the moment the components are a bit to high to be able to produce these devices for a interesting price.
P a g e | 120
1. 2. 3. 4. 5. 6. 7. 8. 9. 1 0. 1 1. 1 2.
http://en.wikipedia.org/wiki/Resistance http://en.wikipedia.org/wiki/Resistor http://en.wikipedia.org/wiki/Capacitor http://en.wikipedia.org/wiki/Diode http://en.wikipedia.org/wiki/Light-emitting_diode http://en.wikipedia.org/wiki/Transistor http://en.wikipedia.org/wiki/Crystal_oscillator http://en.wikipedia.org/wiki/Relay http://en.wikipedia.org/wiki/Transformer http://en.wikipedia.org/wiki/Intel_8051 http://www.8052.com/book http://www.vishay.com/docs/82030/82030.pdf