0% found this document useful (0 votes)
23 views60 pages

Smart Classroom Monitoring System

The thesis titled 'Smart Classroom Monitoring System' presents a project aimed at developing an IoT-based device for monitoring and controlling classroom lighting and visitor counts in real-time. Utilizing NodeMCU and infrared sensors, the system automates energy management by turning off lights when no one is present and provides data on classroom usage via the Blynk application. The work is supervised by Dr. Rajkumar Patel and is a partial fulfillment of the requirements for the Bachelor of Technology degree at Rajkiya Engineering College Sonbhadra.

Uploaded by

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

Smart Classroom Monitoring System

The thesis titled 'Smart Classroom Monitoring System' presents a project aimed at developing an IoT-based device for monitoring and controlling classroom lighting and visitor counts in real-time. Utilizing NodeMCU and infrared sensors, the system automates energy management by turning off lights when no one is present and provides data on classroom usage via the Blynk application. The work is supervised by Dr. Rajkumar Patel and is a partial fulfillment of the requirements for the Bachelor of Technology degree at Rajkiya Engineering College Sonbhadra.

Uploaded by

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

Smart Classroom Monitoring System

A Thesis Submitted in
Partial Fulfilment of the Requirements for the Degree of
Bachelor of Technology
by
Raj Kumar 1884120041
Shreyansh Sharma 1884120059
Ashish Kumar Bind 1884120015
Akash Singh 1884120006
Himanshu Srivastava 1884120025

Under the Supervision of


Dr. Rajkumar Patel

Department of Electrical Engineering


Rajkiya Engineering College Sonbhadra
June, 2022

pg. 1
DECLARATION

Thesis Title: Smart Classroom Monitoring System

Degree for which the Thesis is submitted: Bachelor of Technology

We declare that the presented thesis represents largely our own ideas and work in our own
words. Where others ideas or words have been included, we have adequately cited and
listed in the reference materials. We have adhered to all principles of academic honesty
and integrity. No falsified or fabricated data have been presented in the thesis. We
understand that any violation of the above will cause for disciplinary action by the
Institute, including revoking the conferred degree, if conferred, and can also evoke penal
action from the sources which have not been properly cited or from whom proper
permission has not been taken.

 Raj Kumar 1884120041


 Shreyansh Sharma 1884120059
 Ashish Kumar Bind 1884120015
 Akash Singh 1884120006
 Himanshu Srivastava 1884120025

Date: 27/05/2022

pg. 2
CERTIFICATE

It is certified that the work contained in the thesis entitled ‘Smart Classroom Monitoring
System’ submitted by Raj Kumar, 1884120041; Shreyansh Sharma, 1884120059; Ashish
Kumar Bind, 1884120015; Akash Singh, 1884120006; Himanshu Srivastava,
1884120025 for the award of B.Tech is absolutely based on their work carried out under
my supervision and that this work has not been submitted elsewhere for any degree.

Dr. Rajkumar Patel


Department of Electrical Engineering
Rajkiya Engineering College Sonbhadra

pg. 3
ABSTRACT

This project is about how to monitor and control lighting system using IOT. This project’s
aim is to make a device by which we can maintain and record the number of
visitors/students in the particular classroom in real time. This project is made to prevent
unwanted electric power waste in schools, colleges, offices and houses. For this project
we will use nodeMCU and two IR (Infrared sensor) as main devices also monitor and
control the data using Blynk Application as it is much cheaper and easier to manage and
control. And also Blynk application is easy to use and the data is much easier to
understand.

Except that, it also acted as a car power switching system. While the IR sensor
is caused, the sign will transmit wirelessly to take in addition movement.
This whole method is operated totally robotically through its sensors. We are able
to display the overall range of incoming, outgoing, and modern site visitors on line from
any part of the sector the use of Blynk Dashboard. To be counted wide variety the
incoming and outgoing site visitors, it’s a long way makes use of Infrared or IR Sensor.
The visitors records uploads routinely to Blynk cloud the usage of the NodeMCU
ESP8266 Wi-Fi Module. While no human beings are gift in the room, the
electrical appliances turns OFF robotically. Whilst the moderate sensor is added about,
the sensor will ship statistics to the Blynk.

The principle function of this venture is to find whether the lecture room is to be
had for now not by way of the use of the IR sensor to hit upon any presence of light.
We've finished few researches from the internet and additionally consult the lectures to
determine the tools and gadget wished for this undertaking. The NodeMCU module is the
primary software in this undertaking because it controls all of the fundamental operations.

pg. 4
ACKNOWLEDGEMENT

First of all, we praise omnipresent God, the creator of this universe, for giving the
opportunity to pursue B.Tech in our life. It gives us an immense pleasure to acknowledge
the several individuals who were influential in completing our B.Tech project.

We would like to express our sincere thanks to our respected project supervisor
Dr. Rajkumar Patel, HOD of Electrical Engineering Department, Rajkiya Engineering
College Sonbhadra for his motivation and valuable advices during various phases of this
project. We are highly grateful to him for his day-to-day instructions, valuable
suggestions and formulation of research problem that we received during this project.

We would like to thank Prof. G. S. Tomar, Director, Rajkiya Engineering


College Sonbhadra for providing the support during the course.

We would like to thank project review committee members, Dr. Raj Kumar
Patel, Mr. Umesh Kumar Gupta, Dr. Vijay Pratap Singh, Mr. Ram Ishwar Vais
and Dr. T. Chiranjeevi for their valuable inputs to improve our work and support during
this project.

We would like to thank the Electrical Engineering Department, Rajkiya


Engineering College Sonbhadra for providing facilities to finish this research work.

We owe a special thanks to our family members who supported us and helped us
throughout our life and during this study. We dedicate this work to you all.

Raj Kumar
Shreyansh Sharma
Ashish Kumar Bind
Akash Singh
Himanshu Srivastava

Date: 27/05/20229

pg. 5
CONTENTS

Declaration ii
Certificate iii
Abstract iv
Acknowledgement v
Contents vi
List of Figures ix
1. Introduction 10-12
1.1. Objective 10
1.2. Problem Statement 10
1.3. Thesis Organization 11
References 12

2. Survey of Smart Classroom Monitoring System 13-16


2.1 Literature review 13
2.2 Internet of Things(IOT) 13
2.3 Improving Smart Classroom Concept with IOT using 14
NodeMCU
2.4 Related Works 15
2.5 Scope of Work 15

References 16

3. Methodology 17-21
3.1 Introduction 17
3.2 Analysis Study & Research Paradigm Justification 17
3.3 Project Design and Development 18

18
3.3.1 Project Development Methodology
3.3.2 Data Flow Diagram 19

3.3.3 Project Testing 19

pg. 6
3.4 Software and Hardware Requirements 20

3.4.1 Software Requirements 20


20
3.4.2 Hardware Requirements
3.5 Framework 20

3.6 Conclusions 21
21
References
4. Implementation, Testing & Result 23-52

4.1 Blynk App 23

24
4.1.1 Features
25
4.1.2 What do I need to Blynk?
26
4.1.3 Supported Software
27
4.1.4 Create a Blynk Project
29
4.1.5 Add Widgets to the Project
30
4.1.6 Upload the Firmware
32
4.2 Hardware
4.2.1 IR Sensor as Visitor Counter 32

4.2.2 NodeMCU ESP8266 34

4.2.2.1 Switching Board and LED Indicator 36

4.2.2.2 I/O Pins 37

4.2.2.3 Details of ESP8266 NodeMCU Board 37

4.2.2.4 Installing the NodeMCU Board on Windows OS 40

4.2.3 0.96” 12C OLED Display 44


4.2.3.1 Connection of OLED Display with Arduino Board 45
4.2.4 5V 1 Channel Relay Module 47
4.2.4.1 Pin Details 48
4.3 Result 51

4.4 Colcusion 51
References 51

pg. 7
5. Future Scopes, Advantages & disadvantages 53-55
5.3 Functions of Proposed System 53
5.4 Future Scopes 53
5.5 Advantages 54
5.6 Disadvantages 54
5.7 Conclusion 54
References
54

Appendix: Code Used 56-60

pg. 8
LIST OF FIGURES

FIGURE No. Caption Page No.


