[go: up one dir, main page]

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

LDR Based Street Lights IOT

Uploaded by

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

LDR Based Street Lights IOT

Uploaded by

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

LDR BASED INTELLIGENT STREET LIGHTS USING IOT

ABSTRACT

Nowadays, human has become too busy and he is unable to find time even to
switch off the lights wherever not necessary. This can be seen more effectively in the
case of street lights. The present system is like, the street lights will be switched on in the
evening before the sun sets and they are switched off the next day morning after there is
sufficient light on the roads. But the actual timings for these street lights to be switched
on are when there is absolute darkness. With this, the power will be wasted up to some
extent. This project gives the best solution for electrical power wastage. Also the manual

This paper is aimed at defining the process of automating the operation of


electronic devices, in this case, street lights of a certain campus or area where there is a
reliable network connection. This is achieved by using a microcontroller to control the
target electronic device wirelessly instead of operating the electronic device manually
and a relay to electromagnetically provide the functioning of a switch and also use a step-
down converter to regulate voltage and convert it from 220v AC to 5v DC. The
microcontroller used is the ESP8266 (NodeMCU) as this microcontroller has inbuilt Wi-
Fi module that can suffice connecting to a network helping us in reaching the goal of
wirelessly operating electronic devices. This is a step in the direction of a smart world
where internet of things is the way of communication between all electronic devices and
efficient utilization of this system saves a lot of energy and there will be lesser need of
human intervention. This is an efficient step in the right direction of digitizing routine
tasks and have much more control over them as opposed to being present physically near
the electronic device. Keywords: Internet of T
CHAPTER-1

1.1 Required components:

1. NODE MCU
2. LDR
3. LED

Block Diagram

LDR
CLOUD

NODE

MCU APP

Reset
circuit
Power Supply:

Step Bridge Filter


Regulator +5V to all sections
down Rectifier Circuit
T/F

1.2 BACKGROUND OF THE PROJECT

The software application and the hardware implementation help the microcontroller
(AT89S52) to monitor all the parameters continuously and display it on the LCD The system is
totally designed using LDR and embedded systems technology. AT89S52 is the microcontroller
and forms the heart of the system.

The Controlling unit has an application program to allow the microcontroller read the
incoming data through the LDR and change the status of the loads accordingly. The performance
of the design is maintained by controlling unit. The system consisting of the LDR, this forms the
link between user and the system. AT89S52continuously receives the data from LDR, after
processing, the data is displayed on the LCD. Based on this information AT89S52 controls the
loads.

1.3ORGANIZATION OF THE THESIS


In view of the proposed thesis work explanation of theoretical aspects and algorithms
used in this work are presented as per the sequence described below.
CHAPTER_2

INTRODUCTION TO EMBEDDED SYSTEMS

2.1 INTRODUCTION:

An embedded system can be defined as a computing device that does a specific focused
job. Appliances such as the air-conditioner, VCD player, DVD player, printer, fax
machine, mobile phone etc. are examples of embedded systems. Each of these appliances
will have a processor and special hardware to meet the specific requirement of the
application along with the embedded software that is executed by the processor for
meeting that specific requirement. The embedded software is also called “firm ware”.
The desktop/laptop computer is a general purpose computer. You can use it for a variety
of applications such as playing games, word processing, accounting, software
development and so on. In contrast, the software in the embedded systems is always fixed
listed below:

· Embedded systems do a very specific task, they cannot be programmed to do different


things. . Embedded systems have very limited resources, particularly the memory.
Generally, they do not have secondary storage devices such as the CDROM or the floppy
disk. Embedded systems have to work against some deadlines. A specific job has to be
completed within a specific time. In some embedded systems, called real-time systems,
the deadlines are stringent. Missing a deadline may cause a catastrophe-loss of life or
damage to property. Embedded systems are constrained for power. As many embedded
systems operate through a battery, the power consumption has to be very low.

· Some embedded systems have to operate in extreme environmental conditions such as


very high temperatures and humidity.

2.2 Application Areas

Nearly 99 per cent of the processors manufactured end up in embedded systems.


The embedded system market is one of the highest growth areas as these systems are
used in very market segment- consumer electronics, office automation, industrial
automation, biomedical engineering, wireless communication,

data communication, telecommunications, transportation, military and so on.

Consumer appliances: At home we use a number of embedded systems which include


digital camera, digital diary, DVD player, electronic toys, microwave oven, remote
controls for TV and air-conditioner, VCO player, video game consoles, video recorders
etc. Today’s high-tech car has about 20 embedded systems for transmission control,
engine spark control, air-conditioning, navigation etc. Even wristwatches are now

becoming embedded systems. The palmtops are powerful embedded systems using which
we can carry out many general-purpose tasks such as playing games and word
processing.

Office automation: The office automation products using em embedded systems are
copying machine, fax machine, key telephone, modem, printer, scanner etc.

Industrial automation: Today a lot of industries use embedded systems for process
control. These include pharmaceutical, cement, sugar, oil exploration, nuclear energy,
electricity generation and transmission. The embedded systems for industrial use are
designed to carry out specific tasks such as monitoring the temperature, pressure,
humidity, voltage, current etc., and then take appropriate action based on the monitored
levels to control other devices or to send information to a centralized monitoring station.
In hazardous industrial environment, where human presence has to be avoided, robots are
used, which are programmed to do specific jobs. The robots are now becoming very
powerful and carry out many interesting and complicated tasks such as hardware
assembly.

Medical electronics: Almost every medical equipment in the hospital is an embedded


system. These equipments include diagnostic aids such as ECG, EEG, blood pressure
measuring devices, X-ray scanners; equipment used in blood analysis, radiation,
colonscopy, endoscopy etc. Developments in medical electronics have paved way for
more accurate diagnosis of diseases.
Computer networking: Computer networking products such as bridges, routers,
Integrated Services Digital Networks (ISDN), Asynchronous Transfer Mode (ATM),
X.25 and frame relay switches are embedded systems which implement the necessary
data communication protocols. For example, a router interconnects two networks. The
two networks may be running different protocol stacks. The router’s function is to obtain
the data packets from incoming pores, analyze the packets and send them towards the
destination after doing necessary protocol conversion. Most networking equipments,
other than the end systems (desktop computers) we use to access the networks, are
embedded systems

Telecommunications: In the field of telecommunications, the embedded systems can be


categorized as subscriber terminals and network equipment. The subscriber terminals
such as key telephones, ISDN phones, terminal adapters, web cameras are embedded
systems. The network equipment includes multiplexers, multiple access systems, Packet
Assemblers Dissemblers (PADs), sate11ite modems etc. IP phone, IP gateway, IP
gatekeeper etc. are the latest embedded systems that provide very low-cost voice
communication over the Internet.

Wireless technologies: Advances in mobile communications are paving way for many
interesting applications using embedded systems. The mobile phone is one of the marvels
of the last decade of the 20’h century. It is a very powerful embedded system that
provides voice communication while we are on the move. The Personal Digital Assistants
and the palmtops can now be used to access multimedia services over the Internet.
Mobile communication infrastructure such as base station controllers, mobile switching
centers are also powerful embedded systems.

Insemination: Testing and measurement are the fundamental requirements in all


scientific and engineering activities. The measuring equipment we use in laboratories to
measure parameters such as weight, temperature, pressure, humidity, voltage, current etc.
are all embedded systems. Test equipment such as oscilloscope, spectrum analyzer, logic
analyzer, protocol analyzer, radio communication test set etc. are embedded systems built
around powerful processors. Thank to miniaturization, the test and measuring equipment
are now becoming portable facilitating easy testing and measurement in the field by
field-personnel.

Security: Security of persons and information has always been a major issue. We need to
protect our homes and offices; and also the information we transmit and store.
Developing embedded systems for security applications is one of the most lucrative
businesses nowadays. Security devices at homes, offices, airports etc. for authentication
and verification are embedded systems. Encryption devices are nearly 99 per cent of

the processors that are manufactured end up in~ embedded systems. Embedded systems
find applications in . every industrial segment- consumer electronics, transportation,
avionics, biomedical engineering, manufacturing, process control and industrial
automation, data communication, telecommunication, defense, security etc. Used to
encrypt the data/voice being transmitted on communication links such as telephone lines.
Biometric systems using fingerprint and face recognition are now being extensively used
for user authentication in banking applications as well as for access control in high
security buildings.

Finance: Financial dealing through cash and cheques are now slowly paving way for
transactions using smart cards and ATM (Automatic Teller Machine, also expanded as
Any Time Money) machines. Smart card, of the size of a credit card, has a small micro-
controller and memory; and it interacts with the smart card reader! ATM machine and
acts as an electronic wallet. Smart card technology has the capability of ushering in a
cashless society. Well, the list goes on. It is no exaggeration to say that eyes wherever
you go, you can see, or at least feel, the work of an embedded system!

Overview of Embedded System Architecture


Every embedded system consists of custom-built hardware built around a Central
Processing Unit (CPU). This hardware also contains memory chips onto which the
software is loaded. The software residing on the memory chip is also called the
‘firmware’. The embedded system architecture can be represented as a layered
architecture as shown in Fig.

The operating system runs above the hardware, and the application software runs above
the operating system. The same architecture is applicable to any computer including a
desktop computer. However, there are significant differences. It is not compulsory to
have an operating system in every embedded system. For small appliances such as remote
control units, air conditioners, toys etc., there is no need for an operating system and you
can write only the software specific to that application. For applications involving
complex processing, it is advisable to have an operating system. In such a case, you need
to integrate the application software with the operating system and then transfer the entire
software on to the memory chip. Once the software is transferred to the memory chip, the
software will continue to run for a long time you don’t need to reload new software.

Now, let us see the details of the various building blocks of the hardware of an embedded
system. As shown in Fig. the building blocks are;

· Central Processing Unit (CPU)


· Memory (Read-only Memory and Random Access Memory)

· Input Devices

· Output devices

· Communication interfaces

· Application-specific circuitry

2.3 Central Processing Unit (CPU):

The Central Processing Unit (processor, in short) can be any of the following:
microcontroller, microprocessor or Digital Signal Processor (DSP). A micro-controller is
a low-cost processor. Its main attraction is that on the chip itself, there will be many other
components such as memory, serial communication interface, analog-to digital converter
etc. So, for small applications, a micro-controller is the best choice as the number of
external components required will be very less. On the other hand, microprocessors are
more powerful, but you need to use many external components with them. D5P is used
mainly for applications in which signal processing is involved such as audio and video
processing.
Memory:

The memory is categorized as Random Access 11emory (RAM) and Read Only Memory
(ROM). The contents of the RAM will be erased if power is switched off to the chip,
whereas ROM retains the contents even if the power is switched off. So, the firmware is
stored in the ROM. When power is switched on, the processor reads the ROM; the
program is program is executed.

2.4 Input devices:

Unlike the desktops, the input devices to an embedded system have very limited
capability. There will be no keyboard or a mouse, and hence interacting with the
embedded system is no easy task. Many embedded systems will have a small keypad-you
press one key to give a specific command. A keypad may be used to input only the digits.
Many embedded systems used in process control do not have any input device for user
interaction; they take inputs from sensors or transducers 1’fnd produce electrical signals
that are in turn fed to other systems.

2.5 Output devices:

The output devices of the embedded systems also have very limited capability. Some
embedded systems will have a few Light Emitting Diodes (LEDs) to indicate the health
status of the system modules, or for visual indication of alarms. A small Liquid Crystal
Display (LCD) may also be used to display some important parameters.

2.6 Communication interfaces:

The embedded systems may need to, interact with other embedded systems at they may
have to transmit data to a desktop. To facilitate this, the embedded systems are provided
with one or a few communication interfaces such as RS232, RS422, RS485, Universal
Serial Bus (USB), IEEE 1394, Ethernet etc.
2.7 Application-specific circuitry:

Sensors, transducers, special processing and control circuitry may be required fat
an embedded system, depending on its application. This circuitry interacts with the
processor to carry out the necessary work. The entire hardware has to be given power
supply either through the 230 volts main supply or through a battery. The hardware has to
design in such a way that the power consumption is minimized.
CHAPTER 3

HARDWARE IMPLEMENTATION

This chapter briefly explains about the Hardware Implementation of the project. It
discusses the design and working of the design with the help of block diagram in detail. It
explains the features, timer programming, serial communication, microcontroller. It also
explains the various modules used in this project.

3.1 Project Design

The implementation of the project design can be divided in two parts.

 Hardware implementation
 Firmware implementation
Hardware implementation deals in drawing the schematic on the plane paper according to
the application, testing the schematic design over the breadboard using the various IC’s to
find if the design meets the objective, carrying out the PCB layout of the schematic tested
on breadboard, finally preparing the board and testing the designed hardware.

The firmware part deals in programming the microcontroller so that it can control
the operation of the IC’s used in the implementation. In the present work, we have used
the Orcad design software for PCB circuit design, the Keil µv4 software development
tool to write and compile the source code, which has been written in the C language. The
Proloadprogrammer has been used to write this compile code into the microcontroller.
The firmware implementation is explained in the next chapter.

The project design and principle are explained in this chapter using the block
diagram and circuit diagram. The block diagram discusses about the required components
of the design and working condition is explained using circuit diagram and system wiring
diagram.
3.2 INTRODUCTION TO MICROCONTROLLER

Based on the Processor side Embedded Systems is mainly divided into 3 types

1. Micro Processor : - are for general purpose eg: our personal computer

2. Micro Controller:- are for specific applications, because of cheaper cost we will go
for these

3. DSP ( Digital Signal Processor ):- are for high and sensitive application purpose

MICROCONTROLLER VERSUS MICROPROCESSOR

A system designer using a general-purpose microprocessor such as the Pentium or the


68040 must add RAM, ROM, I/O ports, and timers externally to make them functional.
Although the addition of external RAM, ROM, and I/O ports makes these systems
bulkier and much more expensive, they have the advantage of versatility such that the
designer can decide on the amount of RAM, ROM and I/O ports needed to fit the task at
hand.

A Microcontroller has a CPU (a microprocessor) in addition to a fixed amount of


