0% found this document useful (0 votes)
1K views

Smart Building Using PIR Sensor

The document describes a smart building project that uses PIR sensors and an Arduino Uno microcontroller to automatically control lights in a meeting room based on occupancy. The system senses occupants with PIR sensors and switches lights on and off accordingly. It can analyze usage data like number of occupants, time lights are on, and power consumed. Components include an Arduino Uno, ESP8266 WiFi module, PIR sensors, relay modules, and other basic electronics.

Uploaded by

Siva Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views

Smart Building Using PIR Sensor

The document describes a smart building project that uses PIR sensors and an Arduino Uno microcontroller to automatically control lights in a meeting room based on occupancy. The system senses occupants with PIR sensors and switches lights on and off accordingly. It can analyze usage data like number of occupants, time lights are on, and power consumed. Components include an Arduino Uno, ESP8266 WiFi module, PIR sensors, relay modules, and other basic electronics.

Uploaded by

Siva Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 16

SMART BUILDING USING PIR SENSOR

Smart buildings are the ones where various parameters like temperature, lights, water etc. are
monitored and analysed so as to make it highly efficient.

In this course, we will work on smart lights in a smart building and learn how to develop such a
system and how to send data from such a system to the cloud for analysis. The project you
develop can sense the number of occupants in the meeting room with the help of PIR sensors
and automatically switch the lights ON/ OFF based on occupancy. You will be able to analyse
the usage of the meeting room, number of persons at various times of the day, the time for
which lights are on and the power consumed.

COMPONENTS REQUIRED:-

 Arduino Uno
 ESP8266
 PIR Sensors
 Relay Driver Modules
 USB to UART Cable
 Buzzer
 Bulb Holders
 Barrel Connector
 Breadboard & Wire
 1 pin Connectors
 Wooden Chassis
 Screwdriver*
 Wire Stripper*

ARDUINO UNO:-

The Arduino UNO is an open-source microcontroller board based on


the Microchip ATmega328P microcontroller and developed by Arduino.cc. The
board is equipped with sets of digital and analog input/output (I/O) pins that may
be interfaced to various expansion boards (shields) and other circuits.[1] The board
has 14 Digital pins, 6 Analog pins, and programmable with the Arduino
IDE (Integrated Development Environment) via a type B USB cable.[4] It can be
powered by a USB cable or by an external 9 volt battery, though it accepts voltages
between 7 and 20 volts. It is also similar to the Arduino Nano and Leonardo. The
hardware reference design is distributed under a Creative Commons Attribution
Share-Alike 2.5 license and is available on the Arduino website. Layout and
production files for some versions of the hardware are also available. "Uno" means
one in Italian and was chosen to mark the release of Arduino Software (IDE)
1.0. The Uno board and version 1.0 of Arduino Software (IDE) were the reference
versions of Arduino, now evolved to newer releases. The Uno board is the first in a
series of USB Arduino boards, and the reference model for the Arduino
platform. The ATmega328 on the Arduino Uno comes preprogrammed with a boot
loader that allows uploading new code to it without the use of an external hardware
programmer. It communicates using the original STK500 protocol.[1] The Uno also
differs from all preceding boards in that it does not use the FTDI USB-to-serial
driver chip. Instead, it uses the Atmega16U2 (Atmega8U2 up to version R2)
programmed as a USB-to-serial converter.

Technical Specifications

 Microcontroller : Microchip ATmega328P


 Operating Voltage : 5 Volts
 Input Voltage : 7 to 20 Volts
 Digital I/O Pins : 14 (of which 6 provide PWM output)
 Analog Input Pins :6
 DC Current per I/O Pin : 20 mA
 DC Current for 3.3V Pin : 50 mA
 Flash Memory : 32 KB of which 0.5 KB used by boot loader
 SRAM : 2 KB
 EEPROM : 1 KB
 Clock Speed : 16 MHz
 Length : 68.6 mm
 Width : 53.4 mm
 Weight : 25 g