FIGURE 3.1 Project Development phased 18
FIGURE 3.2 Data Flow Diagram 19
FIGURE 3.3 Example of IR Sensor and node MCU Module 19
FIGURE 3.4 Prototype Model of Visitors Counter 21
FIGURE 4.1 Blynk platform 24
FIGURE 4.2 Blynk App Main Page 25
FIGURE 4.3 Creating Account 26
FIGURE 4.4 App First Page 27
FIGURE 4.5 Board Select 28
FIGURE 4.6 Creating New Project 28
FIGURE 4.7 Widget Box 29
FIGURE 4.8 Button Setting 30
FIGURE 4.9 ESP8266_Standalone menu 31
FIGURE 4.10 Add Board > NodeMCU 1.0 31
FIGURE 4.11 IR Sensor 34
FIGURE 4.12 Node MCU ESP8266 35
FIGURE 4.13 ESP Dev Board Pinout 38
FIGURE 4.14 Preferences 41
FIGURE 4.15 Board Manager 41
FIGURE 4.16 Board Menu 42
FIGURE 4.17 Port Menu 43
FIGURE 4.18 Connection of ESP8266 with Cable 44
FIGURE 4.19 OLED Display 44
FIGURE 4.20 0.96” OLED Pin Description 45
FIGURE 4.21 Library Manager 45
FIGURE 4.22 Adafruit GFX in Library Manager 46

FIGURE 4.23 Adding Adafruit SSD1306 46


FIGURE 4.24 Relay Module 47
FIGURE 4.25 Pinout Diagram of Relay 48
FIGURE 4.26 Relay Module Components 49

pg. 9
CHAPTER
1
Introduction
This project is referred to as “Smart Classroom Monitoring System” the use
of internet of things (IOT). The main motive of this project is to develop a class
automation gadget that offers the person whole control over all remotely
controllable/monitoring devices of the study room the use of IOT. The principle reason
for this challenge is to examine the use of study room every day through the presence
of light within the classroom each time the lecture room is being used. However, this
project will also relate to power ON and off the light automatically. The presence of
person can be detected the usage of IR sensor along with NodeMCU module.

1.1 Objective
o Design a bi-directional visitor counter managed by way of the microcontroller
(NodeMCU) so as to display its statistical output on an liquid crystal
display and therefore mild up the room.

o Design Automatic Room Light Controller implemented by continuously


monitoring the light intensity inside the room with the help of visitor counts.

o To analyse data about the usage of the classroom daily and can be monitored
remotely from anywhere.

1.2 Problem Statement


Nowadays excessive and uncontrolled use of electricity have turns into one of the
supply of growing monthly bill payments. That is why there is an initiative in
improving the existing wiring system to greater systematic and consumer-friendly.
Counting the site visitors helps to maximize the efficiency and effectiveness of
personnel, floor vicinity and sales potential of an organization. Visitor counting is not
limited to the access/go out point of a company however has a huge range of
applications that provide information to management at the volume and flow of people
throughout a location.
pg. 10
A primary method for counting the visitors involves hiring human auditors to
face and manually tally the quantity of site visitors who pass by way of a certain place.
However human-based totally records series comes at great expense. With human
handling the manual counting of traffic, there are dispositions of inefficiencies,
misrepresentation, time wastage and unnecessary financial implications. With this in
thoughts, it is imperative to develop and promote a digital visitor counter for you to be
bidirectional in nature and utilise the microcontroller. This may limit all human
interferences to the barest and ensure that the project of maintaining data on traffic’
visit is much less time-consuming, efficient and nearly error free.
Here's a low-price microcontroller-primarily based visitor counter that can be
used to recognize the wide variety of persons at an area. All of the components required
are without difficulty available in the market and the circuit is simple to build. IR
transmitter-receiver pairs are used at the passage: One pair comprising IR transmitter
IR TX1 and receiver phototransistor T1 is mounted at the access factor of the
passage, whilst the other pair comprising IR transmitter IR TX2 and phototransistor T2
is installation on the exit of the passage.

Technology of visitor counting had dated lower back to the 1990s. However,
there are some shortcomings present in the existing system. Visitor counting is simply
a measurement of the visitor traffic entering and exiting places of work, department
stores, sports venues, and auditorium. Counting the visitors enables to maximise the
efficiency and effectiveness of personnel, floor area and income ability of a business
enterprise.

1.4 Thesis organization

This thesis consists of five chapters. The rest of the thesis is organized as follows:
In Chapter 2, literature survey on Smart Classroom Monitoring System and scope of
present research work is discussed.

In Chapter 3, Methodology of Smarm Classroom is presented. In this chapter, required


hardware & software are discussed.

In Chapter 4, implementation, testing and results are discussed.

In Chapter 5, future scope, advantages and disadvantages of work are discussed.

pg. 11
References
Text Book
[1] Piero Zappi, Elisabetta Farella, and Luca Benini. (September, 2010). Fellow,
Tracking Motion Direction and Distance with Pyroelectric IR Sensors, 10(9).

[2] Mr. Rahul Mishra, Dr. Shelej Khera, Mr. Manoj Kumar, Mr. Vikrant Verma. (June-
December, 2017). Sensor Based Lighting Control System for Energy Efficient
Building Environment Using Real-Time Occupancy Measurements, 9(2), 54-56.

[3] V. V. Murali Krishna* and T. Anuradha. (May, 2016). An Energy Efficient Power
Usage Controlling and Monitoring using Wireless Sensor Network, 9(17), DOI:
10.17485/ijst/2016/v9i17/93007.

[4] Daniel Palma, Juan Enrique Agudo *, Héctor Sánchez and Miguel Macías Macías.
(2014). An Internet of Things Example: Classrooms Access Control over Near Field
Communication, 14.

[5] Rajeev Piyare1 and Seong Ro Lee. (September, 2013). Towards Internet of
Things(IOT) Integration of Wireless Sensor Network to Cloud Service Data Collection
and Sharing. International Journal of Computer Networks & Communications (IJCNC)
5(5).

Research Paper
[6] https://law.stanford.edu/wp-content/uploads/2016/06/Electricity-Consumption-
and-Economic-Growth.pdf

pg. 12
CHAPTER
2
Survey of Smart Classroom
Monitoring System

2.1 Literature review


This chapter will give an explanation for about the literature review for this project
briefly. This chapter will talk approximately the concept, principle, perspective and the
approach so that it will be used in order to finish this project. Earlier than the
advancement of information systems, counting of visitors passing through a place used
to been finished manually. The room appliances are still more often than not managed
manually in most parts of the world that regularly results in electricity wastage in case
of personal negligence. With the innovation in technology, many electronic structures
along with bidirectional site visitors’ counters and automated equipment controllers
have been evolved to maintain check of the traffic visiting a hall and controlling the
lights of that room the site visitors up and down the usage of output from an IR sensor.

2.2 Internet of Things (IOT)


In the starting, the internet was best designed for communication in which computers
should access to the website, download content material or communicate with different
customers. But technology evolve growing extra powerful devices, faster and with
greater abilities. Advances in electronics generation are also creating smaller devices
low power intake which means that that massive network of sensors may be created,
with the potential to obtain data, process it and act for this reason. Right here it is how
the idea of the internet of things arises. Under this time period, computers and
technologies are around customers without noticing their presence, being able to
cooperate and adapt their behaviours to the surroundings and enabling customers to
interact with technology without interfering with their everyday lifestyles. On this feel,
the idea of laptop as hardware tool is diluted to combine connected devices around and
in cooperation with users’ everyday life. However, the facts we've got these days
depends closely at the data generated with the aid of users of their interactions with
objects.

pg. 13
When the term the internet of things regarded it became achieved underneath the
basis that if there were devices with the ability to understand the
entirety approximately such gadgets or things. From all of the statistics formerly
accrued we would be capable of track and manage the whole thing and to realize when
things want to change low strength consumption this means that huge network of
sensors may be created, with the potential to attain information, process it and act for
this reason. Right here it is how the concept of the internet of things arises. Under this
term, computers and technologies are around users without noticing their presence,
being capable of cooperate and adapt their behaviours to the surroundings and enabling
customers to interact with technology without interfering with their ordinary life. on
this sense, the idea of laptop as hardware device is diluted to integrate connected
devices around and in cooperation with users’ each day lifestyles while the term the
internet of things regarded it become done under the premise that if there had been
devices with the capacity to recognise everything about such objects or things. From
all the statistics formerly gathered we would be capable of tune and manipulate the
whole thing and to realize when things need to change.

