0% found this document useful (0 votes)
28 views69 pages

Major Project - Report

Uploaded by

meenu
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)
28 views69 pages

Major Project - Report

Uploaded by

meenu
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/ 69

A MAJOR PROJECT REPORT

On
Home Automation using Esp8266 with Google Assistant
Submitted in partial fulfilment of the requirements for the award of the

Degree of

BACHELOR OF TECHNOLOGY

in

Electronics & Communication Engineering

By

A. NITHIN (Regd.No.20891A0403)

B. CHARAN KUMAR (Regd.No.20891A0408)

K. VINOD KUMAR (Regd.No.2091A0428)

Y. SAI KRISHNA REDDY (Regd.No.20891A0459)

Under the guidance of

MR. J. RAMESH

Assistant Professor

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING


VIGNAN INSTITUTE OF TECHNOLOGY AND SCIENCE
(Affiliated to JNTU, Hyderabad, Approved by AICTE, New Delhi)

Near Ramoji film city, Deshmuki village, Pochampally Mandal, Yadadri Bhuvanagiri District.

AN AUTONOMOUS INSTITUTION
2023-24
CERTIFICATE

This is to certify that the project report entitled – Home Automation using Esp8266
with Google Assistant submitted by-A.Nithin (20891A0403) ,B.Charan kumar
(20891A0408) , K.Vinod Kumar (20891A0428) , Y.Sai krishna
Reddy(20891A0459) the Vignan Institute of Technology & Science, Yadadri,
Bhuvanagiri Dist., in partial fulfilment for the award of the degree of B. Tech in
Electronics & Communication Engineering is a bonafide record of project work carried
out by him/her under my supervision. The contents of this report, in full or in parts, have
not been submitted to any other Institution or University for the award of any degree or
diploma.

Mr J.Ramesh Dr. P. A Harsha Vardhini

Assistant Professor Head of the Department

(External Examiner)
i
DECLARATION

We declare that this project report titled –– Home Automation using


Esp8266 with Google Assistant submitted submitted in partial fulfilment
of the degree of B. Tech in Electronics & Communication Engineering is
a record of original work carried out by us under the supervision of Assistant
professor Mr J.Ramesh and has not formed the basis for the award of any
other degree or diploma, in this orany other Institution or University. In
keeping with the ethical practice in reporting scientific information, due
acknowledgements have been made wherever the findings of others have
been cited.

A.Nithin 20891A0403

B.Charan kumar 20891A0408

K.Vinod Kumar 20891A0428

Y.Sai krishna Reddy 20891A0459

Date: Hyderabad.

ii
ACKNOWLEDGEMENT

Every project big or small is successful largely due to the effort of a number of
wonderful people who have always given their valuable advice or lent a helping hand.
We sincerely appreciate the inspiration; support and guidance of all those people who
have been instrument as in making this project a success.

We thank our beloved Chairman, Dr. L Rathaiah, who gave us great


encouragement to work.

We thank CEO, Mr. Boyapati Shravan, we remember him for his valuable
ideas and facilities available in college during the development of the project.

We convey our sincere thanks to Dr. G. Durga Sukumar, Principal of our


institution for providing us with the required infrastructure and a very vibrant and
supportive staff.

We would like to thank our Head of the Department, Electronics and


Communication Engineering, Dr. P. A Harsha Vardhini ,a distinguished and eminent
personality, whose strong recommendation, immense support, and constant
encouragement has been great help to us. We intensely thank her for the same.

We would like to thank our guide, MR J. RAMESH, Assistant Professor who


has invested his full effort in guiding the team in achieving the goal.

Special thanks go to my teammates, who helped me and gave suggestions in


making this project. We have to appreciate the guidance given by other supervisors as
well as the panels especially in our project presentation that has improved our
presentation skills thanks to their comment and advice. We take this opportunity to
thank all our lecturers who have directly or indirectly helped our project. We pay our
respects and love to our parents and all other family members and friends for their love
and encouragement throughout our career.

1
ABSTRACT

In the midst of this rapidly evolving world of over 50 billion internet-connected


