PIR_based_energy_conservation by kishorkna



                                     HARDWARE DESIGN

The Hardware design phase consists of several parts. They are:

   a) Micro-controller circuit design.
   b) RTC interface.
   c) LCD interface.
   d) Switch and buzzer connections.

The design consideration associated with each part is as discussed below:

5.1 Designing of power supply:

       The power supply circuit has to provide a 5v-regulated power to the micro controller for
its operation. The dc power required is derived from a 230v AC supply mains.

       The circuit diagram of the designed power supply is as shown in fig 5.1.

In the circuit, a step down transformer of rating 230v primary with a isolated secondary
winding is used. The secondary winding provides an 8v ac output, with a current
capacity of 500mA.
       The voltage provided by the secondary winding, is rectified by using a bridge
rectifier. A capacitor filter to remove the ripple present in the output follows this. In these
instrument power supplies, the filter sections can be either  or L sections, but these
sections are not normally needed in low power, low voltage applications and only a
single capacitor is sufficient. The internal impedance of the secondary winding is
sufficient to limit the current during the initial surge. The capacitor value should be of
very high value for low ripple. Thus, a capacitor of 1000f with a working voltage of 18v
is sufficient, but with a factor of safety the working voltage is considered as 35v.

The filtered DC output from secondary winding, without any load has a value of 10v to
12v with normal input supply of 230v AC. The input voltage may fluctuate over a wide
range practically. To accommodate these ranges a higher initial output, which is more
than 12v is considered. The regulator itself requires 2v higher than its regulated output,
i.e., 7v is needed for getting 5v. In order to accommodate the voltage fluctuations on the
lower side of 230v, another 5v additional voltage is considered.

     This voltage is fed to a three-pin regulator 7805, which basically provides an output of 5v
irrespective of its input supply, provided the input is greater than 7v. But, at the maximum input
voltage, it should not exceed 32v, and as it is, it never happens, unless the input supply voltage
is greater then 400v, and is of rare nature. The output of this regulator is connected with a small
capacitor of 0.1f to 1f (between output and ground). This capacitor improves the noise
immunity of the power supply circuit. This output drives the micro controller.
                                Fig.5.1. Micro controller power supply.

       5.2 Design of Micro controller circuit

   The basic features needed with a micro controller for this application are:

    An I2C module to interface the I2C compatible RTC to the controller.
    Approximately 8k-12k of ROM space for the basic implementation software, which is to
        be developed during the project implementation.
    Minimum of 256 bytes of internal RAM to store the data received, process variables
        while the program is running and also to use as stack.
        11 I/O lines to interface the LCD, to display the strings that are to be transmitted, and on
        the receiver side that are received.

Apart form these basic features, it is also required to have the following additional features, to
make the product a full- fledged commercial product.

    Analog input pins, to sense the parameters such as temperature, humidity, and wind
        speed, etc. the environmental factors or certain other analog signals of interest.
    Additional 3-4 I/O lines to indicate the status and fault conditions through LEDs.
    Additional ROM/RAM memory space to incorporate other advanced control applications.
   Most of the present day micro controllers from different manufacturers satisfy these


   Apart from these standard features, in order to use the micro controllers, especially
to write the developed code into ROM of the micro controller, the necessary software
and hardware support from the micro controller manufacturer, commonly referred as
developmental tools.

   The features required by the micro controller to be used in this project is to be
advanced, but because of the non-availability of development tools and also due to their
cost, we resorted to a basic and popular micro controller from ATMEL, the AT89C52.
The operational features of the micro controller along with the software instructions are
provided in the “Annexure-A”.

     The micro controller has to be used to collect the data from the ADC and to display it.
Several different types of micro controllers are available in the market from different
manufacturers with different capabilities; such as in built ROM, RAM, I/O ports. Timers ADC,
DAC etc. also varies from one micro controller to the other.

     For a particular application, apart from these logic issues, the other main aspect is its