2.3 Improving Smart Classroom Concept with Internet of Things


using NodeMCU
On the grounds that smart domestic technology was first introduced in 1975, many
researchers have mentioned the topic very well. Starting 2010, the smart home topics
most extensively related to IOT. Panna ET. Al (2010) of their research developed the
improvement of power saving smart domestic Prototype. The main cause of this
prototype is to keep electricity. The prototype handiest makes use of temperature and
infrared sensors. The temperature sensor is used to regulate the air conditioning and
infrared sensors to detect human presence within the room. Microcontroller will decide
whether or not the air conditioner and the lighting must be on or off primarily based on
the sensor readings. The predicted the cost of power utilization can be recorded into a
database that may be accessed by means of the consumer. In other studies, Piyare and
song (2011) proposed a smart home-control and monitoring system the use of smart
phone. This studies discusses the clever domestic manipulate and tracking the usage
of micro-web server and smartphones. Micro net-server installed on Arduino used to
transmit data from the sensor to phone user, then the consumer can send commands to
Arduino to control digital devices. Other studies discuss on how a smart domestic was
built with GSM based automation. This research discusses the house automation gadget
the use of Arduino microcontroller connected to the GSM modem controlled from
android telephone. This automation device is simplest used to turn on or flip off
electronic devices. On every other take a look at, smart home was built using email as
the platform.

pg. 14
This research discusses home safety device the usage of facial pattern
recognition to get into the house. This gadget makes use of a Beagle Bone and cameras.
The system used email to make communication with customers. Another study
proposed a prototype of smart home intelligent lights manage architecture on board
sensors using a mobile computing gadget. This research discusses a prototype of a
smart home through using ambient light Sensor on smartphones. Therefore, we
determined to make a smart home prototype the use of the NodeMCU. The principle
functions of our prototype made are automation, manage, tracking, and security. The
automation will create an automation e.g. lights that is based totally on human
presence. The manipulate function is able to show on and off digital devices remotely.

2.4 Related Works


Tracking Motion Direction and Distance with Pyroelectric IR Sensors Piero
Zappi, Elisabetta Farella, and Luca Benini, Fellow, IEEE
The PIR sensors are extensively used in surveillance structures and automatic light
switching systems as simple but reliable triggers. They also have shown promising
abilities as low-price camera enhancers in video surveillance systems. The work of
Rajgarhia et al. (2011) uses PIR sensors at the facet of cameras to cope
with privateness problems. PIR sensors are deployed in non-public rooms even as
cameras in public regions. Human tracking is performed by means of correlating
information from the two structures. This paper demonstrates the benefits of reducing
camera deployment in favour of PIR sensors. In fact, a survey on 60 people highlights
how motion sensors are taken into consideration less invasive for human beings privacy
than cameras. In Bai and Teng, (2010) the layout of a board for domestic surveillance
is proposed. The board includes an ARM processor collectively with an
internet digicam and a PIR sensor. The latter triggers the web camera in presence of an
intruder in order to capture and ship to a remote server the snapshot. Cucchiara et
al.(2010) recommend a technique to fuse information from a dense network of PIR
sensors with the video streaming from a fixed of cameras to enhance consistent
labelling of human beings moving. PIR sensors detect humans presence and their
direction of movement, and these features help distinguish reflections and changes of
movement behind obstacles

2.5 Scope of Work


This project primarily base on modelling of a micro-controller controlled bi-directional
visitor counter system that will:

pg. 15
o Count visitor which enters and leave the room and display total occupant inside the
room
o Room Light Controlling as per student in the room
o Implement two IR proximity sensors
o Identify the counter process (count up or countdown)
o Work in a double entrance and single exit room.

References
Text Book
[1] Piero Zappi, Elisabetta Farella, and Luca Benini, Fellow, Tracking Motion
Direction and Distance with Pyroelectric IR Sensors, VOL. 10, NO. 9, SEPTEMBER
2010

[2] Mr. Rahul Mishra, Dr. Shelej Khera, Mr. Manoj Kumar, Mr. Vikrant Verma, Sensor
Based Lighting Control System for Energy Efficient Building Environment Using
Real-Time Occupancy Measurements, Volume--9 •• Number--2 June --Dec 2017 pp..
54—56

[3] V. V. Murali Krishna* and T. Anuradha, An Energy Efficient Power Usage


Controlling and Monitoring using Wireless Sensor Network, Vol 9(17), DOI:
10.17485/ijst/2016/v9i17/93007, May 2016

[4] Daniel Palma, Juan Enrique Agudo *, Héctor Sánchez and Miguel Macías Macías,
An Internet of Things Example: Classrooms Access Control over Near Field
Communication, 2014, 14

[5] Rajeev Piyare1 and Seong Ro Lee, Towards Internet of Things(IoT) Integration of
Wireless Sensor Network to Cloud Service Data Collection and Sharing, International
Journal of Computer Networks & Communications (IJCNC) Vol.5, No.5, September
2013

pg. 16
CHAPTER
3
Methodology

3.1 Introduction
To have buildings which are able to adapt to the user needs and at the same time to
operate efficiently. It is essential to understand the hobby the people are performing.
Presence sensors, which can be broadly deployed in modern buildings, try to alter
lighting to the presence of people in indoor spaces. Even though,
a wonderful deal extra in terms of comfort and electricity efficiency may
be achieved if extra detailed data at the hobby of the customers is detected sensors
are broadly used as a presence trigger. But the analogue output of IR sensors relies
upon on numerous different elements, along with the space of the body from the IR
sensor, the direction and speed of movement, the body shape and size.

3.2 Analysis Study & Research Paradigm Justification


So that it will increase this project, there are 4 stages that involves in research
paradigm and all these stages are related to each other. The four levels are as
observed:
1. Feasibility look at for the duration of this level, research is carried out to discover
the impact of positive and negative. The statistics which include objective, scope
and problem announcement become diagnosed after doing a little research by way
of reviewing few related articles or reports that relate to the projects. Then an
offer changed into organized and it end up proposed steady with
the research achieved. The very last end result proven that smart classroom to be
develop due to the energy consumption problems.

2. Data collection and accumulating in this level, all the associated data was
collected through a few method of records collection strategies, which can be
analysing articles, reports and journals. After reviewed of records gathered, the
approach that is suitable for this project is internet of things (IOT). Therefore, this
technique could be implemented in this project.

pg. 17
3. Framework design stage for this stage, framework is layout as well as prototyping
of the system. A framework will describe about the collection of classes or tools that
will be used to help in developing the system.

4. Evaluation stage for the duration of this stage, all unit and sub modules can be
tested before system integration process. That is important as it's far had to ensure
that the machine for the project will function as expected and meet the project
requirement.

3.3 Project Design and Development


3.3.1 Project Development Methodology
For this assignment, Rapid Application Development (RAD) system may be used.
RAD is a new and extraordinarily interactive systems development approach that
arose from 1990s. Furthermore, RAD is a concept which could develop faster and
higher quality products. In addition, RAD also tries to solve both weak point of the
structured development methodologies, which might be lengthy development time
and difficulty in understanding a device totally based totally on paper description.
RAD methodologies alter the systems improvement life Cycle (SDLC) phases to
develop some components of the gadget quickly. The benefit of this method is to get
the customers to higher recognize the system via interactive and simultaneous
revisions which can bring the system toward what it needed.

Figure 3.1: Project Development phased

pg. 18
3.3.2 Data Flow Diagram

Fig. 3.2 Data Flow Diagram

3.3.3 Project Testing

Figure 3.3 Example of IR Sensor and node MCU Module

Next, we can look into structure, behaviour, and information of the device through
conceptual model. Through project designing and modelling, we can understand
greater about the situation or the problem that may occur for the duration of task
testing and be prepared for it and it additionally help us to make fast choice wisely.

pg. 19
3.4 Software and Hardware Requirements
The requirement of hardware and software program are the most important for this
project as it will result in the successful of this task. Without software application
and hardware requirement, this challenge cannot be completed.

3.4.1 Software Requirements


Software requirement for this project are:
o Arduino IDE 1.8.19
o Blynk App

3.4.2 Hardware Requirement


Hardware requirement for this project are:
o NodeMCU WiFi Module
o IR Sensor
o Relay Module 5V
o OLED Display
o Bread Board
o Jumper Wires
o USB B-Type Cable
o Bulb
o Switch
o Bulb Holder
o Connecting Wires
o Smartphone/Laptop

