Motion Detector THDC
Motion Detector THDC
ABSTRACT
This paper describes automatic lighting and security system design using PIR motion
sensors. Using this sensor we can certainly minimize electrical power consumption and
minimize cases of people forgetting to turn off the lights before they leave. The
electricity crisis and the neglect of people to turn off lights is one of the most common
problems in Indonesia, especially in the regions. With the help of sensors, we can
eliminate these shortcomings by minimizing waste of electricity or saving the power
produced. Using the motion received from any motion, the PIR sensor provides a high
signal to the microcontroller. So we can easily create a program for the microcontroller
to set the alarm. So this project is very low cost and also saves power. It also minimizes
electricity bills from any office. What's more, this creates an opportunity to minimize
the release of burdens in cities and villages.
ii
LIST OF ABBREVIATIONS AND ACRONYMS
GND Ground
CHAPTER 1: INTRODUCTION
Background
The detection of motion finds its roots in astronomy, which goes back thousands of years
ago. Early farmers looked to the heavens and used the movement of stars to determine when
to plant crops and when to harvest them.
The first motion detection system; radar, was pioneered by Heinrich Hertz. Hertz studied the
properties of waves and found that waves could bounce off of objects and had different
speeds. This revelation was a breakthrough and as Furnish (2007) cites, the increased demand
for detection and monitoring during World War II generated technological advances in
motion sensing. And in 1940s, radar technology was sufficiently advanced that the military
could detect attacks in advance and guide aircraft, Huebsch (2014).
Although the development of radar systems was a great achievement, its applications were
limited to military use, then. One of the first applications of motion sensing outside the
military was developed by Samuel Bagno in the mid-1940s. Using his knowledge of radar
and newly developed electrical components, Bagno began doing research on an ultrasonic
alarm, which worked similarly to radar. His ultrasonic alarm created "a web of ultrasonic
waves inside a room" and detected the motion of a person, Cerruti (1995).
The invention of the ultrasonic alarm generated a demand for other non-military applications
of this technology, especially infrared technology. Although infrared detection had been
invented in the mid-1800s, its applications were limited to astronomy then, Cerruti (1995),
but over time, its scope of application has grew tremendously.
Passive Infrared, commonly known as PIR is the technology of motion detectors that is used
to detect people by sensing the thermal infrared radiation emitted by the human body. PIR
motion detectors always use thermal sensors, detecting the small temperature increase when
the sensor element is exposed to radiation and absorbs it.
2
Problem Statement
Automation is a field that incorporates computer science and electronics heavily. The
growing need to have systems that can be controlled remotely and can be attached to almost
every appliance and furniture has seen the development of new age of computing referred to
as Internet of Things (I0T). People today need systems that can work independently and send
feedback (results of processing; output) to them and can as well monitor various processes in
their homes, offices etc. It is this need that inspires the development of a simple motion
detection unit that its use can be customized to domestic usage for unique needs.
Research Questions
Over time, there have been a growing need to have systems that can work independently and
can be controlled remotely. Internet has contributed to this because of its ever decreasing cost
on connection. Leased line connections such as fibre optic connections, as well as the ADSL
(Asymmetric Digital Subscriber Line) connections tend to replace PSTN (Public Switched
Telephone Network) and ISDN (Integrated Services Digital Network) connections for
everyday use.
3
Previous studies have shown challenges in implementing intelligent embedded systems with
human rights groups always on the watch out demanding for health implication of radiations
that such devices emit when in operation.
The motion sensor component being developed in this project will instead tap infrared
radiations instead of generating them to detect motion.
4
Introduction
This chapter offers a brief background into the areas that are related to the research
performed in this report as well as the areas that support the reasons for performing this
research.
The first section takes a look at embedded systems, the issues and tools involved in their
design, current trends and the challenges in embedded systems design.
Section third which is also the final section of this chapter discusses embedded development
cycle.
Simply put, the proposed outcome of this chapter is a clearer understanding of the important
variables of research as they relate to motion detection.
Embedded Systems
Embedded systems have become a buzz word in the last five years. However, embedded
systems and processors have been around for much longer than that, Stepner (1999). One
only needs to look around to see embedded systems everywhere: cell phones, alarm clocks,
personal data assistants (PDAs), automobile subsystems such as ABS and cruise control, etc.
This is different from general purpose systems, such as the computer that sits on a desk in an
office. The processor running that computer is termed a “general purpose” processor because
it was “designed to perform many different tasks well,” Collins (2000) as opposed to an
embedded system that has been built to perform a few specific tasks either very well or
within very strict parameters.
5
Response time is a critical factor in many embedded systems; whether it is a specific time
that an embedded system tasks needs to be run or the time between tasks that is important.
The most difficult task for an embedded system designer to do is to quantify time deadlines,
decide whether these deadlines are firm, and recognize what the consequences are if these
deadlines are not met, Collins (2000).
Size is also an important decision in many embedded systems. Many embedded systems
designed today are bought and sold simply because they are smaller than the last
implementation of that product. A living example is mobile phones.
Another design issue concerning today’s embedded system designers is power consumption.
Many of embedded systems are usually very small that are handheld devices that are made to
be mobile hence; they must have a battery. Since the designer does not want the user to be
forced to plug in or recharge the device every five minutes, the designer must make important
choices in his design decisions and balance a feature’s merits against the power that the
feature will consume, Collins (2000).
A final consideration that embedded designers need to deal with is cost. Regardless of any
choice of the above issues made, an embedded product is not going to sell if its cost is
exorbitant. Most end users will sacrifice a small amount of performance, or a slightly less
amount of battery time, for an embedded product that is less costly than all of its competitors.
This demands that the designer must consider the cost of adding a particular modification to
the design and whether or not the end user will be willing to pay that additional cost for that
additional feature, Collins (2000).
6
However, there is hope in embedded systems development because they have garnered more
interest in the research community as well as their increased need. Microprocessor companies
are now delving into this interesting field. Intel, a leading processor manufacturer has a keen
eye in embedded systems that has seen it manufacture varied microcontrollers and sponsoring
research towards the realisation of Internet of Things (IoT).
This is a motivation to embedded designers because embedded systems tools are now
catching up with regular system design tools, and they have become more readily available
and diverse in their area of coverage, Stepner (1999).
Stepner (1999) opens further by stating that tools that were not available five to ten years ago
are now available as part of “common EDA development suites”. Also, there are tools that
are now available for the development of embedded system application software as well as
the development of real-time operating systems in normal computer programming languages
with C Language taking the lead.
Two of the trends currently hot in the world of embedded systems that are discussed here are
that of application specific integrated circuits (ASICs) and systems on a chip (SOC).
uses. Like the title suggests, this is an IC that has been designed for a specific
application”.
Examples of ICs that are not ASICs are standard computer parts such as RAM, ROM,
multiprocessors, etc. Examples of ICs that are ASICs are a chip designed for a toy
robot or a chip designed to examine sun spots from a satellite, Smith (1997).
System on a Chip
System on a chip (SOC) is exactly what it sounds like i.e. “hardware designers have
taken the normally separate pieces of a complete system; the CPU, memory
controller, main memory, I/O control, and the various buses and interconnects, and
placed many or all of them on a single piece of silicon” Collins (2000). This explains
why there is reduction in size, power, cost and drop time delay.
Motion sensing systems involve processing of analog data to digital data for an efficient
relevant mechanical output. Therefore, they belong to a certain category of information
systems.
All objects on the earth emit light in accordance with their temperature and surface characteristics.
Naturally, light (infrared radiation) is also emitted from our bodies. (This radiation is emitted from
the body surface, and is centred on a wave-length of 10μm.) When a person enters the detection
area of the sensor, the amount of infrared radiation incident on the sensor varies by the amount
corresponding to the difference in temperature between the body surface and background. These
sensors detect the human body by detecting the change in incident infrared radiation. That is, the
sensor is actuated by the difference in temperature between human body (which is a heat source)
and floor, walls and other objects forming the background. The same also applies to inanimate
objects such as rolling ball. This is because, when those objects move, friction acts on them thus
generating heat. This heat emits infrared radiation which the passive infrared type can detect.
Software Plan
The first step in the software plan is to select an algorithm which solves the problem specified
in the problem specification stage. It is advisable to consider and compare in terms of code
side, speed, difficulty, and ease of maintenance different algorithms.
Once a basic algorithm is chosen the overall problem should be broken down into smaller
problems which are then solved by different devices (modular programming).
Device Plan
At this stage, the routines for hardware specific features are planned. These routines include:
1) Set up the reset vector
2) Set up the interrupt vectors
3) Watch the stack (hardware or software)
4) Interact with peripherals such as timers, serial ports, and analog-digital converters (ADC).
5) Work with I/O ports
Testing
Each module should be tested to ensure that it is functioning properly. Testing is done using
simulators and/or emulators. It is also important to test the hardware to be used.
Integrate
This is the last stage of embedded development cycle. At this stage, the modules are
combined to create a functioning program. At this point, it is important to test routines which
are designed to respond to specific conditions. These routines include interrupt service and
watchdog support routines. The entire program is thoroughly tested.
11
CHAPTER 3: METHODOLOGY
Introduction
This chapter consists of project planning, project block diagrams and project description. In
this chapter also, all the methods that were used to implement the project is described.
Project Planning
The progress and development of the project consists of four main parts. The first part
focuses on detailed literature review regarding the sensor system used in this project, CD4017
AND IR SENSOR and anything related to motion detection.
The last part is on modelling for prototyping and test the system to get the result and fix it if it
the results not just like we want.
12
Literature Review for
devices used in the project Develop source code on
Arduino for the sensor
system, alarm system and
status indicator
Development of the
prototype
Modelling
Study on hardware used
(equipments and
component)
System Testing
Study C language to write a
program
Project Description
This is an endeavour to develop a motion detector component that will be core to further
enhancements for relevance applicability by any user.
Piezzo buzzer and the serial monitor will be the output devices for the motion detector as the
CD4017 IC becomes the central processing module. PIR sensor is the input component. The
serial monitor becomes the status indicator module.
Hardware implementation in this project consists of PIR Sensor, piezzo Buzzer, Arduino
UNO microcontroller and a computer. The CD 4017 acts like the interface between the PIR
sensor and the piezzo buzzer, computer and the LED on pin 13 of the CD 4017 because it is
the central processing unit that controls the flow of operation between the input and output
modules.
The sensor module developed in this project is aimed at extending the ability of the overall
motion detector system by detecting abnormal activities happening within the environment of
the module.
PIR sensor has been picked to implement this project. This is because it allows one to sense
motion, by detecting whether a human has moved in or out of the sensors range. They are
small, inexpensive, low-power, easy to use and don't wear out.
14
This sensor has a sensitivity range of up to 20feet (6 metres) and a 110°X70° detection range
making it a wide lens detection sensor. This means it can measure 110° vertically (from top)
and 70° horizontally (from left to right). However, the PIR sensor can’t count how many
people are around it or how close they are to the sensor because the lens is often fixed to a
certain sweep.
The motion sensing system consists of all modules that have been developed; the sensor
system, alarm system and the status indicator system. The serial monitor will be used for
status reporting. The alarm module can be connected either along the board or some distance
away from the microcontroller. The alarm subsystem consists of a piezzo buzzer to make a
noise and LED to give some visual indicator to the user.
15
Software Development
Figure 3.6.1 below is the flow chart of how the motion detector will work in its programming.
The program will have a continuous looping and will continue to execute according to the
flow chart. The program will initialize at first to make sure all the system ready to be
function. The first program to be executed sensor system then followed by the alarm and
status indicator module which will be executed concurrently.
START
Motion NO
Detected?
YES
STOP
Introduction
This chapter contains the results and discussion from the hardware and software part of the
project that have been implemented on the motion detector system. below shows the overall
system that has been integrated together.
Testing development
After successful implementation of the sensor module and the alarm module, with the CD
4017 to make the motion detector system, the project continued to the next stage; the testing
phase. Project testing will concentrate on several aspects according to functionality and
reliability. This facet is of importance to this project because it will determine whether this
project has achieved its objective or not. This testing development unit will also involve
hardware and software part of the project. below show the flowchart for testing phase of the
project.
17
Start
YES
YES
NO
Y
18
CHAPTER 5: CONCLUSION AND RECOMMENDATIONS
Conclusion
The task for developing the motion sensor system using infrared technology was successful
and achieved the objective for the overall project.
From this project, I can confirm that infrared technology is key in motion sensing. The alarm
module and the status indicator component helped make the system more efficient as the CD
4017 played the central processing unit (CPU) role.
The potential application of this technology in future is relevant in security, tallying and can
be enhanced further into imaging technology at a more reliable and cheaper cost.
The serial monitor in the project was as a platform to give readable notifications.
When making something new, it’s obvious that one faces several problems. The first problem
that I encountered was making the PIR Sensor work with the CD 4017 and also making all
the components work in a coordinated manner.
The hardest part on the project was in the programming part because I ventured into
embedded programming, a fact that made me to tirelessly read and practice this unique, fairly
hard but interesting nerve of systems development. It was a challenge making mechanical
devices work and on several occasions I had to consult Titus Koech, a friend who takes
BEng. Electrical and Communications Engineering from the School of Engineering in order
to understand circuits.
19
It was a challenge working on the project with borrowed devices from a friend who at the
same time was also working on his project. This is because of the cost, especially of the
Arduino UNO board as very few retailers of electronics are aware of it and they only make
few purchases thus making them increase its buying price.
1. Use of GSM Modem: This will increase the ability of remotely receiving a
notification and controlling a set of actions. For example, if used in a home, the user
can make the system switch on a CD player that will create an impression that
someone is inside the house.
2. Making GUI (Graphical User Interface): To make this motion sensor system more
user friendly.
3. Using a more powerful sensor: It will enhance the system by giving it the counting
ability.
4. Using spy Cameras: For taking pictures that will be sent to the user in order to know
the kind of object that has been detected within the detection range.
REFERENCES
Byte Craft Limited. First Steps in Embedded Systems, Ontario: 2002. Available
www.bytecraft.com 18th April, 2016.
Collins, M., “An Evaluation of Embedded System Behavior Using Full-System Software
Emulation” Msc. Thesis. University of Maryland, College Park, 2000.
Gwennap, L., "New Processor Paradigm: V-IRAM." Journal of Microprocessor Report, Vol.
12, No. 3 (1998) pp. 17-19.
Kozyrakis, C., et al. "Scalable Processors in the Billion-Transistor Era: IRAM." IEEE
Computer, Vol. 30, No. 9, (1997) pp. 75-78.
Stepner, D., et al. “Embedded application design using a real-time OS.” DAC 99: New
Orleans LA, 1999.
Internet Sources
Cerruti, L.,"Dante's Bones." Archimedes; The Sciences in the European Periphery During
the Enlightenment, (1995) pp. 95-178.
Motion Sensors. Illumin. Hp. 2007. Motion Sensors. Furnish, T., Available
www.illumin.usc.edu 9th Dec.2015
www.media.digikey.com/pdf/data%20sheets/panasonic%20electric%20works%20pdfs/amn
%20design%20manual.pdf
www.arduino.cc
21
BIBLIOGRAPHY
Abeni, L., and Buttazzo, G., "Integrating multimedia applications into hard real-time
systems." In Proc. IEEE Real-Time Systems Symposium (RTSS), 1998.
Adafruit Learning Systems. PIR Motion Sensor Created by Lady Ada. Available
www.learn.adafruit.com 30th March, 2016.
Kalinsky, D., "A survey of task schedulers." In Embedded Systems Conference. San Jose CA,
1999.
Lee, A., and Seshia, A., Introduction to Embedded Systems: A Cyber-Physical Systems
Approach. UC Berkley, 2011. Available www.leeseshia.org 16th March 2016.
Liu, J., Real-Time Systems. Prentice Hall: Upper Saddle River NJ, 2000.
Samingan B.L., “Radio Frequency Identification and Global System for Mobile
Communication Application for Anti- Theft Car Security System”. Bsc. Thesis. Universiti
Teknologi Malaysia, Skudai, 2014.
22
APPENDICES
void setup() { // Setup code for the system. Runs once only
pinMode(ledPin, OUTPUT); // output point of LED in this case Pin 13
pinMode(switchPin, INPUT); // Input point of PIR sensor
pinMode (buzzerPin, OUTPUT); // output point of Piezzo Buzzer
Serial.begin (9600);
}
/* This loop part will run over and over again as long as the Arduino has
power*/
/* this block of code reads the input value and assigns it to the integer
value.*/
void loop() {
value = digitalRead(switchPin);
if (HIGH == value) { // HIGH means motion detected
digitalWrite(ledPin, HIGH); // LED Lights for 5 seconds
digitalWrite (buzzerPin,HIGH); // Buzzer buzzes for 5 seconds
Serial.println ("MOTION DETECTED");
delay (10000); //Waits for 10seconds but is adjustable. Syntax
1000ms=1sec counter++;
Serial.println(counter);
}
else {
digitalWrite(ledPin, LOW); //LOW means no motion detected, LED & Buzzer off
}
}
23
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(switchPin, INPUT);
}
void loop() {
value = digitalRead(switchPin);
if (HIGH == value) {
digitalWrite(ledPin, HIGH);
}
else {
digitalWrite(ledPin, LOW);
}
}
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(switchPin, INPUT);
pinMode (buzzerPin, OUTPUT);
}
void loop() {
value = digitalRead(switchPin);
if (HIGH == value) {
digitalWrite(ledPin, HIGH);
digitalWrite (buzzerPin,HIGH); //Buzzer buzzes for 5 seconds
}
else {
digitalWrite(ledPin, LOW);
}
}
24