With advancement of technology things are becoming simpler and easier for us. Automation is the use of control systems and information technologies to reduce the need for human work in the production of goods and services. In the scope of industrialization, automation is a step beyond mechanization. Whereas mechanization provided human operators with machinery to assist them with the muscular requirements of work, automation greatly decreases the need for human sensory and mental requirements as well. Automation plays an increasingly important role in the world economy and in daily experience. Automatic systems are being preferred over manual system. Through this project we have tried to show automatic control of a house as a result of which power is saved to some extent. The past decade has seen significant advancement in the field of consumer electronics. Various “intelligent” appliances such as cellular phone, air conditioners, home security devices, home theatres, etc., are set to realize the concept of a smart home. They have given rise to a Personal Area Network in home environment, where all these appliances can be interconnected and monitored using a single controller. Home automation involves introducing a degree of computerized or automatic control to certain electrical and electronic systems in a building. These include lighting, temperature control, etc. This project demonstrates a simple home automation system which contains a remote mobile host controller and several client modules (home appliances). The client modules communicate with the host controller through a wireless device such as a Bluetooth enabled mobile phone, in this case, an android based Smart phone.
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Smart Home Automation using Atmega328p
1. A
PROJECT
ON
“Smart Home Automation using Atmega328p”
SUBMITTED IN PARTIAL FULFILLMENT OF
REQUIREMENT OF THE DEGEE OF
BACHELOR OF TECHNOLOGY
IN
ELECTRICAL ENGINEERING
SUBMITTED TO: SUBMITTED BY:
Electrical Department
DEPARTMENT OF ELECTRICAL ENGINEERING
VYAS COLLEGE OF ENGINEERING AND TECHNOLOGY, JODHPUR
RAJASTHAN TECHNICAL UNIVERSITY, KOTA
2017
Lakshminarayan,
Mehul Raj, Pyara Ram,
Omprakash, Jasraj,
Ravi Chawla
2. Department of Electrical Engineering
This is to certify that the project entitled, “Smart Home using
Atmega328p" submitted by "Lakshminarayan, Mehul Raj, Jasraj, Pyara Ram,
Omprakash Meena, Ravi Chawla" in partial fulfilment of the requirements for
the award of "B. Tech Degree" in "Electrical Engineering" at the "VYAS
INSTITUTE OF ENGINEERING AND TECHNOLOGY, JODHPUR
(Raj.)" is an authentic work carried out by him under my supervision and
guidance.
To the best of my knowledge, the matter embodied in the project has not been
submitted to any other University / Institute for the award of any Degree or
Diploma.
Date:
Project Guide Name Head of Department:
Vikas Mathur Mr. Manish Bhati
CERTIFICATE
Submitted To
Electrical Department
3. TABLE OF CONTENTS
Abstract.......................................................................................... 1
Home Automation.......................................................................... 2
Need of Automation....................................................................... 3
Introduction.................................................................................... 4
Component Used............................................................................ 5
Tools Used ..................................................................................... 7
1. Atmega328p Controller or Arduino UNO ................................ 8
2. IR Sensor for Object detection .................................................. 19
3. Flame Sensor.............................................................................. 23
4. Earthquake Sensor ..................................................................... 25
5. Servo Motor............................................................................... 27
6. Piezo Buzzer .............................................................................. 30
7. DC Motor Fan............................................................................ 32
Connection of sensors with output ............................................... 34
Program for Project ....................................................................... 35
Advantages .................................................................................... 38
Disadvantages ................................................................................ 38
References...................................................................................... 39
4. ~ 1 ~
I. ABSTRACT
With advancement of technology things are becoming simpler and easier for us.
Automation is the use of control systems and information technologies to reduce the
need for human work in the production of goods and services. In the scope of
industrialization, automation is a step beyond mechanization. Whereas mechanization
provided human operators with machinery to assist them with the muscular
requirements of work, automation greatly decreases the need for human sensory and
mental requirements as well. Automation plays an increasingly important role in the
world economy and in daily experience. Automatic systems are being preferred over
manual system. Through this project we have tried to show automatic control of a house
as a result of which power is saved to some extent.
The past decade has seen significant advancement in the field of consumer electronics.
Various “intelligent” appliances such as cellular phone, air conditioners, home security
devices, home theatres, etc., are set to realize the concept of a smart home. They have
given rise to a Personal Area Network in home environment, where all these appliances
can be interconnected and monitored using a single controller.
Home automation involves introducing a degree of computerized or automatic control
to certain electrical and electronic systems in a building. These include lighting,
temperature control, etc.
This project demonstrates a simple home automation system which contains a remote
mobile host controller and several client modules (home appliances). The client
modules communicate with the host controller through a wireless device such as a
Bluetooth enabled mobile phone, in this case, an android based Smart phone.
5. ~ 2 ~
II. HOME AUTOMATION
Home/office automation is the control of any or all electrical devices in our home or
office, whether we are there or away. Home/office automation is one of the most
exciting developments in technology for the home that has come along in decades.
There are hundreds of products available today that allow us control over the devices
automatically, either by remote control; or even by voice command.
Home automation (also called demotics) is the residential extension of "building
automation". It is automation of the home, housework or household activity. Home
automation may include centralized control of lighting, HVAC (heating, ventilation and
air conditioning), appliances, and other systems, to provide improved convenience,
comfort, energy efficiency and security. Disabled can provide increased quality of life
for persons who might otherwise require caregivers or institutional care.
A home automation system integrates electrical devices in a house with each other. The
techniques employed in home automation include those in building automation as well
as the control of domestic activities, such as home entertainment systems, houseplant
and yard watering, pet feeding, changing the ambiance "scenes" for different events
(such as dinners or parties), and the use of domestic robots. Devices may be connected
through a computer network to allow control by a personal computer, and may allow
remote access from the internet.
Typically, a new home is outfitted for home automation during construction, due to the
accessibility of the walls, outlets, and storage rooms, and the ability to make design
changes specifically to accommodate certain technologies. Wireless systems are
commonly installed when outfitting a pre-existing house, as they reduce wiring
changes. These communicate through the existing power wiring, radio, or infrared
signals with a central controller. Network sockets may be installed in every room like
AC power receptacles.
6. ~ 3 ~
III. NEED OF AUTOMATION
Earlier, we looked into the face of future when we talked about automated devices,
which could do anything on instigation of a controller, but today it has become a reality.
a) An automated device can replace good amount of human working force,
moreover humans are more prone to errors and in intensive conditions the
probability of error increases whereas, an automated device can work with
diligence, versatility and with almost zero error.
Replacing human operators in tasks that involve hard physical or
monotonous work.
Replacing humans in tasks done in dangerous environments (i.e. fire,
space, volcanoes, nuclear facilities, underwater, etc.)
Performing tasks that are beyond human capabilities of size, weight,
speed, endurance, etc.
Economy improvement. Automation may improve in economy of
enterprises, society or most of humankind. For example, when an
enterprise that has invested in automation technology recovers its
investment, or when a state or country increases its income due to
automation like Germany or Japan in the 20th Century.
b) This is why this project looks into construction and implementation of a
system involving hardware to control a variety of electrical and electronics
system.
7. ~ 4 ~
Introduction
Homes of the 21st century will become more and more self-controlled and automated.
Simple devices such as a timer to turn on one’s coffee maker in the morning have been
around for many years, but much more sophisticated mechanisms will soon be prevalent
in homes around the world.
Imagine walking into your home and being greeted at the door with lights illuminating
your path without you ever having to touch light switch, with your favourite music
streaming through the speakers in whichever room you enter (because your home
recognized that it was you and not some other household member), all while having the
peace of mind knowing that your home automation system took care of activating your
security system. Furthermore, such a system could allow the user to schedule events to
occur at recurring intervals (e.g., turn on sprinkler system at 4:30a.m. every Tuesday
and Thursday).
This report describes an approximation of such a home automation system that was
designed and built as a final project for 6.111 at M.I.T. This system was designed to be
flexible and generally programmable, extensible such that adding additional features is
relatively simple, and modular and forward-compatible, so that new components can be
added without redesigning the entire system. To achieve these goals, the system runs a
user-defined program on a special-purpose processor, using real-world sensor inputs as
operands.
8. ~ 5 ~
COMPONENTS USED
Following components are used in this project:
S.no Component Name Quantity Price
1 ATmega328P with Bootloader 1 ₹ 200
2 28-pin IC Base 1 ₹ 10
3 LM7805 voltage Regulator 1 ₹ 15
4 LED Red 10 ₹ 20
5 LED White 5 ₹ 10
6 Resistor, 1/4W, 10K ohm 10 ₹ 20
7 Resistor, 1/4W, 220 ohm 10 ₹ 20
8 Resistor, 1/4W, 100 ohm 5 ₹ 10
9 Resistor, 1/4W, 1K ohm 10 ₹ 20
10 Capacitor 0.1µF, 25V 2 ₹ 5
11 Capacitor 470µF, 50V 1 ₹ 5
12 Capacitor 22pF, 50V 2 ₹ 5
13 16MHz Crystal 2 ₹ 50
14 1N4007 Diode 5 ₹ 10
15 2-pin screw terminal 2 ₹ 30
9. ~ 6 ~
S.no Component Name Quantity Price
16 Piezo Buzzer 8 ohm 1 ₹ 20
17 3-pin Header Connector 10 ₹ 30
18 Copper Clad (PBC) – 4 x 6 in 2 ₹ 100
19 Single Stand PCB Wire 3 meter ₹ 15
20 12-volt 2-amp Transformer 1 ₹ 200
21 IR Led pair TX & RX 3 ₹ 100
22 LM358 IC 4 ₹ 120
23 Heat Sink 1 ₹ 10
24 LM35 Temp. Sensor 1 ₹ 90
25 Push Button 1 ₹ 5
26 Connection Wires 5 meter ₹ 30
27 Servo Motor 9 gram 1 ₹ 230
10. ~ 7 ~
TOOLS USED
Following tools are used in this project:
S.no Tools Name Quantity Price
1 Hot Melt Glue Gun 1 ₹ 300
2 Glue Sticks 5 ₹ 80
3 PCB Drill Machine 1 ₹ 90
4 0.8 mm Drill bit 2 ₹ 40
5 Soldering Iron 1 ₹ 180
6 Micro Pointed tip for Solder Iron 1 ₹ 30
7 Soldering bit cleaning Sponge 1 ₹ 30
8 Soldering Wire As Required ₹ 50
9 Soldering Flux As Required ₹ 10
10 Etching Power 100 gram ₹ 80
11. ~ 8 ~
Main Parts of our projects –
1. Atmega328p Controller or Arduino UNO
2. IR Sensor for object detection
3. Flame Sensor
4. Earthquake Sensor
5. Servo Motor
6. Piezo Buzzer
7. LM35 Temperature
8. 5-volt DC Fan
1. Atmega328p Controller or Arduino UNO
Arduino is a popular open-source single-board microcontroller, descendant of the open-
source Wiring platform, designed to make the process of using electronics in
multidisciplinary projects more accessible. The hardware consists of a simple open
hardware design for the Arduino board with an Atmel AVR processor and on-board
input/output support. The software consists of a standard programming language
compiler and the boot loader that runs on the board. Arduino hardware is programmed
using a Wiring-based language (syntax and libraries), similar to C++ with some slight
simplifications and modifications, and a Processing-based integrated development
environment. Current versions can be purchased pre-assembled; Additionally,
variations of the Italian-made Arduino—with varying levels of compatibility—have
been released by third parties; some of them are programmed using the Arduino
software. The Arduino project received an honorary mention in the Digital
Communities category at the 2006 Prix Ars Electronica.
Fig 1: Arduino Mega2560
12. ~ 9 ~
An Arduino board consists of an 8-bit Atmel AVR microcontroller with complementary
components to facilitate programming and incorporation into other circuits. An
important aspect of the Arduino is the standard way that connectors are exposed,
allowing the CPU board to be connected to a variety of interchangeable add-on modules
known as shields. Official Arduinos have used the megaAVR series of chips,
specifically the ATmega8, ATmega168, ATmega328, ATmega1280, and
ATmega2560. A handful of other processors have been used by Arduino compatibles.
Most boards include a 5-volt linear regulator and a 16 MHz crystal oscillator (or
ceramic resonator in some variants), although some designs such as the Lily Pad run at
8 MHz and dispense with the on-board voltage regulator due to specific form-factor
restrictions. An Arduino's microcontroller is also pre-programmed with a boot loader
that simplifies uploading of programs to the on- chip flash memory, compared with
other devices that typically need an external programmer. Chip flash memory,
compared with other devices that typically need an external programmer.
Fig 2: Arduino UNO pinout and Parts
13. ~ 10 ~
ATmega328 Micro Controller –
The Arduino Uno is a microcontroller board based on the ATmega328 (datasheet). It
has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog
inputs, a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP header,
and a reset button. It contains everything needed to support the microcontroller; simply
connect it to a computer with a USB cable or power it with a AC-to-DC adapter or
battery to get started. The Uno differs from all preceding boards in that it does not use
the FTDI USB-to-serial driver chip. Instead, it features the Atmega8U2 programmed as
a USB-to-serial converter.
Fig 3: Atmega328p microcontroller
Technical Specification-
Microcontroller ATmega328
Input Voltage 5V
Input Voltage (recommended) 7-12V
Digital I/O Pins 14 (of which 6 provide PWM output)
Analog Input Pins 6
DC Current per I/O Pin 40 mA
DC Current for 3.3V Pin 50 mA
Flash Memory 32 KB of which 0.5 KB used by bootloader
EEPROM 1 KB
Clock Speed 16 MHz
14. ~ 11 ~
Pin mapping-
Fig 4: Atmega328p Pin Mapping
Feature –
High Performance, Low Power Atmel ® AVR® 8-Bit Microcontroller Family
• Advanced RISC Architecture
– 131 Powerful Instructions
– Most Single Clock Cycle Execution
– 32 x 8 General Purpose Working Registers
– Fully Static Operation
– Up to 20 MIPS Throughput at 20MHz
– On-chip 2-cycle Multiplier
• High Endurance Non-volatile Memory Segments
– 32KBytes of In-System Self-Programmable Flash program
Memory
15. ~ 12 ~
– 1KBytes EEPROM
– 2KBytes Internal SRAM
– Write/Erase Cycles: 10,000 Flash/100,000 EEPROM
– Data Retention: 20 years at 85°C/100 years at 25°C(1)
– Optional Boot Code Section with Independent Lock Bits
• In-System Programming by On-chip Boot Program
• True Read-While-Write Operation
– Programming Lock for Software Security
• Atmel® QTouch® Library Support
– Capacitive Touch Buttons, Sliders and Wheels
– QTouch and QMatrix® Acquisition
– Up to 64 sense channels
Atmel-42735B-328/P_Datasheet_Summary-11/2016
• Peripheral Features
– Two 8-bit Timer/Counters with Separate Prescaler and Compare Mode
– One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture
Mode
– Real Time Counter with Separate Oscillator
– Six PWM Channels
– 8-channel 10-bit ADC in TQFP and QFN/MLF package
• Temperature Measurement
– 6-channel 10-bit ADC in PDIP Package
• Temperature Measurement
– Two Master/Slave SPI Serial Interface
– One Programmable Serial USART
– One Byte-oriented 2-wire Serial Interface (Philips I2C compatible)
– Programmable Watchdog Timer with Separate On-chip Oscillator
– One On-chip Analog Comparator
– Interrupt and Wake-up on Pin Change
• Special Microcontroller Features
16. ~ 13 ~
– Power-on Reset and Programmable Brown-out Detection
– Internal Calibrated Oscillator
– External and Internal Interrupt Sources
– Six Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, Standby,
and
Extended Standby
• I/O and Packages
– 23 Programmable I/O Lines
– 28-pin PDIP, 32-lead TQFP, 28-pad QFN/MLF and 32-pad QFN/MLF
• Operating Voltage:
– 1.8 - 5.5V
• Temperature Range:
– -40°C to 105°C
• Speed Grade:
– 0 - 4MHz @ 1.8 - 5.5V
– 0 - 10MHz @ 2.7 - 5.5V
– 0 - 20MHz @ 4.5 - 5.5V
• Power Consumption at 1MHz, 1.8V, 25°C
– Active Mode: 0.2mA
– Power-down Mode: 0.1µA
– Power-save Mode: 0.75µA (Including 32kHz RTC)
Pin Descriptions
1. VCC
Digital supply voltage.
2. GND
Ground.
3. Port B (PB[7:0]) XTAL1/XTAL2/TOSC1/TOSC2
17. ~ 14 ~
Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each
bit). The Port B output buffers have symmetrical drive characteristics with both high
sink and source capability. As inputs, Port B pins that are externally pulled low will
source current if the pull-up resistors are activated. The Port B pins are tri-stated when
a reset condition becomes active, even if the clock is not running.
Depending on the clock selection fuse settings, PB6 can be used as input to the inverting
Oscillator amplifier and input to the internal clock operating circuit.
Depending on the clock selection fuse settings, PB7 can be used as output from the
inverting Oscillator amplifier.
If the Internal Calibrated RC Oscillator is used as chip clock source, PB[7:6] is used as
TOSC[2:1] input for the Asynchronous Timer/Counter2 if the AS2 bit in ASSR is set.
4. Port C (PC[5:0])
Port C is a 7-bit bi-directional I/O port with internal pull-up resistors (selected for each
bit). The PC[5:0]
output buffers have symmetrical drive characteristics with both high sink and source
capability. As inputs,
Port C pins that are externally pulled low will source current if the pull-up resistors are
activated. The Port
C pins are tri-stated when a reset condition becomes active, even if the clock is not
running.
5. PC6/RESET
If the RSTDISBL Fuse is programmed, PC6 is used as an I/O pin. Note that the
electrical characteristics
of PC6 differ from those of the other pins of Port C.
If the RSTDISBL Fuse is unprogrammed, PC6 is used as a Reset input. A low level on
this pin for longer
than the minimum pulse length will generate a Reset, even if the clock is not running.
Shorter pulses are
not guaranteed to generate a Reset.
The various special features of Port C are elaborated in the Alternate Functions of Port
C section.
6. Port D (PD[7:0])
Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each
bit). The Port D output buffers have symmetrical drive characteristics with both high
18. ~ 15 ~
sink and source capability. As inputs, Port D pins that are externally pulled low will
source current if the pull-up resistors are activated. The Port D pins are tri-stated when
a reset condition becomes active, even if the clock is not running.
7. AVCC
AVCC is the supply voltage pin for the A/D Converter, PC[3:0], and PE[3:2]. It should
be externally connected to VCC, even if the ADC is not used. If the ADC is used, it
should be connected to VCC through a low-pass filter. Note that PC[6:4] use digital
supply voltage, VCC.
8. AREF
AREF is the analog reference pin for the A/D Converter.
9. ADC[7:6] (TQFP and VFQFN Package Only)
In the TQFP and VFQFN package, ADC[7:6] serve as analog inputs to the A/D
converter. These pins are powered from the analog supply and serve as 10-bit ADC
channels.
19. ~ 16 ~
LM7805 Voltage regulator-
Voltage regulator IC's are the IC’s that are used to regulate voltage. IC 7805 is a 5V
Voltage Regulator that restricts the voltage output to 5V and draws 5V regulated power
supply. It comes with provision to add heatsink.
Fig 5: LM7805 Voltage regulator
The maximum value for input to the voltage regulator is 35V. It can provide a constant
steady voltage flow of 5V for higher voltage input till the threshold limit of 35V. If the
voltage is near to 7.5V then it does not produce any heat and hence no need for heatsink.
If the voltage input is more, then excess electricity is liberated as heat from 7805.
It regulates a steady output of 5V if the input voltage is in rage of 7.2V to 35V. Hence
to avoid power loss try to maintain the input to 7.2V. In some circuitry voltage
fluctuation is fatal (for e.g. Microcontroller), for such situation to ensure constant
voltage IC 7805 Voltage Regulator is used. For more information on specifications of
7805 Voltage Regulator please refer the data sheet here (IC 7805 Voltage Regulator
Data Sheet).
IC 7805 is a series of 78XX voltage regulators. It’s a standard, from the name the last
two digits 05 denotes the amount of voltage that it regulates. Hence a 7805 would
regulate 5v and 7806 would regulate 6V and so on.
The schematic given below shows how to use a 7805 IC, there are 3 pins in IC 7805,
pin 1 takes the input voltage and pin 3 produces the output voltage. The GND of both
input and out are given to pin 2.
20. ~ 17 ~
Fig 6: LM7805 Use in Circuit
Voltage Regulator is one of the most important and commonly used electrical
components. Voltage Regulators are responsible for maintaining a steady voltage across
an Electronic system. Voltage fluctuations may result in undesirable effect on an
electronic system, so to maintaining a steady constant voltage is necessary according to
the voltage requirement of a system.
Circuit Diagram –
Fig 7: Atmega328p microcontroller Circuit
22. ~ 19 ~
2. IR Sensor for Object detection
Infrared technology addresses a wide variety of wireless applications. The main areas
are sensing and remote controls. In the electromagnetic spectrum, the infrared portion
is divided into three regions: near infrared region, mid infrared region and far infrared
region.
The wavelengths of these regions and their applications are shown below.
Near infrared region — 700 nm to 1400 nm — IR sensors, fibre optic
Mid infrared region — 1400 nm to 3000 nm — Heat sensing
Far infrared region — 3000 nm to 1 mm — Thermal imaging
The frequency range of infrared is higher than microwave and lesser than visible light.
For optical sensing and optical communication, photo optics technologies are used in
the near infrared region as the light is less complex than RF when implemented as a
source of signal. Optical wireless communication is done with IR data transmission for
short range applications.
An infrared sensor emits and/or detects infrared radiation to sense its surroundings.
The working of any Infrared sensor is governed by three laws: Planck’s Radiation law,
Stephen – Boltzmann law and Wien’s Displacement law.
Planck’s law states that “every object emits radiation at a temperature not equal to 00K”.
Stephen – Boltzmann law states that “at all wavelengths, the total energy emitted by a
black body is proportional to the fourth power of the absolute temperature”. According
to Wien’s Displacement law, “the radiation curve of a black body for different
temperatures will reach its peak at a wavelength inversely proportional to the
temperature”.
23. ~ 20 ~
The basic concept of an Infrared Sensor which is used as Obstacle detector is to transmit
an infrared signal, this infrared signal bounces from the surface of an object and the
signal is received at the infrared receiver.
There are five basic elements used in a typical infrared detection system: an infrared
source, a transmission medium, optical component, infrared detectors or receivers and
signal processing. Infrared lasers and Infrared LED’s of specific wavelength can be
used as infrared sources. The three main types of media used for infrared transmission
are vacuum, atmosphere and optical fibres. Optical components are used to focus the
infrared radiation or to limit the spectral response. Optical lenses made of Quartz,
Germanium and Silicon are used to focus the infrared radiation. Infrared receivers can
be photodiodes, phototransistors etc. some important specifications of infrared
receivers are photosensitivity, detectivity and noise equivalent power. Signal
processing is done by amplifiers as the output of infrared detector is very small.
IR Transmitter
Infrared Transmitter is a light emitting diode (LED) which emits infrared radiations.
Hence, they are called IR LED’s. Even though an IR LED looks like a normal LED, the
radiation emitted by it is invisible to the human eye.
The picture of a typical Infrared LED is shown below.
Fig 10: IR transmitter LED
There are different types of infrared transmitters depending on their wavelengths,
output power and response time.
24. ~ 21 ~
IR Receiver
Infrared receivers are also called as infrared sensors as they detect the radiation from
an IR transmitter. IR receivers come in the form of photodiodes and phototransistors.
Infrared Photodiodes are different from normal photo diodes as they detect only infrared
radiation. The picture of a typical IR receiver or a photodiode is shown below.
Fig 11: IR Receiver LED
Different types of IR receivers exist based on the wavelength, voltage, package, etc.
When used in an infrared transmitter – receiver combination, the wavelength of the
receiver should match with that of the transmitter.
Fig 12: IR Sensor working
25. ~ 22 ~
LM358 IC
LM358 is also one of the types of operational amplifier. LM358 consists of two
independent, high-gain, frequency-compensated operational amplifiers designed to
operate from a single supply over a wide range of voltages.
Fig 13: LM358 IC
Circuit Diagram –
Fig 14: IR Sensor Circuit
26. ~ 23 ~
PCB Layout –
Fig 15: IR Sensor PCB layout
PCB Design –
Fig 16: IR Sensor PCB
3. Flame Sensor
Flame Detector module is representative of the many similar devices that are designed
to interface with micro-controllers. This particular device consists of an IR detector,
op amp circuitry, sensitivity adjustment and an LED indicator.
the viewing angle is at sixty degrees. Thus the sensor view is incredibly important as
you design your projects.
27. ~ 24 ~
Fig 17: IR Flame Sensor
The flame sensor module detects wavelengths from 760nm-1100nm. The are other
sources of heat that will also detect this wavelength. It is therefore important that you
ensure that the only source of this particular range will be the flame that you want to
detect. Otherwise, your project may be riddled with false measurements.
28. ~ 25 ~
Circuit Diagram –
Fig 18: IR Flame Sensor Circuit
PCB layout –
Fig 19: IR Flame Sensor PCB Layout
4. Earthquake Sensor
An earthquake is an unavoidable and unpredictable natural phenomenon that often
causes damage to lives and property. We cannot fight it but we can stay alert and aware
using technology that can protect us and the industry. Here a simple earthquake
indicator for home and industry using an Arduino and a highly-sensitive accelerometer
is presented that can indicate vibrations.
29. ~ 26 ~
This project can be modified and used as a knock-and-shake detector for ATMs,
vehicles or door-break alarms. But its main aim is to detect earthquakes and other
seismic activities.
Vibration Switch –
This project can be modified and used as a knock-and-shake detector for ATMs,
vehicles or door-break alarms. But its main aim is to detect earthquakes and other
seismic activities. Vibration Switch is a device that recognizes the amplitude of the
vibration to which it is exposed and provides some sort of response when this amplitude
exceeds a predetermined threshold value. The switch response is typically an electrical
contact closure or contact opening. The electrical contact may be either an
electromechanical relay or solid-state triac.
Vibration switches are primarily used for protecting critical machinery from costly
destructive failure by initiating an alarm or shutdown when excessive vibration of the
machinery is detected. Conversely, a vibration switch can be utilized to warn of the
absence of vibration, such as when a conveyer ceases to function due to a broken drive
belt.
The Vibration Switch is a safety device designed for protecting rotating machinery such
as motors, generators, engines, pumps and fans from abnormal levels of vibration. The
switch trips if the vibration level becomes excessive, shutting down the device being
protected. The switch operates by means of a magnetic air gap, with an increased air
gap for low vibration and a decreased air gap for high vibration levels. The air gap can
be adjusted to set the sensitivity of the switch.
Fig 20: Vibration Switch
30. ~ 27 ~
Circuit Diagram –
Fig 21: Earthquake Sensor Circuit
5. Servo Motor
A servo motor is an electrical device which can push or rotate an object with great
precision. If you want to rotate and object at some specific angles or distance, then you
use servo motor. It is just made up of simple motor which run through servo mechanism.
If motor is used is DC powered then it is called DC servo motor, and if it is AC powered
motor then it is called AC servo motor. We can get a very high torque servo motor in a
small and light weight packages. Doe to these features they are being used in many
applications like toy car, RC helicopters and planes, Robotics, Machine etc.
31. ~ 28 ~
Fig 22: Servo Motor
The position of a servo motor is decided by electrical pulse and its circuitry is placed
beside the motor.
Servo Mechanism
It consists of three parts:
Controlled device
Output sensor
Feedback system
It is a closed loop system where it uses positive feedback system to control motion and
final position of the shaft. Here the device is controlled by a feedback signal generated
by comparing output signal and reference input signal.
Here reference input signal is compared to reference output signal and the third signal
is produces by feedback system. And this third signal acts as input signal to control
device. This signal is present as long as feedback signal is generated or there is
difference between reference input signal and reference output signal. So the main task
of servomechanism is to maintain output of a system at desired value at presence of
noises.
Working principle of Servo Motors
32. ~ 29 ~
A servo consists of a Motor (DC or AC), a potentiometer, gear assembly and a
controlling circuit. First of all, we use gear assembly to reduce RPM and to increase
torque of motor. Say at initial position of servo motor shaft, the position of the
potentiometer knob is such that there is no electrical signal generated at the output port
of the potentiometer. Now an electrical signal is given to another input terminal of the
error detector amplifier. Now difference between these two signals, one comes from
potentiometer and another comes from other source, will be processed in feedback
mechanism and output will be provided in term of error signal. This error signal acts as
the input for motor and motor starts rotating. Now motor shaft is connected with
potentiometer and as motor rotates so the potentiometer and it will generate a signal.
So as the potentiometer’s angular position changes, its output feedback signal changes.
After sometime the position of potentiometer reaches at a position that the output of
potentiometer is same as external signal provided. At this condition, there will be no
output signal from the amplifier to the motor input as there is no difference between
external applied signal and the signal generated at potentiometer, and in this situation
motor stops rotating.
Controlling Servo Motor:
Servo motor is controlled by PWM (Pulse with Modulation) which is provided by the
control wires. There is a minimum pulse, a maximum pulse and a repetition rate. Servo
motor can turn 90 degrees from either direction form its neutral position. The servo
motor expects to see a pulse every 20 milliseconds (ms) and the length of the pulse will
determine how far the motor turns. For example, a 1.5ms pulse will make the motor
turn to the 90° position, such as if pulse is shorter than 1.5ms shaft moves to 0° and if
it is longer than 1.5ms than it will turn the servo to 180°.
Servo motor works on PWM (Pulse width modulation) principle, means its angle of
rotation is controlled by the duration of applied pulse to its Control PIN. Basically servo
motor is made up of DC motor which is controlled by a variable resistor (potentiometer)
and some gears. High speed force of DC motor is converted into torque by Gears. We
know that WORK= FORCE X DISTANCE, in DC motor Force is less and distance
(speed) is high and in Servo, force is High and distance is less. Potentiometer is
connected to the output shaft of the Servo, to calculate the angle and stop the DC motor
on required angle.
33. ~ 30 ~
Fig 23: Servo Motor Controlling
Servo motor can be rotated from 0 to 180 degree, but it can go up to 210 degrees,
depending on the manufacturing. This degree of rotation can be controlled by applying
the Electrical Pulse of proper width, to its Control pin. Servo checks the pulse in every
20 milliseconds. Pulse of 1 ms (1 millisecond) width can rotate servo to 0 degree, 1.5ms
can rotate to 90 degrees (neutral position) and 2 ms pulse can rotate it to 180 degrees.
6. Piezo Buzzer
Piezo buzzer is an electronic device commonly used to produce sound. Light weight,
simple construction and low price make it usable in various applications like car/truck
reversing indicator, computers, call bells etc. Piezo buzzer is based on the inverse
principle of piezo electricity discovered in 1880 by Jacques and Pierre Curie. It is the
phenomena of generating electricity when mechanical pressure is applied to certain
materials and the vice versa is also true. Such materials are called piezo electric
materials. Piezo electric materials are either naturally available or manmade. Piezo
ceramic is class of manmade material, which poses piezo electric effect and is widely
used to make disc, the heart of piezo buzzer. When subjected to an alternating electric
34. ~ 31 ~
field they stretch or compress, in accordance with the frequency of the signal thereby
producing sound.
Fig 24: Piezo Buzzer
The above image shows a very commonly used piezo buzzer also called piezo
transducer operating at DC voltage. Encapsulated in a cylindrical plastic coating, it has
a hole on the top face for sound to propagate. A yellow metallic disc which plays an
important role in the producing sound can be seen through the hole. The above image
shows a very commonly used piezo buzzer also called piezo transducer operating at DC
voltage. Encapsulated in a cylindrical plastic coating, it has a hole on the top face for
sound to propagate. A yellow metallic disc which plays an important role in the
producing sound can be seen through the hole. The two leads are used to supply a DC
voltage.
Fig 24: Piezo Buzzer Components
35. ~ 32 ~
The inductor coil surrounded by tape is shown in the image above.
This is the opposite side of the PCB, having the necessary electronic components: a
resistor, a transistor and an inductor. The input to the transducer is a low voltage DC
signal, however in order to produce sound the piezo ceramic disc needs oscillations of
high voltage. The transistor and resistor combination works as an oscillator circuit to
produce low amplitude oscillations from the DC voltage. The magnitude of these
oscillations is amplified by the inductor.
Working:
When a small DC voltage is applied to the input pins, it is first converted to an
oscillating signal using the combination of resistor and transistor. These oscillating
signals are amplified using the inductor coil. When high voltage alternating signals are
applied to the piezo ceramic disc, it causes mechanical expansion and contraction in
radial direction. This causes the metal plate to bend in opposite direction. When metal
plate bends and shrinks in opposite direction continuously it produces sound waves in
the air.
7. DC Motor Fan
A DC motor in simple words is a device that converts direct current (electrical energy)
into mechanical energy. It’s of vital importance for the industry today, and is equally
important for engineers to look into the working principle of DC motor in details that
has been discussed in this article. In order to understand the operating principle of DC
motor we need to first look into its constructional feature.
36. ~ 33 ~
Fig 26: DC Motor Construction
The very basic construction of a DC motor contains a current carrying armature which
is connected to the supply end through commutator segments and brushes it is placed
within the north south poles of a permanent or an electro-magnet as shown in the
diagram below.
Now to go into the details of the operating principle of DC motor it’s important that we
have a clear understanding of Fleming’s left hand rule to determine the direction of
force acting on the armature conductors of DC motor.
Fig 27: DC Motor for Fan
Fleming’s left hand rule says that if we extend the index finger, middle finger and thumb
of our left hand in such a way that the current carrying conductor is placed in a magnetic
field (represented by the index finger) is perpendicular to the direction of current
(represented by the middle finger), then the conductor experiences a force in the
direction (represented by the thumb) mutually perpendicular to both the direction of
field and the current in the conductor.
37. ~ 34 ~
Connection among Sensors, Input, Output and Power
supply-
Fig 28: Block Diagram of project
5 volt
38. ~ 35 ~
Program for Project-
#include<Servo.h>
int position = 90;
boolean forward = false;
Servo servo;
const int IRsensor1 = 13;
const int IRsensor2 = 12;
const int Earthquake = 11;
const int Flamesensor = 10;
const int door = 9;
const int Buzzer = 14;
const int temp = 17;
const int ledlight = 18;
const int Fan = 19;
unsigned long off_time1;
unsigned long off_time2;
unsigned long off_time3;
int buttonState1 = 0;
int buttonState2 = 0;
int buttonState3 = 0;
int buttonState4 = 0;
int tempvalue = 0;
boolean State1 = false;
boolean State2 = false;
void setup () {
servo.attach(door);
pinMode(Buzzer, OUTPUT);
pinMode(Fan, OUTPUT);
pinMode(ledlight, OUTPUT);
digitalWrite(Buzzer, LOW);
digitalWrite(Fan, LOW);
digitalWrite(ledlight, LOW);
pinMode(IRsensor1, INPUT);
pinMode(IRsensor2, INPUT);
pinMode(Flamesensor, INPUT);
pinMode(Earthquake, INPUT);
pinMode(temp, INPUT);
}
39. ~ 36 ~
void loop() {
buttonState1 = digitalRead(IRsensor1);
buttonState2 = digitalRead(IRsensor2);
buttonState4 = digitalRead(Flamesensor);
buttonState3 = digitalRead(Earthquake);
tempvalue = analogRead(temp);
if (!State1)
{
if (buttonState4 == HIGH || buttonState3 == HIGH)
{
digitalWrite(Buzzer, HIGH);
State1 = true;
off_time1 = millis() + 3000;
}
}
else if ((State1) && (millis() >= off_time1))
{
digitalWrite(Buzzer, LOW);
State1 = false;
}
if (! State2)
{
if (buttonState2 == HIGH)
{
digitalWrite(Fan, HIGH);
digitalWrite(ledlight, HIGH);
State2 = true;
off_time2 = millis() + 5000;
}
}
else if ((State2) && (millis() >= off_time2)) /* is it on and is it
later or equal to off_time */
{
digitalWrite(Fan, LOW );
digitalWrite(ledlight, LOW);
State2 = false;
}
if (!forward)
{
if (buttonState1 == HIGH || buttonState4 == HIGH || buttonState3 ==
HIGH)
{
servo.write(-- position);
40. ~ 37 ~
if (position == 0)
forward = true ;
off_time3 = millis() + 5000;
}
}
else if ((forward) && (millis() >= off_time3))
{
servo.write (++ position) ;
if (position == 90)
forward = false ;
}
}
Software Used -
•Arduino IDE
Programming Languages Used -
•Embedded C/C++
•Java & XML
41. ~ 38 ~
Advantages
• It is a robust and easy to use system.
• There is no need for extra training of that person who is using it.
• All the control would be in your hands by using this home automation system.
• This project can provide the facility of monitoring all the appliances.
• The schematic of Arduino is open source, for the future enhancement of the project
board can be extended to add more hard ware features.
Disadvantages
• High power required for continuously supply.
• It only work when the object or user is in the range of sensor.
• Installation of Smart Home instruments are very costly.
• Highly trained technician required for this type of system.