Pins
General Pin functions

 LED: There is a built-in LED driven by digital pin 13. When the pin is HIGH
value, the LED is on, when the pin is LOW, it's off.
 VIN: The input voltage to the Arduino/Genuino board when it's using an
external power source (as opposed to 5 volts from the USB connection or other
regulated power source). You can supply voltage through this pin, or, if
supplying voltage via the power jack, access it through this pin.
 5V: This pin outputs a regulated 5V from the regulator on the board. The board
can be supplied with power either from the DC power jack (7 - 20V), the USB
connector (5V), or the VIN pin of the board (7-20V). Supplying voltage via the
5V or 3.3V pins bypasses the regulator, and can damage the board.
 3V3: A 3.3 volt supply generated by the on-board regulator. Maximum current
draw is 50 mA.
 GND: Ground pins.
 IOREF: This pin on the Arduino/Genuino board provides the voltage reference
with which the microcontroller operates. A properly configured shield can read
the IOREF pin voltage and select the appropriate power source or enable
voltage translators on the outputs to work with the 5V or 3.3V.
 Reset: Typically used to add a reset button to shields which block the one on
the board.

Special Pin Functions


Each of the 14 digital pins and 6 Analog pins on the Uno can be used as an input or
output, using pin Mode, digital Write, and digital Read functions. They operate at 5
volts. Each pin can provide or receive 20 mA as recommended operating condition
and has an internal pull-up resistor (disconnected by default) of 20-50k ohm. A
maximum of 40mA is the value that must not be exceeded on any I/O pin to avoid
permanent damage to the microcontroller. The Uno has 6 analog inputs, labeled A0
through A5, each of which provide 10 bits of resolution (i.e. 1024 different values).
By default they measure from ground to 5 volts, though is it possible to change the
upper end of their range using the AREF pin and the analog Reference function.

In addition, some pins have specialized functions:

 Serial / UART: pins 0 (RX) and 1 (TX). Used to receive (RX) and transmit
(TX) TTL serial data. These pins are connected to the corresponding pins of the
ATmega8U2 USB-to-TTL Serial chip.
 External Interrupts: pins 2 and 3. These pins can be configured to trigger an
interrupt on a low value, a rising or falling edge, or a change in value.
 PWM (Pulse Width Modulation): 3, 5, 6, 9, 10, and 11 can provide 8-bit PWM
output with the analog Write function.
 SPI (Serial Peripheral Interface): 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK).
These pins support SPI communication using the SPI library.
 TWI (Two Wire Interface) / I2C: A4 or SDA pin and A5 or SCL pin. Support
TWI communication using the Wire library.
 AREF (Analog REFerence): Reference voltage for the analog inputs.

ESP 8266 Wi-Fi Module:-

The ESP8266 is a low-cost Wi-Fi microchip with full TCP/IP


stack and microcontroller capability produced by manufacturer Espressif Systems.
This small module allows microcontrollers to connect to a Wi-Fi network and
make simple TCP/IP connections using Hayes-style commands. However, at first
there was almost no English-language documentation on the chip and the
commands it accepted. The very low price and the fact that there were very few
external components on the module, which suggested that it could eventually be
very inexpensive in volume, attracted many hackers to explore the module, chip,
and the software on it, as well as to translate the Chinese documentation.
The ESP8285 is an ESP8266 with 1 MiB of built-in flash,
allowing for single-chip devices capable of connecting to Wi-Fi.

Features
 Processor:

L106 32-bit RISC microprocessor core based on the Tensilica Xtensa Diamond
Standard 106Micro running at 80 MHz

 Memory:
 32 KiB instruction RAM
 32 KiB instruction cache RAM
 80 KiB user-data RAM
 16 KiB ETS system-data RAM
 External QSPI flash: up to 16 MiB is supported (512 KiB to 4 MiB typically
included)
 IEEE 802.11 b/g/n Wi-Fi
 Integrated TR switch, balun, LNA, power amplifier and matching network
 WEP or WPA/WPA2 authentication, or open networks
 16 GPIO pins
 SPI
 I2C (software implementation)
 I2S interfaces with DMA (sharing pins with GPIO)
 UART on dedicated pins, plus a transmit-only UART can be enabled on GPIO2
 10-bit ADC (successive approximation ADC)