3.5 Framework
Usually, Framework is an actual or conceptual structure supposed to serve as a
support or manual for the building of something that expands the shape into
something beneficial. In laptop machine, a framework is often a layered structure
indicating what type of programs can or have to be constructed and the way they
could interrelate. A few laptop machine frameworks also consist of actual
programs, specify programming interfaces, or offer programming tools for the use
of the frameworks. A framework may be normally comprehensive than a protocol
and more prescriptive than a structure.

pg. 20
Fig. 3.4 Prototype Model of Visitors Counter

When IR sensor detects any Object presence, it will send the signal to the
nodeMCU. NodeMCU act as a bridge between Blynk and sensor. Then nodeMCU
will send the data receive to Blynk app to be analyse.

3.6 Conclusion
In conclusion, this chapter describe about the methodology for this project. Besides
that, the requirement of the software and hardware that needed for this project also
has been listed in this chapter.

References
Text Book
[1] Piero Zappi, Elisabetta Farella, and Luca Benini, Fellow, Tracking Motion
Direction and Distance with Pyroelectric IR Sensors, VOL. 10, NO. 9,
SEPTEMBER 2010
pg. 21
[2] Mr. Rahul Mishra, Dr. Shelej Khera, Mr. Manoj Kumar, Mr. Vikrant Verma,
Sensor Based Lighting Control System for Energy Efficient Building Environment
Using Real-Time Occupancy Measurements, Volume--9 •• Number--2 June --Dec
2017 pp.. 54—56

[3] V. V. Murali Krishna* and T. Anuradha, An Energy Efficient Power Usage


Controlling and Monitoring using Wireless Sensor Network, Vol 9(17), DOI:
10.17485/ijst/2016/v9i17/93007, May 2016

[4] Daniel Palma, Juan Enrique Agudo *, Héctor Sánchez and Miguel Macías
Macías, An Internet of Things Example: Classrooms Access Control over Near
Field Communication, 2014, 14

[5] Rajeev Piyare1 and Seong Ro Lee, Towards Internet of Things(IoT) Integration
of Wireless Sensor Network to Cloud Service Data Collection and Sharing,
International Journal of Computer Networks & Communications (IJCNC) Vol.5,
No.5, September 2013

Research Paper
[6] https://myfik.unisza.edu.my/www/fyp/fyp17sem2/report/041534.pdf

Figure
[7] https://images.app.goo.gl/jW1QwDMGzJwhE2Eh8 [Fig. 3.4(a)]

[8] https://images.app.goo.gl/XgHsLm26ZPATWHaD8 [Fig. 3.4(b)]

pg. 22
CHAPTER
4
Implementation, Testing & Result

Testing and implementation is ready to assemble the machine as specific layout


that has been evolved in preceding section, methodically established to make sure
that they're blunders loose and completely meet the consumer requirement, This
section need to be done before a mission is completely applied. This part of the
thesis goes through the chronological order of the technique it took to setup up
Blnyk app, setup the prototype, and others to screen and manipulate the mild
switching approach.

4.1 Blynk app


Blynk is a Platform with IOS and Android apps to control Arduino, Raspberry Pi
and the likes over the net. It’s a virtual dashboard in which you can build a
photograph interface on your project by using honestly dragging and dropping
widgets. Blynk was designed for the internet of things. It can manage hardware
remotely, it may display sensor records, it is able to keep records, visualize it and
do many other cool things.
There are three major additives within the platform:

 Blynk App: Permits to you create first rate interfaces for your initiative with
numerous widgets we offer.

 Blynk Server: Responsible for all of the communications between the


smartphone and hardware. You could use our Blynk Cloud or run your
personal Blynk server regionally. Its open-source, may want to easily take care
of thousands of devices and might also be launched on a Raspberry Pi.

 Blynk Libraries: For all of the popular hardware systems, permit verbal
exchange with the server and procedure all of the incoming and out
coming commands.

Now believe each time you press a Button in the Blynk app, the message travels to
space the Blynk Cloud, in which it magically reveals its way on your hardware.

pg. 23
It works the same inside the contrary path and everything happens in a Blynk of a
watch.

Fig 4.1 Blynk platform

4.1.1 Features
Similar API & UI for all supported hardware & devices connection to the cloud using:
o WiFi
o Bluetooth and BLE
o Ethernet
o USB (Serial)
o GSM
o Set of easy-to-use Widgets
o Direct pin manipulation with no code writing
o Easy to integrate and add new functionality using virtual pins
o History data monitoring via Super Chart widget
o Device-to-Device communication using Bridge Widget
o Sending emails, tweets, push notifications, etc.
o New features are constantly added

pg. 24
4.1.2 What do I need to Blynk?
At this point you might be thinking: “Ok, I want it. What do I need to get started?” –
Just a couple of things, really:

 Hardware
Blynk works over the internet. This means that the hardware you select should be
able to connect to the internet. Some of the forums, like Arduino Uno will want an
Ethernet or Wi-Fi defend to communicate, others are already internet-enabled: just
like the ESP8266, Raspberry Pi with WiFi dongle, Particle Photon or SparkFun
Blynk Board. But even in case you don’t have a protect, you can connect it over
USB for your pc or computer (it’s a chunk greater complicated for beginners,
however we got you blanketed). What’s cool, is that the list of hardware that works
with Blynk is massive and will keep on growing.

 A Smartphone
The Blynk app is a well-designed interface builder. It works on both IOS and
Android, so no holy wars here, ok?

Fig 4.2 Blynk App Main Page

pg. 25
4.1.3 Supported Software
Blynk application can be found from the following links:
 Android Blynk App
 IOS Blynk App

After downloading the app, create an account and log in. (If feasible than log in
together with your real mail identity for higher connectivity later.) You’ll also need
to install the Blynk Arduino Library, which allows generate the firmware going for
walks for your ESP8266. Down load the contemporary launch from
https://github.com/blynkkk/blynk-library/releases, and observe on the side of
the instructions there to put inside the unique libraries.

Fig 4.3 Creating Account

pg. 26
4.1.4 Create a Blynk Project
After create new account, install Blynk Library in sketch. After that,
opened caricature software program application and choose document then
choosed options. Next duplicate a link to download the Blynk’s Library
into caricature. We get the link from internet.
Next, I’m able to configure Blynk with a view to begin my project. First I
click on the new venture button.

Fig 4.4 App First Page

Click the “Create New Project” in the app to create a new Blynk app. Give it any
name.

pg. 27
Fig. 4.5 Board Select

Then I need to pick out hardware to be able to be used on this task. As stated in
advance, for this project, we will used NodeMCU as principal hardware. Then for
the connection type, we will used Wi-Fi.
.

Fig 4.6 Creating New Project

pg. 28
4.1.5 Add Widgets to the Project
o Then you will be presented with a smooth new challenge.
o To open the widget container, click on in the undertaking window to open.
o We are selecting a button to control Led connected with NodeMCU.
o Click on Button.
o Give name to Button say led.
o Below OUTPUT tab- click on pin and pick out the pin to which led is
connected to NodeMCU, proper here its miles digital pin 2, as an end
result pick virtual and under pin D2.and click on preserve.
o Under MODE tab- Select whether you want this button as “push button” or
“Switch”.

Fig. 4.7 Widget Box

pg. 29
Fig 4.8 Button Setting

4.1.6 Upload the Firmware


 Now that your Blynk project is about-up, open Arduino and navigate to the
ESP8266_Standalone example within the file > Examples > Blynk >
Boards_WiFi> ESP8266_Standalone menu.

pg. 30
Fig 4.9 ESP8266_Standalone menu

 Also add board < ESP8266 < Node MCU 1.0

Fig 4.10 Add Board > NodeMCU 1.0

pg. 31
4.2 Hardware

4.2.1 IR Sensor as Visitor Detector:


IR Sensor module has an infrared transmitter and a receiver. The infrared
emitting tube emits a certain frequency which even as encounters
an impediment replicate again to the signal. The pondered sign is then
obtained with the aid of the receiver tube. The alternative additives in the
circuit are O-pamp, Variable Resistor & output LED. IR sensor is a digital device
that emits the light which will experience a few item of the surroundings. An IR
sensor can measure the heat of an object in addition to detect the motion.
Generally, in the infrared spectrum, all the gadgets radiate some form of
thermal radiation. Those styles of radiations are invisible to our eyes, but
infrared sensor can stumble on those radiations.