RAM, ROM, I/O ports, and a timer all on a single chip. In other words, the processor, the
RAM, ROM, I/O ports and the timer are all embedded together on one chip; therefore,
the designer cannot add any external memory, I/O ports, or timer to it. The fixed amount
of on-chip ROM, RAM, and number of I/O ports in Microcontrollers makes them ideal
for many applications in which cost and space are critical.

General Micro Processor

1. cpu for computers

2. No RAM, ROM, I/O on CPU chip itself

3. Example : Intel’s x86


Data bus Many chips on mother’s board
CPU
General
purpose RAM ROM I/O PORT TIMER SERIAL COM
micro PORT
processor

ADDRESS BUS

Micro Controller

CPU RAM ROM

I/O PORT Timer Serial COM A sigle Chip


Port

A smaller Computer
On chip RAM, ROM, I/O PORTS……..

Example: Intel 8052 etc….

Microprocessor vs. Microcontroller

Microprocessor Microcontroller
CPU is stand alone RAM, RAM, I/O, CPU,RAM,ROM,I/O and timer are all on a
timer are separate single chip

Designer can decide on the amount of Fix amount of on chip ROM,RAM, I/O
ROM, RAM and I/O ports. Ports.

Expansive, Versatility For applications in which cost, power and


space are critical

General purpose Single purpose

Block Diagram of the Project and its Description

The block diagram of the design is as shown in Fig 3.1. It consists of power
supply unit, microcontroller, sensor module, LCD. The brief description of each unit is
explained as follows.

3.3 Block Diagram

LDR

IR

8051 Micro
Crystal
controller

LED
Reset
circuit
+5V to all sections
Step
+5V to all sections Bridge+5V to all sections
Filter
Regulator +5v output
down Rectifier Circuit
T/F

3.4 Power Supply:


The input to the circuit is applied from the regulated power supply. The a.c. input i.e.,
230V from the mains supply is step down by the transformer to 12V and is fed to a
rectifier. The output obtained from the rectifier is a pulsating d.c voltage. So in order to
get a pure d.c voltage, the output voltage from the rectifier is fed to a filter to remove any
a.c components present even after rectification. Now, this voltage is given to a voltage
regulator to obtain a pure constant dc voltage.

Transformer:

Usually, DC voltages are required to operate various electronic equipment and


these voltages are 5V, 9V or 12V. But these voltages cannot be obtained directly. Thus
the a.c input available at the mains supply i.e., 230V is to be brought down to the
required voltage level. This is done by a transformer. Thus, a step down transformer is
employed to decrease the voltage to a required level.

Rectifier:

The output from the transformer is fed to the rectifier. It converts A.C. into
pulsating D.C. The rectifier may be a half wave or a full wave rectifier. In this project, a
bridge rectifier is used because of its merits like good stability and full wave rectification.

Filter:

Capacitive filter is used in this project. It removes the ripples from the output of
rectifier and smoothens the D.C. Output received from this filter is constant until the
mains voltage and load is maintained constant. However, if either of the two is varied,
D.C. voltage received at this point changes. Therefore a regulator is applied at the output
stage.

Voltage regulator:

As the name itself implies, it regulates the input applied to it. A voltage regulator
is an electrical regulator designed to automatically maintain a constant voltage level. In
this project, power supply of 5V and 12V are required. In order to obtain these voltage
levels, 7805 and 7812 voltage regulators are to be used. The first number 78 represents
positive supply and the numbers 05, 12 represent the required output voltage levels.

IOT:

The Internet of Things (IoT) is a system of interrelated computing


devices, mechanical and digital machines, objects, animals or people that are provided
with unique identifiers (UIDs) and the ability to transfer data over a network without
requiring human-to-human or human-to-computer interaction.[1][2][3][4]

The definition of the Internet of things has evolved due to the convergence of multiple
technologies, real-time analytics, machine learning, commodity sensors, and embedded
systems.[5] Traditional fields of embedded systems, wireless sensor networks, control
systems, automation (including home and building automation), and others all contribute
to enabling the Internet of Things. In the consumer market, IoT technology is most
synonymous with products pertaining to the concept of the "smart home", covering
devices and appliances (such as lighting fixtures, thermostats, home security systems and
cameras, and other home appliances) that support one or more common ecosystems, and
can be controlled via devices associated with that ecosystem, such
as smartphones and smart speakers.

There are a number of serious concerns about dangers in the growth of IoT, especially in
the areas of privacy and security; and consequently industry and governmental moves to
begin to address these.

Security[edit]

Security is the biggest concern in adopting Internet of things technology, [180] with
concerns that rapid development is happenening without appropriate consideration of the
profound security challenges involved[181] and the regulatory changes that might be
necessary.[182][183]

Most of the technical security concerns are similar to those of conventional servers,
workstations and smartphones,[184] and include weak authentication, forgetting to change
default credentials, unencrypted messages sent between devices, SQL injections and poor
handling of security updates.[185][185] However, many IoT devices have severe operational
limitations on the computational power available to them. These constraints often make
them unable to directly use basic security measures such as implementing firewalls or
using strong cryptosystems to encrypt their communications with other devices [186] - and
the low price and consumer focus of many devices makes a robust security patching
system uncommon.[citation needed]

Internet of things devices also have access to new areas of data, and can often control
physical devices,[187] so that even by 2014 it was possible to say that many Internet-
connected appliances could already "spy on people in their own homes" including
televisions, kitchen appliances,[188] cameras, and thermostats.[189] Computer-controlled
devices in automobiles such as brakes, engine, locks, hood and trunk releases, horn, heat,
and dashboard have been shown to be vulnerable to attackers who have access to the on-
board network. In some cases, vehicle computer systems are Internet-connected, allowing
them to be exploited remotely.[190] By 2008 security researchers had shown the ability to
remotely control pacemakers without authority. Later hackers demonstrated remote
control of insulin pumps[191] and implantable cardioverter defibrillators.[192]

Poorly secured Internet-accessible IoT devices can also be subverted to attack others. In
2016, a distributed denial of service attack powered by Internet of things devices running
the Mirai malware took down a DNS provider and major web sites.[193] The Mirai
Botnet had infected roughly 65,000 IoT devices within the first 20 hours. [194] Eventually
the infections increased to 200,000 to 300,000 infections. [194] Brazil, Columbia and
Vietnam made up of 41.5% of the infections. [194] The Mirai Botnet had singled out
specific IoT devices that consisted of DVRs, IP cameras, routers and printers. [194] Top
vendors that contained the most infected devices were identified as Dahua, Huawei, ZTE,
Cisco, ZyXEL and MikroTik.[194] In May 2017, Junade Ali, a Computer Scientist
at Cloudflare noted that native DDoS vulnerabilities exist in IoT devices due to a poor
implementation of the Publish–subscribe pattern.[195][196] These sorts of attacks have
caused security experts to view IoT as a real threat to Internet services.[197]

The U.S. National Intelligence Council in an unclassified report maintains that it would
be hard to deny "access to networks of sensors and remotely-controlled objects by
enemies of the United States, criminals, and mischief makers... An open market for
aggregated sensor data could serve the interests of commerce and security no less than it
helps criminals and spies identify vulnerable targets. Thus, massively parallel sensor
fusion may undermine social cohesion, if it proves to be fundamentally incompatible with
Fourth-Amendment guarantees against unreasonable search." [198] In general, the
intelligence community views the Internet of things as a rich source of data.[199]