devices, all new inventions are made solely from need. Today, the IoT is sweeping
the world not only because it makes life easier, but because it is much more
efficient. From time to time, new breakthrough technologies are created with the
help of the IoT. Ultimately, people no longer have to rely on traditional machines
that are slow and require more effort. This is a prototype home automation system
that allows you to control everyday devices such as fans, lights, and other loads at
the push of a button on the device. To enhance usage of wireless fidelity and
reduce usage of sensors embedded on each appliance we introduce the usage of
APIs and wireless modules. The whole project will be using API to communicate
with NodeMCU and Relay module so that a machine to machine communication is
established over WiFi and loads connected could be remotely controlled with
google`s voice assistant. In this project we will be using these technologies:
Embedded Systems, cross platform API named Sinric Pro is used here to integrate
the working.Once the project is fully built one can control upto 4 appliances like
fan,light, and any other load over WiFi via Google Voice Assistant installed on
user’s phone.

2
TABLE OF CONTENTS
DECRIPTION PAGE NUMBER

CERTIFICATE i

DECLARATION ii

ACKNOWLEDGEMENTS 1

ABSTARACT 2

TABLE OF CONTENTS 3

LIST OF FIGURES 4

LIST OF TABLES 5

1. INTRODUCTION 6

2. Literature survey 8

2.1. Review of related literature 8

2.2. Review of foreign study 8

3. Analysis and design 9

3.1. Introduction 9

3.2. System architecture 9

3.3. Introduction to NODENCU 10

3.4. History 10

3.5. Specifications 11

3.6. Regular power supply 14

3.6.1. Operation of regulated power supply 15

3.6.1.1. Step down transformer 15

3.6.1.2. Rectification 15

3.6.1.3. DC filtration 16

3.6.1.4. Regulation 17

3.7. RELAY(ELECTRO MECHANICAL SWITCH) 18

4. Implemention 22

3
4.1. Hardware implemention 22

4.1.1 Automatic (software) reset 23

4.1.2. USB over current protection 24

4.1.3. Physical charactristics 24

4.2. How to get started with Arduino 24

5. Software discription 33

5.1. Embedded C language 45

5.1.1. Differences between C and Embedded C 47

5.2. Web server 52

5.3. ESP8266 firm work 53

5.4. Google Assistant 54

6. Testing and Dubbing 55

6.1. Instiling the software 55

6.2. connecting a battery 55

6.3. Moving on 55

6.4. Troubling shotting 57

6.5. Falssing and LED 57

6.6. Dubbing 57

6.7. Project testing 57

7. Applications , Advantages and future scope 58

7.1. Applications 58

7.2. Advantages 59

7.3. Future scope 59

7.4. Problems faced 59

8. Conclusion 60

4
LIST OF FIGURES

FIGURE TITLE PAGE NO.

1.1 Block diagram 6

3.2 System architecture 10

3.4 Specifications (NODEMCU pinout) 13

3.6 Regular power supply 14

3.6.1.2. Rectification 15

3.6.1.3. DC filtration 17

3.7 Relay 19

4.2 Arduino IDE 25

4.4 Software implementation 33

4.5 NODE MCU 41

5.1 Embedded C language 46

6.3 Moving on 56

6.4 Trouble shotting 58

LIST OF TABLES

FIGURE TITLE PAGE NO

5.1 Embedded C language 46

5.1.1 Difference between C and Embedded C 47

5
CHAPTER 1

INTRODUCTION TO PROJECT

1.1. INTRODUCTION:

World’s demand for electricity had grown 85% between 2010 and 2017 this
increase is more than today’s total use of electricity in India, USA, Japan, Australia
combined. We can’t decrease the electricity growth rate but we can lessen the
amount of electricity wasted each year by turning off our home appliances when
not in use. This project presents a design and prototype of Home Automation
system that will use ESP8266 Wi-Fi module as a network provider in connecting
with other appliances.
The proposed system has two main components. The first main part is
Arduino, which controls and manages input of Wi-Fi module. The other main
component is Wi-Fi module through Wi-Fi module a web server can be added to
the module which will help in controlling of devices over Internet. One server can
manage many hardware interface modules as long as it exists on Wi-Fi network
coverage.
It supports a wide range of home automation devices like power
management components, and security components. We want to make this
automation system centralized and artificially intelligent. Further we will connect
the specific home to our database and it can be accessed from anywhere through a
specific IP address or website. Also, an app would be developed which will allow
the user to control their devices using the Google Assistant.

6
Block Diagram:

Hardware Components:

 NodeMCU Module

 Relay Driver

 Power Supply

Software:

 Arduino IDE

 Embedded C Programming Language.

7
CHAPTER 2

LITERATURE SURVEY

3.1 REVIEW OF RELATED LITERATURE:


When people think about home automation, most of them may imagine
living in a smart home: One remote controller for every household appliance,
cooking the rice automatically, starting air conditioner automatically, heating water
for bath automatically and shading the window automatically during night. To
some extent home automation equals to smart home. They both bring out smart
living condition and make our life more convenient and fast. Early home
automation began with labor-saving machines. Self-contained electric or gas
powered home appliance became viable in the 1900s with the introduction of
electric power distribution led to the introduction of washing machine (1904),
water heater (1889), refrigerator, sewing machines, dishwashers and clothes dryers.
As per our survey currently there exists system neither at cheaper rates nor easy to
handle. Various systems are hard to install, difficult to use and maintain. Current
systems are generally proprietary, closed and not very user friendly Based on
Arduino or GSM or low cost home security system and home automation system.

3.2 REVIEW OF FOREIGN STUDY:

In their paper, Tan, Lee and Soh (2002) proposed the development of an
Internet-based system to allow monitoring of important process variables from a
distributed control system (DCS). This paper proposes hardware and software
design considerations which enable the user to access the process variables on the
DCS, remotely and effectively rent designations.

8
Potamitis, Georgila, Fakotakis, and Kokkinoss, G. (2003) suggested the use
of speech to interact remotely with the home appliances to perform a particular
action on behalf of the user. The approach is inclined for people with disability to
perform real-life operations at home by directing appliances through speech. Voice
separation strategy is selected to take appropriate decision by speech recognition.

CHAPTER 3

ANALYSIS AND DESIGN

3.1.

INTRODUCTION:

This project is to provide authentication for electrical equipment’s


controlling using smart cards. The main objective of this project is Authenticated
device control system which is implemented using smart cards.

3.2. SYSTEM ARCHITETURE:

The flowchart explains the home automation system. The controlling device
will be connected with the Wi-Fi module through hotspot created by the module
(fig 1.2). The module will be connected with the microcontroller .The controller
will give the required command to the relay board and the relay board acts as
switch between the circuit. The appliances will be connected with the relay board.
Now, the appliances can be controlled using internet of things.

9
Block Diagram:

3.2. INTRODUCTION TO NODEMCU:

NodeMCU is an open source IOT platform. It includes firmware which runs


on the ESP8266 Wi-Fi SoC from Espressif Systems, and hardware which is based
on the ESP-12 module. The term "NodeMCU" by default refers to the firmware
rather than the development kits. The firmware uses the Lua scripting language. It
is based on the eLua project, and built on the Espressif Non-OS SDK for ESP8266.
It uses many open source projects, such as lua-cjson, and spiffs.

History:

NodeMCU was created shortly after the ESP8266 came out. On December
30, 2013, Express if Systems began production of the ESP8266. The ESP8266 is a
Wi-Fi SoC integrated with a Tensilica Xtensa LX106 core, widely used in IOT
applications. NodeMCU started on 13 Oct 2014, when Hong committed the first

10
file of NodeMCU-firmware to GitHub. Two months later, the project expanded to
include an open-hardware platform when developer Huang R committed
the gerber file of an ESP8266 board, named devkit v0.9. Later that month, Tuan
PM ported MQTT client library from Contiki to the ESP8266 SoC platform, and
committed to NodeMCU project, then NodeMCU was able to support the MQTT
IOT protocol, using Lua to access the MQTT broker. Another important update
was made on 30 Jan 2015, when Devsaurus ported the u8glib to NodeMCU
project, enabling NodeMCU to easily drive LCD, Screen, OLED, even VGA
displays.

In summer 2015 the creators abandoned the firmware project and a group of
independent but dedicated contributors took over. By summer 2016 the NodeMCU
included more than 40 different modules. Due to resource constraints users need to
select the modules relevant for their project and build a firmware tailored to their
needs.

Specifications:
NodeMCU Dev Board is based on widely explored esp8266 System on Chip
from Express if. It combined features of WIFI access point and station +
microcontroller and uses simple LUA based programming language. ESP8266
NodeMCU offers-
-- Arduino-like hardware IO
-- Event-driven API for network applications
--10 GPIOs D0-D10, PWM functionality, IIC and SPI communication, 1-Wire and
ADC A0 etc. all in one board
--Wi-Fi networking (can be uses as access point and/or station, host a webserver),
connect to internet to fetch or upload data.
--excellent few $ system on board for Internet of Things (IOT) projects.

11
Recently, there has been interest in programming ESP8266 systems using
Arduino IDE. Programming, of ESP8266 using Arduino IDE is not very straight
forward, until it is properly configured. Especially because, the Input and output
pins have different mapping on NodeMCU than those on actual ESP8266 chip.
I had request about showing how to program ESP-12E NodeMCU using
Arduino IDE. I struggled myself earlier in the beginning, so thought of making this
Instruct able for beginners. This is quick guide/tutorial for getting started with
Arduino and ESP8266 NodeMCU V2 ESP-12Ewifi module. (I think, this method
can be used for other NodeMCU boards too. (or only ESP8266 boards, but with
necessary hardware modifications and using FTDI modules for programming- not
covered in this tutorial because, this is only for NodeMCU development boards).
This Instruct able gives quick intro to-
1) Installing Arduino core for ESP8266 Wi-Fi chip in Arduino IDE and Getting
started with sketches written using latest stable Arduino IDE 1.6.7
2) Run/modify basic LED blink sketch to blink onboard LED and/or externally
connected LED at pin D0 or GPIO-16 as per the pin configuration mentioned
here and here.
NOTE- To use NodeMCU V1 or V2 or V3 development boards using Arduino
IDE, we do not need to flash it with firmware using NodeMCU flasher. It is
required only if we intend to program NodeMCU using Lua script with esplorer
etc.
First and foremost word of - CAUTION!
* The ESP8266 chip requires 3.3V power supply voltage. It should not be powered
with 5 volts like other Arduino boards.
* NodeMCU ESP-12E development board can be connected to 5Vusing micro
USB connector or Vin pin available on board.
* The I/O pins of ESP8266 communicate or input/output max 3.3V only. The pins
are NOT 5V tolerant inputs.

12
NodeMCU Pin out:

3.6. REGULATOR POWER SUPPLY:

13
A regulated power supply is an embedded circuit; it converts unregulated
AC into a constant DC. With the help of a rectifier it converts AC supply into DC.
Its function is to supply a stable voltage (or less often current), to a circuit or
device that must be operated within certain power supply limits. The output from
the regulated power supply may be alternating or unidirectional, but is nearly
always DC.

A regulated DC power supply is also called as a linear power supply; it is an


embedded circuit and consists of various blocks.

The regulated power supply will accept an AC input and give a constant DC
output. Figure below shows the block diagram of a typical regulated DC power
supply.

The basic building blocks of a regulated DC power supply are as follows:

14
1. A step down transformer
2. A rectifier
3. A DC filter
4. A regulator

3.6.1. Operation of Regulated Power Supply:

3.6.1.1. Step Down Transformer:


A step down transformer will step down the voltage from the ac mains to the
required voltage level. The turn’s ratio of the transformer is so adjusted such as to
obtain the required voltage value. The output of the transformer is given as an
input to the rectifier circuit.

3.6.1.2. Rectification:
Rectifier is an electronic circuit consisting of diodes which carries out the
rectification process. Rectification is the process of converting an alternating
voltage or current into corresponding direct (DC) quantity. The input to a rectifier
is ac whereas its output is unidirectional pulsating DC. Usually a full wave rectifier
or a bridge rectifier is used to rectify both the half cycles of the ac supply (full
wave rectification). Figure below shows a full wave bridge rectifier.

15
A bridge rectifier consists of four p-n junction diodes connected in the above
shown manner. In the positive half cycle of the supply the voltage induced across
the secondary of the electrical transformer i.e. VMN is positive. Therefore point E
is positive with respect to F. Hence, diodes D 3 and D2 are reversed biased and
diodes D1 and D4 are forward biased. The diode D3 and D2 will act as open
switches (practically there is some voltage drop) and diodes D1 andD4 will act as
closed switches and will start conducting. Hence a rectified waveform appears at
the output of the rectifier as shown in the first figure. When voltage induced in
secondary i.e. VMN is negative than D3 and D2 are forward biased with the other
two reversed biased and a positive voltage appears at the input of the filter.

3.6.1.3. DC Filtration:
The rectified voltage from the rectifier is a pulsating DC voltage having very
high ripple content. But this is not we want, we want a pure ripple free DC
waveform. Hence a filter is used. Different types of filters are used such as
capacitor filter, LC filter, Choke input filter, π type filter. Figure below shows a
capacitor filter connected along the output of the rectifier and the resultant output
waveform.

16
As the instantaneous voltage starts increasing the capacitor charges, it
charges till the waveform reaches its peak value. When the instantaneous value
starts reducing the capacitor starts discharging exponentially and slowly through
the load (input of the regulator in this case). Hence, an almost constant DC value
having very less ripple content is obtained.

3.6.1.4. Regulation:

This is the last block in a regulated DC power supply. The output voltage or
current will change or fluctuate when there is change in the input from ac mains or
due to change in load current at the output of the regulated power supply or due to
other factors like temperature changes. This problem can be eliminated by using a
regulator. A regulator will maintain the output constant even when changes at the
input or any other changes occur. Transistor series regulator, Fixed and variable IC
regulators or a Zener diode operated in the zener region can be used depending on

17
their applications. IC’s like 78XX and 79XX are used to obtained fixed values of
voltages at the output.

3.7. RELAY (ELECTRO MECHANICAL SWITCH):

A relay is an electrically operated switch. Current flowing through the coil


of the relay creates a magnetic field which attracts a lever and changes the switch
contacts the coil current can be on or off, so relays have two switch positions and
they are double throw switches.

Relays allow one circuit to switch a second circuit which can be


completely separate from the first. For example a low voltage battery circuit can
use a relay to switch a 230v ac mains circuit. There is no electrically connection
inside the relay between the two circuits; the link is magnetic and mechanical.

The coil of a relay passes relatively large current, typically 30mA for a 12v
relay, but it can be as much as 100mA for relays designed to operate from lower
voltages. Most chips cannot provide this current and transistor. Usually used to
amplify the small IC current to the larger value required for the relay coil. The
maximum output current for the popular 555timer IC is 200ma, so these devices
can supply relay coils directly without amplifications.

Relays usually SPDT or DPDT but they can have more sets of switch
contacts, for example relays with four sets of change over contacts are readily
available.

Most relays are designed for PCB mounting but you can solder wires
directly to the pins providing you take care to avoid melting the plastic case of the
relay.

18
The supplier’s catalogue should show you relay connection. The coil will
be obvious and it may be connected either way round. Relay coils produce brief
high voltage spikes. When they are switched off and this can be destroying
transistors and IC’s in the circuit. To prevent damage, we must connect a
protection diode across a relay coil. The figure shows a working relay with its coil
and switch contacts. You can see the lever on the being attracted by magnetism
when the coil is switched on. This lever moves the switches contacts.

Fig1.8 Diagram of relay

The relay’s switch connections are usually labeled COM, NC, and NO:

 COM= common, always connect to this; it is the moving part of the switch.

 NC=normally closed, COM is connected to this when relay is off.

 NO=normally open, COM is connected to this when relay is no.

 Connect to COM and NO if you want the switched circuit to be on when the
relay coil is on.

 Connect to COM and NC if you want the switched circuit to be on when the
relay coil is off.
Choosing a Relay:

You need to consider several features in choosing a relay.

19
1. Physical size and pin arrangement:

If you are choosing a relay for an existing PCB you will need to ensures
that its dimension and pin arrangement are suitable.

2. Coil voltage:

The relays coil voltage rating and resistance must suite the circuit
powering the relay coil. Many relay coil. Many relays have a coil rated for a 12v
supply but 5v and 12v relays are readily available. Some relays operate perfectly
well with a supply voltage which is little lower than rated value.

3. Coil resistance:

The circuit must be able to supply the current required by the relay coil.
We can use ohms law to calculate:

Relay coil current= Supply voltage/ Coil resistance

For example: A 12v supply relay with a coil resistance of 400ohms passes a
current of 30ma. This is ok for 555timer IC (maximum output current 200ma), but
it is too much for most ICs and they will require a transistor to amplify the current.

4. Switch ratings (voltage and current):

The relays switch contacts must be suitable for the circuit they are to
control. We will need to check the voltage and current ratings. Note that the
voltage rating is usually higher for AC, for example:”5A AT 24VDC OR 125V
AC”.

5. Switch contacts arrangement (SPDT, DPDT etc):

20
Most relays are SPDT or DPDT which are often described as’ single pole
changeover” (SPCO) or” double pole changeover”(DPCO).

Advantages of relays:

 Relays can switch AC and CD, transistors can only switch CD.
 Relays can switch high voltages, transistors cannot.
 Relay are a better choice for switching large currents (>5a).
 Relay can switch many contacts at once.
Disadvantages of relays:

 Relays are bulkier than transistors for switching small currents.


 Relays cannot switch rapidly (except reed relays), transistors can switch
many times per second. Relays use more power due to the current following
through their coil. Relays require more current than many chips can provide,
so a low power transistor may be needed to switch the current for the relays
coil.

21
CHAPTER 4

IMPLEMENTATION

4.1. HARDWARE IMPLEMENTATION:

The Arduino Uno can be programmed with the Arduino software


(download). Select "Arduino Uno from the Tools > Board menu (according to the
microcontroller on your board). For details, see the reference and tutorials.

The ATmega328 on the Arduino Uno comes pre burned with a boot loader
that allows you to upload new code to it without the use of an external hardware
programmer. It communicates using the original STK500 protocol (reference, C
header files). You can also bypass the boot loader and program the microcontroller
through the ICSP (In-Circuit Serial Programming) header; see these instructions
for details. The ATmega16U2 (or 8U2 in the rev1 and rev2 boards) firmware
source code is available. The ATmega16U2/8U2 is loaded with a DFU boot
loader, which can be activated by:

 On Rev1 boards: connecting the solder jumper on the back of the board (near
the map of Italy) and then resetting the 8U2.

 On Rev2 or later boards: there is a resistor that pulling the 8U2/16U2 HWB
line to ground, making it easier to put into DFU mode. You can then use
Atmel's FLIP software (Windows) or the DFU programmer (Mac OS X and
Linux) to load a new firmware. Or you can use the ISP header with an external
programmer (overwriting the DFU boot loader). See this user-contributed
tutorial for more information.

4.1.1. Automatic (Software) Reset:


Rather than requiring a physical press of the reset button before an upload,
the Arduino Uno is designed in a way that allows it to be reset by software running

22
on a connected computer. One of the hardware flow control lines (DTR) of the
ATmega8U2/16U2 is connected to the reset line of the ATmega328via a 100 nano
farad capacitor. When this line is asserted (taken low), the reset line drops long
enough to reset the chip. The Arduino software uses this capability to allow you to
upload code by simply pressing the upload button in the Arduino environment.
This means that the boot loader can have a shorter timeout, as the lowering of DTR
can be well-coordinated with the start of the upload. This setup has other
implications. When the Uno is connected to either a computer running Mac OS X
or Linux, it resets each time a connection is made to it from software (via USB).
For the following half-second or so, the boot loader is running on the Uno. While it
is programmed to ignore malformed data (i.e. anything besides an upload of new
code), it will intercept the first few bytes of data sent to the board after a
connection is opened. If a sketch running on the board receives one-time
configuration or other data when it first starts, make sure that the software with
which it communicates waits a second after opening the connection and before
sending this data. The Uno contains a trace that can be cut to disable the auto-reset.
The pads on either side of the trace can be soldered together to re-enable it. It's
labeled "RESET-EN". You may also be able to disable the auto-reset by
connecting a 110 ohm resistor from 5V to the reset line; see this forum thread for
details.

4.1.2. USB Over current Protection:

The Arduino Uno has a resettable poly fuse that protects your computer's
USB ports from shorts and over current. Although most computers provide their
own internal protection, the fuse provides an extra layer of protection. If more than
500 mA is applied to the USB port, the fuse will automatically break the
connection until the short or overload is removed.

23
4.1.3. Physical Characteristics:
The maximum length and width of the Uno PCB are 2.7 and 2.1 inches
respectively, with the USB connector and power jack extending beyond the former
dimension. Four screw holes allow the board to be attached to a surface or case.
Note that the distance between digital pins 7 and 8 is 160 mil (0.16"), not an even
multiple of the 100 mil spacing of the other pins.

4.2. HOW TO GET STARTED WITH ARDUINO:

So, you decided to go and buy yourself an Arduino, but once it arrived,
you realized you have no idea what to do with it. Do not panic, for help is at
hand! In this how-to, we will look at how to get started with Arduino
microcontroller boards. We’ll cover software installation, as well as connecting
and configuring the Arduino IDE.

You Will Need:

 Arduino Uno

 USB B Cable

 Windows 10, Windows 8, Windows 7, Mac, or Linux OS

 Arduino IDE

 About 15 minutes

Step 1: Download and Install the IDE:

You can download the IDE from the official Arduino website. Since the
Arduino uses a USB to serial converter (which allow it to communicate with the
host computer), the Arduino board is compatible with most computers that have
a USB port. Of course, you will need the IDE first. Luckily, the Arduino

24
designers have released multiple versions of the IDE for different operating
systems, including Windows, Mac, and Linux. In this tutorial, we will use
Window 10, so ensure that you download the correct version of the IDE if you
do not have Windows 10.

Once downloaded, install the IDE and ensure that you enable most (if not
all) of the options, INCLUDING the drivers.

Step 2: Get the Arduino COM Port Number:

Next, you’ll need to connect the Arduino Uno board to the computer. This
is done via a USB B connection. Thanks to the wonderful world of USB, we do
not need to provide power to the Arduino, as the USB provides 5V up to 2A.
When the Arduino is connected, the operating system should recognize the
board as a generic COM port (for example, my Arduino Uno uses a CH340G,
which is an RS-232 serial to USB converter). Once it’s recognized, we will need
to find out what port number it has been assigned. The easiest way to do this is
to type “device manager” into Windows Search and select Device Manager
when it shows.

25
Finding the device manager option in Windows 10

In the Device Manager Window, look for a device under “Ports (COM &
LPT) and chances are the Arduino will be the only device on the list. In my
Device Manager, the Arduino shows up as COM7 (I know this because CH340
is in the device name).

The Arduino in my case is a CH340, and it shows on COM7 (port 7).

Be warned, the Arduino won’t always be recognized automatically. If


your Arduino is not recognized. Then uninstall the driver, remove the Arduino,
reinsert the Arduino, find the unrecognized device, right click “Update driver”,
and then click “Search automatically”. This should fix 99 out of 100 problems.

If the Arduino is not recognized, update the driver.

26
In the window that appears, click “Search automatically”.

Windows can be a real pain sometimes with COM ports, as it can


magically change their numbers between connections. In other words, one day,
your Arduino may be on port 7 (as shown here), but then on other days,
Windows may shift it to a different port number. As I understand it, this
happens when you connect other COM ports to your system (which I do
frequently).

So, if you can’t find your Arduino on the port that you usually use, just go
to your Device Manager and check what port it’s actually on and, if necessary,
update your driver.

27
Step 3: Configure the IDE:

Now that we have determined the COM port that the Arduino is on, it’s
time to load the Arduino IDE and configure it to use the same device and port.
Start by loading the IDE. Once it’s loaded, navigate to Tools > Board > Arduino
Uno. However, if you are using a different board (i.e., not the Arduino Uno),
you must select the proper board!

Tell the IDE which board you are using.

28
Next, you must tell the IDE which COM port the Arduino is on. To do
this, navigate to Tools > Port > COM7. Obviously, if your Arduino is on a
different port, select that port instead.

Step 4: Loading a Basic Example:

For the sake of simplicity, we will load an example project that the
Arduino IDE comes with. This example will make the onboard LED blink for a
second continuously. To load this example, click File > Examples > 01.Basics >
Blink.

Load the blink example.

29
With the example loaded, it’s time to verify and upload the code. The
verify stage checks the code for errors, and then compiles the ready-for-
uploading code to the Arduino. The upload stage actually takes the binary data,
which was created from the code, and uploads it to the Arduino via the serial
port. To verify and compile the code, press the check mark button in the upper
left window.

The “Verify” button will compile the Arduino code.

30
If the compilation stage was successful, you should see the following
message in the output window at the bottom of the IDE. You might also see a
similar message—just it’s one that does not have words like “ERROR” and
“WARNING”.

This is a successful compilation.

With the code compiled, you must now upload it the Arduino Uno. To do
this, click the arrow next to the check mark.

The “Upload” button will program the Arduino with your code.

31
1.4. SOFTWARE IMPLEMENTATION:

The Arduino integrated development environment (IDE) is a cross-platform


application written in Java, and is derived from the IDE for the Processing
programming language and the Wiring projects. It includes a code editor which is
capable of compiling and uploading programs to the board with a single click. A
program or code written for Arduino is called a "sketch”.

Following are the steps involved:


1. Open Arduino IDE as shown below

32
Arduino programs are written in C or C++. The Arduino IDE comes with a
software library called "Wiring" from the original Wiring project, which makes
many common input/output operations much efficient. Users only need define two
functions to make a runnable cyclic executive 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

2. Select the COM Port from tools

3. Select the required Arduino board from Tools

33
4. Write the sketch in Arduino IDE

5. Compile and upload the Sketch to Arduino board

34
GETTING STARTED WITH NODEMCU USING ARDUINO IDE:

Introduction:

NodeMCU is Lua based firmware of ESP8266. Generally, ESPlorer IDE is


referred for writing Lua scripts for NodeMCU. It requires to get familiar with
ESPlorer IDE and Lua scripting language.

There is another way of developing NodeMCU with a well-known IDE i.e.


Arduino IDE. We can also develop NodeMCU applications using Arduino
development environment. This makes things easy for Arduino developers than
learning new language and IDE for NodeMCU.

Let’s see about setting up Arduino IDE with NodeMCU.

35
First Download Arduino IDE (version
1.6+) https://www.arduino.cc/en/Main/Software

 Open Arduino IDE and Go to File -> Preference.

 Now on Preference window, Enter below link in Additional Boards


Manager URLs

http://arduino.esp8266.com/stable/package_esp8266com_index.json

36
 Now close Preference window and go to Tools -> Board -> Boards
Manager

37
 In Boards Manager window, Type esp in the search box, esp8266 will be
listed there below. Now select latest version of board and click on install.

 After installation of the board is complete, open Tools->Board->and select


NodeMCU 1.0 (ESP-12E Module).

38
 Now Your Arduino IDE is ready for NodeMCU

Example:

Let’s see how to write simple serial print sketch using Arduino IDE for
NodeMCU.

First connect NodeMCU Development Kit with PC as shown in below figure.

39
NodeMCU connection with PC

 After setting up Arduino IDE for NodeMCU, open Arduino IDE and write
simple sketch of serial print as shown in below figure.

40
Arduino Sketch:

void setup() {

Serial.begin(9600); /* initialise serial communication */

void loop() {

Serial.println("Smart Shopping Cart System");

/* print Electronic Wings at new line per second */

delay(1000);

41
 Ensure that you have selected the correct board as shown in below
figure. Also make sure that you have selected the appropriate COM
port.

 Now compile & upload the written sketch directly to the NodeMCU Dev
Kit by clicking on upload button.

42
 Now Click on Serial Monitor (upper right corner) option to check output
on serial monitor window of Arduino IDE.

 Serial monitor output window will pop up with output as shown in below
figure.

43
CHAPTER 5

SOFTWARE DESCRIPTION

5.1. Embedded C Language:

Embedded C Programming is the soul of the processor functioning inside


each and every embedded system we come across in our daily life, such as mobile
phone, washing machine, and digital camera.
Each processor is associated with embedded software. The first and foremost
thing is the embedded software that decides functioning of the embedded system.
Embedded C language is most frequently used to program the microcontroller.

Embedded C Programming
Earlier, many embedded applications were developed using assembly level
programming. However, they did not provide portability. This disadvantage was
overcome by the advent of various high level languages like C, Pascal, and

44
COBOL. However, it was the C language that got extensive acceptance for
embedded systems, and it continues to do so. The C code written is more reliable,
scalable, and portable; and in fact, much easier to understand.

About C Language:

C language was developed by Dennis Ritchie in 1969. It is a collection of


one or more functions, and every function is a collection of statements performing
a specific task.
C language is a middle-level language as it supports high-level applications and
low-level applications. Before going into the details of embedded C programming,
we should know about RAM memory organization.

Salient features of the language

 C language is software designed with different keywords, data types,


variables, constants, etc.
 Embedded C is a generic term given to a programming language written in
C, which is associated with particular hardware architecture.
 Embedded C is an extension to the C language with some additional header
files. These header files may change from controller to controller.
 The microcontroller 8051 #include<reg51.h> is used.
The embedded system designers must know about the hardware architecture to
write programs. These programs play prominent role in monitoring and controlling
external devices. They also directly operate and use the internal architecture of the
microcontroller, such as interrupt handling, timers, serial communication and other
available features.

Differences between C and Embedded C

45
5.1.1. Differences between C and Embedded C:
The basic additional features of the embedded software

Data types:
The data type refers to an extensive system for declaring variables of
different types like integer, character, float, etc. The embedded C software uses
four data types that are used to store data in the memory.

The ‘char’ is used to store any single character; ‘int’ is used to store integer
value, and ‘float’ is used to store any precision floating point value.

The size and range of different data types on a 32-bit machine is given in the
following table. The size and range may vary on machines with different word
sizes.

46
Data types
Keywords:
There are certain words that are reserved for doing specific tasks. These
words are known as keywords. They are standard and predefined in the Embedded
C.

Keywords are always written in lowercase. These keywords must be defined


before writing the main program. The basic keywords of embedded software are
given below:

Keywords
sbit: This data type is used in case of accessing a single bit of SFR register.
 Syntax: sbit variable name = SFR bit;
 Ex: sbit a=P2^1;

47
 Explanation: If we assign p2.1 as ‘a’ variable, then we can use ‘a’ instead of
p2.1 anywhere in the program, which reduces the complexity of the
program.

Bit: This data type is used for accessing the bit addressable memory of RAM (20h-
2fh).
 Syntax: bit variable name;
 Ex: bit c;
 Explanation: It is a bit sequence setting in a small data area that is used by a
program to remember something.

SFR: This data type is used for accessing a SFR register by another name. All the
SFR registers must be declared with capital letters.
 Syntax: SFR variable name = SFR address of SFR register;
 Ex: SFR port0=0x80;
 Explanation: If we assign 0x80 as ‘port0’, then we can use 0x80 instead of
port0 anywhere in the program, which reduces the complexity of the
program.

SFR Register: The SFR stands for ‘Special Function Register’. Microcontroller
8051 has 256 bytes of RAM memory. This RAM is divided into two parts: the first
part of 128 bytes is used for data storage, and the other of 128 bytes is used for
SFR registers. All peripheral devices like I/O ports, timers and counters are stored
in the SFR register, and each element has a unique address.

The Structure of an Embedded C Program

 Comments
 preprocessor directives

48
 global variables
 main() function
{
local variables
statements
…………..
…………..
}

fun(1)
{

local variables
statements
…………..
…………..
}

Comments: In embedded C programming language, we can place comments in


our code which helps the reader to understand the code easily.
C=a+b; /* add two variables whose value is stored in another
variable C*/

Preprocessor directives: All the functions of the embedded C software are


included in the preprocessor library like “#includes<reg51.h>, #defines”. These
functions are executed at the time of running the program.

49
Global variable: A global variable is a variable that is declared before the main
function, and can be accessed on any function in the program.

Global variable
Local variable: A local variable is a variable declared within a function, and it is
valid only to be used within that function.

Local variable
Main () function: The execution of a program starts with the main function. Every
program uses only one main () function.
Advantages of embedded C program

 Its takes less time to develop application program.


 It reduces complexity of the program.
 It is easy to verify and understand.
 It is portable in nature from one controller to another.
We hope that we have been successful in providing an easy and
approachable way for the beginners of Embedded C programming. Better

50
understanding of the Embedded C programming is the most essential prerequisite
for designing embedded based projects.

5.2. WEB SERVER:

A web server (sometimes called an HTTP server or application server) is a


program that serves content using the HTTP protocol. This content is frequently in
the form of HTML documents, images, and other web resources, but can include
any type of file. The content served by the web server can be pre-existing (static
content) or generated on the fly (dynamic content). In order to be considered a web
server, an application must implement the HTTP protocol. Applications built on
top of web servers (such as blogging software, forums, or wikis) belong in the
separate web software category. A user agent, commonly a web browser or web
crawler, initiates communication by making a request for a specific resource using
HTTP and the server responds with the content of that resource or an error
message if unable to do so. The resource is typically a real file on the server's
secondary storage, but this is not necessarily the case and depends on how the web
server is implemented.

While the primary function is to serve content, a full implementation of


HTTP also includes ways of receiving content from clients. This feature is used for
submitting web forms, including uploading of files. Web servers are not only used
for serving the World Wide Web. They can also be found embedded in devices
such as printers, routers, webcams and serving only a local network. The web
server may then be used as a part of a system for monitoring or administering the
device in question. This usually means that no additional software has to be
installed on the client computer, since only a web browser is required (which now
is included with most operating systems).

51
5.3. ESP8266 FRAMEWORK:
ESP modules are available from a variety of sources, and the firmware
contained in the ESP8266 chips on the modules is almost always outdated and
often of questionable origin. The firmware "updates" and tools that are available
from these same sources are also sometimes suspect. Consequently, it is the aim of
this article to document a procedure for downloading the latest available firmware
directly from Espresso if and installing it on an ESP8266 using the flash tool
provided by Espresso. In order to update the firmware on any ESP8266, it is
necessary to have it properly powered and connected to a PC. In addition, a means
of resetting the IC and putting it in the download mode must be provided. The
schematic diagram and photograph below show the recommended setup; note that
the wire colors in the schematic correspond to the wire colors.

5.4 GOOGLE ASSISTANT:


The Google Assistant is software which allows its users to control all the
apps in their device to be controlled directly through it. It allows the users to
control and command most of the apps in their devices using voice commands.
This provides more convenience to the people as they only have to command the
google assistant thorough voice command.

52
CHAPTER 6

TESTING AND DEBUGING

1.1. INSTALLING THE SOFTWARE:


Follow the instructions on the Getting Started section of the Arduino web
site, http://arduino.cc/en/Guide/HomePage. Go all the way through the steps to
where you see the pin 13 LED blinking. This is the indication that you have all
software and drivers successfully installed and can start exploring with your own
programs.

1.2. CONNECTING A BATTERY:

For stand-alone operation, the board is powered by a battery rather than


through the USB connection to the computer. While the external power can be
anywhere in the range of 6 to 24 V (for example, you could use a car battery), a
standard 9 V battery is convenient. While you could jam the leads of a battery
snap into the Vin and GND connections on the board, it is better to solder the
battery snap leads to a DC power plug and connect to the power jack on the
board. A suitable plug is part number 28760 from. Here is what this looks like.

1.3. MOVING ON:

Connect your Arduino to the computer with the USB cable. You do not
need the battery for now. The green PWR LED will light. If there was already a
program burned into the Arduino, it will run. Start the Arduino development
environment. In Arduino-speak, programs are called “sketches”, but here we
will just call them programs.

53
In the editing window that comes up, enter the following program, paying
attention to where semi-colons appear at the end of command lines.

void setup() {

Serial.begin(9600);

Serial.println("Hello World");

void loop() {

Your window will look something like this:

 Click the Upload button or Ctrl-U to compile the program and load on
the Arduino board.

 Click the Serial Monitor button . If all has gone well, the monitor
window will show your message and look something like this

54
1.4. TROUBLE SHOOTING:
If there is a syntax error in the program caused by a mistake in typing, an
error message will appear in the bottom of the program window. Generally,
staring at the error will reveal the problem. If you continue to have problems, try
this idea

 Run the Arduino program again


 Check that the USB cable is secure at both ends.
 Reboot your PC because sometimes the serial port can lock up
 If a “Serial port…already in use” error appears when uploading
 Ask a friend for help.

55
1.5. FLASHING AN LED:
Light emitting diodes (LED's) are handy for checking out what the Arduino can
do.. For this task, you need an LED, a 330 ohm resistor, and some short pieces of
22 or 24 g wire. The figure to the right is a sketch of an LED and its symbol used
in electronic schematics Using 22 g solid wire, connect the 5V power pin on the
Arduino to the bottom red power bus on the breadboard and the Gnd pin on the
Arduino to the bottom blue power buss on the breadboard. Connect the notched or
flat side of the LED (the notch or flat is on the rim that surrounds the LED base;
look carefully because it can be hard to find) to the Gnd bus and the other side to a
free hole in main area of the breadboard Place the resistor so that one end is in the
same column as the LED and the other end is in a free column. From that column,
connect a wire to digital pin 2 on the Arduino board. Your setup will look
something like this

void setup() {

pinMode(2,OUTPUT);

digitalWrite(2,HIGH);

delay(1000);

digitalWrite(2,LOW);

void loop() {

1.6. DEBUGGING:

56
Embedded debugging may be performed at different levels, depending on
the facilities available. From simplest to most sophisticate they can be roughly
grouped into the following areas:

 Interactive resident debugging, using the simple shell provided by the


embedded operating system (e.g. Forth and Basic)

 External debugging using logging or serial port output to trace operation


using either a monitor in flash or using a debug server like the Remedy
Debugger which even works for heterogeneous multi core systems.

 An in-circuit debugger (ICD), a hardware device that connects to the


microprocessor via a JTAG or Nexus interface. This allows the operation of
the microprocessor to be controlled externally, but is typically restricted to
specific debugging capabilities in the processor.

 An in-circuit emulator replaces the microprocessor with a simulated


equivalent, providing full control over all aspects of the microprocessor.

 A complete emulator provides a simulation of all aspects of the hardware,


allowing all of it to be controlled and modified and allowing debugging on a
normal PC.

 Unless restricted to external debugging, the programmer can typically load


and run software through the tools, view the code running in the processor,
and start or stop its operation. The view of the code may be as assembly
code or source-code.

Because an embedded system is often composed of a wide variety of


elements, the debugging strategy may vary. For instance, debugging a software
(and microprocessor) centric embedded system is different from debugging an
embedded system where most of the processing is performed by peripherals (DSP,

57
FPGA, and co-processor). An increasing number of embedded systems today use
more than one single processor core. A common problem with multi-core
development is the proper synchronization of software execution. In such a case,
the embedded system design may wish to check the data traffic on the busses
between the processor cores, which requires very low-level debugging, at
signal/bus level, with a logic analyzer, for instance.

CHAPTER 7

APPLICATIONS, ADVANTAGES AND FUTURE SCOPE

7.1. APPLICATIONS:

Applications of RFID based Device Control and Authentication:

1) This project can be used in Industries, Shopping malls, Office.

7.2. ADVANTAGES:

 Easy installation and use.

 Low cost

7.3. FUTURE SCOPE:

Android app will also develop for easily use. In Android app there will be
direct buttons for ON or OFF the system or to receive the OTP. For more security
purpose camera module can also be implemented on the system. If any person

58
attempt to enter in home with more than three time wrong password then at that
time camera module will be activate. And camera module will capture the image of
person who trying to attack on system. It can use antivirus so that hacking of the
system can be difficult.

7.4. PROBLEMS FACED:


In this system Wi-Fi module is a very important part for communication
between mobile phone and microcontroller. Wi-Fi module requires only 3.3v
power whereas the Relay board needs more power. Thus separate power will be
given to both the relay and microcontroller. Connection between the
microcontroller and Wi-Fi module and relay should not be loose if it is loose the
system will not work properly.

59
CONCLUSION

In this paper, a novel architecture for low cost and flexible home
Automation system using Arduino microcontroller is proposed and implemented.
Overall Arduino is easy to understand & its coding is easy. By implementing this
type of system we can ensure that the energy conservation can be done. By help of
this system we can increase the efficiency of the appliances .we can have the
complete control over the home appliances from a long distance. This will Increase
the comfortability of human being and it will reduce the Human efforts.

60
REFERENCES

[1]. Raj Sharma, Chirag, Pranjalkatara, Vishnu Shankar “Proceedings of IEEE

TechSym 2014 Satellite Conference VIT University, Paper on Advanced Low-


Cost Security system using sensors, Arduino and GSM communication
module”.
[2]. DeepaliJavale, Mohd. Mohsen, Shreerang Nandewar, MayurShingate, “Home

Automation and Security using Android ADK”, March, 2013.


[3]. E. Yavuz, B. Hasan, I. Serkan and K. Duygu. "Safe and Secure PIC Based

Remote Control Application for Intelligent Home”, a. Volume 7, No. 5, May-


2007.
[4]. N. Sriskanthan and Tan Karand. "Bluetooth Based Home Automation System".

Journal of Microprocessors and Microsystems, Vol. a. 26, pp.281-289, 2002.


[5]. Kusuma S M, Assistant Professor, Department of telecommunication, MSRIT,

Bangalore, India. “Home Automation Using Internet of Things” July 1999.


[6]. NiharikaShrotriya, Anjali Kulkarni, PritiGadhave, International Journal of

Science, Engineering and Technology Research (IJSETR), “SMART HOME


USING WI-FI” December 1996.

61
APPIENDICES

SCHEMATIC DIAGRAM:

CODE:

#include <ESP8266WiFi.h>

#include <Adafruit_MQTT.h>

#include <Adafruit_MQTT_Client.h>

#define Relay1 D6

#define nw_led D4

#define WLAN_SSID "Raspberry Pi" // Your SSID

#define WLAN_PASS "GR426374" // Your password

62
/************************* Adafruit.io Setup
*********************************/

#define AIO_SERVER "io.adafruit.com" //Adafruit Server

#define AIO_SERVERPORT 1883

#define AIO_USERNAME "project_09" // Username

#define AIO_KEY "aio_CZGT19oRLZOT6P7A0AdrdeTyVCXV" // Auth


Key

//WIFI CLIENT

WiFiClient client;

Adafruit_MQTT_Client mqtt(&client, AIO_SERVER, AIO_SERVERPORT,


AIO_USERNAME, AIO_KEY);

Adafruit_MQTT_Subscribe Light1 = Adafruit_MQTT_Subscribe(&mqtt,


AIO_USERNAME"/feeds/relay_1"); // Feeds name should be same everywhere

void MQTT_connect();

void setup() {

Serial.begin(115200);

63
pinMode(Relay1, OUTPUT);

pinMode(nw_led, OUTPUT);

// Connect to WiFi access point.

Serial.println(); Serial.println();

Serial.print("Connecting to ");

Serial.println(WLAN_SSID);

WiFi.begin(WLAN_SSID, WLAN_PASS);

while (WiFi.status() != WL_CONNECTED) {

delay(500);

Serial.print(".");

Serial.println();

Serial.println("WiFi connected");

digitalWrite(nw_led, HIGH);

delay(500);

digitalWrite(nw_led, LOW);

delay(500);

digitalWrite(nw_led, HIGH);

delay(500);

digitalWrite(nw_led, LOW);

64
delay(500);

mqtt.subscribe(&Light1);

void loop() {

MQTT_connect();

Adafruit_MQTT_Subscribe *subscription;

while ((subscription = mqtt.readSubscription(20000))) {

if (subscription == &Light1) {

Serial.print(F("Got: "));

Serial.println((char *)Light1.lastread);

int Light1_State = atoi((char *)Light1.lastread);

digitalWrite(Relay1, Light1_State);

void MQTT_connect() {

int8_t ret;

65
if (mqtt.connected()) {

return;

Serial.print("Connecting to MQTT... ");

uint8_t retries = 3;

while ((ret = mqtt.connect()) != 0) {

Serial.println(mqtt.connectErrorString(ret));

Serial.println("Retrying MQTT connection in 5 seconds...");

mqtt.disconnect();

delay(5000);

retries--;

if (retries == 0) {

while (1);

Serial.println("MQTT Connected!");

66

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy