Thesis Matter
Thesis Matter
Thesis Matter
1.1 Introduction
Just imagine, how beneficial it will be to be able to switch on our air condition
for half an hour before we reach our home in the summertime. When we leave our
home for some work without realizing that some appliances such as fans, air
conditioners, and lights are on; then by using our mobile phone or internet, we are able
to turn off power to those devices. It will be even more useful if the system detects
unauthorized movement in the house and alerts us or sends messages on our mobile
phones or we can know the status of our house anytime. Such systems provide security
from natural, incidental, intended, unintended, accidental and human made problems
by continuously monitoring homes with different sensory systems like motion, smoke,
gas, temperature, glass break or door break detectors and fire alarm systems. Security
is a big challenge everywhere because thefts are increasing day by day owing to the
unsafe and insecure security systems in homes, commercial complexes and industries.
Several conventional technologies are available to keep home properties safe from
intruders, but most common smart home security systems work on wireless GSM
communication.
1
new technologies are coming up. One of the latest, emerging, and trending
technologies
2
is the ‘Internet of Things’. This technology is expected to rule the world within a few
years. Home Automation System uses the technology of the Internet of Things for
monitoring and controlling the electrical and electronic appliances at home from any
remote location by simply using a Smartphone. The implementation of a low-cost,
flexible home automation system is presented. It enhances the use of wireless
communication which provides the user with remote control of various electronic and
electrical appliances.
3
1.2 EXISTING SYSTEM
4
CHAPTER-2
PROPOSED SYSTEM
5
2.1 Description
Monitoring and controlling wireless devices with IoT and Arduino involves
using an Arduino board connected to sensors and actuators. The Arduino collects data
from sensors and communicates with the IoT platform over the internet using Wi-Fi or
other wireless modules. The IoT platform processes and stores the data, allowing
remote monitoring through a web or mobile app. Control signals can also be sent to
the Arduino to actuate devices. Security measures are implemented to protect data and
ensure the system's reliability.
• Security. ...
• Installation. ...
• Cost.
6
4. Healthcare: Tracking vital signs and medication adherence for remote
patient monitoring and telemedicine.
8. Wearable Devices: Tracking fitness metrics and health data for personal
well-being.
7
CHAPTER-3
HARDWARE DESCRIPTION
9
MIT's Handy board, and numerous others offer comparative usefulness. These
apparatuses take the chaotic subtle elements of microcontroller programming and
wrap them up in a simple to-utilize bundle. Arduino additionally rearranges the
methodology of working with microcontrollers; moreover, it offers some advantages
for instructors, students, and intrigued individuals:
• Inexpensive - Arduino boards are moderately cheap compared with other
microcontroller boards. The cheapest version of the Arduino module can be amassed
by hand, and even the preassembled Arduino modules cost short of $50.
• Cross-platform - The Arduino programming runs multiple operating systems
Windows, Macintosh OSX, and Linux working frameworks. So, we conclude that
Arduino has an advantage as most microcontroller frameworks are constrained to
Windows.
• Straightforward, clear programming method - The Arduino programming
environment is easy to use for novices, yet sufficiently versatile for cutting-edge
customers to adventure as well. For educators, it favourably engaged around the
Processing programming environment, so
understudies finding ways to understand how to program in that environment will be
familiar
with the nature of Arduino.
10
3.1 Arduino UNO:
The Arduino UNO is a microcontroller board based on the ATmega328
(datasheet). It has 14 digital input/output pins (of which 6 can be used as PWM
outputs), 6 Analog inputs, a 16 MHz crystal oscillator, a USB connection, a power
jack, an ICSP header, and a reset button. It contains everything needed to support the
microcontroller; simply connect it to a computer with a USB cable or power it with an
AC-to-DC adapter or battery to get started. The Uno differs from all preceding boards
in that it does not use the FTDI USB-to-serial driver chip. Instead, it features the
Atmega8U2 programmed as a USB-to-serial converter. "Uno" means one in Italian and
is named to mark the upcoming release of Arduino 1.0. The Uno and version 1.0 will
be the reference versions of Arduino, moving forward. The Uno is the latest in a series
of USB Arduino boards, and the reference model for the Arduino platform;
11
DC Current for 3.3V Pin 50 mA
Flash Memory
32 KB of which 0.5 KB was used by
bootloader
SRAM 2 KB
EEPROM 1 KB
Clock Speed 16 MHz
POWER
The Arduino Uno can be powered via a USB connection or with an external
power supply. The power source is selected automatically.
12
be unstable. If using more than 12V, the voltage regulator may overheat and damage
the board. The recommended range is 7 to 12 volts.
• VIN. The input voltage to the Arduino board when it's using an external power
source (as opposed to 5 volts from the USB connection or other regulated power
source). You can supply voltage through this pin, or, if supplying voltage via the
power jack, access it through this pin.
• 5V. The regulated power supply is used to power the microcontroller and other
components on the board. This can come either from VIN via an on-board regulator,
or be supplied by USB or another regulated 5V supply.
MEMORY:
The Atmega328 has 32 KB of flash memory for storing code (of which 0,5
KB is used for the bootloader); It has also 2 KB of SRAM and 1 KB of EEPROM
(which can be read and written with the EEPROM library).
INPUT/OUTPUT
Each of the 14 digital pins on the Uno can be used as an input or output,
using PinMode(), digitalWrite(), and digitalRead() functions. They operate at 5 volts.
Each pin can provide or receive a maximum of 40 mA and has an internal pull-up
resistor (disconnected by default) of 20-50 KOhms. In addition, some pins have
specialized functions:
13
• Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data.
These pins are connected to the corresponding pins of the ATmega8U2 USB-to-TTL
Serial chip.
• PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite()
function.
• LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH
value, the LED is on, when the pin is LOW, it's off. The Uno has 6 Analog inputs,
each of which provides 10 bits of resolution (i.e. 1024 different values). By default
they measure from ground to 5 volts, though is it possible to change the upper end of
their range using the AREF pin and the analogReference() function? Additionally,
some pins have specialized functionality:
• I 2C: 4 (SDA) and 5 (SCL). Support I2C (TWI) communication using the Wire
library. There are a couple of other pins on the board:
• AREF. Reference voltage for the Analog inputs. Used with analogReference().
• Reset. Bring this line LOW to reset the microcontroller. Typically used to add a
reset button to shields that block the one on the board.
Communication:
The Arduino Uno has several facilities for communicating with a computer,
another Arduino, or other microcontrollers. The ATmega328 provides UART TTL
(5V) serial communication, which is available on digital pins 0 (RX) and 1 (TX). An
ATmega8U2 on the board channels this serial communication over USB and appears
as a virtual COM port to software on the computer. The '8U2 firmware uses the
standard
14
USB COM drivers, and no external driver is needed. However, on Windows, an *.inf
file is required.
The Arduino software includes a serial monitor that allows simple textual
data to be sent to and from the Arduino board. The RX and TX LEDs on the board
will flash when data is being transmitted via the USB-to-serial chip and USB
connection to the computer (but not for serial communication on pins 0 and 1).
The ATmega328 also supports I2C (TWI) and SPI communication. The
Arduino software includes a Wire library to simplify the use of the I2C bus; see the
documentation for details. To use the SPI communication, please see the ATmega328
datasheet.
Programming
The Arduino Uno can be programmed with the Arduino software. The
ATmega328 on the Arduino Uno comes pre-burned with a bootloader 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 headerfiles). You can
also bypass the bootloader 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 bootloader, 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. 10 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 bootloader). See this user-contributed
tutorial for more information.
15
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 on
a connected computer. One of the hardware flow control lines (DTR) of the
ATmega8U2/16U2 is connected to the reset line of the ATmega328 via 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 bootloader 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 bootloader 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. 11
The Arduino Uno has a resettable polyfuse that protects your computer's
USB ports from shorts and overcurrent. Although most computers provide their
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.
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
16
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.
3.2 LCD:
17
3.2.2 LCD 16×2 Pin Diagram
Pin1 (Ground/Source Pin): This is a GND pin of display, used to connect the GND
terminal of the microcontroller unit or power source.
Pin2 (VCC/Source Pin): This is the voltage supply pin of the display, used to
connect the supply pin of the power source.
Pin3 (V0/VEE/Control Pin): This pin regulates the difference of the display, used
to connect a changeable POT that can supply 0 to 5V.
Pin4 (Register Select/Control Pin): This pin toggles among command or data
register, is used to connect a microcontroller unit pin, and obtains either 0 or 1(0 =
data mode, and 1 = command mode).
Pin5 (Read/Write/Control Pin): This pin toggles the display among the read or
write operation, and it is connected to a microcontroller unit pin to get either 0 or 1
(0 = Write Operation and 1 = Read Operation).
Pin 6 (Enable/Control Pin): This pin should be held high to execute the Read/Write
process, and it is connected to the microcontroller unit & constantly held high.
Pins 7-14 (Data Pins): These pins are used to send data to the display. These pins
are connected in two-wire modes like 4-wire mode and 8-wire mode. In the 4-wire
mode, only four pins are connected to the microcontroller unit like 0 to 3, whereas
in the 8- wire mode, 8-pins are connected to the microcontroller unit like 0 to 7.
Pin15 (+ve pin of the LED): This pin is connected to +5V)
Pin 16 (-ve pin of the LED): This pin is connected to GND).
Fig.3.2(b): LCD-16×2-pin-diagram
18
3.2.3 Features of LCD16x2
A 16×2 LCD has two registers like data register and a command register. The
RS (register select) is mainly used to change from one register to another. When the
register set is ‘0’, then it is known as a command register. Similarly, when the register
set is ‘1’, then it is known as a data register.
Command Register
The main function of the command register is to store the instructions of
commands which are given to the display. So that predefined tasks can be performed
such as clearing the display, initializing, setting the cursor place, and display control.
Here command processing can occur within the register.
Data Register
The main function of the data register is to store the information that is to be
exhibited on the LCD screen. Here, the ASCII value of the character is the information
that is to be exhibited on the screen of LCD. Whenever we send the information to
LCD, it transmits to the data register, and then the process starts there. When register
set =1, then the data register will be selected.
19
For Hex Code-01, the LCD command will be the clear LCD screen
For Hex Code-02, the LCD command will be returning home
For Hex Code-04, the LCD command will be decrement cursor
For Hex Code-06, the LCD command will be Increment cursor
For Hex Code-05, the LCD command will be Shift display right
For Hex Code-07, the LCD command will be Shift display left
For Hex Code-08, the LCD command will be Display off, cursor off
For Hex Code-0A, the LCD command will be cursor on and display off
For Hex Code-0C, the LCD command will be cursor off, display on
For Hex Code-0E, the LCD command will be cursor blinking, Display on
For Hex Code-0F, the LCD command will be cursor blinking, Display on
For Hex Code-10, the LCD command will be to Shift the cursor position to the left
For Hex Code-14, the LCD command will be to Shift the cursor position to the right
For Hex Code-18, the LCD command will be Shift the entire display to the left
For Hex Code-1C, the LCD command will be Shift the entire display to the right
For Hex Code-80, the LCD command will Force the cursor to the beginning
(1st line)
For Hex Code-C0, the LCD command will Force the cursor to the beginning
(2nd line)
For Hex Code-38, the LCD command will be 2 lines and a 5×7 matrix
3.3 Relay
Fig.3.3(a): Relay
20
Fig.3.3(b): 5V Single-Channel Relay Module Pinout
2 Ground 0V reference
21
3.3.2 Single-Channel Relay Module Specifications
The following are the major components present in a relay module; we will
get into the details later in this article.
5V Relay, Transistor, Diode, LEDs, Resistors, Male Header pins, 3-pin screw-type
terminal connector, etc.
22
First is the screw terminal block. This is the part of the module that is in
contact with mains so a reliable connection is needed. Adding screw terminals makes
it easier to connect thick main cables, which might be difficult to solder directly. The
three connections on the terminal block are connected to the normally open, normally
closed, and common terminals of the relay.
The second is the relay itself, which, in this case, is a blue plastic case. Lots of
information can be gleaned from the markings on the relay itself. The part number of
the relay on the bottom says “05VDC”, which means that the relay coil is activated at
5V minimum – any voltage lower than this will not be able to reliably close the
contacts of the relay. There are also voltage and current markings, which represent the
maximum voltage and current, the relay can switch. For example, the top left marking
says “10A 250VAC”, which means the relay can switch a maximum load of 10A
when connected to a 250V mains circuit. The bottom left rating says “10A 30VDC”,
meaning the relay can switch a maximum current of 10A DC before the contacts get
damaged.
The 'relay status LED' turns on whenever the relay is active and provides an
indication of current flowing through the relay coil.
The input jumper is used to supply power to the relay coil and LEDs. The
jumper also has the input pin, which when pulled high activates the relay.
The switching transistor takes an input that cannot supply enough current to
directly drive the relay coil and amplifies it using the supply voltage to drive the relay
coil. This way, the input can be driven from a microcontroller or sensor output. The
freewheeling diode prevents voltage spikes when the relay is switched off.
23
3.3.4 How Does A Relay Work?
There are two advantages of this system – First, the current required to activate
the relay is much smaller than the current that relay contacts are capable of switching,
and second, the coil and the contacts are galvanically isolated, meaning there is no
electrical connection between them.
This means that the relay can be used to switch mains current through an
isolated low-voltage digital system like a microcontroller.
LEDs can be added to this basic circuit to act as indicators, sometimes even optical
isolation is added to input to further improve isolation
24
Fig.3.3(e): Internal Circuit of Single-Channel Relay
The extra components apart from the relay are there since it would not be
possible to drive the relay directly from the pins of a microcontroller. digital logic or a
sensor. This is because although the coil consumes much less current than the currents
it can switch, it still needs relatively significant current – low-power relays consume
around 50mA while higher-power relays consume around 500mA. The coil is also an
inductive load, so when the coil is switched off, a large flyback voltage is developed
which can damage the device by turning it on and off. For this reason, a flyback diode
is added anti-parallel to the relay coil to clamp the flyback voltage.
LEDs can be added to this basic circuit to act as indicators, and sometimes
even optical isolation is added to the input to further improve the isolation.
Relay modules like this one are commonly used to drive mains loads from a
microcontroller like the Arduino or a sensor. In cases like this, the common circuit
diagram would be as follows.
25
Fig.3.3(f): How to Use Single-Channel Relay
For simple on/off applications, the relay can be connected as shown above.
One terminal of mains is connected to common, and the other is connected to NO or
NC depending on whether the load should be connected/disconnected when the relay
is active.
Check out the image below to see how the relay module is connected to a
microcontroller and mains source and load.
26
3.3.6 Single-Channel Relay Module Basic Trouble Shooting
If the relay does not switch on, i.e. no audible clicking sound is heard:
The contacts might be stuck - Check by physically shaking the relay, if a light clicking
sound is not heard, then tap the relay hard, in most cases, this should ‘unstick’ both the
contacts.
If the contacts do click when the relay is shaken, then the transistor or the flyback
diode might be damaged and must be replaced.
Mains switching
High current switching
Isolated power delivery
Home automation
3.4 BUZZER
27
Fig.3.4(b): Active Passive Buzzer Pinout
Rated Voltage: 6V DC
Operating Voltage: 4-8V DC
Rated current: <30mA
Sound Type: Continuous Beep
Resonant Frequency: ~2300 Hz
Small and neat sealed package
Breadboard and Perf board friendly
28
3.4.3 How to use a Buzzer
Applications of Buzzer
29
3.5 DHT11 Temperature and Humidity sensor:
30
For the DHT11 Sensor module
DHT11 Specifications
31
3.6.1 Pin Out Configuration Of Ultrasonic Sensor
1 Vcc The Vcc pin powers the sensor, typically with +5V
2 Trigger A trigger pin is an Input pin. This pin has to be kept high for 10us to initialize measurement
by sending a US wave.
3 Echo The echo pin is an Output pin. This pin goes high for a period that will be equal to the time
taken for the US wave to return to the sensor.
32
3.6.3 HC-SR04 Ultrasonic Sensor – Working and Applications
Now, to calculate the distance using the above formulae, we should know the
Speed and time. Since we are using the Ultrasonic Wave we know the universal speed
of US wave at room conditions which is 330m/s. The circuitry built on the module
will calculate the time taken for the US wave to come back and turn on the echo pin
high for that same particular amount of time, this way we can also know the time
taken. Now simply calculate the distance using a microcontroller or microprocessor.
33
How to use the HC-SR04 Ultrasonic Sensor
Power the Sensor using a regulated +5V through the Vcc and Ground pins of the
sensor. The current consumed by the sensor is less than 15mA and hence can be
directly powered by the onboard 5V pins (If available). The Trigger and the Echo pins
are both I/O pins and hence they can be connected to the I/O pins of the
microcontroller. To start the measurement, the trigger pin has to be made high for
10uS and then turned off. This action will trigger an ultrasonic wave at the frequency
of 40Hz from the transmitter and the receiver will wait for the wave to return. Once
the wave is returned after it gets reflected by any object the Echo pin goes high for a
particular amount of time which will be equal to the time taken for the wave to return
to the sensor.
The amount of time during which the Echo pin stays high is measured by the
MCU/MPU as it gives the information about the time taken for the wave to return to
the Sensor. Using this information the distance is measured as explained in the above
heading.
Applications
Used to avoid and detect obstacles with robots like biped robots,
obstacle avoider robots, path-finding robots, etc.
Used to measure the distance within a wide range of 2cm to 400cm
Can be used to map the objects surrounding the sensor by rotating it
Depth of certain places like wells, pits, etc can be measured since the
waves can penetrate through water
In this section we have the Transformer and bridge rectifier, which are
connected serially, and voltage regulators for +5V and +12V (7805 and 7812) via a
capacitor (1000µF) in parallel are connected parallel as shown in the circuit diagram
below. Each voltage regulator output is again connected to the capacitors of values
(100, 10µF, 1 µF, 0.1 µF) are connected parallel through which the corresponding
output(+5V or +12V) is taken into consideration.
1) Transformer
A transformer is a device that transfers electrical energy from one circuit to another
through inductively coupled electrical conductors. A changing current in the first
circuit (the primary) creates a changing magnetic field; in turn, this magnetic field
induces a changing voltage in
35
the second circuit (the secondary). By adding a load to the secondary circuit, one can
make current flow in the transformer, thus transferring energy from one circuit to the
other.
The secondary induced voltage VS, of an ideal transformer, is scaled from the
primary VP by a factor equal to the ratio of the number of turns of wire in their
respective windings:
Basic principle
The transformer is based on two principles: firstly, that an electric current can
produce a magnetic field (electromagnetism) and secondly that a changing magnetic
field within a coil of wire induces a voltage across the ends of the coil
(electromagnetic induction). By changing the current in the primary coil, it changes
the strength of its magnetic field; since the changing magnetic field extends into the
secondary coil, a voltage is induced across the secondary.
36
Fig.3.8(a): An Ideal Step-Down Transformer Showing Magnetic Flux in Core
Induction law
The voltage induced across the secondary coil may be calculated from
Faraday’s law of induction, which states that:
37
Taking the ratio of the two equations for VS and VP gives the basic equation for
stepping up or stepping down the voltage
If the secondary coil is attached to a load that allows current to flow, electrical
power is transmitted from the primary circuit to the secondary circuit. Ideally, the
transformer is perfectly efficient; all the incoming energy is transformed from the
primary circuit to the magnetic field and into the secondary circuit. If this condition is
met, the incoming electric power must equal the outgoing power.
38
If the voltage is increased (stepped up) (VS > VP), then the current is decreased
(stepped down) (IS < IP) by the same factor. Transformers are efficient so this formula
is a reasonable approximation.
If the voltage is increased (stepped up) (VS > VP), then the current is decreased
(stepped down) (IS < IP) by the same factor. Transformers are efficient so this formula
is a reasonable approximation.
The impedance in one circuit is transformed by the square of the turns ratio.
For example, if an impedance ZS is attached across the terminals of the secondary coil,
it appears to the primary circuit to have an impedance of
Detailed operation
39
The changing magnetic field induces an electromotive force (EMF) across
each winding. Since the ideal windings have no impedance, they have no associated
voltage drop, and so the voltages VP and VS measured at the terminals of the
transformer, are equal to the corresponding EMFs. The primary EMF, acting as it does
in opposition to the primary voltage, is sometimes termed the "back EMF". This is due
to Lenz's law which states that the induction of EMF would always be such that it will
oppose development of any such change in magnetic field.
2) Bridge Rectifier
Basic Operation
When the input connected at the left corner of the diamond is positive with
respect to the one connected at the right-hand corner, current flows to the right along
the upper colored path to the output, and returns to the input supply via the lower one.
40
When the right-hand corner is positive relative to the left hand corner, current
flows along the upper colored path and returns to the supply via the lower colored
path
In each case, the upper right output remains positive with respect to the lower
right one. Since this is true whether the input is AC or DC, this circuit not only
produces DC power when supplied with AC power: it also can provide what is
sometimes called "reverse polarity protection". That is, it permits normal functioning
when batteries are installed backwards or DC input-power supply wiring "has its wires
crossed" (and protects the circuitry it powers against damage that might occur without
this circuit in place).
41
Fig.3.10: Wave Forms of Half Wave and Full Wave Rectifier
For many applications, especially with single phase AC where the full-wave
bridge serves to convert an AC input into a DC output, the addition of a capacitor may
be important because the bridge alone supplies an output voltage of fixed polarity but
pulsating magnitude (see diagram above).
42
waveform from the bridge. One explanation of 'smoothing' is that the capacitor
provides a low impedance path to the AC component of the output, reducing the AC
voltage across, and AC current through, the resistive load. In less technical terms, any
drop in the output voltage and current of the bridge tends to be cancelled by loss of
charge in the capacitor.
This charge flows out as additional current through the load. Thus, the change
of load current and voltage is reduced relative to what would occur without the
capacitor. Increases of voltage correspondingly store excess charge in the capacitor,
thus moderating the change in output voltage / current. Also see rectifier output
smoothing.
Because a bleeder sets a minimum current drain, the regulation of the circuit,
defined as percentage voltage change from minimum to maximum load, is improved.
However, in many cases the improvement is of insignificant magnitude.
The capacitor and the load resistance have a typical time constant τ = RC
where C and R are the capacitance and load resistance respectively. As long as the
load resistor is large enough so that this time constant is much longer than the time of
one ripple cycle, the above configuration will produce a smoothed DC voltage across
the load.
In some designs, a series resistor at the load side of the capacitor is added. The
smoothing can then be improved by adding additional stages of capacitor–resistor
pairs, often done only for sub-supplies to critical high-gain circuits that tend to be
sensitive to supply voltage noise.
43
The idealized waveforms shown above are seen for both voltage and current
when the load on the bridge is resistive. When the load includes a smoothing
capacitor, both the voltage and the current waveforms will be greatly changed. While
the voltage is smoothed, as described above, current will flow through the bridge only
during the time when the input voltage is greater than the capacitor voltage. For
example, if the load draws an average current of n Amps, and the diodes conduct for
10% of the time, the average diode current during conduction must be 10n Amps. This
non-sinusoidal current leads to harmonic distortion and a poor power factor in the AC
supply.
Output can also be smoothed using a choke and second capacitor. The choke
tends to keep the current (rather than the voltage) more constant. Due to the relatively
high cost of an effective choke compared to a resistor and capacitor this is not
employed in modern equipment.
Some early console radios created the speaker's constant field with the current
from the high voltage ("B +") power supply, which was then routed to the consuming
circuits, (permanent magnets were considered too weak for good performance) to
create the speaker's constant magnetic field. The speaker field coil thus performed 2
jobs in one: it acted as a choke, filtering the power supply, and it produced the
magnetic field to operate the speaker.
3) Voltage Regulator
78xx ICs have three terminals and are most commonly found in the TO220
form factor, although smaller surface-mount and larger TrO3 packages are also
available from some manufacturers. These devices typically support an input voltage
which can be anywhere from a couple of volts over the intended output voltage, up to
a maximum of 35 or 40 volts, and can typically provide up to around 1 or 1.5 amps of
current (though smaller or larger packages may have a lower or higher current rating).
A gas sensor is a device which detects the presence or concentration of gases in the
atmosphere. Based on the concentration of the gas the sensor produces a
corresponding potential difference by changing the resistance of the material inside
the sensor, which can be measured as output voltage. Based on this voltage value the
type and concentration of the gas can be estimated.
45
The type of gas the sensor could detect depends on the sensing material
present inside the sensor. Normally these sensors are available as modules with
comparators as shown above. These comparators can be set for a particular threshold
value of gas concentration. When the concentration of the gas exceeds this threshold
the digital pin goes high. The Analog pin can be used to measure the concentration of
the gas.
Gas sensors are typically classified into various types based on the type of the sensing
element it is built with. Below is the classification of the various types of gas sensors
based on the sensing element that are generally used in various applications:
46
3.9 WIFI MODULE (ESP8266)
ESP8266 was designed by the Chinese company Espressif Systems for uses in
Internet of Things (IoT) systems. ESP8266 is a complete WIFI system on chip that
incorporates a 32-bit processor, some RAM and depending on the vendor between
512KB and 4MB of flash memory. This allows the chip to either function as a wireless
adapter that can extend other systems with WIFI functionality, or as a standalone unit
that can by itself execute simple applications. Depending on the specific module
variant (ESP-1 to ESP-12 at the time of this thesis) between 0 and 7 General Purpose
Input/Output (GPIO) pins are available, in addition to Rx and Tx pins of the UART,
making the module very suitable for IoT applications. The Software Development Kit
(SDK) provided by Espressif contains a lightweight implementation of a TCP/IP
control stack (IWIP) for WIFI communication. The modules house libraries for optional
services such as Dynamic Host Configuration Protocol (DHCP), Domain Name
System (DNS), JavaScript Object Notation (JSON) and Secure Socket Layer (SSL)
libraries for Application Level programming. It incorporates 802.11 MAC extensions
such as 802.11b/g/n/d/e/h/i/k/r that manage signal transmission, encapsulation,
encryption, collision management and roaming functionality. The chip generally
comes as part of a module, soldered to a Printed Circuit Board (PCB), however it is
possible to purchase only the chip itself in order to create a truly custom module. The
module variants currently available on the market may include an antenna (PCB or
ceramic) or a U-FL connector, a hardware component for serial communication and a
myriad of other auxiliary components such as resistors, capacitors and LEDs.
The processor inside the module is a low power, 80MHz, 32bit Tensilica
Xtensa LX. It is classified as a DPU, which is Tensilicas own type of CPU combining
the strengths of a traditional CPU and a DSP to achieve better performance for
47
data-intensive tasks. Multiple compilation tools exist for this processor with the ESP
community even attempting to design their own version of gcc compiler to achieve
more efficient code density and better performance.
Being a WIFI SoC, this chip requires a fair amount of power to operate its
transceiver. It has incorporated some impressive power management features,
including highly integrated components that allow for greater optimization and
increased efficiency. All this makes ESP8266 one of the least power-hungry chips in
the WIFI IC industry! Unfortunately, its levels of demand are still higher than of
those based on
48
wireless technologies such as Bluetooth, or ZigBee. The official ESP8266 datasheet
states this regarding current draw:
However, this is just the power consumption of the ESP8266EX chip, the
entire module, featuring additional hardware such as LEDs, crystals, capacitors and
registers revealed that actual consumption of the MOD-WiFi-ESP8266-DEV varied
greatly from this table. The approximate idle (while ready to receive packets) current
of the module was measured to be 70mA, with somewhat higher when receiving
packets in 802.11n mode. Transmission drew 80mA current.
The module was also prone to high current spikes in the range of 300mA at
unpredictable points in time, often causing a full module restart. This problem does
seem to have been dealt with in most recent SDK, however most manufacturers still
choose to add additional capacitances parallel to power supply in order to prevent such
instances from occurring. The ESP8266 can operate in a total of 3 power saving modes
all of which sacrifice a portion of functionality to achieve lower power consumption.
These modes are: Light Sleep Modem Sleep Deep Sleep The Light and Modem
modes are so called WIFI sleep modes. They are designed to be used when the module
is in STA mode, meaning it does not have to actively send beacons to announce its
presence and verify clients’ statuses. The Light Sleep WIFI mode is to be used when
the module needs to maintain WLAN connection without actively transmitting or
49
receiving data, allowing the CPU to operate at a lower voltage (or be suspended
altogether) and turning off the WIFI modem between AP status beacons. This would
allow the module to save power while still answer to beacons, effectively maintaining
the wireless connection. In this mode a DTIM3 setup at the AP, with 300ms sleep and
3ms wake cycle can, according to the datasheet, lower power consumption to 0.9mA
[15]. Modem Sleep is used when the CPU needs to be active. In this mode the WIFI
modem is turned off between the AP status beacons, maintaining the connection at
minimal cost while allowing the CPU to perform without interference. A similar
DTIM3 setup as in previous example leaves the current consumption at 15mA [15].
The Deep Sleep turns of all functionality (CPU and WIFI modem), while maintaining
only the RTC clock, allowing the module to be woken up by a timed interrupt. When
waking up, the module performs a complete reset, meaning all RAM data is erased
(although there is limited space in RTC memory block that does not get erased) and
the WIFI connection needs to be re-established. Espressif claims a 300s sleep and 1s
wake cycle (claimed as enough to connect to AP) results in average consumption of
less than 1mA [15]. Important to note is that WIFI sleep-modes described above may
not always be true. In test conducted in this thesis they only seemed to lower the
power consumption to 20- 50mA in Light Sleep and 40mA in Modem Sleep. Although
conventional Deep Sleep resulted in an average of 10uA, there were instances when
the deep-sleep sequence seemed to execute in an incorrect manner, leaving the power
consumption at standby levels (~80mA). This issue has been known to Espressif that
has promised to address it in future releases of the SDK. It should also be noted that
the module is specified for voltages between 1.7V and 3.6V, meaning it can be
powered by two AA alkaline batteries placed in series (achieving 3V). However, the
ESP will not work with a Lithium Ion (or LiPo) based batteries without additional
power regulating circuits.
ESP8266 has multiple peripherals through which it can interface with other
modules in a classic embedded fashion. In this section only the setup of the
communication link will be presented, since the exact flow of bits to achieve such
communication was handled automatically by the module and is therefore deemed of
no immediate interest for this thesis. In this case classical UART was used to decode
output and encoding data to be sent to the sensor. Similarly, EM50 data logger has an
50
UART of its own and can do the same thing on its end. Serial asynchronous
communication does not require a common clock, however in order for the data to be
processed correctly and at right intervals a common baud rate (can be viewed as
symbols per second) needs to be set for both devices. The baud-rates supported by
ESPs UART component range from 9600 to 921600bps, while the EM50 is
configured for 9600bps as default.
51
CHAPTER-4
SOFTWARE DESCRIPTION
Writing Sketches
Programs written using Arduino Software (IDE) are called sketches. These sketches
are written in the text editor and are saved with the file extension. ino. The editor has
features for cutting/pasting and for searching/replacing text. The message area gives
feedback while saving and exporting and also displays errors. The console displays
text output by the Arduino Software (IDE), including complete error messages and
other information. The bottom righthand corner of the window displays the configured
board and serial port. The toolbar buttons allow you to verify and upload programs,
create, open, and save sketches, and open the serial monitor.
NB: Versions of the Arduino Software (IDE) prior to 1.0 saved sketches with the
extension .pde. It is possible to open these files with version 1.0, you will be
prompted to save the sketch with the .ino extension on save.
Verify
Checks your code for errors compiling it.
Upload
Compiles your code and uploads it to the configured board.
See uploading below for details.
52
Note: If you are using an external programmer with your board, you can
hold down the "shift" key on your computer when using this icon. The text
will change to "Upload using Programmer"
New
Creates a new sketch.
Open
Presents a menu of all the sketches in your sketchbook. Clicking one will
open it within the current window overwriting its content.
Note: due to a bug in Java, this menu doesn't scroll; if you need to open a
sketch late in the list, use the File | Sketchbookmenu instead.
Save
Saves your sketch.
Serial Monitor
Opens the serial monitor.
File
New
Creates a new instance of the editor, with the bare minimum structure of a sketch
already in place.
Open
Allows to load a sketch file browsing through the computer drives and folders.
Open Recent
Provides a short list of the most recent sketches, ready to be opened.
53
Sketchbook
Shows the current sketches within the sketchbook folder structure; clicking on any
name opens the corresponding sketch in a new editor instance.
Examples
Any example provided by the Arduino Software (IDE) or library shows up in this
menu item. All the examples are structured in a tree that allows easy access by topic or
library.
Close
Closes the instance of the Arduino Software from which it is clicked.
Save
Saves the sketch with the current name. If the file hasn't been named before, a name
will be provided in a "Save as.." window.
Save as...
Allows to save the current sketch with a different name.
Page Setup
It shows the Page Setup window for printing.
Print
Sends the current sketch to the printer according to the settings defined in Page Setup.
Preferences
Opens the Preferences window where some settings of the IDE may be customized,
as the language of the IDE interface.
Quit
Closes all IDE windows. The same sketches open when Quit was chosen will be
automatically reopened the next time you start the IDE.
Edit
Undo/Redo
Goes back of one or more steps you did while editing; when you go back, you may
go forward with Redo.
Cut
Removes the selected text from the editor and places it into the clipboard.
Copy
Duplicates the selected text in the editor and places it into the clipboard.
54
Copy for Forum
Copies the code of your sketch to the clipboard in a form suitable for posting to the
forum, complete with syntax coloring.
Copy as HTML
Copies the code of your sketch to the clipboard as HTML, suitable for embedding in
web pages.
Paste
Puts the contents of the clipboard at the cursor position, in the editor.
Select All
Selects and highlights the whole content of the editor.
Comment/Uncomment
Puts or removes the // comment marker at the beginning of each selected line.
Increase/Decrease Indent
Adds or subtracts a space at the beginning of each selected line, moving the text one
space on the right or eliminating a space at the beginning.
Find
Opens the Find and Replace window where you can specify text to search inside the
current sketch according to several options.
Find Next
Highlights the next occurrence - if any - of the string specified as the search item in
the Find window, relative to the cursor position.
Find Previous
Highlights the previous occurrence - if any - of the string specified as the search
item in the Find window relative to the cursor position.
Sketch
Verify/Compile
Checks your sketch for errors compiling it; it will report memory usage for code and
variables in the console area.
Upload
Compiles and loads the binary file onto the configured board through the configured
Port.
55
Upload Using Programmer
This will overwrite the bootloader on the board; you will need to use Tools > Burn
Bootloader to restore it and be able to Upload to USB serial port again. However, it
allows you to use the full capacity of the Flash memory for your sketch. Please note
that this command will NOT burn the fuses. To do so a Tools -> Burn
Bootloader command must be executed.
Export Compiled Binary
Saves a .hex file that may be kept as archive or sent to the board using other tools.
Show Sketch Folder
Opens the current sketch folder.
Include Library
Adds a library to your sketch by inserting #include statements at the start of your code.
For more details, see libraries below. Additionally, from this nu item you can
the Library Manager andme import new libraries from .zip access
Add files.
File...
Adds a source file to the sketch (it will be copied from its current location). The new
file appears in a new tab in the sketch window. Files can be removed from the sketch
using the tab menu accessible clicking on the small triangle icon below the serial
monitor one on the right side o the toolbar.
Tools
Auto Format
This formats your code nicely: i.e. indents it so that opening and closing curly
braces line up, and that the statements inside curly braces are indented more.
Archive Sketch
Archives a copy of the current sketch in .zip format. The archive is placed in the
same directory as the sketch.
Fix Encoding & Reload
Fixes possible discrepancies between the editor char map encoding and other
operating systems char maps.
Serial Monitor
Opens the serial monitor window and initiates the exchange of data with any connected
56
board on the currently selected Port. This usually resets the board, if the board
supports Reset over serial port opening.
Board
Select the board that you're using. See below for descriptions of the various boards.
Port
This menu contains all the serial devices (real or virtual) on your machine. It should
automatically refresh every time you open the top-level tools menu.
Programmer
For selecting a hardware programmer when programming a board or chip and not
using the onboard USB-serial connection. Normally you won't need this, but if you're
burning a bootloader to a new microcontroller, you will use this.
Burn Bootloader
The items in this menu allow you to burn a bootloader onto the microcontroller on an
Arduino board. This is not required for normal use of an Arduino or Genuino board
but is useful if you purchase a new ATmega microcontroller (which normally come
without a bootloader). Ensure that you've selected the correct board from the Boards
menu before burning the bootloader on the target board. This command also set the
right fuses.
Help
Here you find easy access to a number of documents that come with the Arduino
Software (IDE). You have access to Getting Started, Reference, this guide to the IDE
and other documents locally, without an internet connection. The documents are a
local copy of the online ones and may link back to our online website.
Find in Reference
This is the only interactive function of the Help menu: it directly selects the relevant
page in the local copy of the Reference for the function or command under the cursor.
57
4.1.1 Arduino IDE: Initial Setup
This is the Arduino IDE once it’s been opened. It opens into a blank sketch
where you can start programming immediately. First, we should configure the board
and port settings to allow us to upload code. Connect your Arduino board to the PC
via the USB cable.
You have to tell the Arduino IDE what board you are uploading to. Select the
Toolspulldown menu and go to Board.This list is populated by default with the
currently available Arduino Boards that are developed by Arduino. If you are using an
Uno or an Uno-Compatible Clone (ex. Funduino, SainSmart, IEIK, etc.), select
Arduino Uno. If you are using another board/clone, select that board.
58
Fig.4.2: Arduino IDE: Board Setup Procedure
If you downloaded the Arduino IDE before plugging in your Arduino board,
when you plugged in the board, the USB drivers should have installed automatically.
The most recent Arduino IDE should recognize connected boards and label them with
which COM port they are using. Select the Tools pulldown menu and then Port.Here it
should list all open COM ports, and if there is a recognized Arduino Board, it will also
give it’s name. Select the Arduino board that you have connected to the PC. If the
setup was successful, in the bottom right of the Arduino IDE, you should see the board
type and COM number of the board you plan to program. Note: the Arduino Uno
occupies the next available COM port; it will not always be COM3.
59
Fig.4.3 Arduino IDE: COM Port Setup
Uploading Blink One common procedure to test whether the board you are
using is properly set up is to upload the “Blink” sketch. This sketch is included with
all Arduino IDE releases and can be accessed by the Filepull-down menu and going to
Examples, 01. Basics, and then select Blink. Standard Arduino Boards include a
surface- mounted LED labeled “L” or “LED” next to the “RX” and “TX” LEDs, that is
connected to digital pin 13. This sketch will blink the LED at a regular interval, and is
an easy way to confirm if your board is set up properly and you were successful in
uploading code. Open the “Blink” sketch and press the “Upload” button in the upper-
left corner to upload “Blink” to the board.
60
Fig.4.4 Arduino IDE: Loading Blink Sketch
ThingSpeak is IoT platform for user to gather real-time data; for instance,
climate information, location data and other device data. In different channels in
ThingSpeak, you can summarize information and visualize data online in charts and
analyze useful information.
ThingSpeak can integrate IOT: bit (micro: bit) and other software/ hardware
platforms. Through IOT:bit, you can upload sensors data to ThingSpeak (e.g.
temperature,
61
humidity, light intensity, noise, motion, raindrop, distance and other device
information).
Goal:
we need to create the thingspeak channel and get the
key
Step 1
62
Step 2
Step 3
63
Field 1: Temperature
Step 4
Step 5
Open your web browser, go to https://thingspeak.com , select your channel > “API
Keys” ,copy the API key as follows:
64
65
CHAPTER-5
RESULT
Fig.5.1 Hardware Kit of IoT Based Smart Home Security and Home Automation
System
66
CHAPTER-6
CONCLUSION AND FUTURE
SCOPE
6.1 Conclusion:
The wireless devices monitoring and controlling using Internet of Things has been
experimentally proven to work satisfactorily by connecting simple appliances to it
and the appliances were successfully controlled remotely through internet
6.3 The future scope of the power theft detection system includes
the following:
The future scope of wireless device monitoring and control using IoT and
Arduino includes the potential for expanded automation, improved energy efficiency,
and enhanced connectivity for a wide range of applications, from smart homes to
industrial processes.
67
REFERENCES:
[1] Vinay sagar K N, Kusuma S M, Jan-2016, “Home Automation Using Internet of
Things”, International Research Journal of Engineering and Technology, vol. 02, no.
03, pp. 01-10..
[2] Pooja N.Pawar, Shruti Ramachandran, Nisha P.Singh, Varsha V.Wagh, April
2018, “A Home Automation System using Internet of Things”, International Journal
of Innovative Research in Computer and Communication Engineering, vol. 4, no. 4,
pp. 54-63.
[3] Shweta Singh, Kishore Kumar Ray, 2017, “home automation system using internet
of things”, International Journal of Computer Engineering and Applications, pp. 45-
49.
[4] K.Saiteja, S.Aruna deepthi, G.Raghu, B.Ravali, April 2017, “Home Automation
Using IOT”, International Journal of Engineering Trends and Technology, pp. 229-
235. 66
[5] A. Amudha, 2017, “Home Automation using IoT”, International Journal of
Electronics Engineering Research,vol. 9, no. 6, pp. 939-944.
[6] Priyanka Zambare , Pooja Madake , Aparna Pottabathini , Prof. Jayant Sawarkar,
February 2018, “The Survey on IoT Based Home Automation”, International Journal
of Innovative Research in Science Engineering and Technology, vol. 7, no. 2, pp. 223-
31.
[7] Abdul Aziz Md, K Harshasri, K Shanmukharao, March 2017, “Cost Effective
Voice Controlled Home Automation Using IoT”, International Journal of Engineering
Research in Computer Science and Engineering, vol. 4, no. 3, pp. 01-10.
[8] Mamata Khatu, Neethu Kaimal, Pratik Jadhav, Syedali Adnan Rizvi, February
2015, “Implementation of Internet of Things for Home Automation”, International
Journal of Emerging Engineering Research and Technology, vol. 3, no. 2, pp. 7-11.
[9]
B.P Kulkarni, Aniket V Joshi, Vaibhav V Jadhav, Akshaykumar, April 2017, v“IoT
Based Home Automation Using Raspberry PI”, International Journal of Innovative
Studies in Sciences and Engineering Technology, vol. 3, no. 4, pp. 13- 19. [10]
Dhakad Kunal, Dhake Tushar, Undegaonkar Pooja, Zope Vaibhav, February 2016,
“Smart Home Automation using IoT”, International Journal of Advanced Research in
Computer and Communication Engineering, vol. 5, no. 2, pp. 56-61.
68