o The emitter is virtually an IR LED (moderate Emitting Diode) and the detector
is virtually an IR photodiode. Photodiode is touchy to IR mild of the identical
wavelength that's emitted by way of the IR LED. Whilst IR mild falls on the
photodiode, the resistances and the output voltages will alternate in share
to the significance of the IR light obtained.

o There are five basic factors used in a regular infrared detection system: an
infrared source, a transmission medium, optical issue, infrared detectors or
receivers and sign processing. Infrared lasers and Infrared LED’s of particular
wavelength used as infrared assets.

o The three principal forms of media used for infrared transmission are
vacuum, surroundings and optical fibers. Optical components are used to
awareness the infrared radiation or to restriction the spectral reaction.

Types of IR Sensor
There are two types of IR sensors are available and they are:
 Active Infrared Sensor
 Passive Infrared Sensor

pg. 32
Active Infrared Sensor
Active infrared sensors consist of elements: infrared source and infrared detector.
Infrared assets include the LED or infrared laser diode. Infrared detectors consist of
photodiodes or phototransistors. The energy emitted with the aid of the infrared
supply is pondered by an object and falls at the infrared detector.

Passive Infrared Sensor


Passive infrared sensors are basically Infrared detectors. Passive infrared sensors do
no longer use any infrared supply and detector. They are of two types: quantum and
thermal. Thermal infrared sensors use infrared energy because the source of warmth.
Thermocouples, pyro electric detectors and bolometers are the commonplace types
of thermal infrared detectors. Quantum kind infrared sensors provide better detection
overall performance. It is faster than thermal kind infrared detectors. The photograph
sensitivity of quantum kind detectors is wavelength structured.

IR Sensor Working Principle


There are different sorts of infrared transmitters depending on their wavelengths,
output power and response time. An IR sensor consists of an IR LED and an IR
Photodiode, collectively they may be referred to as Photo Coupler or Opt Coupler.

IR Transmitter or IR LED
Infrared Transmitter is a light emitting diode (LED) which emits infrared radiations
referred to as IR LED’s. Despite the fact that an IR LED looks as if an everyday
LED, the radiation emitted by its far invisible to the human eye.

IR Receiver or Photodiode
Infrared receivers or infrared sensors discover the radiation from an IR transmitter.
IR receivers come inside the shape of photodiodes and phototransistors. Infrared
Photodiodes are unique from normal image diodes as they discover best infrared
radiation. below picture shows the image of an IR receiver or a photodiode,
exclusive styles of IR receivers exist based totally on the wavelength, voltage,
package, etc. when utilized in an infrared transmitter – receiver combination, the
wavelength of the receiver should fit with that of the transmitter.

The photograph-diode’s resistance and output voltage trade in percentage to


the IR mild obtained. That is the underlying running principle of the IR sensor.
.

pg. 33
Fig 4.11 IR Sensor

4.2.2 NodeMCU ESP8266


The NodeMCU ESP8266 improvement board comes with the ESP-12E module
containing the ESP8266 chip having Tensilica Xtensa 32-bit LX106 RISC
microprocessor. This microprocessor helps RTOS and operates at 80MHz to a
hundred and sixty MHz adjustable clock frequency. NodeMCU has 128 KB RAM
and 4MB of Flash memory to save records and packages. NodeMCU may be
powered using a Micro USB jack or VIN pin (external supply Pin). It helps UART,
SPI, and I2C interface. NodeMCU is an IOT Module based at the ESP8266 Wi-Fi
chip Module. NodeMCU makes use of the Lua Scripting language and is an open-
supply internet resource (IOT) platform. This module has CH340g USB to TTL
Converter IC on board.

The ESP8266 NodeMCU CP2102 board has ESP8266 that is


a rather covered chip designed for the wishes of the new IOT-related worldwide.
Offers a whole answer and contains a Wi-Fi network, permitting it to host a utility
or down load all Wi-Fi conversation sports from another app processor.

The ESP8266 has the potential to technique and save competencies allowing it to be
integrated with sensors and other tool-precise devices thru its GPIOs with a few
earlier enhancements and fewer loading for the duration of operation.

pg. 34
Its high level of chip integration lets in for minimal outside rotation, and the
complete answer, which includes the front module, is designed to accommodate a
small PCB region. ESP8266 NodeMCU improvement board - a actual plug-and-play
answer for less highly-priced projects using Wi-Fi. The module comes up Wi-Fi rest
with the NodeMCU wireless so they may be geared up to head - simply deploy your
USB driver.

Fig 4.12 Node MCU ESP8266

The ESP-12 Lua NodeMCU WIFI improvement Board integrated built-in board
consists of a entire ESP8266 Wi-Fi module with all broken GPIO, a complete USB-
serial integrated, and power built-in a built-inunmarried packet of the breadboard.
The board is pre-loaded with NodeMCU - Lua-based wi-firmware for ESP8266 that
allows easy control with pure script building language - Lua - so that you're equipped
to go integrated just a few built-in. ESP-12 Lua NodeMCU.
WIFI Dev. Board integrated built-in with ESP8266 is a very smooth-to-use
microcontroller + in a single platform to build projects with Wi-Fi and IOT-
integrated built-in of factors. The board is primarily based at the ESP8266 Wi-Fi
Module chip with the ESP-12 SMD footprint grated.

pg. 35
The Wi-Fi improve board has already integrated on its board all of the ESP8266
(ESP-12E) code for organizing and uploading the code. It has WIFI USB serial chip
add codes, a 3.3V voltage regulator, and a good judgment degree converter circuit
so that you can speedy down load codes and built-in integrated your circuits.

If if you are built-in with Ardubuilt-ino, built-in the use of NodeMCU is the
subsequent step if you are built-in for a compatible alternative, with Wi-Fi.
NodeMCU is primarily based on ESP8266-12E Wi-Fi built-in-On-Chip. Loaded
with open source, Lua-based wi-firmware. Gettbuilt-ing started out with
NodeMCU could be very easy. Perfect for IOT programs, and other Wi-Fi
connectivity programs. This chip has plenty built-in not unusual with Ardubuilt-ino
- each of these microcontroller-armed prototyping forums may be configured the
usage the Ardubuilt-ino IDE. ESP8266 is greater currently released than Ardubuilt-
ino and has more potent mean built-in. It has a 32-bit RISC processor clocked at
80MHz, built-in addition to a RAM deliver and helps up to 16 MB of external flash
garage. The tool is built integrated useful for IOT packages, because of its small
footprint and Wi-Fi support. ESP8266 Integrates 802.11b / g / n HT40 Wi-Fi
transceiver, so it can most effective hook up with a Wi-Fi community and built-
interact with the integrated. It can also built-installation its very own network, built-
in other gadgets to connect directly to it. There may be a board controller that
guarantees very easy strength at the MCU itself, built integrated a push-button reset
and USB connection to make it simpler to connect to your pc.

So we start with its electricity necessities. The running voltage of


ESP8266 is 3 to 3.3v. The NodeMCU board has produced an LDO voltage regulator
that maintains a strength level of 3.3v. In case it offers 600mA reliably.

Energy requirements:
 Operating voltage: 2.5 to 3.3 v.
 Onboard power control 3.3v 600mA
 It currently operates 800mA

4.2.2.1 Switching Board and LED Indicator


The ESP8266 comes with 2 switches one is reset and the opposite is a flash button,
a reset button to apply of course reset NodeMCU and a flash button is used to down
load and use while updating firmware. The board is also constructed into the LED
indicator connected to the D0 pin and may be adjustable.
NodeMCU installs the CP2102 USB-to-UART Bridge Controller, which
allows to convert the USB signal to serial and lets in your pc to configure and
connect to the ESP8266 chip. It additionally has a connection speed of 4.5Mbps.

pg. 36
4.2.2.2 I / O Pins:
The ESP6266 NodeMCU board comes with 17 GPIO, these anchors assign all kinds
of structural functions like:
 10 bit ADC channel
 PWM output
 UART display
 SPI, I2C, I2S display: to connect all kinds of sensors and devices.
 I2S: sound installation for your project.
 Due to the pin multiplexing feature of ESP8266 (multiple parameters multiplied
by one GPIO pin). Which means that one GPIO pin can work as a PWM / UART
/ SPI.

