automatic power saver
TRANSCRIPT
-
7/28/2019 Automatic Power Saver
1/117
1
-Automatic power saver
CHAPTER:1
- 1 -
-
7/28/2019 Automatic Power Saver
2/117
2
-Automatic power saver
INTRODUCTION
This Project Automatic Room Light Controller with Visitor Counter using Microcontroller is a
reliable circuit that takes over the task of controlling the room lights as well us counting number of
persons/ visitors in the room very accurately. When somebody enters into the room then the counter isincremented by one and the light in the room will be switched ON and when any one leaves the room
then the counter is decremented by one. The light will be only switched OFF until all the persons in the
room go out. The total number of persons inside the room is also displayed on the seven segment
displays. The microcontroller does the above job. It receives the signals from the sensors, and this signal
is operated under the control of software which is stored in ROM. Microcontroller AT89C52
continuously monitor the Infrared Receivers, When any object pass through the IR Receiver's then the IR
Rays falling on the receivers are obstructed , this obstruction is sensed by the Microcontroller
Visitor counting is simply a measurement of the visitor traffic entering and exiting
offices, malls, sports venues, etc. Counting the visitors help to maximize the efficiency and
effectiveness of employees, floor area and sales potential of an organization.
Visitor counting is not limited to the entry/exit point of a company but has a wide range
of applications that provide information to management on the volume and flow of peoplethroughout a location. A primary method for counting the visitors involves hiring human auditors
to stand and manually tally the number of visitors who pass by a certain location. But human-
based data collection comes a great expense.
Here is a low-cost microcontroller-based visitor counter that can be used to know the
number of person at a place. All the components required are readily available in the market andthe circuit is easy to build.
Two IR transmitter-receiver pairs are used at the passage: one pair comprising IR
transmitter IR TX1 and receiver phototransistor T1 is installed at the entry point of the passage,while the other pair comprising IR transmitter IR TX2 and phototransistor T2 is installed at the
exit of the passage. The IR signals from the IR LEDs should continuously fall on the respective
phototransistors, so proper orientation of the transmitter and phototransistor is necessary..
- 2 -
-
7/28/2019 Automatic Power Saver
3/117
3
-Automatic power saver
CHAPTER: 2
- 3 -
-
7/28/2019 Automatic Power Saver
4/117
4
-Automatic power saver
- 4 -
-
7/28/2019 Automatic Power Saver
5/117
5
-Automatic power saver
INTRODUCTION
This project is the most common and interesting to start with. The application is counting the
number of persons entering in and exiting out like in Delhi Metro stations, Industries, offices,
lift, car parking, and many moreOur objective is to count the objects (persons) entering and exiting the room so we need
some sensors to detect the objects and a control unit which calculates the object, below you can
find the block diagram and circuit diagram which illustrate the solution and the Embedded Csource code .
PRINCIPLE:
From the block diagram it is clear that the sensor pairs are placed face to face so
that an IR radiations from IR LED are continuously received by phototransistor
which makes its emitter base junction forward and collector current Ic equals toemitter current Ie (i.e, Ic=Ie) assuming base current to be negligible. Hence the
voltage at collector node becomes zero (logic 0) which is feed to microcontroller
port pin P3.2 and P3.3, if any object is placed in between the sensor pair blocks the
IR radiation which in turns put the phototransistor in cut-off mode and Ic!=Ie, this
makes collector voltage to +5V (logic 1)
In our program we have to poll both the inputs from both the sensors at port pin
P3.2 and P3.3 to detect for the entry or exit, if sensor pair one is been obstructed
(P3.2 becomes one) first, implies persons entry and second pair is obstructed (P3.3
becomes one) first shows exit. After obstructed any one sensor we have to poll for
the next sensor to determine a complete entry or exit.
CIRCUIT DESCRIPTION
Fig. 1: Transmitter-receiver set -up at theentrance-cum-exit of the passage
- 5 -
-
7/28/2019 Automatic Power Saver
6/117
6
-Automatic power saver
Fig. 1 shows the transmitter-receiver set-up at the entrance-cum-exit of the passage along
with block diagram. Two similar sections detect interruption of the IR beam and generate clock
pulse for the microcontroller. The microcontroller controls counting and displays the number ofpersons present inside the hall.
Fig. 2 shows the circuit of the microcontroller-based visitor counter, where in thetransmitter and the receiver from the IR detection circuit. Control logic is built around
transistors, operational amplifier LM324 (IC1) and flip-flop (IC2).
When nobody is passing through the entry/exit point, the IR beam continuously falls on
phototransistor T1. Phototransistor T1 conducts and the high voltage at its emitter drives
transistor T3 into saturation, which makes pin 3 of comparator N1 low and finally output pin 1 ofcomparator N1 is high.
Now if someone enters the place, first the IR beam from IR TX1 is interrupted and then
the IR beam from IR TX2. When the beam from IR TX1 is interrupted, phototransistor T1 and
transistor T3 cut-off and pin 3 of comparator N1 goes high.
The low output (pin 1) of comparator N1 provides negative trigger pulse to pin 1 of J-Kflip-flop IC2 (A). At this moment, the high input at J and K pins of flip-flop IC2 (A) toggles
its output to low. On the other hand, the low input at J and K pins of IC2(B) due to clock pin
1 of IC2(A) and J input (pin 9) and K input (pin 12) of IC2(B) are connected to pin ofcomparator N1. The negative-going pulse is applied to clock pin 6 of IC2(B) when the person
interrupts the IR beam from IR TX2. There is no change in the output of IC 2(B) flip-flop. This
triggers the external interrupt INT0 (pin 12) of microcontroller AT89C52.
The AT89C52 is an 8-bit microcontroller with 8 kB of flash-based program memory, 256
bytes of RAM, 32 input/output lines, three 16-bit timers/counters, on-chip oscillator and clockcircuitry. A 12MHz crystal is used for providing clock.
Ports 0, 1 and 2 are configured for 7segment displays. Port-0 pin is externally pulled up
with 10-kilo-ohm resistor network RNW1 because port-0 is an 8-bit, open-drain, bi-directional,input/output (I/O) port. Port-1 and port-2 are 8-bit bi-directional I/O ports with internal pull-ups
(no need of external pull-ups).
Port pins 3.0 and 3.1 are configured to provide the set pulse to J-K flip-flops IC2(A) and
IC2(B), respectively. External interrupts INT0 and INT1 receive the interrupt pulse when the
person interrupts the IR beams. Resistor R9 andcapacitor C5 provide power-on-reset pulse to
the microcontroller. Switch S1 is used for manual reset.
When the microcontroller is rest, the flip-flop are brought in set state through the
microcontroller at software run time by making their set pin high for a moment.
The value of the counter increments by 1 when the interrupt service routine for INT0 is
executed. The output of the corresponding J-K flip-flop is set to high again by making its set
- 6 -
-
7/28/2019 Automatic Power Saver
7/117
7
-Automatic power saver
input pin low through the microcontroller. The micro-controller is configured as a negative-edge-
triggered interrupt sensor.
Similarly, if somebody exits the place, first the IR beam from IR TX2 is interrupted and
then the IR beam from IR TX1. When the beam from IR TX2 is interrupted, output pin 7 of
comparator N2 goes low. This provides clock pulse to pin 6 of J-K flip-lop IC2 (B).
At this moment, the high input at J and K pins of flip-flop IC2 (B) toggles its output to
low. On the other hand, the low input at Jand Kpins of IC2 (A) due to clock pin 6 of IC2(B)and J input (pin4) and K input (pin16) of IC2(A) are connected to pin 7 of comparator N2.
The negative-going pulse is applied to clock pin 1 of IC2(A) when the person interrupts
the IR beam from IR TX1. There is no change in the output of IC2(A) flip-flop. This triggers theexternal interrupt INT1 (pin 13) of microcontroller AT89C52. The value of the counter
decrements by 1 when interrupt service routine for INT1 is executed. The output of the
corresponding J-K flip-flop is set to high again by making its set input pin low through the
microcontroller.
Fig. 3: Power supply circuit
The circuit is powered by regulated 5V. Fig.3 shows the circuit of the power supply. The
AC mains is stepped down by transformer X1 to deliver secondary output of 7.5V, 250mA,
which is rectified by bridge rectifier BR1, filtered by capacitor C6 and regulated by IC 7805(IC4). Capacitor C7 bypasses any ripple in the regulated output.
- 7 -
-
7/28/2019 Automatic Power Saver
8/117
8
-Automatic power saver
PARTS LIST:
Semiconductors:
IC1.......................................LM324 quad op-amp
IC2.......................................74LS76 J-K flip-flop
IC3.......................................AT89C52 Microcontroller
IC4.......................................7805 5V regulator
T1, T2..................................L14F1 npn Phototransistor
T3, T4..................................2N3904 npn transistor
IR TX1, IR TX2..................IR transmitting LED
BR1.....................................1A bridge rectifier
DISI-DIS3...........................LTS543 CC 7-segment display
Resistors (all -watt,5% carbon):
R1, R2...........................68-ohm
R3, R4...........................6.8-kilo-ohm
R5, R6...........................100-ohm
R7, R8, R10, R11.........10-kilo-ohm
R9.................................4.7-kilo-ohm
R12-R32.......................220-ohm
VR1, VR2.....................20-kilo-ohm resistor Network
Capacitors:
C1, C2.................................0.2F ceramic disk
C3, C4.................................33PF ceramic disk
C5........................................10F, 16V electrolytic
C7........................................0.1F ceramic disk
Miscellaneous:
XTAL..............................................12MHz crystal
X1....................................................230V primary to 7.5V,250mA secondary transformer
S1....................................................Push-to-on switch
S2....................................................On /off switch
- 8 -
-
7/28/2019 Automatic Power Saver
9/117
9
-Automatic power saver
- 9 -
-
7/28/2019 Automatic Power Saver
10/117
10
-Automatic power saver
- 10 -
-
7/28/2019 Automatic Power Saver
11/117
11
-Automatic power saver
CHAPTER: 3
WHAT IS EMBEDDED TECHNOLOGY
Embedded technology is software or hardware that is hidden embedded in the large
device or system. It typically refers to a fixed function device as compared with a PC which runs
general purpose application. Embedded technology is nothing new. It all around us and has been
for year. An early example of embedded technology is a engine control unit in a car what setting
to give the engine. Your coffee maker has embedded technology in the form of microcontroller,
- 11 -
-
7/28/2019 Automatic Power Saver
12/117
12
-Automatic power saver
which is what tells it to make coffee at 6 a.m. the vending has it too. Overall billion of device
based on embedded technology.
In the past embedded technology existed standalone device vending machine & copier
that did their job with little regard for what went on around them. But as technology learned to
connect devices to the internet and each other, embedded technology potential has grown.
Cell phone companies figured that out along time ago, which is why cell phone are cheap
and service plan are expensive. It is not the phone itself that matter, but the connectivity of the
vast network of other phone, other people and internet. Until you download software that lets
you find a local restaurant and manage your finances.
Let say you make a freezer the big, expensive kind that grocery stores buy. You sell me
and you are with that customer, when it brakes the customer calls the service person who
probably comes from somewhere other than your company. But let us say that freezer knows that
it is about to go on fritz.
Let say three refrigerator alert the customer before it break. Better yet, let us say the
freezer alert the manufacture and are able to send a service person to do preventive work and
save a lot of hazardous from melting.
Embedded technology allows all of that to happen. You, the freezer company have
transformed yourself from Product Company and Service Company.
- 12 -
-
7/28/2019 Automatic Power Saver
13/117
13
-Automatic power saver
Fig no. 2.1 embedded system
The possibility to go beyond that programming device to communication with businesscan eliminate the need for costly call centre. Copy machine that can order that replacement
cartridge will save time and money. Remember, the fact the technology is not what important,
and nighters is the device.
Applications:
Telecom:
Mobile phone system (handset and base station), modems and routers.
Automotive application:
Braking system, tracking control, Airbag release system, management unit and Steer-
by- wire systems .
Domestic application:
- 13 -
-
7/28/2019 Automatic Power Saver
14/117
14
-Automatic power saver
Dishwasher, television, washing machine, microwave oven, video recorder, security
system, garage door controller, calculator, digital watches, VCRs, digital cameras,
remote control, treat mills.
Robotic:
Fire fighting robot, automatic floor cleaner, robotic arm .
Aerospace application:
Flight control systems, Engine controllers, autopilots, passenger entertainment systems .
Medical equipment:
Anesthesia monitoring systems, ECG monitor, pacemaker, drug delivery systems.
Defense system:
Radar systems, fighter aircraft flight controller systems, Radio systems, missile
guideline systems .
Office automation:
Laser printers, Fax machines, Pagers, Cash registers, gas pumps, Credit/Davit card
readers, Thermostats, Grain analyzers.
Programming Languages Used in New Embedded Designs:
- 14 -
0.0%
10.0%
20.0%
30.0%
40.0%
50.0%
60.0%
70.0%
80.0%
90.0%
Ass em bly C C++ Java Other
1998-1999
1999-2000
-
7/28/2019 Automatic Power Saver
15/117
15
-Automatic power saver
Fig no. 2.2
Micro Controllers Trend in the Embedded Systems
- 15 -
-
7/28/2019 Automatic Power Saver
16/117
16
-Automatic power saver
Fig no. 2.3
CHAPTER: 3
AT89C52
MICROCONTROLLER
- 16 -
-
7/28/2019 Automatic Power Saver
17/117
17
-Automatic power saver
AT89C52 (8-bit Microcontroller with 8K Bytes Flash)
Features:
Compatible with MCS-51 Products
8K 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
256 x 8-bit Internal RAM
32 Programmable I/O Lines
Three 16-bit Timer/Counters
Eight Interrupt Sources
Programmable Serial Channel
- 17 -
-
7/28/2019 Automatic Power Saver
18/117
18
-Automatic power saver
Low-power Idle and Power-down Modes
Description:
The AT89C52 is a low-power, high-performance CMOS 8-bit microcomputer with 8K
bytes of Flash programmable and erasable read only memory (PEROM). The device ismanufactured using Atmels high-density nonvolatile memory technology and is compatible with
the industry-standard 80C51 and 80C52 instruction set and pin out.
The on-chip Flash allows the program memory to be reprogrammed in-system or by a
conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with Flash
on a monolithic chip, the Atmel AT89C52 is a powerful microcomputer which provides a
highly-flexible and cost-effective solution to many embedded control applications.
- 18 -
-
7/28/2019 Automatic Power Saver
19/117
19
-Automatic power saver
- 19 -
-
7/28/2019 Automatic Power Saver
20/117
20
-Automatic power saver
The AT89C52 provides the following standard features: 8K bytes of Flash, 256 bytes of
RAM, 32 I/O lines, three 16-bit timer/counters, a six-vector two-level interrupt architecture, full-
duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89C52 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 hardware reset.
Pin Description:
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 sinkeight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high impedance
inputs.
Port 0 can 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 verification.
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 (IIL) because of the internal pull-ups.
- 20 -
-
7/28/2019 Automatic Power Saver
21/117
21
-Automatic power saver
In addition, P1.0 and P1.1 can be configured to be the timer/counter 2
external count input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX),
respectively, as shown in the following table.
Port 1 also receives the low-order address bytes during Flash programming and
verification.
Port 2
Port 2 is an 8-bit bi-directional I/O port with internal pullups. 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 externallybeing pulled low will source current (IIL) because of the internal pullups.
Port 2 emits the high-order address byte during fetches from external program memory
and during accesses to external data memory that uses 16-bit addresses (MOVX @ DPTR).
In this application, Port 2 uses strong internal pullups when emitting 1s. During accesses to
external data memory that uses 8-bit addresses (MOVX @ RI), Port 2 emits the contents ofthe 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 pullups. 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 pullups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled
low will source current (IIL) because of the pullups.
Port 3 also serves the functions of various special features of the AT89C51, as shown in
the following table.
- 21 -
-
7/28/2019 Automatic Power Saver
22/117
22
-Automatic power saver
Port 3 also receives some control signals for Flash programming and verification.
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 is an 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
AT89C52 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.
- 22 -
-
7/28/2019 Automatic Power Saver
23/117
23
-Automatic power saver
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.
This pin also receives the 12-volt programming enable voltage (VPP) during Flash
programming when 12-volt programming is selected.
XTAL1
Input to the inverting oscillator amplifier and input to the internal clock operating circuit.
XTAL2
Output from the inverting oscillator amplifier.
- 23 -
-
7/28/2019 Automatic Power Saver
24/117
24
-Automatic power saver
Special Function Registers:
A map of the on-chip memory area called the Special Function Register (SFR) space is
shown in Table 1. Note that not all of the addresses are occupied, and unoccupied addresses maynot be implemented on the chip. Read accesses to these addresses will in general return random
data, and write accesses will have an indeterminate effect.
User software should not write 1s to these unlisted locations, since they may be used in
future products to invoke new features. In that case, the reset or inactive values of the new bits
will always be 0.
Timer 2 Registers Control and status bits are contained in registers T2CON (shown in
Table 2) and T2MOD (shown in Table 4) for Timer 2. The register pair (RCAP2H, RCAP2L) is
the Capture/Reload registers for Timer 2 in 16-bit capture mode or 16-bit auto-reload mode.
Interrupt registers the individual interrupt enable bits are in the IE register. Two priorities
can be set for each of the six interrupt sources in the IP register.
- 24 -
-
7/28/2019 Automatic Power Saver
25/117
25
-Automatic power saver
- 25 -
-
7/28/2019 Automatic Power Saver
26/117
26
-Automatic power saver
Data Memory:
The AT89C52 implements 256 bytes of on-chip RAM. The upper 128 bytes occupy a
parallel address space to the special Function Registers. That means the upper 128 bytes have the
same addresses as the SFR space but are physically separate from SFR space.
When an instruction accesses an internal location above address 7FH, the address mode
used in the instruction specifies whether the CPU accesses the upper 128 bytes of RAM or the
SFR space. Instructions that use direct addressing access SFR space.
For example, the following direct addressing instruction accesses the SFR at location
0A0H (which is P2).
MOV 0A0H, #data
Instructions that use indirect addressing access the upper 128 bytes of RAM. Forexample, the following indirect addressing instruction, where R0 contains 0A0H, accesses the
data byte at address 0A0H, rather than P2 (whose address is 0A0H).
MOV @R0, #data
Note that stack operations are examples of indirect addressing, so the upper 128 bytes of
data RAM are available as stack space.
Timer 0 and 1
Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and Timer 1 in
the AT89C51.
Timer 2
Timer 2 is a 16-bit Timer/Counter that can operate as either a timer or an event counter.
The type of operation is selected by bit C/T2 in the SFR T2CON (shown in Table 2).
Timer 2 has three operating modes: capture, auto-reload (up or down counting), and baud
rate generator. The modes are selected by bits in
T2CON, as shown in Table 3. Timer 2 consists of two 8-bit registers, TH2 and TL2. Inthe Timer function, the TL2 register is incremented everymachine cycle. Since a machine cycle
consists of 12 oscillator periods, the count rate is 1/12 of the oscillator frequency.
- 26 -
-
7/28/2019 Automatic Power Saver
27/117
-
7/28/2019 Automatic Power Saver
28/117
28
-Automatic power saver
Figure 2 shows Timer 2 automatically counting up when DCEN = 0. In this mode, two
options are selected by bit EXEN2 in T2CON. If EXEN2 = 0, Timer 2 counts up to 0FFFFH
and then sets the TF2 bit upon overflow.The overflow also causes the timer registers to be
reloaded with the 16-bit value in RCAP2H and RCAP2L. The values in Timer in Capture
ModeRCAP2H and RCAP2L are preset by software. If EXEN2 = 1, a 16-bit reload can be
triggered either by an overflow or by a 1-to-0 transition at external input T2EX. This
transition also sets the EXF2 bit. Both the TF2 and EXF2 bits can generate an interrupt if
enabled.
Setting the DCEN bit enables Timer 2 to count up or down, as shown in Figure 3. In this
mode, the T2EX pin controls the direction of the count. A logic 1 at T2EX makes Timer 2
count up. The timer will overflow at 0FFFFH and set the TF2 bit. This overflow also causes
the 16-bit value in RCAP2H and RCAP2L to be reloaded into the timer registers, TH2 and
TL2, respectively.
Logic 0 at T2EX makes Timer 2 count down. The timer underflows when TH2 and TL2
equal the values stored in RCAP2H and RCAP2L. The underflow sets the TF2 bit and causes
0FFFFH to be reloaded into the timer registers.
The EXF2 bit toggles whenever Timer 2 overflows or underflows and can be used as a
17th bit of resolution. In this operating mode, EXF2 does not flag an interrupt.
- 28 -
-
7/28/2019 Automatic Power Saver
29/117
29
-Automatic power saver
- 29 -
-
7/28/2019 Automatic Power Saver
30/117
30
-Automatic power saver
Baud Rate Generator
Timer 2 is selected as the baud rate generator by setting TCLK and/or RCLK in T2CON
(Table 2). Note that the baud rates for transmit and receive can be different if Timer 2 is used for
the receiver or transmitter and Timer 1 is used for the other function. Setting RCLK and/or
TCLK puts Timer 2 into its baud rate generator mode, as shown in Figure 4.
The baud rate generator mode is similar to the auto-reload mode, in that a rollover in TH2
causes the Timer 2 registers to be reloaded with the 16-bit value in registers RCAP2H and
RCAP2L, which are preset by software. The baud rates in Modes 1 and 3 are determined by
Timer 2s overflow rate according to the following equation.
The Timer can be configured for either timer or counter operation. In most applications, it is
configured for timer operation (CP/T2 = 0). The timer operation is different for Timer 2 when itis used as a baud rate generator. Normally, as a timer, it increments every machine cycle (at 1/12
the oscillator frequency). As a baud rate generator, however, it increments every state time (at
1/2 the oscillator frequency). The baud rate formula is given below.
Where (RCAP2H, RCAP2L) is the content of RCAP2H and RCAP2L taken as a 16-bit
unsigned integer.
Timer 2 as a baud rate generator is shown in Figure 4. This figure is valid only if RCLK
or TCLK = 1 in T2CON. Note that a rollover in TH2 does not set TF2 and will not generate an
interrupt. Note too, that if EXEN2 is set,a 1-to-0 transition in T2EX will set EXF2 but will not
cause a reload from (RCAP2H, RCAP2L) to (TH2, TL2). Thus when Timer 2 is in use as a baudrate generator, T2EX can be used as an extra external interrupt.
- 30 -
-
7/28/2019 Automatic Power Saver
31/117
-
7/28/2019 Automatic Power Saver
32/117
32
-Automatic power saver
The clock-out frequency depends on the oscillator frequency and the reload value of
Timer 2 capture registers (RCAP2H, RCAP2L), as shown in the following equation.
In the clock-out mode, Timer 2 roll-overs will not generate an interrupt. This behavior is
similar to when Timer 2 is used as a baud-rate generator. It is possible to use Timer 2 as a baud-
rate generator and a clock generator simultaneously. Note, however, that the baud-rate and clock-
out frequencies cannot be determined independently from one another since they both use
RCAP2H and RCAP2L.
UARTThe UART in the AT89C52 operates the same way as the UART in the AT89C51.
Interrupts
The AT89C52 has a total of six interrupt vectors: two external interrupts (INT0 and
INT1), three timer interrupts (Timers 0, 1, and 2), and the serial port interrupt. These interrupts
are all shown in Figure 6.
Each of these interrupt sources can be individually enabled or disabled by setting or
clearing a bit in Special Function Register IE. IE also contains a global disable bit, EA, which
disables all interrupts at once.
Note that Table shows that bit position IE.6 is unimplemented. In the AT89C51, bit
position IE.5 is also unimplemented. User software should not write 1s to these bit positions,
since they may be used in future AT89 products.
Timer 2 interrupt is generated by the logical OR of bits TF2 and EXF2 in register
T2CON. Neither of these flags is cleared by hardware when the service routine is vectored to. In
fact, the service routine may have to determine whether it was TF2 or EXF2 that generated the
interrupt, and that bit will have to be cleared in software.
The Timer 0 and Timer 1 flags, TF0 and TF1, are set at S5P2 of the cycle in which the
timers overflow. The values are then polled by the circuitry in the next cycle. However, the
Timer 2 flag, TF2, is set at S2P2 and is polled in the same cycle in which the timer overflows.
- 32 -
-
7/28/2019 Automatic Power Saver
33/117
33
-Automatic power saver
Oscillator Characteristics:
XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier thatcan be configured for use as an on-chip oscillator, as shown in Figure 7. 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 8. 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.
Idle Mode
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.
Note that when idle mode is terminated by a hardware reset, the device normally resumes
program execution from where it left off, up to two machine cycles before the internal reset
- 33 -
-
7/28/2019 Automatic Power Saver
34/117
34
-Automatic power saver
algorithm takes control. On-chip hardware inhibits access to internal RAM in this event, but
access to the port
Pins are not inhibited. To eliminate the possibility of an unexpected write to a port pin
when idle mode is terminated by a reset, the instruction following the one that invokes idle mode
should not write to a port pin or to external memory.
Power-down Mode
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 exit from power-down is ahardware 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.
- 34 -
-
7/28/2019 Automatic Power Saver
35/117
35
-Automatic power saver
Program Memory Lock Bits:
The AT89C52 has three lock bits that can be left unprogrammed (U) or can be
programmed (P) to obtain the additional features listed in the following table.
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. The latched value of EA must agree with the current
logic level at that pin in order for the device to function properly.
Programming the Flash:
The AT89C52 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 AT89C52 inside the users
system, while the high-voltage programming mode is compatible with conventional third-party
Flash or EPROM programmers.
The AT89C52 is shipped with either the high-voltage or low-voltage programming modeenabled. The respective top-side marking and device signature codes are listed in the following
table.
The AT89C52 code memory array is programmed byte-bybyte 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.
- 35 -
-
7/28/2019 Automatic Power Saver
36/117
-
7/28/2019 Automatic Power Saver
37/117
-
7/28/2019 Automatic Power Saver
38/117
-
7/28/2019 Automatic Power Saver
39/117
39
-Automatic power saver
CHAPTER: 4
What are crystal oscillators?
- 39 -
-
7/28/2019 Automatic Power Saver
40/117
40
-Automatic power saver
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 beapplied 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 LCoscillator for the upper HF 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'tbe discussing frequency synthesizers and direct digital synthesis (DDS) here. They are
particularly interesting topics to be covered later.
A practical example of a Crystal Oscillator:
This is a typical example of the type of crystal oscillators which may be used for say
converters. Some points of interest on crystal oscillators in relation to figure 1.
Figure 1 - schematic of a crystal oscillator
The transistor could be a general purpose type with an Ft of at least 150 MHz for HF use.
A typical example would be a 2N2222A. The turns ratio on the tuned circuit depicts ananticipated nominal load of 50 ohms. This allows theoretical 2K5 ohms on the collector. If it is
followed by a buffer amplifier(highly recommended) I would simply maintain the typical 7:1turns ratio. I have included a formula for determining L and C in the tuned circuits of crystaloscillators in case you have forgotten earlier tutorials. Personally I would make L a reactance of
around 250 ohms. In this case I'd make C a smaller trimmer in parallel with a standard fixed
value.
- 40 -
http://www.electronics-tutorials.com/oscillators/crystal-grinding.htmhttp://www.electronics-tutorials.com/amplifiers/buffer-amplifiers.htmhttp://www.electronics-tutorials.com/oscillators/crystal-grinding.htmhttp://www.electronics-tutorials.com/amplifiers/buffer-amplifiers.htm -
7/28/2019 Automatic Power Saver
41/117
41
-Automatic power saver
CHAPTER: 5
SEVEN
SEGMENT
DISPLAY
- 41 -
-
7/28/2019 Automatic Power Saver
42/117
42
-Automatic power saver
SEVEN SEGMENT DISPLAY:
A popular type consists of seven small, bar-shaped LED segment arranged so that
depending on which combinations are energized, the numbers 0 to 9 light up. All the LED
cathodes (or sometimes anodes) are joined to form a common connection. Current limiting
resistors are required (e.g. 270 ohms), preferably one per segment.
- 42 -
-
7/28/2019 Automatic Power Saver
43/117
-
7/28/2019 Automatic Power Saver
44/117
44
-Automatic power saver
LED CONSTRUCTIONS: -
To reduce reflection losses in LEDs there are two obvious ways: -
a) The first is to ensure that most rays strike the surface at less than the critical angle. This
may be achieved by shaping the semiconductor /air interface into a hemisphere.
b) The second technique is to encapsulate the junction in a transparent medium of high
refractive index. This is usually a plastic material with refractive index of about 1.5.
Molding the plastic into an approximately hemispherical shape can minimize the losses at
the plastic lair interface.
- 44 -
-
7/28/2019 Automatic Power Saver
45/117
45
-Automatic power saver
CHAPTER: 6
- 45 -
-
7/28/2019 Automatic Power Saver
46/117
46
-Automatic power saver
RELAY
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 tocontrol an output circuit of higher power than the 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-overcontacts.
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 "make"
contact. Form A contact is ideal for applications that require to switch a high-current
power source from a remote device.
- 46 -
http://en.wikipedia.org/wiki/Switchhttp://en.wikipedia.org/wiki/Magnethttp://en.wikipedia.org/wiki/Joseph_Henryhttp://en.wikipedia.org/wiki/1835http://en.wikipedia.org/wiki/Amplifierhttp://en.wikipedia.org/wiki/Switchhttp://en.wikipedia.org/wiki/Magnethttp://en.wikipedia.org/wiki/Joseph_Henryhttp://en.wikipedia.org/wiki/1835http://en.wikipedia.org/wiki/Amplifier -
7/28/2019 Automatic Power Saver
47/117
47
-Automatic power saver
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 therelay 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.
Operation:
When a current flows through the coil, the resulting magnetic field attracts an armature
that is mechanically linked to a moving contact. The movement either makes or breaks a
connection with a fixed contact. When the current to the coil is switched off, the armature isreturned by a force that is half as strong as the magnetic force to its relaxed position. Usually this
is a spring, but gravity is also used commonly in industrial motor starters. 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.
If the coil is energized with DC, a diode is frequently installed across the coil, to dissipate
the energy from the collapsing magnetic field at deactivation, which would otherwise generate aspike of voltage and might cause damage to circuit components. If the coil is designed to be
energized with 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 armatureduring the AC cycle.
By analogy with the 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, a
light-emitting diode (LED) is used with a photo transistor.
Relays are used:
to control a high-voltage circuit with a low-voltage signal, as in some types ofmodems,
to control a high-current circuit with a low-current signal, as in the startersolenoid of an
automobile,
to detect and isolate faults on transmission and distribution lines by opening and closing
circuit breakers (protection relays),
to 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-voltageswitch. 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,
to perform logic functions. For example, the boolean AND function is realised by
connecting NO relay contacts in series, the OR function by connecting NO contacts in
parallel. The change-over or Form C contacts perform the XOR (exclusive or) function.
- 47 -
http://en.wikipedia.org/wiki/Current_(electricity)http://en.wikipedia.org/wiki/Coilhttp://en.wikipedia.org/wiki/Magnetic_fieldhttp://en.wikipedia.org/wiki/Spring_(device)http://en.wikipedia.org/wiki/Arcinghttp://en.wikipedia.org/wiki/Thyristorhttp://en.wikipedia.org/wiki/Light-emitting_diodehttp://en.wikipedia.org/wiki/Voltagehttp://en.wikipedia.org/wiki/Modemhttp://en.wikipedia.org/wiki/Current_(electricity)http://en.wikipedia.org/wiki/Starter_motorhttp://en.wikipedia.org/wiki/Solenoidhttp://en.wikipedia.org/wiki/Automobilehttp://en.wikipedia.org/wiki/Current_(electricity)http://en.wikipedia.org/wiki/Coilhttp://en.wikipedia.org/wiki/Magnetic_fieldhttp://en.wikipedia.org/wiki/Spring_(device)http://en.wikipedia.org/wiki/Arcinghttp://en.wikipedia.org/wiki/Thyristorhttp://en.wikipedia.org/wiki/Light-emitting_diodehttp://en.wikipedia.org/wiki/Voltagehttp://en.wikipedia.org/wiki/Modemhttp://en.wikipedia.org/wiki/Current_(electricity)http://en.wikipedia.org/wiki/Starter_motorhttp://en.wikipedia.org/wiki/Solenoidhttp://en.wikipedia.org/wiki/Automobile -
7/28/2019 Automatic Power Saver
48/117
48
-Automatic power saver
Similar functions for NAND and NOR are accomplished using NC contacts. Due to the
failure modes of a relay compared with a semiconductor, they are widely used in safety
critical logic, such as the control panels of radioactive waste handling machinery.
to perform 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 copperdisk 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 isallowed to escape slowly. The time period can be varied by increasing or decreasing the
flow rate. For longer time periods, a mechanical clockwork timer is installed.
- 48 -
-
7/28/2019 Automatic Power Saver
49/117
-
7/28/2019 Automatic Power Saver
50/117
50
-Automatic power saver
CIRCUIT DIAGRAM
CIRCUIT DESCRIPTION:
The circuit is simple NPN transistor common emitter switching circuit. The transistor T-1is supplied through negative at emitter. The base is conducted through the port output from
computer and collector gives output to energies the relay commonly connected to +ve supply.
The diode prevents back emf produced by relay while working.
- 50 -
-
7/28/2019 Automatic Power Saver
51/117
51
-Automatic power saver
CHAPTER: 7
- 51 -
-
7/28/2019 Automatic Power Saver
52/117
-
7/28/2019 Automatic Power Saver
53/117
53
-Automatic power saver
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 experimenters 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 household
appliances like Tran receivers, record player, cassette players, digital clock etc.
THEORYUSE 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 the 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
- 53 -
-
7/28/2019 Automatic Power Saver
54/117
54
-Automatic power saver
to collector- the 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 equal-valued 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 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 9 V, and part ofthe 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.
BRIDGE RECTIFIER:
- 54 -
-
7/28/2019 Automatic Power Saver
55/117
-
7/28/2019 Automatic Power Saver
56/117
56
-Automatic power saver
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
The 230 ac supply is converted into 12volts by the power supply in which 4 elements are
used:-
Transformer
7805 regulator
Diodes 4007(in bridge shape)
Capacitor(100microfarad & 470microfarad)
Fig no.5.6 : power supply
BRIDGE RECTIFIER:
Bridge rectifier circuit consists of four diodes arranged in the form of bridge as shown in figure.:
OPERATION:
During the positive half cycle of the input supply, the upper end A of the transformer secondary
becomes positive with respect to its lower point B. this makes point 1 of bridge. Positive with respect to
- 56 -
-
7/28/2019 Automatic Power Saver
57/117
57
-Automatic power saver
point 2. The diode D1 & D2 becomes forward biased & D3 & D4 become reverse biased. As a result a
current starts flowing from point1, through D1 the load & D2 to the negative end.
During, negative half cycle, the point 2 becomes positive with respect to point 1. Diodes D1 & D2
now become reverse biased. Thus a current flow from point2 to point1.
Fig no. 5.7 : Bridge rectifier
VOLTAGE REGULATOR:
THE ADAPTING 3-TERMINAL VOLTAGE REGULATORS FOR CONSTANT HIGH
VOLTAGE POWER SUPPLIES:
One can get a constant high-voltage power supply using inexpensive 3-terminal voltage
regulators through some simple techniques described below. Depending upon the currentrequirement, a reasonable load regulation can be achieved. Line regulation in all cases is equal to
that of the voltage regulator used.
Though high voltage can be obtained with suitable voltage boost circuitry using ICs like
LM 723, some advantages of the circuits presented below are: simplicity, low cost, and
practically reasonable regulation characteristics. For currents of the order of 1A or less, only one
zener and some resistors and capacitors are needed. For higher currents, one pass transistor such
as ECP055 is needed.
Before developing the final circuits, let us first understand the 3-terminal type constant
voltage regulators. Let us see the schematic in Fig. where 78XX is a 3-terminal voltage regulator.
- 57 -
-
7/28/2019 Automatic Power Saver
58/117
58
-Automatic power saver
Schematic for obtaining low-voltage regulated output using 3-terminal voltage regulators.
Rectified and filtered unregulated voltage is applied at VIN and a constant voltage
appears between pins 2 and 2 of the voltage regulator. *The distribution of two currents in the
circuit (IBIAS and ILOAD) is as shown.
* It is highly recommended to use the two capacitors as shown. Electrically regulator will
be at a distance from the rectifier supply. Thus, a tantalum grade capacitor of 5mf and rated
voltage is good. Electrolytic capacitor is not suitable for it is poor in response to load transients,
which have high frequency components. At the output side a 0.22mf disc ceramic capacitor isuseful to eliminate spurious oscillations, which the regulator might break into because of its
internal high gain circuitry.
These voltage regulators have a typical bias current of 5 mA, which is reasonably
constant. By inserting a small resistor Rx between pin 2 and ground, the output voltage in many
cases. By this method voltage increment of 5 to 10 per cent is practically feasible. However, if a
high-value resistance is used to obtain a higher output voltage, a slight variation in bias current
will result in wide variation of the output voltage.
Now let us see that what can be done to get a higher but constant output voltage. If to thecircuit of Fig. resistor RY and zener Vz are added as shown in Fig., the output voltage is now
given by ,
VOUT=VR+VZ + IBIAS RX
A constant current flows through RY** because VOUT is constant, and small variations
in IBIAS do not change practically the operating point of Vz.
This situation is like constant current biasing of zener, which results in a very accurate setting of
the zener voltage.
** As long a sVIN>VOUT+2 volts, VOZ is constant from the reasoning of Fig, and
thus current through RY is constant.
VOZ=VR + IBIAS Rx
- 58 -
-
7/28/2019 Automatic Power Saver
59/117
59
-Automatic power saver
Here the pin 2 of the regulator is raised above ground by Vz + IBIAS Rx. Thus, any
combination of zener with a proper selection of RY can be used.
For example, Let VR=+15 V for 7815
IBIAS=5mA
VZ=39V (standard from ECIL)
For a standard 400mW zener of ECIL make, IZ MAX=10 mA. Thus, if we let pass 5mA
through RY to make a 55-volt supply
55 - 39
RY = ---------------=3.2k3.3k
5 x 10-3
55 - 39 - 15 1
RX = ---------------------= ---------- = 200 ohm
IBIAS 5 x 10-3
Schematic for constant high-voltage power supplies
It should be noted here that the maximum input voltage allowed for 78XX regulators is35V between pins 1 and 2. We see that the actual voltage betweens pin 1 and 2 of the regulator
in this circuit is
VIN - VZ - IBIAS RX
It is therefore necessary that VIN be so chosen that voltage between pins 1 and 2 of the
IC does not exceed the maximum rating. Also, a high input-output differential voltage VIN-
- 59 -
-
7/28/2019 Automatic Power Saver
60/117
60
-Automatic power saver
VOUT means more power dissipation in the series-pass element, the regulator. Thus, with proper
selection of the input transformer voltage and capacitor, this should be minimized.
For example, if 7805 is used, VR equals + 5V and VZ is 40V, so VOUT=45 volts. For
7805, the maximum input voltage is 35 V and the minimum 7V. Therefore,
VIN MAX = 45 + 35 - 5 = 75 VOLTS
VIN MIN = 45 + 7 - 5 = 47 VOLTS
Thus, from no-load to full-load condition, the unregulated input voltage-including peak
ripple-should be within these limits. This gives a margin of 75-47, i.e. 28 volt. Hence, the
designer can work out the maximum transformer voltage from the no-load input voltage chosen
on the upper side.
The capacitor's value can be determined from the full load unregulated voltage chosen.
Roughly, per 100mA current, 100mf capacitor gives 1-volt peak-to-peak ripple. Hence,
capacitor's value can be determined for the desired current.
This circuit will have an excellent load and line regulation. For shot-circuit protection, it
is recommended to use a fast-blow fuse of suitable value. Although the regulator has inherent
short-circuit protection, the maximum current differs from device to device. Adequate heat sink
should be used with the regulator.
Schematic for constant high-voltage power supplies providing currents in excess of one ampere
Now if currents in excess of 1A are needed, the circuit shown in fig. is useful. This circuit
is similar to that in Fig. except that a pass transistor ECP055 is added besides a 0.5-ohm or more
resistor. This transistor bypasses the excessive current. By selecting proper Rz the ratio of two
currents passing through the regulator and transistor can be altered.
- 60 -
-
7/28/2019 Automatic Power Saver
61/117
61
-Automatic power saver
This circuit will show load and live regulation within 1% and will function properly for
VIN-VOUT as low as 4 volt. For short-circuit protection, a fast blow fuse is recommended as
this circuit does not have inherent short-circuit protection. Adequate heat sink is to be used for
the pass transistors. For negative voltages, use 79XX series regulators and ECN055 as the pass
transistor. Some advantages of the circuits described above are: the lowest cost among
comparable performance circuits, ability to work at low input-output differential, and flexibility
in design for various applications.
So audio enthusiasts, if you are troubled by hum emanating from your power amplifier,
try this inexpensive alternative for power supply.
FEATURES:
Output current in Excess of 1.0A
No external component required
Internal thermal overload protection
Internal short circuit current limiting
Output transistor safe-area compensation
Output voltage offered in 2% and 4% tolerance
Available in surface mount D2PAK and standard 3-lead transistor packages
Previous commercial temperature range has been extended to a junction temperature
range of -40 degree C to +125 degree C.
TRANSFORMER:
Transformer is a major class of coils having two or more winding usually wrapped
around a common core made from laminated iron sheets. It has two coils named primary and
secondary. If the current flowing through primary is fluctuating, then a current will be inducted
into the secondary winding. A steady current will not be transferred from one coil to other coil.
- 61 -
-
7/28/2019 Automatic Power Saver
62/117
-
7/28/2019 Automatic Power Saver
63/117
63
-Automatic power saver
terminal can be done by identifying silver/black line. The silver/black line is the negative
terminal(cathode) and the other terminal is positive terminal (anode).
APPLICATION:
1. Diodes: rectification, free wheeling, etc
2. Zener diodes: voltage control, regulator etc.
3. Tunnel diode: control the current flow, ssnobbier circuit etc.
RESISTANCE:
Resistance is). Allthe opposition of a material to the current. It is measured in Ohms
(conductors represent a certain amount of resistance, since no conductor is 100% efficient. To
control the electron flow (current) in a predictable manner, we use resistors. Electronic circuits
use calibrated lumped resistance to control the flow of current. Broadly speaking, resistor can be
divided into two groups viz. fixed & adjustable (variable) resistors. In fixed resistors, the value is
fixed & cannot be varied. In variable resistors, the resistance value can be varied by an adjuster
knob. It can be divided into (a) Carbon composition (b) Wire wound (c) Special type. The most
common type of resistors used in our projects is carbon type. The resistance value is normally
indicated by colour bands. Each resistance has four colors, one of the band on either side will be
gold or silver, this is called fourth band and indicates the tolerance, others three band will give
the value of resistance (see table). For example if a resistor has the following marking on it say
red, violet, gold. Comparing these colored rings with the colour code, its value is 27000 ohms or
27 kilo ohms and its tolerance is 5%. Resistor comes in various sizes (Power rating). The
bigger, the size, the more power rating of 1/4 watts. The four colour rings on its body tells us the
value of resistor value as given below.
COLOURS CODE
Black-----------------------------------------------------0
Brown----------------------------------------------------1
- 63 -
-
7/28/2019 Automatic Power Saver
64/117
-
7/28/2019 Automatic Power Saver
65/117
65
-Automatic power saver
Resistance coils of different values are connected b/w the gaps. When the knob is rotated,
the pointer also moves over the brass pieces. If a gap is skipped over, its resistance is included in
the circuit. If two gaps are skipped over, the resistances of both together are included in the
circuit and so on.
A dial type of resistance box contains many dials depending upon the range, which , itwill haveit has to cover. If a resistance box has to read up to 10,000 three dials each having ten
gaps i.e. ten resistance coils each of resistance. . The third dial will have ten resistances each of
100 10
The dial type of resistance boxes is better because the contact resistance in this case is
small & constant.
TESTING:
Resistors are checked with an ohm meter/millimeter. For a defective resistor the ohm
meter shows infinite high reading.
CAPACITORS:
It is an electronic component whose function is to accumulate charges and then release it.
To understand the concept of capacitance, consider a pair of metal plates which all areplaced near to each other without touching. If a battery is connected to these plates the positive
pole to one and the negative pole to the other, electrons from the battery will be attracted from
the plate connected to the positive terminal of the battery. If the battery is then disconnected, oneplate will be left with an excess of electrons, the other with a shortage, and a potential or voltage
difference will exists between them. These plates will be acting as capacitors. Capacitors are oftwo types: - (1) fixed type like ceramic, polyester, electrolytic capacitors-these names refer to the
material they are made of aluminum foil. (2) Variable type like gang condenser in radio ortrimmer. In fixed type capacitors, it has two leads and its value is written over its body and
variable type has three leads. Unit of measurement of a capacitor is farad denoted by the symbol
F. It is a very big unit of capacitance. Small unit capacitor are pico-farad denoted by pf(Ipf=1/1000,000,000,000 f) Above all, in case of electrolytic capacitors, it's two terminal are
- 65 -
-
7/28/2019 Automatic Power Saver
66/117
66
-Automatic power saver
marked as (-) and (+) so check it while using capacitors in the circuit in right direction. Mistake
can destroy the capacitor or entire circuit in operational.
Fig no. 5.12 : CAPACITOR
BASIC:
Like a battery, a capacitor has two terminals. Inside the capacitor, the terminals connect to
two metal plates seperated by a dielectric. The dielectric can be air, paper , plastic, or anything
else that does not conduct electricity and keeps the plates from touching each other. You can
eaisily make a capacitor from two pieces of aluminium foil and piece of paper. It wont be a
particularly good capacitor in terms of its storage capacity, but it will work. In an electronic
circuit, a capacitor is shown like this:
- 66 -
-
7/28/2019 Automatic Power Saver
67/117
-
7/28/2019 Automatic Power Saver
68/117
-
7/28/2019 Automatic Power Saver
69/117
69
-Automatic power saver
- 69 -
-
7/28/2019 Automatic Power Saver
70/117
70
-Automatic power saver
PHOTO SEMICONDUCTOR
A Germanium or silicon diode or transistor, which has a transparent encasing, can serve as a
photodiode or transistor because the light photons can initiate conduction in the p-n-
junction region. Early devices such as the OCP 71 were Ge-devices. Later, silicon types
became available with lower leakage current and better light sensitivity. In a phototransistor,
the base lead is not used; but, if a resistor is connected form base to emitter it reduced the
light sensitivity. Darlington connected photo transistors (two transistors together in one
case) such as the 2N5777 are very sensitive with a hFE of 2.5K, a dark current of 100nA and
a light current of 0.5-2.0mA for light flux density H=2mW/cm2. The device is rated 200mW
and voltage of 25V maximum.
SCRs with a light window are also available, called as LASCR, which are very sensitive
and can turn mains power ON and OFF, with light.
The switching speed of phototransistors far exceeds those of LDRs, made of CdS. The s.
Maximum switching speeds and fall time is 50rise time for the 2N5777 is 75 is 1KHz.
Photo devices are useful in optical encoding, intrusion alarms, tape readers, level control,
character recognition etc.
Nowadays packing containing an LED and a photodiode, called opto-coupler is used for
switching on power or control circuits. Because the light source (LED) and photodiode are
physically kept separated (with 2mm) in the package, isolation upto 2500V can be had.
- 70 -
-
7/28/2019 Automatic Power Saver
71/117
71
-Automatic power saver
LED:
LED falls within the family of P-N junction device. The light emitting device(LED) is a
diode that will give off visible light when it is energized. In any forward biased P-N
junction there is, with in the structure and primarilyclose to the junction a recombination
of hole and electrons. This recombination requires that the energy possessed by the
unbound free electron be transferred to another state. This process of giving off light by
applying an electrical source is called electroluminescence.
Fig no. 5.15 : LED and LED SYMBOL
LED is a component used for indication. All the function being carried out are displayed by
LED. The LED is diode which glows when the current is being flow through it in forward bias
condition. This LED are available in the round shell and also in the flat shells. The positive leg is
longer than negative leg.
- 71 -
-
7/28/2019 Automatic Power Saver
72/117
72
-Automatic power saver
- 72 -
-
7/28/2019 Automatic Power Saver
73/117
73
-Automatic power saver
PHOTODIODE
A photodiode is a semiconductor diode that functions as a photo detector. Photodiodes arepackaged with either a window or optical fibre 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.
If a conventional silicon diode is connected in the reverse-biased circuit of fig. 1, negligible
current will flow through the diode and zero voltage will develop across R
1
. If the diode casing
is now carefully removed so that the diode's semiconductor junction is revealed, and the junction
is them exposed to visible light in the same circuit, the diode current will rise, possibly to as
- 73 -
-
7/28/2019 Automatic Power Saver
74/117
74
-Automatic power saver
Fig. 1 Reverse-based diode circuit.
high as 1 mA, producing a significant output across R1. Further investigation will show that the
diode current (and thus the output voltage) is directly proportional to light intensity, and that the
diode is therefore photosensitive.
In practice, all silicon junctions are photosensitive, and a photodiode can be regarded as a
conventional diode housed in a case that lets external light reach its photosensitive
semiconductor junction. Fig. 2 shows the standard photodiode symbol. In use, the photodiode is
reverse biased and the output voltage is taken from across a series-connected load resistor. This
resistor may be connected between the diode and ground, as in fig. 1, or between the diode and
the positive supply line, as in fig. 3
Fig. 2 Photodiode symbol
The human eye is sensitive to a range of light radiation, as shown in fig. 4. It has a peak spectral
response to the colour green, which has a wave length of about 550 nm, but has a relatively low
sensitivity to the colour violet (400 nm) at one end of the spectrum and to dark red (700 nm) at
the other. Photodiodes also have spectral response characteristics, and these are determined by
the chemistry used in the semiconductor junction material. Fig. 4 shows typical response curves
of a general-purpose photodiode, and infrared (IR) photodiode.
- 74 -
Photodiode
-
7/28/2019 Automatic Power Saver
75/117
75
-Automatic power saver
Photodiodes have a far lower light-sensitivity than cadmium-sulphide LDRs, but give a far
quicker response to changes in light level. Generally, LDRs are ideal for use in slow-acting
direct-coupled light-level sensing applications, while photodiodes are ideal for use in fast-acting
AC-coupled signalling applications. Typical photodiode applications include IR remote-control
circuits, IR beam switches and alarm circuits, and photographic flash slave circuits, etc.
Fig 3 Photodiode circuit with D1-to-V + load
- 75 -
-
7/28/2019 Automatic Power Saver
76/117
76
-Automatic power saver
Fig. 4 Typical spectral response curves of (a) the human eye, (b) a general-purpose photodiode, and (c) an infra-
red photodiode.
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 electronand electron hole. If the absorption occurs in the junction's depletion region, these carriers are
swept from the junction by the built-in fieldof the depletion region, producing aphotocurrent.
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,
- 76 -
-
7/28/2019 Automatic Power Saver
77/117
77
-Automatic power saver
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 effectare more sensitive to light than ones based on the photovoltaic effect.
Avalanche photodiodes have a similar structure, however they are operated with much higher
reverse bias. This allows eachphoto-generatedcarrier to be multiplied by avalanche breakdown,resulting in internal gain within the photodiode, which increases the effective responsivity 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 Wavelength range (nm)
Silicon 1901100
Germanium 8001700
Indium gallium arsenide 8002600
Lead sulfide
-
7/28/2019 Automatic Power Saver
78/117
78
-Automatic power saver
Rponsivity
The ratio of generated photocurrent to incident light power, typically expressed in A/W
when used in photoconductive mode. The responsively may also be expressed as a quantumefficiency, or the ratio of the number of photogene rated carriers to incident photons, thus a unit
less quantity.
Dark current
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.
Noise-equivalent power
(NEP) 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 NEP,
1/NEP; and the specific detectivity ( ) is the detectivity normalized to the area (A) of the
photodetector, . The NEP is roughly the minimum detectable input power of a
photodiode.
- 78 -
-
7/28/2019 Automatic Power Saver
79/117
79
-Automatic power saver
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 requiredfor 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.
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 Computedtomography (coupled with scintillates) 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-visionequipment and laser range finding.
- 79 -
-
7/28/2019 Automatic Power Saver
80/117
80
-Automatic power saver
PHOTOTRANSISTOR
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.
- 80 -
-
7/28/2019 Automatic Power Saver
81/117
81
-Automatic power saver
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). Other performance specifications for phototransistors includespectral 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 phototransistorsinclude 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
availa
Fig. 5 shows the standard symbol of a phototransistor, which can be regarded as a conventional
transistor housed in a case that enables its semiconductor junctions to be exposed to external
light. The device is normally used with its base open circuit, in either of the configurations
shown in fig. 6, and functions as follows.
- 81 -
-
7/28/2019 Automatic Power Saver
82/117
82
-Automatic power saver
Fig. 5 Phototransistor symbol.
In fig. 6(a), the base-collector junction of the transistor is effectively reverse biased and thus acts
as a photodiode. The photo-generated currents of the base-collector junction feed directly into
the base of the device, and the normal current-amplifying transistor action causes the output
current to appear (in greatly amplified form) as collector current, and in fig. 6(a) R1 causes this
current to generate an output voltage as shown.
In practice, the collector and emitter current of the transistor are virtually identical and, since the
base is open circuit, the device is not subjected to significant negative feedback. Consequently,
the alternative fig. 6(b) circuit, inwhich R1 is connected to Q1 emitter, gives a virtually identical
performance to that of fig. 6(a).
- 82 -
-
7/28/2019 Automatic Power Saver
83/117
83
-Automatic power saver
Fig. 6 Alternative phototransistor configuration.
The sensitivity of a phototransistor is typically one hundred times greater than that of a
photodiode, but is useful maximum operating frequency (a few hundred kilohertz) isproportionally lower than that of a photodiode by using only its base and collector terminals and
ignoring the emitter, as shown in fig. 7.
- 83 -
-
7/28/2019 Automatic Power Saver
84/117
84
-Automatic power saver
Fig. 7 Phototransistor used as a photodiode
INFRARED LED'S:-
Gallium arsenide is a direct-gap semiconductor with an energy gap of 1.4eV at room
temperature. A typical GaPs LED is made by solid-state impurity diffusion with zinc as the p-
type impurity diffused into an n-type sub state doped with tin, tellurium or silicon. The external
efficiency at room temperature is typically 5 percent.
A GaAs diode can also be fabricated by liquid-phase epitaxy with silicon as both its n and
p dopants. If a silicon atom replaces a Ga atom, it provides one additional electron, thus theresulting GaAs in as n-type. If a silicon atom replaces arsenic atoms, an electron is missing and
the resulting GaAs is a p-type. In Si doped GaAs diode, the emission peak shifts down to
1.32eV. Since the emission is in infrared region, GaAs light sources are suitable for application
such as the optical isolator. The high switching speed, with a recovery time between 2 and 10ns,
makes them ideal for data transmission.
- 84 -
-
7/28/2019 Automatic Power Saver
85/117
85
-Automatic power saver
The disadvantages of the GaAs emitter are emitted wavelength and the associated
attenuation an dispersion. A critical issue of using an LED for the fibre optics is the coupling of
light from the semiconductor to the fibre. Because of the larger refractive index of GaAs relative
to air, the internal efficiency of LED can be quite low.
INFRARED TRANSMITTER
R1=4.7K
VR1=10K
R2=10K
C2=0.001f
C3=0.01f
C1=10f16v
WORKING
- 85 -