Pinout of ESP-01
The pinout is as follows for the common ESP-01
module:

1. VCC, Voltage (+3.3 V; can handle up to 3.6


V)
2. GND, Ground (0 V)
3. RX, Receive data bit X
4. TX, Transmit data bit X
5. CH_PD, Chip power-down
6. RST, Reset
7. GPIO 0, General-purpose input/output No. 0
8. GPIO 2, General-purpose input/output No. 2

RELAY4 4-CHANNEL RELAY DRIVER MODULE:-


The 4-Channel Relay Driver Module makes it simple and convenient to drive loads
such as 12V relays from simple 5V digital outputs of your Arduino compatible
board or other microcontroller. You can use any of the control channels
independently, so simply leave any unused channels disconnected.

Module Pinout

 Logic GND: Connect to GND on your microcontroller.


 Input 1: Connect to a digital output from your microcontroller, or leave
unconnected if channel not used.
 Input 2: Connect to a digital output from your microcontroller, or leave
unconnected if channel not used.
 Input 3: Connect to a digital output from your microcontroller, or leave
unconnected if channel not used.
 Input 4: Connect to a digital output from your microcontroller, or leave
unconnected if channel not used.
 Relay power +: Connect to the positive (+) lead of the power source for
your relays. Can be 5 to 24V DC.
 Relay power -: Connect to the negative (-) lead of the power source for your
relays.
 Relay 1 +: Connect to the + side of the coil of your first relay.
 Relay 1 -: Connect to the - side of the coil of your first relay.
 Relay 2/3/4 +: As per Relay 1 +.
 Relay 2/3/4 -: As per Relay 1 -.

Basic Connections
Connect from 1 to 4 channels to your microcontroller and relays as required. In this
example we've connected to D10 through D13 on the Eleven. This is a particularly
convenient method because it can also be done by fitting a 5-pin male breakaway
header to the 4-Channel Relay Driver Module, and plugging it directly into the
Arduino header so that GND on the module aligns with GND on the header.
Relays are connected directly to each output channel. In many tutorials about
relays you will see instructions that you must include a protection diode across the
relay terminals. You do not need to do that when using the 4-Channel Relay Driver
Module, because the protection diodes are built in to the module itself.

PIR SENSOR (PASSIVE INFRARED SENSOR):-

A passive infrared sensor (PIR sensor) is an electronic sensor that


measures infrared (IR) light radiating from objects in its field of view. They are
most often used in PIR-based motion detectors. PIR sensors are commonly used in
security alarms and automatic lighting applications. PIR sensors detect general
movement, but do not give information on who or what moved. For that purpose,
an active IR sensor is required.

PIR sensors are commonly called simply "PIR", or sometimes "PID",


for "passive infrared detector". The term passive refers to the fact that PIR devices
do not radiate energy for detection purposes. They work entirely by
detecting infrared radiation (radiant heat) emitted by or reflected from objects.
Operating principles
All objects with a temperature above absolute zero emit heat energy in the form of
radiation. Usually this radiation isn't visible to the human eye because it radiates at
infrared wavelengths, but it can be detected by electronic devices designed for such
a purpose.