ESP8266 is a microchip in a QFN bundle with each TCP / IP suite abilities


and a microcontroller. ESP8266 brings a notably integrated Wi-Fi solution that
meets the net industry's desires for such things as low fee, green power intake,
reliable performance, and included structure. Synthetic by using Espresso if
structures in Shanghai, China. The full power of the Wi-Fi network can serve as a
slave to the microcontroller supervisor or as a standalone application. Whilst we say
a bunch microcontroller host it means it may be used as a Wi-Fi adapter on any
microcontroller the use of SPI or UART interface. While used as a stand-by myself
device it can permit microcontroller and Wi-Fi networking.Esp8266 is based totally
around the Tensilica L106 Diamond series which is a 32-bit processor and has on-
chip SRAM. It also includes power modules, RF balloon, RF receiver and
transmitter, analogy and transmitter-receiver, digital baseband, amplifier, filters, and
other small components.

4.2.2.3 Details of ESP8266 NodeMCU Board


 The Esp8266 specification is split into three elements: Hardware, Software, and
Wi-Fi.
 By way of hardware specification, its package deal size is QFN 32pins with
a size of 5mm x 5mm. overall performance scores variety from 2.5V to 3.6V.
The chip uses 80mA cutting-edge on common.
 Its CPU is a Tensilica L106 32bit processor with on-chip SRAM. The border
interface contains UART, SDIO, SPI, I2C, I2S, IR remote control, GIPO's,
ADC, PWM, LED Light, and buttons.
 Its firmware can be updated using OTA and UART. It uses IPv4, TCP, UDP,
and HTTP as network protocols.
 The user can configure to apply pre-configured AT commands, Cloud Server,
and run the cellular app.

pg. 37
 Wi-Fi frequency ranges from 2.4G to 2.5G. It uses the Wi-Fi protocol IEEE
802.11 b / g / n. The power of Esp6266 Wi-Fi is guaranteed by the Wi-Fi
Alliance.

Fig 4.13 ESP Dev. Board Pinout

1) Power Pins:
 There are four power pins namely- a VIN pin and three 3.3V pins.
 There are VIN pin can be used to directly supply ESP8266 and its components if
you have a controlled 5V voltage source.
pg. 38
 The 3.3V pins are the output of the voltage board controller
 These pins can be used to supply power to external parts.

2) GND- Ground:
It is the ground pin of the ESP8266 NodeMCU development board.

3) I2C Pins:
These are used to integrate all styles of I2C sensors and parameters within the
task. Both I2C master and I2C Slave are supported. The performance of the I2C
optical connector can be systematically detected, and the clock frequency is one
hundred kHz at maximum velocity. It must be mentioned that the frequency of
the I2C clock have to be greater than the frequency of the slowest clock of the
slave device.

4) GPIO Pins:
The ESP8266 NodeMCU has 17 GPIO anchors that can be assigned to various
functions such as I2C, I2S, UART, PWM, IR Remote Control, LED Light, and
Button respectively. Each GPIO digitally-enabled can be adjusted to internal drag
or drop or set to high intensity. When set as input, it can also be set to Edge-trigger
or level-trigger to produce CPU interference.

5) ADC channel:
NodeMCU is embedded 10-bit with SAR ADC accuracy. These functions can be
finished the usage of the ADC viz. VDD3P3 pin electricity deliver and TOUT pin
energy enter. but, they can't be used simultaneously.

6) UART: The ESP8266 NodeMCU has 2 UART domains, namely UART0 and UART1,
which offer different connections (RS232 and RS485), and can speak as much as
four.5 Mbps. UART0 pins (TXD0, RXD0, RST0 & CTS0) may be used for verbal
exchange helps fluid manipulate. But, the UART1 (TXD1 pin) consists of a
statistics switch signal only, so it's far used to print the log.

7) SPI Pins:
 ESP8266 incorporates two SPIs (SPI and HSPI) into slave and master modes.
 These SPIs also support the following SPI features:
 4-time modes for SPI format transfer
 Up to 80 MHz with split clocks of 80 MHz
 Up to 64-Byte FIFO

pg. 39
8) SDIO Pins:
 ESP8266 carries the secure virtual input / Output Interface (SDIO) that is used
to connect directly to SD cards.
 4-bit 25 MHz SDIO v1.1 and 4-bit 50 MHz SDIO v2.0 are supported.

9) PWM Pins:
 The board has four Pulse Width Modulation (PWM) channels.
 PWM output can be programmed and used to pressure virtual engines and
LEDs.
 The frequency range of PWM levels from a thousand μs to ten thousand μs,
eg among 100 Hz and 1 kHz.

10) Control Pins:


 These anchors are used to control ESP8266.
 These anchors include Chip Enable pin (EN), Reset pin (RST), and WAKE pin.

11) EN Pin(Enable):
The ESP8266 chip is enabled when the EN pin is pulled inner. When pulled LOW
the chip works at low power.

12) RST Pin(Reset):


The RST pin is used to reset the ESP8266 chip.

13) Wake Pin:


The use of Wake pin is used to wake up the chip from a deep sleep.

4.2.2.4 Installing the ESP8266 Board on Windows OS


o Let’s continue with installing ESP8266 Arduino center.
o The first element is having modern Arduino IDE (Arduino 1.6.four or higher)
set up on your pc. If don’t have it, we advocate upgrading now.
o To start, we’ll need to update the board supervisor with a custom URL. Open
up Arduino IDE and visit record > possibilities. Then, reproduction beneath
URL into the additional Board manager URLs textual content field located on
the lowest of the window:

pg. 40
Fig 4.14 Preferences

Click OK, then navigate to the Board manager through going to equipment >
forums > boards manager. There must be a couple new entries further to the usual
entry and choose install. Arduino forums. Filter out your search by means of Click
on ESP8266.

Fig 4.15 Board Manager


pg. 41
The board definitions and equipment for the ESP8266 include an entire new set of
gcc, g++, and other moderately huge, compiled binaries, so it is able to take a few
minutes to download and installation (the archived document is ~110MB). once the
installation has completed, a small installed textual content will appear next to the
access. You can now close the Board manager.

Arduino Example: Blink


To make sure ESP8266 Arduino core and the NodeMCU are properly set up, we’ll
add the best sketch of all – The Blink.
We are able to use the on-board LED for this check. As noted in advance in this
tutorial, D0 pin of the board is connected to on-board Blue LED & is consumer
programmable.Before we get to importing sketch & playing with LED, we want to
ensure that the board is chosen well in Arduino IDE. Open Arduino IDE and pick
NodeMCU 0.9 (ESP-12 Module) choice under your Arduino IDE > tools > Board
menu.

Fig 4.16 Board Menu

pg. 42
Now, plug your ESP8266 NodeMCU into your laptop through micro-B USB cable.
Once the board is plugged in, it need to be assigned a unique COM port.
On windows machines, this may be something like COM#, and on Mac/Linux
computers it's going to come within the shape of /dev/tty.usbserial-XXXXXX. Select
this serial port underneath the Arduino IDE > tools > Port menu. Also select the
upload velocity: 115200.

Fig 4.17 Port Menu

Warning:
More attention needs to receive to deciding on board, choosing COM port and
deciding on add velocity. You may get espcomm_upload_mem error while uploading
new sketches, if didn't do so. Once the code is uploaded, LED will start blinking. You
may need to tap the RST button to get your ESP8266 to begin running the sketch.

pg. 43
Fig 4.18 Connection of ESP8266 with Cable

4.2.3 0.96" I2C OLED Display:


This 0.96” I2C OLED Display is an OLED monochrome 128×64 dot matrix display
module with I2C Interface. Its miles ideal whilst you need an extremely-
small display. Comparing to LCD, OLED displays are way more aggressive, which has a
number of benefits such as high brightness, self-low electricity intake. It’s far well
suited with any three. 3V-5V microcontroller, consisting of Arduino. The
OLED display doesn’t require backlight, which ends up in a totally excellent assessment
in darkish environments. Moreover, its pixels consume power only whilst they are on, so
the OLED show consumes less electricity while in comparison with other displays.
The version we’re using right here has best 4 pins and communicates with the Arduino the
use of I2C communication protocol. There are models that include an additional RESET
pin. There are also different OLED displays that speak using SPI communication.