economics, which mainly decides the product final price. The other major issue, while choosing
a micro controller is the support provided by the manufacturer for utilizing it. To write the
program into the micro controller, a specific tool known as a writer board is to be needed. The
writer board is not a common gadget for all the micro controllers. Even to develop the program
is also a Herculean job. Normally the programs can be written in assembly and are entered into
a PC, via the software provided by the micro controller manufacturer, the assembly code is
converted into mnemonics (Assembler). This mnemonic code is the one, which is to be written
in to the controller. This is done by a writer board, which is hooked up to the PC, by using the
RS-232 serial interface. Some times it is highly difficult to write the programs in assembly, in
those circumstances, the programs are written in „C‟ and the „C‟ code is converted into the
machine code using a compiler, the code thus generated can be dumped into the micro
controller using a PC.

     To speed up the process of development of gadget, an emulator is needed, which can be
used to develop the programs by using what are called as break points. The assembler and
compilers, are software tools, while emulator is both hardware and software tool. Without these
basic tools, however good might be the micro controller, one cannot use it to its optimum
           The operational features of the micro controller along with the soft ware

instructions were provided in the “Annexure – A”. The internal block diagram of the

micro controller is provided in fig. 5.2
                  Fig.5.2. Internal block diagram of the micro controller.

   Any microprocessor or micro controller requires clock for its operation. Most of them

are having built in oscillators, and only a crystal of appropriate frequency has to be

connected across the terminals provided in the IC. The 89C52 is designed to operate at

12MHz. So the crystal connected is 12MHz, and is connected across the specified pins

as shown in fig.4.6.

                       Fig.4.6. RESET and clock generation circuits.
   In the case of power on or whenever the CPU enters into an endless loop or a

program of an unknown destination, the CPU has to be reset. In order to achieve, both

power on and manual reset, the circuit is to be connected as shown in fig.4.6. In the

reset circuit, it is required to maintain a high voltage (logic 1 level) on the reset pin for a

period 24 clock cycles of the clock. The series RC circuit connected as shown in the

fig.4.6 achieves this. The R& C values are chosen in such a way to provide a high pulse

for a period of more than 24 clock periods, and they are10-Kohms and 10micro farads.

The time constant of the RC circuit is 100msecs. A press to on switch is connected

across the capacitor as shown in the fig 4.6. which on a press provides a high signal on

the reset pin.


       A PIR detector is a motion detector that senses the heat emitted by a living body.
These are often fitted to security lights so that they will switch on automatically if
approached. They are very effective in enhancing home security systems.

       The sensor is passive because, instead of emitting a beam of light or microwave
energy that must be interrupted by a passing person in order to “sense” that person, the
PIR is simply sensitive to the infrared energy emitted by every living thing. When an
intruder walks into the detector‟s field of vision, the detector “sees” a sharp increase in
infrared energy.

       A PIR sensor light is designed to turn on when a person approaches, but will not
react to a person standing still. The lights are designed this way. A moving person
exhibits a sudden change in infrared energy, but a slower change is emitted by a
motionless body. Slower changes are also caused by gradual fluctuations in the
temperature of the environment. If the light were sensitive to these slower changes, it
would react to the sidewalk cooling off at night, instead of the motion of a burglar.

       If you have a PIR light, you may notice that it is more sensitive on cold days than
on warm days. This is because the difference in temperature between the ambient air
and the human body is greater on cold days, making the rise in temperature easier for
the sensor to detect. This has drawbacks, though; if the sensor is too sensitive, it will
pick up things you don‟t want it to such as the movement of small animals.

       Passive infrared sensor is an electronic device, which measures infrared light
radiating from objects in its field of view. PIRs are often used in the construction of PIR-
based motion detectors. Apparent motion is detected when an infrared source with one

temperature, such as a human, passes in front of an infrared source with another
temperature, such as a wall.

       All objects emit what is known as black body radiation. This energy is invisible to
the human eye but can be detected by electronic devices designed for such a purpose.
The term 'Passive' in this instance means the PIR does not emit energy of any type but
merely accepts incoming infrared radiation.

       Infrared radiation enters through the front of the sensor, known as the sensor
face. At the core of a PIR is a solid state sensor or set of sensors, made from
approximately 1/4 inches square of natural or artificial pyroelectric materials, usually in
the form of a thin film, out of gallium nitride (GaN), caesium nitrate (CsNO 3), polyvinyl
fluorides, derivatives of phenylpyrazine, and cobalt phthalocyanine. (See pyroelectric
crystals.) Lithium tantalate (LiTaO3) is a crystal exhibiting both piezoelectric and
pyroelectric properties.

       The sensor is often manufactured as part of an integrated circuit and may consist