On 31 January 2019, the Washington Post wrote an article regarding the security and
ethical challenges that can occur with IoT doorbells and cameras: "Last month, Ring got
caught allowing its team in Ukraine to view and annotate certain user videos; the
company says it only looks at publicly shared videos and those from Ring owners who
provide consent. Just last week, a California family’s Nest camera let a hacker take over
and broadcast fake audio warnings about a missile attack, not to mention peer in on them,
when they used a weak password"[200]

There have been a range of responses to concerns over security. The Internet of Things
Security Foundation (IoTSF) was launched on 23 September 2015 with a mission to
secure the Internet of things by promoting knowledge and best practice. Its founding
board is made from technology providers and telecommunications companies. In
addition, large IT companies are continuously developing innovative solutions to ensure
the security for IoT devices. In 2017, Mozilla launched Project Things, which allows to
routeIoT devices through a safe Web of Things gateway. [201] As per the estimates from
KBV Research,[202] the overall IoT security market [203] would grow at 27.9% rate during
2016–2022 as a result of growing infrastructural concerns and diversified usage of
Internet of things.[204][205]

Governmental regulation is argued by some to be necessary to secure IoT devices and the
wider Internet – as market incentives to secure IoT devices is insufficient.[206][182][183]

Safety[edit]

IoT systems are typically controlled by event-driven smart apps that take as input either
sensed data, user inputs, or other external triggers (from the Internet) and command one
or more actuators towards providing different forms of automation. [207] Examples of
sensors include smoke detectors, motion sensors, and contact sensors. Examples of
actuators include smart locks, smart power outlets, and door controls. Popular control
platforms on which third-party developers can build smart apps that interact wirelessly
with these sensors and actuators include Samsung's SmartThings, [208] Apple's HomeKit,
[209]
and Amazon's Alexa,[210] among others.

A problem specific to IoT systems is that buggy apps, unforeseen bad app interactions, or
device/communication failures, can cause unsafe and dangerous physical states, e.g.,
"unlock the entrance door when no one is at home" or "turn off the heater when the
temperature is below 0 degrees Celsius and people are sleeping at night". [207] Detecting
flaws that lead to such states, requires a holistic view of installed apps, component
devices, their configurations, and more importantly, how they interact. Recently,
researchers from the University of California Riverside have proposed IotSan, a novel
practical system that uses model checking as a building block to reveal "interaction-level"
flaws by identifying events that can lead the system to unsafe states. [207] They have
evaluated IotSan on the Samsung SmartThings platform. From 76 manually configured
systems, IotSan detects 147 vulnerabilities (i.e., violations of safe physical
states/properties).

CLOUD DATA

FIRE BASE:

Firebase evolved from Envolve, a prior startup founded by James Tamplin and Andrew
Lee in 2011. Envolve provided developers an API that enables the integration of online
chat functionality into their websites. After releasing the chat service, Tamplin and Lee
found that it was being used to pass application data that weren't chat messages.
Developers were using Envolve to sync application data such as game state in real time
across their users. Tamplin and Lee decided to separate the chat system and the real-time
architecture that powered it.[8] They founded Firebase as a separate company in
September 2011[1] and it launched to the public in April 2012.[9]
Firebase's first product was the Firebase Real-time Database, an API that synchronizes
application data across iOS, Android, and Web devices, and stores it on Firebase's cloud.
The product assists software developers in building real-time, collaborative applications.

In May 2012, one month after the beta launch, Firebase raised $1.1M in seed
funding from venture capitalists Flybridge Capital Partners, Greylock Partners, Founder
Collective, and New Enterprise Associates.[10]

In June 2013, the company further raised $5.6M in Series A funding from venture
capitalists Union Square Ventures and Flybridge Capital Partners.[11]

In 2014, Firebase launched two products. Firebase Hosting [12] and Firebase
Authentication.[13] This positioned the company as a mobile backend as a service.

In October 2014, Firebase was acquired by Google.[14]

In October 2015, Google acquired Divshot to merge it with the Firebase team.[15]

In May 2016, at Google I/O, the company's annual developer conference, Firebase
expanded its services to become a unified platform for mobile developers. Firebase now
integrates with various other Google services, including Google Cloud Platform, AdMob,
and Google Ads to offer broader products and scale for developers. [16] Google Cloud
Messaging, the Google service to send push notifications to Android devices, was
superseded by a Firebase product, Firebase Cloud Messaging, which added the
functionality to deliver push notifications to iOS and Web devices.

In January 2017, Google acquired Fabric and Crashlytics from Twitter to add those
services to Firebase.[17][18]

In October 2017, Firebase launched Cloud Firestore, a realtime document database as the
successor product to the original Firebase Realtime Database

Firebase RealtimeDatabase[edit]

Firebase provides a realtime database and backend as a service. The service provides
application developers an API that allows application data to be synchronized across
clients and stored on Firebase's cloud. [26][27] The company provides client libraries that
enable integration with Android, iOS, JavaScript, Java, Objective-
C, Swift and Node.js applications. The database is also accessible through a REST API
and bindings for several JavaScript frameworks such
as AngularJS, React, Ember.js and Backbone.js.[28] The REST API uses the Server-Sent
Events protocol, which is an API for creating HTTP connections for receiving push
notifications from a server. Developers using the realtime database can secure their data
by using the company's server-side-enforced security rules.[29]

Firebase Cloud Firestore[edit]

On January 31st 2019, Cloud Firestore was officially brought out of beta [30], making it an
official product of the Firebase line-up. It is the successor to Firebase's original
databasing system, Real-time Database, and allows for nested documents and fields
rather than the tree-view provided in the Real-time Database.

Firebase Storage[edit]

Firebase Storage provides secure file uploads and downloads for Firebase apps,
regardless of network quality. The developer can use it to store images, audio, video, or
other user-generated content. Firebase Storage is backed by Google Cloud Storage.[31]

Firebase Hosting[edit]