Fig 4.19 OLED Display

Pin wiring:
Because the OLED display makes use of I2C communication protocol, wiring is quite
simple. You simply want to connect to the Arduino Uno I2C pins as proven within
the desk under.

pg. 44
Fig 4.20 0.96” OLED Pin Description

4.2.3.1 Connection of OLED Display with Arduino board


To control the OLED show you need the adafruit_SSD1306.h and the
adafruit_GFX.h libraries. Observe the next commands to put in those libraries.
 Open your Arduino IDE and go to Sketch > Include Library > Manage Libraries.
The Library Manager should open.
 Type “SSD1306” in the search box and install the SSD1306 library from
Adafruit.

Fig 4.21 Library Manager

pg. 45
 After installing the SSD1306 library from Adafruit, type “GFX” in the search
box and install the library.

Fig 4.22 Adafruit GFX in Library Manager

 After installing the libraries, restart your Arduino IDE.


 After wiring the OLED display to the Arduino and putting in all required
libraries, you can use one instance from the library to see if everything is
working properly.
 In your Arduino IDE, go to File > Examples > Adafruit SSD1306 and select
the example for the display you’re using.

Fig 4.23 Adding Adafruit SSD1306

pg. 46
 After upload coding and change settings, run the program this will helps to
start OLED display.

4.2.4 5V 1 Channel Relay Module:


This This 1-channel 5V control single-Pole Double-Throw (SPDT) high-stage
trigger AC power relay board may be controlled immediately via a microcontroller
and switch up to 10A at 250 VAC. The inputs of one Channel 5V Relay Module
are isolated to shield any sensitive control circuitry. The default nation of the
relay even as the power is off for COM (power) to be connected to NC
(usually Closed). This is the equal of setting the relay board IN pin to excessive
(has +5V sent it).

Fig 4.24 Relay Module

Relay is an electro-mechanical device which acts as a switch. DC electric current


is used to energize the relay coil which opens or closes the contact switches. Inner
circuit of a single channel 5V relay consists of normally open contacts, typically
closed contacts and a coil.

The subsequent diagram shows its pinout diagram. It’s far known as a
single channel due to the fact only one relay is used and it operates on 5V.

pg. 47
Fig 4.25 Pinout Diagram of Relay

4.2.4.1 Pin details


Relay module consists of six pins such as normally open pin, normally closed,
common, signal, Vcc and ground pins.

1) Signal Pin:
It’s far used to govern the relay. This pin can be active low or lively excessive. In case
of active low, the relay will activate whilst we observe an energetic low signal to the
sign pin. On the opposite, inside the case of a lively excessive, the relay will set off
whilst we follow an active high signal to the sign pin. However generally, those
modules work on a lively excessive signal. This sign will energize the relay coil to
make contact with the common terminal with the commonly open terminal.

2) Vcc Pin:
As its name suggests, it is a 5V relay. That means it calls for 5V DC to perform. Hence,
connect the 5v DC power supply to this pin.

3) Ground Pin:
Connect it with the floor terminal of 5V energy supply. Furthermore, in case you are
driving a relay module with a microcontroller, also connect this pin with the ground
terminal of the microcontroller.

pg. 48
4) Common Pin:
This terminal is connected with the load that we want to switch with the relay module.

5) NC Pin:
As the name of the typically close terminal indicates, its miles generally connected
with the COM pin and forms a closed circuit. However this normally closed
connection breaks even as the relay is activated via way of applying
an energetic excessive or active low signal to the signal pin of the relay module from
a microcontroller.

6) NO Pin:
This pin is normally open except we apply an activation signal to the signal pin of the
5V single channel relay module. In this case, the COM pin breaks its connection with
the NC pin and makes a connection with the NO pin.
5V single-Channel Relay Module additives the following discern depicts all the
components of a 5V single channel relay module.

Fig 4.26 Relay Module Components

1) 5V Relay:
At the heart of the module is a 5V relay covered in blue colour plastic. Maximum
operating current and voltage for each AC and DC load also are noted on the top
of the relay cover. SRD-05VDC-SL-C is a part variety and
it suggests the running voltage. Its miles referred to as a 5V relay module. Due to
the fact the relay operates at 5V DC.

pg. 49
In different words, a 5V energetic excessive or low signal turns on the relay by
energizing its coil. As noted in advance, internally a 5V relay consists of a NC, NO,
COM terminals and a coil.

2) Output Terminal:
On the left hand of this figure is an output terminal that is used to attach a DC/AC
load and DC/AC input electricity source. We can discuss the wiring diagram to attach
a LOAD and electricity source with this terminal in later sections of this educational.
Each terminal of the output connector is attached and not using a, NC and COM pins
of 5V relay. Every factor of the module has screws which make it clean to attach
cables and wires with the relay module. This 5V relay module supports 10A most
output current and maximum contact voltage of 250V AC and 30V DC. If you are the
usage of a immoderate AC voltage and high modern-day load with this module,
you have to use thick main cables.

3) Status LED:
Status LED is SMD LED that is connected via modern limiting resistor and its miles
available on top right nook of the module. It suggests the status of the relay.
In other phrases, the repute LED activates when the relay is energetic and the coil is
energized thru a sign input pin. The DC contemporary passes through a relay coil.

4) Power LED:
Power LED is likewise a SMD type and it shows the status of electricity source related
with the 5V unmarried channel relay module. Do now not connect greater than 5V
source to Vcc and GND pins of the module. In any other case, higher voltage may
harm the repute and power LEDs.

5) Freewheeling Diode:
A freewheeling diode is connected throughout the coil to avoid the effect of back
EMF. It’s also referred to as a fly back diode. The coil used within the relay is an
inductive type. While the modern passes through an inductive load, it produces a back
EMF voltage. This back EMF might also harm the circuit. Consequently, a
freewheeling diode is used to avoid this effect.

6) Input Connector:
On the right hand side of the relay module is an input connector. It is used to offer
input signal and 5V power supply. Furthermore, it also presents strength to the status
LED, energy LED and relay coil.

pg. 50
7) Switching Transistor:
We generally offer an enter signal to a relay from the overall-reason input-output pins
of microcontrollers inclusive of Arduino, TM4C123, ESP32, etc. but the most cutting-
edge sourcing capability of GPIO pins is commonly much less than 20mA. As an end
result, a switching transistor is used in this relay module to extend modern-day to the
level of the minimum modern requirement of the relay coil. Via using a switching
transistor, we can control the relay from the GPIO pin of a microcontroller.

Note: Some relay modules additionally include an opt isolator as a switching device to
offer optical isolation among low and high voltage circuits. But in case you are using
a standalone relay without a module and also you want to apply multiple relays on your
initiatives. You can use a relay driver IC to drive more than one arrays from GPIO pins
of a microcontroller

4.3 Result
After finish the installation of Blynk application and modelling the prototype we can
begin the mission. Then join the prototype to the computer. After that, add the coding
into the NodeMCU. You can observe the result.

4.4 Conclusion
In this chapter, the implementation, testing and the result of the project had been
explained. The implementation and testing have been carried out in prototype model.

References
Figure
[1] https://docs.blynk.cc/#hardware-set-ups-nodemcu
Fig. (4.1), (4.2), (4.3), (4.4), (4.5), (4.6), (4.7).

[2] https://roboindia.com/tutorials/blynk-introduction-nodemcu/

[3] https://components101.com/development-boards/nodemcu-esp8266-
Fig. (4.19)

[4] https://lastminuteengineers.com/esp8266-nodemcu-arduino-tutorial/
Fig. (4.13), (4.14), (4.15), (4.16), (4.17), (4.18).

[5] https://randomnerdtutorials.com/guide-for-oled-display-with-arduino/

pg. 51
Fig. (4.20), (4.21), (4.22), (4.23).

[6] https://microcontrollerslab.com/5v-single-channel-relay-module-pinout-
working-interfacing-applications-datasheet/
Fig. (4.24), (4.25), (4.26).

Research Paper
[7] https://www.elprocus.com/infrared-ir-sensor-circuit-and-working/

[8] https://www.sphinxsai.com/2018/ch_vol11_no4/2/(101-
106)V11N04CT.pdf

[9] http://arduino.esp8266.com/stable/package_esp8266com_index.json

pg. 52
CHAPTER
5
Future Scopes, Advantages &
Disadvantages
This chapter will in brief explained about the functions, purposed and suggestions that
can be executed to improve the machine.