of one (1), two (2) or four (4) 'pixels' of equal areas of the pyroelectric material. Pairs of
the sensor pixels may be wired as opposite inputs to a differential amplifier. In such a
configuration, the PIR measurements cancel each other so that the average
temperature of the field of view is removed from the electrical signal; an increase of IR
energy across the entire sensor is self-cancelling and will not trigger the device. This
allows the device to resist false indications of change in the event of being exposed to
flashes of light or field-wide illumination. (Continuous bright light could still saturate the
sensor materials and render the sensor unable to register further information.)

        At the same time, this differential arrangement minimizes common-mode
interference; this allows the device to resist triggering due to nearby electric fields.
However, a differential pair of sensors cannot measure temperature in that configuration
and therefore this configuration is specialized for motion detectors.

        In a PIR-based motion detector, the PIR sensor is typically mounted on a printed
circuit board, which also contains the necessary electronics required to interpret the
signals from the chip. The complete circuit is contained in a housing, which is then
mounted in a location where the sensor can view the area to be monitored. Infrared
energy is able to reach the sensor through the window because the plastic used is
transparent to infrared radiation (but only translucent to visible light). This plastic sheet
prevents the introduction of dust and insects, which could obscure the sensor's field of


        A few mechanisms have been used to focus the distant infrared energy onto the
sensor surface. The window may have Fresnel lenses molded into it. Alternatively,
sometimes PIR sensors are used with plastic segmented parabolic mirrors to focus the
infrared energy; when mirrors are used, the plastic window cover has no Fresnel lenses
molded into it. A filtering window (or lens) may be used to limit the wavelengths to 8-14
micrometers, which is most sensitive to human infrared radiation (9.4 micrometers being
the strongest).
      The PIR device can be thought of as a kind of infrared „camera‟, which
remembers the amount of infrared energy focused on its surface. Once power is applied
to the PIR the electronics in the PIR shortly settle into a quiescent state and energize a
small relay. This relay controls a set of electrical contacts, which are usually connected
to the detection input of an alarm control panel. If the amount of infrared energy focused
on the sensor changes within a configured time period, the device will switch the state
of the alarm output relay. The alarm output relay is typically a "normally closed (NC)"
relay; also know as a "Form B" relay.

      A person entering the monitored area is detected when the infrared energy
emitted from the intruder's body is focused by a Fresnel lens or a mirror segment and
overlaps a section on the chip, which had previously been looking at some much cooler
part of the protected area. That portion of the chip is now much warmer than when the
intruder wasn't there. As the intruder moves, so does the hot spot on the surface of the
chip. This moving hot spot causes the electronics connected to the chip to de-energize
the relay, operating its contacts, thereby activating the detection input on the alarm
control panel. Conversely, if an intruder were to try to defeat a PIR perhaps
By holding some sort of thermal shield between himself and the PIR, a corresponding
'cold' spot moving across the face of the chip will also cause the relay to de-energize
unless the thermal shield has the same temperature as the objects behind it.

      Manufacturers recommend careful placement of their products to prevent false
alarms. They suggest mounting the PIRs in such a way that the PIR cannot 'see' out of
a window. Although the wavelength of infrared radiation to which the chips are sensitive
does not penetrate glass very well, a strong infrared source (a vehicle headlight,
sunlight reflecting from a vehicle window) can overload the chip with enough infrared
energy to fool the electronics and cause a false (non-intruder caused) alarm. A person
moving on the other side of the glass however would not be 'seen' by the PIR.

      They also recommended that the PIR not be placed in such a position that an
HVAC vent would blow hot or cold air onto the surface of the plastic, which covers the
housing's window. Although air has very low emissivity (emits very small amounts of
infrared energy), the air blowing on the plastic window cover could change the plastic's
temperature enough to, once again, fool the electronics.

       PIRs come in many configurations for a wide variety of applications. The most
common used in home security systems has numerous Fresnel lenses or mirror
segments and has an effective range of about thirty feet. Some larger PIRs are made
with single segment mirrors and can sense changes in infrared energy over one
hundred feet away from the PIR. There are also PIRs designed with reversible
orientation mirrors, which allow either broad coverage (110° wide) or very narrow
'curtain' coverage.

       PIRs can have more than one internal sensing element so that, with the
appropriate electronics and Fresnel lens, it can detect direction. Left to right, right to left,
up or down and provide an appropriate output signal.

To top