Operation
A PIR sensor can detect changes in the amount of infrared radiation impinging
upon it, which varies depending on the temperature and surface characteristics of
the objects in front of the sensor. When an object, such as a person, passes in front
of the background, such as a wall, the temperature at that point in the sensor's field
of view will rise from room temperature to body temperature, and then back again.
The sensor converts the resulting change in the incoming infrared radiation into a
change in the output voltage, and this triggers the detection. Objects of similar
temperature but different surface characteristics may also have a different infrared
emission pattern, and thus moving them with respect to the background may
trigger the detector as well.
PIRs come in many configurations for a wide variety of applications. The most
common models have numerous Fresnel lenses or mirror segments, an effective
range of about 10 meters (30 feet), and a field of view less than 180°. Models with
wider fields of view, including 360°, are available, typically designed to mount on
a ceiling. Some larger PIRs are made with single segment mirrors and can sense
changes in infrared energy over 30 meters (100 feet) from the PIR. There are also
PIRs designed with reversible orientation mirrors which allow either broad
coverage (110° wide) or very narrow "curtain" coverage, or with individually
selectable segments to "shape" the coverage.
Security applications
When used as part of a security system, the electronics in the PIR typically control
a small relay. This relay completes the circuit across a pair of electrical
contacts connected to a detection input zone of the burglar alarm control panel.
The system is usually designed such that if no motion is being detected, the relay
contact is closed—a 'normally closed' (NC) relay. If motion is detected, the relay
will open the circuit, triggering the alarm; or, if a wire is disconnected, the alarm
will also operate.
BARREL CONNECTOR:-

A coaxial power connector is an electrical power connector used for


attaching extra-low voltage devices such as consumer electronics to
external electricity. Also known as barrel connectors, concentric barrel
connectors or tip connectors; these small cylindrical connectors come in an
enormous variety of sizes.
Barrel plug connectors are commonly used to interface the secondary side of a
power supply with the device. Some of these jacks contain a normally closed
switch; the switch can disconnect internal batteries whenever the external power
supply is connected.

ELECTRICAL CONNECTORS:-
An electrical connector is an electro-mechanical device used to join electrical
terminations and create an electrical circuit. Electrical connectors consist of plugs
(male-ended) and jacks (female-ended). The connection may be temporary, as for
portable equipment, require a tool for assembly and removal, or serve as a
permanent electrical joint between two wires or devices.[1] An adapter can be used
to effectively bring together dissimilar connectors.

Hundreds of types of electrical connectors are manufactured for power, signal and
control applications. Connectors may join two lengths of flexible copper wire or
cable, or connect a wire or cable to an electrical terminal. n computing, an
electrical connector can also be known as a physical interface
Male to Female Connectors Male to Male Connectors

BULB HOLDER:-

A light bulb socket, light socket, lamp socket or lamp holder is a device which
mechanically supports and provides electrical connections for a compatible
electric lamp. Sockets allow lamps to be safely and conveniently replaced (re-
lamping). There are many different standards for lamp holders, including early de
facto standards and later standards created by various standards bodies.
USB TO UART CABLE:-

A USB adapter is a type of protocol converter which is used for


converting USB data signals to and from other communications standards.
Commonly, USB adapters are used to convert USB data to standard serial port data
and vice versa. Most commonly the USB data signals are converted to
either RS232, RS485, RS422, or TTL-level UART serial data. The older serial
RS423 protocol is rarely used anymore, so USB to RS423 adapters are less
common.

BUZZER:-

A buzzer or beeper is an audio signaling device,[1] which may


be mechanical, electromechanical, or piezoelectric (piezo for short). Typical uses
of buzzers and beepers include alarm devices, timers, and confirmation of user
input such as a mouse click or keystroke.
BREAD BOARD:-
A breadboard is a solder less device for temporary prototype with electronics and
test circuit designs. Most electronic components in electronic circuits can be
interconnected by inserting their leads or terminals into the holes and then making
connections through wires where appropriate. The breadboard has strips of metal
underneath the board and connect the holes on the top of the board. The metal
strips are laid out as shown below. Note that the top and bottom rows of holes are
connected horizontally and split in the middle while the remaining holes are
connected vertically.

Note how all holes in the selected row are connected together, so the holes in the
selected column. The set of connected holes can be called a node:
To interconnect the selected row (node A) and column (node B) a cable going from
any hole in the row to any hole in the column is needed:

Now the selected column (node B) and row (node A) are interconnected:
CONNECTION DIOGRAM:-

You might also like