5.1 Functions of the proposed system


The function of this assignment is to develop a light automation system that monitor
and control over all remotely controllable devices using IOT. The device could be
very pleasant with the dramatic increase in smart telephone user’s, clever phones
have steadily modified into all-motive portable devices in which the human
beings can offer for his or her each day use. Nowadays, IOT has become one of the
most needed generation international as it could offer a top level view of its modern
state of affairs and to the software it could be used for. The IOT promises to make our
surroundings our houses or places of work and vehicles becomes smarter, more
measurable, and chattier.

Considering the fact that mastering is linked to photos, maps, photographs


and lively motion pictures, you as a student could be able to set up a robust connect
with your faculty. You’ll be enthused to share your mind freely in elegance,
expressing them via writings and drawings. Eventually, it is an excellent option for
students with one of a kind IQs. Smart school room takes all kinds of college students
to make up a category. Even as a few students grasp the ideas in a couple of minutes,
there are others who will need to go through repeated reasons. In this type of state of
affairs, smart classes come as befitting getting to know options. Because you learn
through specific styles of media, those superior technology present an interesting
platform for each the teachers and students.

5.2 Future Scopes.


In Bi-directional visitor counter, the voice alarm may be added to indicate room is
full and person can’t enter.
We can use this NodeMCU Bidirectional Visitor counter in the hall, Shopping
mall, office, functions in the entrance gate to count the total number of visitors
where the need to know the number of people is paramount important.

pg. 53
Use in automated open/close door system.
For automatic room appliances control.

5.3 Advantages
Adds safety through appliance and lighting control.
No need of human intervention.
Can work 24x7 without any problem.
Save time
Save money and increase convenience.

5.4 Disadvantages
The system needs a continuous power supply to be practical or else we might
not be able to control the appliances.
Hence, best way to design the system efficiently would be to implement both the
automated control and manual control through switches at a time.
If there are multiple doors for the same room the project becomes quite complex.
IR sensor cannot detect if lots of people are entering at one time.

5.5 Conclusion
This project has introduced advance generation for class management machine and
safety through IOT to make human life greater smooth and luxuries. The purpose of
this project become to provide an overview of IOT as a technology and showcase its
talents. The undertaking efficiently managed to optimize light automation activity by
imparting the consumer with greater control over its utilization ranges. The results
showed that the IOT technology may be used to deliver improvements to a family
appliance also school room with minimum quantity of hardware. In in addition exams
the accuracy of the results should be advanced with the aid of running all stages
simultaneously.

References:
Text Book
[1]. Piero Zappi, Elisabetta Farella, and Luca Benini. (September, 2010). Fellow,
Tracking Motion Direction and Distance with Pyroelectric IR Sensors, 10(9).

[2]. V. V. Murali Krishna* and T. Anuradha. (May, 2016). An Energy Efficient Power
Usage Controlling and Monitoring using Wireless Sensor Network, 9(17), DOI:
10.17485/ijst/2016/v9i17/93007.

pg. 54
[3]. Daniel Palma, Juan Enrique Agudo *, Héctor Sánchez and Miguel Macías
Macías. (2014). An Internet of Things Example: Classrooms Access Control over
Near Field Communication, 14.

Research Paper
[4] https://www.dnatechindia.com/Bidirectional-VisitorCounter.html

[5]https://www.ijser.org/researchpaper/Congestion-Control-Bidirectional-Digital-
visitor-counter.pdf

[6]https://www.researchgate.net/publication/309429978_ARM_Based_Bidirectional
_Visitor_Counter_and_Automatic_Room_Light_Controller_Using_PIR_Sensors

[7]https://techatronic.com/blynk-home-automation/

pg. 55
Appendix
#define BLYNK_TEMPLATE_ID "*********"
#define BLYNK_DEVICE_NAME "Smart Classroom Monitoring System"
#define BLYNK_AUTH_TOKEN "***********************"

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Blynk.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#define SSD1306_128_64

#define SCREEN_WIDTH 128 // OLED display width, in pixels


#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define SCREEN_ADDRESS 0x3C
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1); //
Reset pin # (or -1 if sharing Arduino reset pin)

char auth[] = "************************"; // You should get Auth Token in the


Blynk App.
char ssid[] = "******"; // Your WiFi credentials.
char pass[] = "**********";

#define inSensor 14 //D5


#define outSensor 12 //D6

const int relay1 = D3;


const int relay2 = D4;

int inStatus;
int outStatus;

int countin = 0;
int countout = 0;

int in;
int out;
int now;

pg. 56
WidgetLED light(V0);

void setup()
{
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
delay(1000); // wait a second
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); //initialize with the I2C addr
0x3C (128x64)
delay(2000);

pinMode(inSensor, INPUT);
pinMode(outSensor, INPUT);
pinMode(relay1, OUTPUT);
digitalWrite(relay1, HIGH);

pinMode(relay2, OUTPUT);
digitalWrite(relay2, HIGH);

Serial.println("Visitor Counter Demo");


display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(20, 20);
display.print("Visitor");
display.setCursor(20, 40);
display.print("Counter");
display.display();
delay(3000);
}

BLYNK_WRITE(V0) // Executes when the value of virtual pin 0 changes


{
if(param.asInt() == 1)
{
// execute this code if the switch widget is now ON
digitalWrite(relay1,HIGH); // Set digital pin 3 HIGH
}
else
{
// execute this code if the switch widget is now OFF

pg. 57
digitalWrite(relay1,LOW); // Set digital pin 3 LOW
}
}

BLYNK_WRITE(V4) // Executes when the value of virtual pin 0 changes


{
if(param.asInt() == 1)
{
// execute this code if the switch widget is now ON
digitalWrite(relay2,HIGH); // Set digital pin 3 HIGH
}
else
{
// execute this code if the switch widget is now OFF
digitalWrite(relay2,LOW); // Set digital pin 3 LOW
}
}

void loop()
{
Blynk.run(); // Initiates Blynk
inStatus = digitalRead(inSensor);
outStatus = digitalRead(outSensor);
if (inStatus == 0)
{
in = countin++;
}

if (outStatus == 0)
{
out = countout++;
}

now = in - out;

if (now <= 0)
{
digitalWrite(relay1, HIGH);
digitalWrite(relay2, HIGH);
light.off();
display.clearDisplay();
display.setTextSize(2);

pg. 58
display.setTextColor(WHITE);
display.setCursor(0, 15);
display.print("No Visitor");
display.setCursor(5, 40);
display.print("Light Off");
display.display();
Serial.println("No Visitors! Light Off");
delay(500);
}
else if(now <= 5)
{
digitalWrite(relay1, LOW);
digitalWrite(relay2, HIGH);
light.on();

display.clearDisplay();
display.setTextColor(WHITE);

display.setTextSize(1);
display.setCursor(15, 0);
display.print("Current Visitor");
display.setTextSize(2);
display.setCursor(50, 15);
display.print(now);

display.setTextSize(1);
display.setCursor(0, 40);
display.print("IN: ");
display.print(in);

display.setTextSize(1);
display.setCursor(70, 40);
display.print("OUT: ");
display.print(out);

display.display();
Serial.print("Current Visitor: ");
Serial.println(now);
Serial.print("IN: ");
Serial.println(in);
Serial.print("OUT: ");
Serial.println(out);
delay(500);

pg. 59
}
else
{
digitalWrite(relay1, LOW);
digitalWrite(relay2, LOW);
light.on();

display.clearDisplay();
display.setTextColor(WHITE);

display.setTextSize(1);
display.setCursor(15, 0);
display.print("Current Visitor");
display.setTextSize(2);
display.setCursor(50, 15);
display.print(now);

display.setTextSize(1);
display.setCursor(0, 40);
display.print("IN: ");
display.print(in);

display.setTextSize(1);
display.setCursor(70, 40);
display.print("OUT: ");
display.print(out);

display.display();
Serial.print("Current Visitor: ");
Serial.println(now);
Serial.print("IN: ");
Serial.println(in);
Serial.print("OUT: ");
Serial.println(out);
delay(500);
}
Blynk.virtualWrite(V1, in); // Visitors In
Blynk.virtualWrite(V2, out); // Visitors Out
Blynk.virtualWrite(V3, now); // Current Visitors
delay(1000);
}

pg. 60

You might also like