Firebase Hosting is a static and dynamic web hosting service that launched on May 13,
2014. It supports hosting static files such as CSS, HTML, JavaScript and other files, as
well as support through Cloud Functions.[32] The service delivers files over a content
delivery network (CDN) through HTTP Secure (HTTPS) and Secure Sockets
Layer encryption (SSL). Firebase partners with Fastly, a CDN, to provide the CDN
backing Firebase Hosting. The company states that Firebase Hosting grew out of
customer requests; developers were using Firebase for its real-time database but needed a
place to host their content.[
3.5 Microcontrollers:

INTRODUCTION TO MICROCONTROLLER

Based on the Processor side Embedded Systems is mainly divided into 3 types

1. Micro Processor : - are for general purpose eg: our personal computer

2. Micro Controller:- are for specific applications, because of cheaper cost we will go for
these

3. DSP ( Digital Signal Processor ):- are for high and sensitive application purpose

3.Introduction Node MCU


NodeMCU is an open source LUA based firmware developed for ESP8266 wifi chip. By
exploring functionality with ESP8266 chip, NodeMCU firmware comes with ESP8266
Development board/kit i.e. NodeMCU Development board.
NodeMCU Development Board/kit v0.9 (Version1)

Since NodeMCU is open source platform, their hardware design is open for
edit/modify/build.

NodeMCU Dev Kit/board consist of ESP8266 wifi enabled chip. The ESP8266 is a low-
cost Wi-Fi chip developed by Espressif Systems with TCP/IP protocol. For more
information about ESP8266, you can refer ESP8266 WiFi Module.

There is Version2 (V2) available for NodeMCU Dev Kit i.e. NodeMCU Development
Board v1.0 (Version2), which usually comes in black colored PCB.
NodeMCU Development Board/kit v1.0 (Version2)

For more information about NodeMCU Boards available in market refer NodeMCU
Development Boards

NodeMCU Dev Kit has Arduino like Analog (i.e. A0) and Digital (D0-D8) pins on its
board.

It supports serial communication protocols i.e. UART, SPI, I2C etc.

Using such serial protocols we can connect it with serial devices like I2C enabled LCD
display, Magnetometer HMC5883, MPU-6050 Gyro meter + Accelerometer, RTC chips,
GPS modules, touch screen displays, SD cards etc.

How to start with NodeMCU?

NodeMCU Development board is featured with wifi capability, analog pin, digital pins
and serial communication protocols.
To get start with using NodeMCU for IoT applications first we need to know about how
to write/download NodeMCU firmware in NodeMCU Development Boards. And before
that where this NodeMCU firmware will get as per our requirement.

There is online NodeMCU custom builds available using which we can easily get our
custom NodeMCU firmware as per our requirement.

To know more about how to build custom NodeMCU firmware online and download it
refer Getting started with NodeMCU

How to write codes for NodeMCU?

After setting up ESP8266 with Node-MCU firmware, let’s see the IDE (Integrated
Development Environment) required for development of NodeMCU.

NodeMCU with ESPlorer IDE

Lua scripts are generally used to code the NodeMCU. Lua is an open source,
lightweight, embeddable scripting language built on top of C programming
language.

For more information about how to write Lua script for NodeMCU refer Getting
started with NodeMCU using ESPlorerIDE

NodeMCU with Arduino IDE

Here is another way of developing NodeMCU with a well-known IDE i.e. Arduino
IDE. We can also develop applications on NodeMCU using Arduino development
environment. This makes easy for Arduino developers than learning new language
and IDE for NodeMCU.

For more information about how to write Arduino sketch for NodeMCU
refer Getting started with NodeMCU using ArduinoIDE
Difference in using ESPlorer and Arduino IDE

Well, there is a programming language difference we can say while developing


application for NodeMCU using ESPlorer IDE and Arduino IDE.

We need to code in C\C++ programming language if we are using Arduino IDE for
developing NodeMCU applications and Lua language if we are using ESPlorer IDE.

Basically, NodeMCU is Lua Interpreter, so it can understand Lua script easily. When we
write Lua scripts for NodeMCU and send/upload it to NodeMCU, then they will get
executes sequentially. It will not build binary firmware file of code for NodeMCU to
write. It will send Luascript as it is to NodeMCU to get execute.

In Arduino IDE when we write and compile code, ESP8266 toolchain in background
creates binary firmware file of code we wrote. And when we upload it to NodeMCU then
it will flash all NodeMCU firmware with newly generated binary firmware code. In fact,
it writes the complete firmware.

That’s the reason why NodeMCU not accept further Lua scripts/code after it is getting
flashed by Arduino IDE. After getting flashed by Arduino sketch/code it will be no more
Lua interpreter and we got error if we try to upload Lua scripts. To again start with Lua
script, we need to flash it with NodeMCU firmware.

Since Arduino IDE compile and upload/writes complete firmware, it takes more time
than ESPlorer IDE.

on properly.
NodeMCU ESP12 Dev Kit V1.0 Pin Definition:

Image Source: Google Image Search (image is used for quick reference and non-profit
purpose only)

While writing GPIO code on NodeMCU, you can’t address them with actual GPIO Pin
Numbers. There are different I/O Index numbers assigned to each GPIO Pin which is
used for GPIO Pin addressing. Refer following table to check I/O Index of NodeMCU
GPIO Pins –
GPIO Pin I/O Index Number

GPIO0 3

GPIO1 10

GPIO2 4

GPIO3 9

GPIO4 2

GPIO5 1

GPIO6 N/A

GPIO7 N/A

GPIO8 N/A

GPIO9 11

GPIO10 12

GPIO11 N/A

GPIO12 6

GPIO13 7

GPIO14 5

GPIO15 8

GPIO16 0
The objective of this post is to explain how to use the ESP8266 library defined constants
that have the correct mapping between NodeMCU and ESP8266 pins.

NodeMCU is a very easy to use ESP8266 board that can be bought at eBay for less that 4
euros. It’s also very practical since it already has an USB header, so we can program the
microcontroller without any additional hardware.

Besides that, the pins are easily accessible, allowing us to take full advantage of the
capabilities of the ESP8266, as opposed to other simpler boards, such as the ESP-01,
which only expose some of the GPIOs of the microcontroller.

Nevertheless, as indicated in some previous tutorials, the numbers of the pins in the
board don’t map to the numbers of the pins on the ESP8266. So, for example, pin D1 of
the board doesn’t map to GPIO1 of the ESP8266 (it actually maps to GPIO5).

Naturally, if this is not taken in consideration, it will lead to a difficult debugging process,
since we will be assuming that the board is not working correctly.

So, the correct pin mapping is the following [1][2] (NodeMCU on the left and ESP8266
on the right):

D0 = GPIO16;

D1 = GPIO5;

D2 = GPIO4;

D3 = GPIO0;

D4 = GPIO2;

D5 = GPIO14;
D6 = GPIO12;

D7 = GPIO13;

D8 = GPIO15;

D9 = GPIO3;

D10 = GPIO1;

LED_BUILTIN = GPIO16 (auxiliary constant for the board LED, not a board pin);

Fortunately, this mapping is defined as constant on ESP8266 the libraries, so we don’t


need to constantly check it. Thus, we can, for example, call a digitalWrite on pin D0,
which will be translated to the real GPIO pin 16 [1].

You can check the full mappings that can be used for the NodeMCU here. Note that
there are also mappings for other ESP8266 boards, which you can check here.

Important: Please note that there are lots of generic ESP8266 boards and there is the
possibility that some of them are sold under the name of NodeMCU and have different
pin mappings. Besides that, there are different NodeMCU versions. Although this
mappings have worked for all the NodeMCU boards I’ve used, please take this in
consideration if you are experiencing problems.

Example code

Just as a very simple example code, we are going to use one of these mapping in the
famous blink example. To avoid the need for external hardware, we are going to use the
NodeMCU built in LED, which is connected to pin D0 of the board [3].

So, we are going to use the defined D0 constant to control the LED without the need to
worry about the mapping to the actual ESP8266 GPIO pin.
void setup() {

pinMode(D0, OUTPUT); //Declare Pin mode

void loop() {

digitalWrite(D0, HIGH); //Turn the LED on

delay(1000); //Wait 1 second

digitalWrite(D0, LOW); //Turn the LED off

delay(1000); //Wait 1 second

Note that we could also have used the LED_BUILTIN constant, which would map to the
same exact result.
IOT TECHNOLOGY

6.1 FIRE BASE:

Firebase evolved from Envolve, a prior startup founded by James Tamplin and Andrew
Lee in 2011. Envolve provided developers an API that enables the integration of online
chat functionality into their websites. After releasing the chat service, Tamplin and Lee
found that it was being used to pass application data that weren't chat messages.
Developers were using Envolve to sync application data such as game state in real time
across their users. Tamplin and Lee decided to separate the chat system and the real-time
architecture that powered it.[8] They founded Firebase as a separate company in
September 2011[1] and it launched to the public in April 2012.[9]

Firebase's first product was the Firebase Real-time Database, an API that synchronizes
application data across iOS, Android, and Web devices, and stores it on Firebase's cloud.
The product assists software developers in building real-time, collaborative applications.

In May 2012, one month after the beta launch, Firebase raised $1.1M in seed
funding from venture capitalists Flybridge Capital Partners, Greylock Partners, Founder
Collective, and New Enterprise Associates.[10]

In June 2013, the company further raised $5.6M in Series A funding from venture
capitalists Union Square Ventures and Flybridge Capital Partners.[11]

In 2014, Firebase launched two products. Firebase Hosting [12] and Firebase
Authentication.[13] This positioned the company as a mobile backend as a service.

In October 2014, Firebase was acquired by Google.[14]

In October 2015, Google acquired Divshot to merge it with the Firebase team.[15]

In May 2016, at Google I/O, the company's annual developer conference, Firebase
expanded its services to become a unified platform for mobile developers. Firebase now
integrates with various other Google services, including Google Cloud Platform, AdMob,
and Google Ads to offer broader products and scale for developers. [16] Google Cloud
Messaging, the Google service to send push notifications to Android devices, was
superseded by a Firebase product, Firebase Cloud Messaging, which added the
functionality to deliver push notifications to iOS and Web devices.

In January 2017, Google acquired Fabric and Crashlytics from Twitter to add those
services to Firebase.[17][18]

In October 2017, Firebase launched Cloud Firestore, a realtime document database as the
successor product to the original Firebase Realtime Database

Firebase Realtime Database[edit]

Firebase provides a realtime database and backend as a service. The service provides
application developers an API that allows application data to be synchronized across
clients and stored on Firebase's cloud. [26][27] The company provides client libraries that
enable integration with Android, iOS, JavaScript, Java, Objective-
C, Swift and Node.js applications. The database is also accessible through a REST API
and bindings for several JavaScript frameworks such
as AngularJS, React, Ember.js and Backbone.js.[28] The REST API uses the Server-Sent
Events protocol, which is an API for creating HTTP connections for receiving push
notifications from a server. Developers using the realtime database can secure their data
by using the company's server-side-enforced security rules.[29]

Firebase Cloud Firestore[edit]

On January 31st 2019, Cloud Firestore was officially brought out of beta [30], making it an
official product of the Firebase line-up. It is the successor to Firebase's original
databasing system, Real-time Database, and allows for nested documents and fields
rather than the tree-view provided in the Real-time Database.

Firebase Storage[edit]

Firebase Storage provides secure file uploads and downloads for Firebase apps,
regardless of network quality. The developer can use it to store images, audio, video, or
other user-generated content. Firebase Storage is backed by Google Cloud Storage.[31]
Firebase Hosting[edit]

Firebase Hosting is a static and dynamic web hosting service that launched on May 13,
2014. It supports hosting static files such as CSS, HTML, JavaScript and other files, as
well as support through Cloud Functions.[32] The service delivers files over a content
delivery network (CDN) through HTTP Secure (HTTPS) and Secure Sockets
Layer encryption (SSL). Firebase partners with Fastly, a CDN, to provide the CDN
backing Firebase Hosting. The company states that Firebase Hosting grew out of
customer requests; developers were using Firebase for its real-time database but needed a
place to host their content.[

6.2 IOT:

The Internet of Things (IoT) is a system of interrelated computing


devices, mechanical and digital machines, objects, animals or people that are provided
with unique identifiers (UIDs) and the ability to transfer data over a network without
requiring human-to-human or human-to-computer interaction.[1][2][3][4]

The definition of the Internet of things has evolved due to the convergence of multiple
technologies, real-time analytics, machine learning, commodity sensors, and embedded
systems.[5] Traditional fields of embedded systems, wireless sensor networks, control
systems, automation (including home and building automation), and others all contribute
to enabling the Internet of Things. In the consumer market, IoT technology is most
synonymous with products pertaining to the concept of the "smart home", covering
devices and appliances (such as lighting fixtures, thermostats, home security systems and
cameras, and other home appliances) that support one or more common ecosystems, and
can be controlled via devices associated with that ecosystem, such
as smartphones and smart speakers.

There are a number of serious concerns about dangers in the growth of IoT, especially in
the areas of privacy and security; and consequently industry and governmental moves to
begin to address these.
6.3 Security[edit]

Security is the biggest concern in adopting Internet of things technology, [180] with
concerns that rapid development is happenening without appropriate consideration of the
profound security challenges involved[181] and the regulatory changes that might be
necessary.[182][183]

Most of the technical security concerns are similar to those of conventional servers,
workstations and smartphones,[184] and include weak authentication, forgetting to change
default credentials, unencrypted messages sent between devices, SQL injections and poor
handling of security updates.[185][185] However, many IoT devices have severe operational
limitations on the computational power available to them. These constraints often make
them unable to directly use basic security measures such as implementing firewalls or
using strong cryptosystems to encrypt their communications with other devices [186] - and
the low price and consumer focus of many devices makes a robust security patching
system uncommon.[citation needed]

Internet of things devices also have access to new areas of data, and can often control
physical devices,[187] so that even by 2014 it was possible to say that many Internet-
connected appliances could already "spy on people in their own homes" including
televisions, kitchen appliances,[188] cameras, and thermostats.[189] Computer-controlled
devices in automobiles such as brakes, engine, locks, hood and trunk releases, horn, heat,
and dashboard have been shown to be vulnerable to attackers who have access to the on-
board network. In some cases, vehicle computer systems are Internet-connected, allowing
them to be exploited remotely.[190] By 2008 security researchers had shown the ability to
remotely control pacemakers without authority. Later hackers demonstrated remote
control of insulin pumps[191] and implantable cardioverter defibrillators.[192]

Poorly secured Internet-accessible IoT devices can also be subverted to attack others. In
2016, a distributed denial of service attack powered by Internet of things devices running
the Mirai malware took down a DNS provider and major web sites.[193] The Mirai
Botnet had infected roughly 65,000 IoT devices within the first 20 hours. [194] Eventually
the infections increased to 200,000 to 300,000 infections. [194] Brazil, Columbia and
Vietnam made up of 41.5% of the infections. [194] The Mirai Botnet had singled out
specific IoT devices that consisted of DVRs, IP cameras, routers and printers. [194] Top
vendors that contained the most infected devices were identified as Dahua, Huawei, ZTE,
Cisco, ZyXEL and MikroTik.[194] In May 2017, Junade Ali, a Computer Scientist
at Cloudflare noted that native DDoS vulnerabilities exist in IoT devices due to a poor
implementation of the Publish–subscribe pattern.[195][196] These sorts of attacks have
caused security experts to view IoT as a real threat to Internet services.[197]

The U.S. National Intelligence Council in an unclassified report maintains that it would
be hard to deny "access to networks of sensors and remotely-controlled objects by
enemies of the United States, criminals, and mischief makers... An open market for
aggregated sensor data could serve the interests of commerce and security no less than it
helps criminals and spies identify vulnerable targets. Thus, massively parallel sensor
fusion may undermine social cohesion, if it proves to be fundamentally incompatible with
Fourth-Amendment guarantees against unreasonable search." [198] In general, the
intelligence community views the Internet of things as a rich source of data.[199]

On 31 January 2019, the Washington Post wrote an article regarding the security and
ethical challenges that can occur with IoT doorbells and cameras: "Last month, Ring got
caught allowing its team in Ukraine to view and annotate certain user videos; the
company says it only looks at publicly shared videos and those from Ring owners who
provide consent. Just last week, a California family’s Nest camera let a hacker take over
and broadcast fake audio warnings about a missile attack, not to mention peer in on them,
when they used a weak password"[200]

There have been a range of responses to concerns over security. The Internet of Things
Security Foundation (IoTSF) was launched on 23 September 2015 with a mission to
secure the Internet of things by promoting knowledge and best practice. Its founding
board is made from technology providers and telecommunications companies. In
addition, large IT companies are continuously developing innovative solutions to ensure
the security for IoT devices. In 2017, Mozilla launched Project Things, which allows to
route IoT devices through a safe Web of Things gateway. [201] As per the estimates from
KBV Research,[202] the overall IoT security market [203] would grow at 27.9% rate during
2016–2022 as a result of growing infrastructural concerns and diversified usage of
Internet of things.[204][205]

Governmental regulation is argued by some to be necessary to secure IoT devices and the
wider Internet – as market incentives to secure IoT devices is insufficient.[206][182][183]

Safety[edit]

IoT systems are typically controlled by event-driven smart apps that take as input either
sensed data, user inputs, or other external triggers (from the Internet) and command one
or more actuators towards providing different forms of automation. [207] Examples of
sensors include smoke detectors, motion sensors, and contact sensors. Examples of
actuators include smart locks, smart power outlets, and door controls. Popular control
platforms on which third-party developers can build smart apps that interact wirelessly
with these sensors and actuators include Samsung's SmartThings, [208] Apple's HomeKit,
[209]
and Amazon's Alexa,[210] among others.

A problem specific to IoT systems is that buggy apps, unforeseen bad app interactions, or
device/communication failures, can cause unsafe and dangerous physical states, e.g.,
"unlock the entrance door when no one is at home" or "turn off the heater when the
temperature is below 0 degrees Celsius and people are sleeping at night". [207] Detecting
flaws that lead to such states, requires a holistic view of installed apps, component
devices, their configurations, and more importantly, how they interact. Recently,
researchers from the University of California Riverside have proposed IotSan, a novel
practical system that uses model checking as a building block to reveal "interaction-level"
flaws by identifying events that can lead the system to unsafe states. [207] They have
evaluated IotSan on the Samsung SmartThings platform. From 76 manually configured
systems, IotSan detects 147 vulnerabilities (i.e., violations of safe physical
states/properties).
3.6LDR (Light Dependent Resistor)

A photo resistor or light dependent resistor (LDR) is a resistor whose resistance decreases
with increasing incident light intensity; in other words, it exhibits photoconductivity. A
photo resistor is made of a high resistance semiconductor. If light falling on the device is
of high enough frequency, photons absorbed by the semiconductor give bound electrons
enough energy to jump into the conduction band. The resulting free electron (and its hole
partner) conduct electricity, thereby lowering resistance. A photoelectric device can be
either intrinsic or extrinsic. An intrinsic semiconductor has its own charge carriers and is
not an efficient semiconductor, for example, silicon. In intrinsic devices the only
available electrons are in the valence band, and hence the photon must have enough
energy to excite the electron across the entire band gap. Extrinsic devices have
impurities, also called do pants, added whose ground state energy is closer to the
conduction band; since the electrons do not have as far to jump, lower energy photons
(that is, longer wavelengths and lower frequencies) are sufficient to trigger the device. If
a sample of silicon has some of its atoms replaced by phosphorus atoms (impurities),
there will be extra electrons available for conduction. This is an example of an extrinsic
semiconductor. Photo resistors are basically photocells.
Key Specifications/Special Features:
 Specifications:
o Maximum power consumption: 500V DC
o Maximum peak value: 500mW
o Spectrum peak value: 540nm
o Light resistance: 5 to 10k
o Dark resistance: 0.6MΩ
 Performances and features:
o Coated with epoxy
o Good reliability
o Small volume
o High sensitivity
o Fast response
o Good spectrum characteristic

 Typical applications:
o Camera automatic photometry
o Photoelectric controls
o Indoor ray controls
o Annunciation
o Industrial controls
o Light control switches
o Light control lamps
o Electronic toys
 Measuring conditions:
o Light resistance: measured at 10 lux with standard light A (2854K color
temperature) and 2hrs illumination at 400 to 600 lux prior to testing
o Dark resistance: measured 10 seconds after closed 10 lux
o Gamma characteristic: between 10 lux and 100 lux and given byγ = lg (R10/R100)
R10, R100 Cell resistance at 10 lux and 100 lux
o The error of γ is ± 0.1
o Pmax: maximum power dissipation at ambient temperature of 25 °C
o Vmax: maximum voltage in darkness that may be applied to the cell continuously
CHAPTER 4
FIRMWARE IMPLEMENTATION OF THE PROJECT

The software used by the arduino is Arduino IDE.

heArduino IDE is a cross-platform application written in Java, and is derived from the
IDE for the Processing programming language and the Wiringproject. It is designed to
introduce programming to artists and other newcomers unfamiliar with software
development. It includes a code editor with features such as syntax highlighting, brace
matching, and automatic indentation, and is also capable of compiling and uploading
programs to the board with a single click. There is typically no need to edit makefiles or
run programs on acommand-line interface. Although building on command-line is
possible if required with some third-party tools such as Ino.

The Arduino IDE comes with a C/C++ library called "Wiring" (from the project of the
same name), which makes many common input/output operations much easier. Arduino
programs are written in C/C++, although users only need define two functions to make a
runnable program:

 setup() – a function run once at the start of a program that can initialize settings
 loop() – a function called repeatedly until the board powers off
Figure 4.1 : A screenshot of the Arduino IDE showing the "Blink"program,a simple
biginner program

A typical first program for a microcontroller simply blinks a LED on and off. In the
Arduino environment, the user might write a program like this:

#define LED_PIN 13

void setup () {

pinMode (LED_PIN, OUTPUT); // enable pin 13 for digital output

void loop () {

digitalWrite (LED_PIN, HIGH); // turn on the LED

delay (1000); // wait one second (1000 milliseconds)

digitalWrite (LED_PIN, LOW); // turn off the LED

delay (1000); // wait one second


}

For the above code to work correctly, the positive side of the LED must be connected to
pin 13 and the negative side of the LED must be connected to ground. The above code
would not be seen by a standard C++ compiler as a valid program, so when the user
clicks the "Upload to I/O board" button in the IDE, a copy of the code is written to a
temporary file with an extra include header at the top and a very simple main()
function at the bottom, to make it a valid C++ program.

The Arduino IDE uses the GNU toolchain and AVR Libc to compile programs, and
uses avrdude to upload programs to the board.

For educational purposes there is third party graphical development environment


called Minibloq available under a different open source license.

4.2 language reference

Arduino programs can be divided in three main parts: structure, values (variables and
constants), and functions.

Available datatypes in ARDUINO IDE are

•void

•boolean

•char ( 0 – 255)

•byte - 8 bit data ( 0 – 255)

•int - 16-bit data (32,767 - -32,768)

•long – 32 bit data (2,147,483,647 to -2,147,483,648)

•float

•double

•string - char array


•String - object

•array

Arithmetic operators
Arithmetic operators include addition,subtraction,multiplication and division.For math
that requires fractions,you can use float variables,if you can bear large size and slow
computation speeds in your microcontroller.
e.g. ,
y = y + 3;
x = x – 7;
i = j * 6;
r = r / 5;

Comparision operators
Comparisons of one variable or constant against another are often used in if statements to
test if a specified condition is true.
e.g. ,
x == y // x is equal to y
x != y // x is not equal to y
x < y // x is less than y
x > y // x is greater than y
x <= y // x is less than or equal to y
x >= y // x is greater than or equal to y

Logical operators
Logical operators are usually a way to logically combine two expressions and return a
TRUE or FALSE depending on the operator.
There are three logical operators, AND, OR, and NOT.
e.g. ,
Logical AND:
if (x > 0 && x < 5) // true only if both expressions are true

Logical OR:
if (x > 0 || y > 0) // true if either expression is true

Logical NOT:
if (!x > 0) // true only if expression

TRUE/FALSE
These are Boolean constants that define logic levels of the arduino.
FALSE is easily defined as 0 (zero)
TRUE is often defined as 1, but can also be anything else except zero. So in a Boolean
sense, -1, 2, and -200 are all also defined as TRUE.
e.g. ,
if (abcd== TRUE);
{
DoSomethingNice;
}
else
{
DoSomethingHorrible;
}

HIGH/LOW
These constants define pin levels as HIGH or LOW and are used when reading or writing
to digital pins.
HIGH is defined as logic level 1, ON, or 5 volts
LOW is logic level 0, OFF, or 0 volts.
e.g. ,
digitalWrite(13, HIGH);
INPUT/OUTPUT
These constants define pin levels as HIGH or LOW and are used when reading or writing
to digital pins.
HIGH is defined as logic level 1, ON, or 5 volts
LOW is logic level 0, OFF, or 0 volts.
e.g. ,
pinmode(13, OUTPUT);

Arduino/processing language Comparision


The Arduino language (based on Wiring) is implemented in C/C++, and therefore has
some differences from the Processing language, which is based on Java.

4.3 SIMULATOR for ARDUINO:

The Arduino Simulator app gives the user the freedom to work without the basic setup of
hardware and software. It is designed to be used by beginners and also, experienced
developers, who want to quickly develop Arduino projects.

The developer can make the necessary changes in the code - delay, pin number, and state
- 0 (low) 1 (high) - and check it immediately. The app shows the breadboard, complete
with 14 LED pins.

You can drag and place the wires in the correct positions to connect to Arduino. If the
wires are placed according to the code, then it will show the expected results. Once
satisfied, you can save it and email it. The code can be copied and used in an actual
project just as easily.

This app is an easy way to work through Arduino projects. With customisable codes, and
a simple to use interface, thisArduino Simulator app from Schogini Systems is a
convenient app for Arduino developers.

A screenshot of Arduino simulator is shown in the figure below


Figure4.3: screenshot of ARDUINO simulator
CHAPTER_5

WORKING PROCEDURE

WORKING PROCEDURE:
The main aim of the project is to control the lights in streets depending upon lighting that
is present on LDR sensor. Use of embedded technology makes this closed loop feedback
control system efficient and reliable.

The LDR sensor checks weather sun light is there or not. Based on the LDR sensor input
the controller controls the bulb. To control the bulb in between controller and bulb.All
this action is performed by the microcontroller

Here we propose an IOT based street light monitoring and controlling system to ensure,
low power consumption, consumption monitoring, instant faulty light detection and light
dimming as per external lighting conditions. Our proposed system consists of smart street
lights that have external light sensing that automatically turns on at desired intensity
based on amount of lighting needed. The system also allows the controller/monitoring
person to check estimate power consumptions as per current intensity of light as well as
predict monthly power consumption. Also each of the unit has load sensing functionality
that allows it to detect if the light has a fault. It then automatically flags that light is faulty
and this data is sent over to the IOT monitoring system so that action can be taken to fix
it. We here use IOTGecko iot development platform for the online system using the
iotgecko api to transmit data and display online.
CHAPTER 6

RESULTS AND DISCUSSIONS

6.1 Testing And Results

We started our project by making power supply. That is easy for me but when we
turn toward the main circuit, there are many problems and issues related to it, which we
faced, like component selection, which components is better than other and its feature
and cost wise a We started our project by making power supply. That is easy for me but
when I turn toward the main circuit, there are many problems and issues related to it,
which are I faced, like component selection, which components is better than other and
its feature and cost wise also, then refer the data books and other materials related to its. I
had issues with better or correct result, which I desired. And also the software problem. I
also had some soldering issues which were resolved using continuity checks performed
on the hardware.

6.2 Conclusion

By implementing this system, we move one step closer to a smarter digital world by eliminating
efforts in tasks that require us to manually operate them by being physically present near the
target electronic equipment. This system is an efficient implementation of the internet of things
concept as it makes it possible to wirelessly operate electronic devices like street lights from
anywhere in the world where there is a network connection available. The system is easy to
setup and implement and requires no extra maintenance compared to the already existing
system. This system can be further enhanced by writing logic into the code that can be capable
of retrieving information of the time of sunset and sunrise from a reliable weather reporting
source and automate the process completely by turning on the street light at the time of sunset
and turning it off by sunrise. This further eliminates human intervention and a manual visit to
the location of the street lights will be required only in case of a malfunction. .

CHAPTER-7

FUTURE EXPANSION

By using this circuit and proper power supply we can implement various applications
Such as fans, tube lights, etc.

By modifying this circuit and using two relays we can achieve a task of opening and
closing the door

Applications

For automatic street lighting system

For automatic room light control

Advantages

Low cost

Easy to use

Power saving

Implement in street lights


BIBILOGRAPHY:

Reference Books

Programming in ANSI C: E BALAGURUSAMY

The 8051microcontroller and embedded systems:MUHAMMAD ALI MAZIDI

JANICE GILLISPIEMAZIDI

The NODEMCU microcontroller: KENNETH J. AYALA

Website

www.datasheets4u.com

www.8051.com

You might also like