Professional Documents
Culture Documents
09-The Development of Remotely Controlled Home Automation System of Energy Saving
09-The Development of Remotely Controlled Home Automation System of Energy Saving
ABSTRACT
The purpose of this study is to showcase the design and development of a web-enabled
home automation system prototype. The unit was developed using low-cost components such as
the ubiquitous Arduino microcontroller. One of the features of the developed unit is the ability to
monitor the power consumed by electrical loads. The unit also has the ability to control the status
of individual loads through the internet using a web-enabled mobile application. This feature
enables load management that could contribute to energy saving.
BLOCK DIAGRAM
ADVANTAGE
DISADVANTAGE
You don’t get quality devices for setting up your smart home via Bluetooth, at the least
what you can do is you will have to setup the whole thing all on yourself.
If you want another user to join this system a whole lot of code and configuration is
needed.
Once Bluetooth is disconnected app also disconnects and reconnecting Bluetooth is a
task.
Bluetooth communication only has range of 10-20 meters.
POWER SUPPLY
Block Diagram
The ac voltage, typically 220V rms, is connected to a transformer, which steps that ac voltage
down to the level of the desired dc output. A diode rectifier then provides a full-wave rectified
voltage that is initially filtered by a simple capacitor filter to produce a dc voltage. This resulting
dc voltage usually has some ripple or ac voltage variation.
A regulator circuit removes the ripples and also remains the same dc value even if the input
dc voltage varies, or the load connected to the output dc voltage changes. This voltage regulation
is usually obtained using one of the popular voltage regulator IC units.
Working principle
Transformer
The potential transformer will step down the power supply voltage (0-230V) to (0-6V) level.
Then the secondary of the potential transformer will be connected to the precision rectifier,
which is constructed with the help of op–amp. The advantages of using precision rectifier are it
will give peak voltage output as DC, rest of the circuits will give only RMS output.
Bridge rectifier
When four diodes are connected as shown in figure, the circuit is called as bridge rectifier.
The input to the circuit is applied to the diagonally opposite corners of the network, and the
output is taken from the remaining two corners.
Let us assume that the transformer is working properly and there is a positive potential, at point
A and a negative potential at point B. the positive potential at point A will forward bias D3 and
reverse bias D4.
The negative potential at point B will forward bias D1 and reverse D2. At this time D3 and D1
are forward biased and will allow current flow to pass through them; D4 and D2 are reverse
biased and will block current flow.
The maximum voltage that appears across the load resistor is nearly-but never exceeds-500 v0lts,
as result of the small voltage drop across the diode. In the bridge rectifier shown in view B, the
maximum voltage that can be rectified is the full secondary voltage, which is 1000 volts.
Therefore, the peak output voltage across the load resistor is nearly 1000 volts. With both
circuits using the same transformer, the bridge rectifier circuit produces a higher output voltage
than the conventional full-wave rectifier circuit.
IC voltage regulators
Voltage regulators comprise a class of widely used ICs. Regulator IC units contain the
circuitry for reference source, comparator amplifier, control device, and overload protection all
in a single IC. IC units provide regulation of either a fixed positive voltage, a fixed negative
voltage, or an adjustably set voltage. The regulators can be selected for operation with load
currents from hundreds of milli amperes to tens of amperes, corresponding to power ratings from
milli watts to tens of watts.
Fig 2.2 Circuit Diagram of Power Supply
A fixed three-terminal voltage regulator has an unregulated dc input voltage, Vi, applied to one
input terminal, a regulated dc output voltage, Vo, from a second terminal, with the third terminal
connected to ground.
The series 78 regulators provide fixed positive regulated voltages from 5 to 24 volts. Similarly,
the series 79 regulators provide fixed negative regulated voltages from 5 to 24 volts.
For ICs, microcontroller, LCD --------- 5 volts
For alarm circuit, op-amp, relay circuits ---------- 12 volts
Choose Optimum
Electronic Chip
S/W Side
H/W Side
HLL/ALL
PCB Layout Design
Algorithm
Coding/Editing Assembling
Compiling/Assembling Components
Debugging
Testing Testing
Simulator
S/W H/W
Download
ICE (In-Circuit
Emulator)
Embedded Product
Each 8031 device has some amount of data RAM built in the device for internal
processing. This area is used for stack operations and temporary storage of data.
This base architecture is supported with onchip peripheral functions like I/O ports,
timers/counters, versatile serial communication port. So it is clear that this 8031 architecture was
designed to cater many real time embedded needs.
So, very soon Intel introduced the 8031 devices (8751) with re-programmable type of Program
Memory using built-in EPROM of size 4K X 8. Like a regular EPROM, this memory can be re-
programmed many times. Later on Intel started manufacturing these 8031 devices without any
onchip Program Memory.
Now I go ahead giving more information on the important functional blocks of the 8031.
Microprocessors have many instructions for moving data from external memory to internal
memory. But microcontrollers have a few such instructions.
Microprocessors have less bit handling instructions, but microcontrollers have many such
instructions.
Microprocessors are concerned with rapid movement of code and data from external
memory. But Microcontroller is concerned with that of bits within the chip.
PIC Microcontroller
PIC Microcontroller:
PIC microcontroller was developed in the year 1993 by microchip technology. The term PIC
stands for Peripheral Interface Controller. Initially this was developed for supporting PDP
computers to control its peripheral devices, and therefore, named as a peripheral interface device.
These microcontrollers are very fast and easy to execute a program compared with other
microcontrollers.
Every PIC microcontroller architecture consists of some registers and stack where registers
function as Random Access Memory( RAM) and stack saves the return addresses. The main
features of PIC microcontrollers are RAM, flash memory, Timers/Counters, EEPROM, I/O
Ports, USART, CCP (Capture/Compare/PWM module), SSP, Comparator, ADC (analog to
digital converter), PSP(parallel slave port), LCD and ICSP (in circuit serial programming) The 8-
bit PIC microcontroller is classified into four types on the basis of internal architecture such as
Base Line PIC, Mid Range PIC, Enhanced Mid Range PIC and PIC18.
PIC16F877A
This powerful (200 nanosecond instruction execution) yet easy-to-program (only 35 single word
instructions) CMOS FLASH-based 8-bit microcontroller packs Microchip's powerful PIC®
architecture into an 40 package and is upwards compatible with the PIC16C5X, PIC12CXXX
and PIC16C7X devices. The PIC16F877A features 256 bytes of EEPROM data memory, self
programming, an ICD, 2 Comparators, 8 channels of 10-bit Analog-to-Digital (A/D) converter, 2
capture/compare/PWM functions, the synchronous serial port can be configured as either 3-wire
Serial Peripheral Interface (SPI™) or the 2-wire Inter-Integrated Circuit (I²C™) bus and a
Universal Asynchronous Receiver Transmitter (USART).
We know that the microcontroller is an integrated chip which consists of CPU, RAM,
ROM, timers, and counters, etc. In the same way, PIC microcontroller architecture consists of
RAM, ROM, CPU, timers, counters and supports the protocols such as SPI, CAN, and UART for
interfacing with other peripherals. At present PIC microcontrollers are extensively used for
industrial purpose due to low power consumption, high performance ability and easy of
availability of its supporting hardware and software tools like compilers, debuggers and
simulators.
PIN DIAGRAM
The PIC microcontroller architecture comprises of CPU, I/O ports, memory organization,
A/D converter, timers/counters, interrupts, serial communication, oscillator and CCP module
which are discussed in detailed below.
It is not different from other microcontrollers CPU and the PIC microcontroller CPU consists
of the ALU, CU, MU and accumulator, etc. Arithmetic logic unit is mainly used for arithmetic
operations and to take logical decisions. Memory is used for storing the instructions after
processing. To control the internal and external peripherals, control unit is used which are
connected to the CPU and the accumulator is used for storing the results and further process.
Memory Organization
The memory module in the PIC microcontroller architecture consists of RAM (Random
Access Memory), ROM (Read Only Memory) and STACK.
RAM is an unstable memory which is used to store the data temporarily in its registers. The
RAM memory is classified into two banks, and each bank consists of so many registers. The
RAM registers are classified into two types: Special Function Registers (SFR) and General
Purpose Registers (GPR).
These registers are used for general purpose only as the name implies. For example, if we
want to multiply two numbers by using the PIC microcontroller. Generally, we use registers for
multiplying and storing the numbers in other registers. So these registers don’t have any special
function,- CPU can easily access the data in the registers.
These registers are used for special purposes only as the name SFR implies. These registers
will perform according to the functions assigned to them , and they cannot be used as normal
registers. For example, if you cannot use the STATUS register for storing the data, these
registers are used for showing the operation or status of the program. So, user cannot change the
function of the SFR; the function is given by the retailer at the time of manufacturing.
Read only memory is a stable memory which is used to store the data permanently. In PIC
microcontroller architecture, the architecture ROM stores the instructions or program, according
to the program the microcontroller acts. The ROM is also called as program memory, wherein
the user will write the program for microcontroller and saves it permanently, and finally the
program is executed by the CPU. The microcontrollers performance depends on the instruction,
which is executed by the CPU.
In the normal ROM, we can write the program for only once we cannot use again the
microcontroller for multiple times. But, in the EEPROM, we can program the ROM multiple
times.
Flash Memory
Flash memory is also programmable read only memory (PROM) in which we can read, write
and erase the program thousands of times. Generally, the PIC microcontroller uses this type of
ROM.
Stack
When an interrupt occurs, first the PIC microcontroller has to execute the interrupt and the
existing process address. Then that is being executed is stored in the stack. After completing the
execution of the interrupt, the microcontroller calls the process with the help of address, which is
stored in the stack and get executes the process.
I/O Ports
The series of PIC16 consists of five ports such as Port A, Port B, Port C, Port D & Port E.
Port A is an 16-bit port that can be used as input or output port based on the status of the TRISA
(Tradoc Intelligence Support Activity) register. Port B is an 8- bit port that can be used as both
input and output port. Port C is an 8-bit and the input of output operation is decided by the status
of the TRISC register. Port D is an 8-bit port acts as a slave port for connection to the
microprocessor BUS. Port E is a 3-bit port which serves the additional function of the control
signals to the analog to digital converter.
BUS
BUS is used to transfer and receive the data from one peripheral to another. It is classified
into two types such as data bus and address.
Address Bus: Address bus is used to transmit the memory address from the peripherals to the
CPU. I/O pins are used to interface the external peripherals; UART and USART both are serial
communication protocols which are used for interfacing serial devices like GSM, GPS,
Bluetooth, IR , etc.
BUS
A/D converters
The main intention of this analog to digital converter is to convert analog voltage values to
digital voltage values. A/D module of PIC microcontroller consists of 5 inputs for 28 pin devices
and 8 inputs for 40 pin devices. The operation of the analog to digital converter is controlled by
ADCON0 and ADCON1 special registers. The upper bits of the converter are stored in register
ADRESH and lower bits of the converter are stored in register ADRESL. For this operation, it
requires 5V of an analog reference voltage.
A/D CONVERTER
Timers/ Counters
PIC microcontroller has four timer/counters wherein the one 8-bit timer and the remaining
timers have the choice to select 8 or 16-bit mode. Timers are used for generating accuracy
actions, for example, creating specific time delays between two operations.
Interrupts
PIC microcontroller consists of 20 internal interrupts and three external interrupt sources
which are associated with different peripherals like ADC, USART, Timers, and so on.
Serial Communication
Serial communication is the method of transferring data one bit at a time sequentially over a
communication channel.
USART: The name USART stands for Universal synchronous and Asynchronous Receiver and
Transmitter which is a serial communication for two protocols. It is used for transmitting and
receiving the data bit by bit over a single wire with respect to clock pulses. The PIC
microcontroller has two pins TXD and RXD. These pins are used for transmitting and receiving
the data serially.
SPI Protocol: The term SPI stands for Serial Peripheral Interface. This protocol is used to send
data between PIC microcontroller and other peripherals such as SD cards, sensors and shift
registers. PIC microcontroller support three wire SPI communications between two devices on a
common clock source. The data rate of SPI protocol is more than that of the USART.
I2C Protocol: The term I2C stands for Inter Integrated Circuit , and it is a serial protocol which
is used to connect low speed devices such as EEPROMS, microcontrollers, A/D converters, etc.
PIC microcontroller support two wire Interface or I2C communication between two devices
which can work as both Master and Slave device.
Serial Communication
Serial Communication
Oscillators
Oscillators are used for timing generation. PIC microcontroller consist of external oscillators like
RC oscillators or crystal oscillators. Where the crystal oscillator is connected between the two
oscillator pins. The value of the capacitor is connected to every pin that decides the mode of the
operation of the oscillator. The modes are crystal mode, high-speed mode and the low-power
mode. In case of RC oscillators, the value of the resistor & capacitor determine the clock
frequency and the range of clock frequency is 30KHz to 4MHz.
CCP module
The name CCP module stands for capture/compare/PWM where it works in three modes
such as capture mode, compare mode and PWM mode.
Capture Mode: Capture mode captures the time of arrival of a signal, or in other words, when
the CCP pin goes high, it captures the value of the Timer1.
Compare Mode: Compare mode acts as an analog comparator. When the timer1 value reaches a
certain reference value, then it generates an output.
PWM Mode: PWM mode provides pulse width modulated output with a 10-bit resolution and
programmable duty cycle.
The PIC microcontroller projects can be used in different applications, such as peripherals,
audio accessories, video games, etc. For better understanding of this PIC microcontroller, the
following project demonstrates PIC microcontroller’s operations.
They are reliable and malfunctioning of PIC percentage is very less. And performance of
the PIC
is very fast because of using RISC architecture.
Power conception is also very less when compared to other micro controllers. When we
see in
the programmer point of view interfacing is very easy, also we can connect analog
devices
directly with out any extra circuitry and use them. Programming is also very easy when
compared to other microcontrollers.
Disadvantages of PIC Microcontroller:
The length of the program will be big because of using RISC (35 instructions).
Program memory is not accessible and only one single accumulator is present.
LCD Display
Liquid Crystal Display. A type of display used especially in small portable electronic
devices. A type of display, usually numerical, used in electronic equipment. Dark characters are
formed on a lighter background. Requires external back lighting to be visible under low-light
conditions.
One of the most popular output devices for embedded electronics is LCD. The LCD interface has
become very simple. This is due to the availability modules for LCDs. The LCD along with
necessary controller (LCD Controller) and mounting facility is made available in the module
itself. The LCD controller takes care of everything necessary for the LCD. We communicate
with the LCD controller with the help of a command set provided by the manufacturer.
Pin Diagram
Figure 1.1 Pin Diagram
While Vcc and Vss provide +5V and ground, respectively, VEE is used for controlling
LCD contrast.
RS – register select:
There are two very important registers inside the LCD. The RS pin is used for their selection as
follows. If RS = 0, the instruction command code register is selected, allowing the user to send a
command such as clear display, cursor at home, etc. If RS = 1 the data register is selected,
allowing the user to send data to be displayed on the LCD.
R/W – read/write:
R/W input allows the user to write information to the LCD or read information from it. R/W = 1
when reading; R/W =0 when writing.
E – Enable:
The enable pin is used by the LCD to latch information presented to its data pins. When data is
supplied to data pins, a high to low pulse must be applied to this pin in order for the LCD to latch
in the data present at the data pins. This pulse must be a minimum of 450 ns wide.
D0 – D7:
The 8 bit data pins, D0 – D7, are used to send information to the LCD or read the contents of the
LCD’s internal registers.
To display letters and numbers, we send ASCII codes for the letters A – Z, a – z, and numbers 0
– 9 to these pins while making RS = 1.
There are also instructions command codes that can be sent to the LCD to clear the display or
force the cursor to the home position or blink the cursor. Table below lists the instruction
command codes.
From the above figure microcontroller is used for 8 bit data display on the LCD. Data
lines of the LCD Pin no.7 to pin no 14 are connected to the port 1 of the microcontroller.
The control pin no.4 register select is connected to P3.5, pin no.5 of LCD for Read/write is
connected to P3.6 and the enable pin (6) is connected to microcontroller.
Bluetooth Module
Bluetooth Module
The Bluetooth module HC-05 is a MASTER/SLAVE module.By default the factory setting is
SLAVE.The Role of the module (Master or Slave) can be configured only by AT
COMMANDS.The slave modules cannot initiate a connection to another Bluetooth device, but
can accept connections.Master module can initiate a connection to other devices.The user can
use it simply for a serial port replacement to establish connection between MCU and GPS, PC to
your embedded project, etc.
Hardware Features
Software Features
Slave default Baud rate: 9600, Data bits:8, Stop bit:1,Parity:No parity.
Auto‐connect to the last device on power as default.
Permit pairing device to connect as default.
Auto‐pairing PINCODE:”1234” as default.
Pin Description
ENABLE:
When enable is pulled LOW, the module is disabled which means the module will not
turn on and it fails to communicate.When enable is left open or connected to 3.3V, the
module is enabled i.e the module remains on and communication also takes place.
Vcc:
Supply Voltage 3.3V to 5V
GND:
Ground pin
TXD & RXD:
These two pins acts as an UART interface for communication
STATE:
It acts as a status indicator.When the module is not connected to / paired with any other
bluetooth device,signal goes Low.At this low state,the led flashes continuously which
denotes that the module is not paired with other device.When this module is connected
to/paired with any other bluetooth device,the signal goes High.At this high state,the led
blinks with a constant delay say for example 2s delay which indicates that the module
is paired.
BUTTON SWITCH:
This is used to switch the module into AT command mode.To enable AT command
mode,press the button switch for a second.With the help of AT commands,the user can
change the parameters of this module but only when the module is not paired with any
other BT device.If the module is connected to any other bluetooth device, it starts to
communicate with that device and fails to work in AT command mode.
Relay
A relay is an electrical switch that opens and closes under control of another electrical
circuit. In the original form, the switch is operated by an electromagnet to open or close one or
many sets of contacts. These contacts can be either Normally Open (NO), Normally Closed
(NC), or change-over contacts.
Normally-open contacts connect the circuit when the relay is activated; the circuit is
disconnected when the relay is inactive. It is also called Form A contact or "make"
contact. Form A contact is ideal for applications that require to switch a high-current
power source from a remote device.
Normally-closed contacts disconnect the circuit when the relay is activated; the circuit is
connected when the relay is inactive. It is also called Form B contact or "break" contact.
Form B contact is ideal for applications that require the circuit to remain closed until the
relay is activated.
Change-over contacts control two circuits: one normally-open contact and one normally-
closed contact. It is also called Form C contact.
Functional description
When a current flows through the coil, the resulting magnetic field attracts an
armature that is mechanically linked to a moving contact. The movement either makes or
breaks a connection with a fixed contact. When the current is switched off, the armature
is usually returned by a spring to its resting position.
Operation of Relay:
The relay driver is used to isolate both the controlling and the controlled device. The
relay is an electromagnetic device, which consists of solenoid, moving contacts (switch) and
restoring spring and consumes comparatively large amount of power. Hence it is possible for the
interface IC to drive the relay satisfactorily. To enable this, a driver circuitry, which will act as a
buffer circuit, is to be incorporated between them. The driver circuitry senses the presence of a
“high” level at the input and drives the relay from another voltage source. Hence the relay is used
to switch the electrical supply to the appliances..From the figure when we connect the rated
voltage across the coil the back emf opposes the current flow but after the short time the supplied
voltage will overcome the back emf and the current flow through the coil increase. When the
current is equal to the activating current of relay the core is magnetized and it attracts the moving
contacts. Now the moving contact leaves from its initial position denoted “(N/C)” normally
closed terminal which is a fixed terminal.
The common contact or moving contact establishes the connection with a new terminal
which is indicated as a normally open terminal “(N/O)”.Whenever, the supply coil is withdrawn
the magnetizing force is vanished. Now, the spring pulls the moving contact back to initial
position, where it makes a connection makes with N/C terminal. However, it is also to be noted
that at this time also a back emf is produced. The withdrawal time may be in microsecond, the
back emf may be in the range of few kilovolts and in opposite polarity with the supplied
terminals the voltage is known as surge voltage. It must be neutralized or else it may damage the
system.
Types of Relay
A latching relay is mechanically arranged so that the armature can rest in either of
two positions. There are two coils that pull the armature in opposite directions, so the relay can
be switched to one position or the other and then left in that state indefinitely. This type of relay
has the advantage that it consumes power only for an instant, while it is being switched, and it
retains its last setting across a power outage. Some common relays may be wired to electrically
latch, which offers no power saving but does ensure that the relay returns to a known state during
and after a power outage.
A reed relay has two, usually normally open, contacts inside a vacuum or inert gas
filled glass tube. This protects the contacts against atmospheric corrosion. The two contacts are
closed by magnetism from a coil around the glass tube, or a permanent magnet moved towards it.
See also: reed switch.
A mercury wetted relay is a form of reed relay in which the contacts are wetted
with mercury. Such relays are used to switch low-voltage signals (one volt or less), or for high-
speed counting and timing applications where the mercury eliminated contact bounce. Mercury
wetted relays are position-sensitive and must be mounted vertically to work properly. Because of
the toxicity and expense of liquid mercury, these relays are rarely specified for new equipment
A machine tool relay is a type standardized for industrial control of machine tools,
transfer machines, and other sequential control. They are characterized by a large number of
contacts (sometimes extendable in the field) which are easily converted from normally-open to
normally-closed status, easily replaceable coils, and a form factor that allows compactly
installing many relays in a control panel. Although such relays once were the backbone of
automation in such industries as automobile assembly, the programmable logic controller mostly
displaced the machine tool relay from sequential control applications.
A contactor is a very heavy-duty relay used for switching electric motors and
lighting loads. Such devices are often used for motor starters, and may be built up with overload
protection devices attached. The overload sensing devices are a form of heat operated relay
where a coil heats a bi-metal strip to open contacts, or where a solder pot melts, releasing a
spring to operate contacts.
A Buchholz relay is a safety device sensing the accumulation of gas in large oil-
filled transformers, which will alarm on slow accumulation of gas or shut down the transformer
if gas is produced rapidly in the transformer oil.
A Solid State Relay (SSR) is a solid state electronic component that provides a
similar function to an electromechanical relay but does not have any moving components,
increasing long-term reliability.
Applications
Relays are used for
To control a high-voltage circuit with a low-voltage signal, as in some types of modems,
To control a high-current circuit with a low-current signal, as in the starter solenoid of an
automobile
To detect and isolate faults on transmission and distribution lines by opening and closing
circuit breakers (protection relays)
CONCLUSION:
REFERENCES