0% found this document useful (0 votes)
24 views58 pages

Design and Construction of Time Based Home Appliances-1

This document describes the design and construction of a time based home appliance controller using a microcontroller. It discusses the components used including the power supply, transformer, rectifier, filter and voltage regulator. It also discusses the microcontroller PIC16F877 and real time clock DS1307 that will be used to program and control the appliances.

Uploaded by

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

Design and Construction of Time Based Home Appliances-1

This document describes the design and construction of a time based home appliance controller using a microcontroller. It discusses the components used including the power supply, transformer, rectifier, filter and voltage regulator. It also discusses the microcontroller PIC16F877 and real time clock DS1307 that will be used to program and control the appliances.

Uploaded by

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

DESIGN AND CONSTRUCTION OF TIME BASED HOME APPLIANCES

CONTROLLER

BY

BAMAI MUHAMMED MAIKORE

2017/HND/EE/PM/001

SUPERVISOR:

MAL BASHIR S. USMAN


CHAPTER ONE

1.0 GENERAL INTRODUCTION

The rapid growth of large scale integrated (LSI) technology has contributed to the

production of a programmable device called micro- processor. The microcontroller

has profundly revolutionized the world, especially in system design and control. To

control a system, a microcomputer is designed around a microprocessor which acts

as its central processing unit. In this work,effort is made to design and construct

appliances controller using a microcontroller which is capable of turning

appliances ON and OFF at a given time of the day. It offers the advantage of

reprogramming. The techniques used are based on the programming characteristics

of a microprocessor, which enable writing of a program, loaded into its memory

which is capable of performing the coded task.

Home devices such as Heaters, Fans, Security lights etc., have a time which

they are most suitable to operate. Time based appliance controllers are systems

that perform the switching (on/0ff) of appliances based on a preprogrammed time.

This system will reduce human effort in switching on/off of devices and will help

reduse the energy wastage and risk of fire outbreak from any controlled device.

This can be achieved by the use of microcontroller and a real time clock as the

brain of the controller.


1.1 AIM AND OBJECTIVE

The aim and objective of this project is to design and construct a device that is

capable of switching on/off of home appliances at a programmed time.

1.2 PROBLEM STATEMENT

Due to stress and other issues bothering Man, there is a high tendency of forgetting

to switch off devices before leaving home for work. This may result to fire

outbreak. Also, in this era of prepaid billing meter for electricity consumption, it is

more expensive to run some devices all day long. Therefore, it is neccessary to

provide a control system capable of switching the appliances on/off at an

appropriate time.

1.3 MOTIVATION

The nature of our weather and the fact that energy need to be conserved is the

motivation behind the design of this device. The device will serve energy because

controlled appliances will be ‘ON’ for a certern programmed time instead of

runing all day long.

1.4 DEVICES TO BE CONTROLLED

 Fan
 Lighting points (Bulbs)

 Aircondition

 Water heater

1.5 APPLICATIONS

 It is used to control electrical appliances in domestic building.

 It can be used in industries to switch ON/OFF electric machines at a given

period of time.
CHAPTER TWO

LITRETURE REVIEW AND THEORITICAL BACKGROUND

2.0 INTRODUCTION:

In this chapter, attempt is made to review some past related projects, and

explanation is given to some of the components used in this project.

2.1 REVIEW OF PAST WORK

Attempts have been made in the past to design and construct controller systems.

Some of the projects are those implemented by Alabuja Gbenga (2004),

“Design and construction of a pc based appliance controller” which He used

discrete component that lack programming ability.

Also, Raja Gopal Akella (2006), “Design and construction of Remotely RTC-

Interfaced Microcontroller for Multiple Device Control”. This project require

human effort to carryout the switching by pressing the remote controller.

Tan Ailing, University of Malaysia Perlis (April 2007), “ Home appliance remote

control using microcontroller and power line”. In this work, human effort is still

require to on/off each devices by pressing the remote controller.

The review of these projects shows their limitations of lack of functionality. A

standard device control system which require no human effort is yet to be


constructed. This can be acheived through the use of a microprocessor which is

very flexible and few components are used due to the fact that most of the work is

software based. The microprocessor used in this project is S PIC16F877 and Dallas

Real time clock (RTC) DS1307 due to it obvious advantages.

2.2 THEORY

The diagram of figure 2.0 shows the functional block diagram of Time based

Appliances Controller. Each unit are aslo discused.

Figure 2.0: Block diagram of time based appliances controller.


2.2.1 POWER SUPPLY UNIT

Most electronic devices require dc voltage to operate. Therefore, batteries are very

useful in low power or portable devices but the operating time of such devices is

limited unless the batteries are recharged or replaced constantly. The more readily

available source of power is the 50Hz, 240V ac outlet. Where a dc voltage is

required, a dc power supply circuit may be employed to convert the ac voltage to a

dc voltage. A voltage regulation may be incorporated in a power supply circuit in

order to eliminate the variation of power supply voltage with changing input

current. A typical arrangement for dc power supply is shown bellow in figure 2.1;

Transformer Rectification Filtration Regulation

Figure 2.1: Power Supply Arrangements.

2.2.2 TRANSFORMER

The transformer is a device used in transforming electric power in one circuit into

electric power of the same frequency but different voltage in another circuit but

with a corresponding decrease or increase in current (Theraja, A.K and Theraja,

B.L 1997).
The transformation is based on the mutual induction between the two circuits

linked by a common magnetic flux. In its simplest form, it consists of two

inductive coils which are electrically separated but magnetically link through a

path of low reluctance. A sipmle diagram of a step down transformer is shown in

figure 2.2 V1, N1 V2, N2

Figure 2.2: Step-down Transformer.

If one coil is connected to an ac voltage source, an alternating flux is set up in the

laminated core, most of which is linked with the other coil in which it produces

mutually induced e.m.f. (according to the faraday’s law of electromagnetic

induction e = Mdl ⁄dt). If the second coil is closed, a current flow in it and so

electric energy is transferred. For the purpose of this project, a 240V to 15V step-

down transformer is used.


2.2.3 RECTIFIER

A rectifier is a circuit which employs one or more diodes to convert ac voltage into

pulsating dc voltage. Full wave bridge rectifier circuit is most frequently used for

electronic dc power supply. It requires four diodes to convert ac into pulsating dc

by eliminating the negative half-cycle of the ac voltage being rectified. The

operation is such that; during the positive diodes D1 and D3 conducts, while the

other two diodes (D2 and D4) conducts during the negative half-cycle. The output

waveform is shown below;

D1 D3
DIODE DIODE

D2 D4
DIODE DIODE

Figure 2.3: Diagrm of full wave brigde rectfier.


Vt

t
0 Π 2Π

Figure 2.4: Output Waveform of Full wave Bridge Rectifier.

2.2.4 FILTRATION

The output of the rectifier has considerable amount of ripples. The ripple voltage is

defined as the deviation of the load from its average or the dc filtering is done by

shunting the load with a capacitor. The effect of this is that the capacitor store

energy during the conduction period. This prolongs the time during which the

current passes through the load thereby decreasing the ripple as shown below;

The function of the filter is to smooth pulsation present in the output voltage

supplied by the rectifier. In practice, no filter gives output voltage that is ripple free

as that of a battery, but it considerably reduces the ripple to a certain extent. A

capacitor is used to achieve the filtering.The arrangement of a filter circuit and its
corresponding wave form is shown in figure

TR2
BR2

AC Main
C2
1000u

G2SB20
TRAN-2P2S

Figure 2.6. Filter circuit


Vt

t
0 Π 2Π 3Π
Figure 2.7: Output Waveform of Filter.

2.2.5 VOLTAGE REGULATION

To maintain a constant output level, a voltage regulator is needed at the output of

the filter. Nowadays, complete voltage regulators are available in an expensive

integrated circuit.

The percentage regulation or simply regulator of a power supply is given by:

% regulation = [(Vmax – Vmin)/Vmax] × 100

Where;
Vmax = maximum dc output voltage

Vmin = minimum dc output voltage

In a general form

% regulation = [(Vno load – Vfull load)/Vfull load] × 100

2.2.6 CONTROLLING UNIT (PIC16F877)

PIC (Peripheral Interface Controller) is the IC which was developed to control

peripheral devices, alleviating the load from the main CPU Compared to a human

being, the brain is the main CPU and the PIC is equivalent to the autonomic

nervous system. The PIC, like the CPU, has calculation functions and memory, and

is controlled by the software.

However, the through put and the memory capacity are low. Depending on the

kind of PIC, the maximum clock operating frequency is about 20 MHz and the

memory capacity (to write the program) is about 1K to 4K words. For this project,

4MHz has been chosen.

The clock frequency determines the speed at which a program is read and an

instruction is executed. The throughput cannot be judged with the clock frequency
alone. It changes with the processor architecture. However within the same

architecture, the one with the highest clock frequency has the highest throughput.

I use a 14-bit WORD for program memory capacity. An instruction is a

word long. Program memory is measured in BYTES, one byte is 8 bits. The bit is

the smallest unit, and can have the value of 1 or 0. The instruction word of the

PIC16F877A is composed of 14 bits. 1K words is equal to 1 x 1,024 x 14 = 14,336

bits. To convert this to bytes divide it by 8 x 1024, (14,336 / 8 x 1024 = 1.75K

bytes).

A memory capacity of 1G bytes = 1,024M bytes, 1M bytes = 1,024K bytes,

1K bytes = 1,024 bytes. 1K bytes is not equal to 1000 bytes. This is because the

calculation is in binary (2 to the tenth power = 1,024).

Pin Diagram
Fig 2.8: The PIC16F877 Pin Diagram.

MCLR : Master Clear ( Active

low Reset )

Vpp : Programming voltage


RA0-5 : Input/Output port A
input

RB0-7 : Input/Output port B THV : High voltage test mode

RC0-7 : Input/Output port C control

RD0-7 : Input/Output port D VREF+/-


Reference voltage
:
RE0-2 : Input/Output port E
SS : Slave select for the
AN0-7 : Analog input port
synchronous serial port
RX : USART Asynchronous
T0CKI : Clock input to Timer 0
Receive
T1OSO : Timer1 oscillator output
TX : USART Asynchronous

Transmit T1OSI : Timer1 oscillator input

SCK : Synchronous serial T1CKI : Clock input to Timer1

clock input PGD : Serial programming data

SCL : Output for both SPI PGC : Serial programming

and I2C modes clock

DT : Synchronous Data PGM : Low voltage

CK : Synchronous Clock programinng input

SDO : SPI Data Out ( SPI INT : External interrupt


mode )

SDI : SPI Data In ( SPI RD : Read control for the

mode ) parallel slave port

SDA : Data I/O ( I2C mode ) WR : Write control for the

parallel slave port


CCP1,2 : Capture In/Compare

Out/PWM Out CS : Select control for the

parallel slave
OSC1/CLKIN Oscillator In/Ecternal

Clock In PSP0-7 : Parallel slave port

Oscillator Out/Clock VDD : Positive supply for logic

OSC2/CLKOUT : Out and I/O pins

Vss : Ground reference for

logic and I/O pins

2.9 ARCHITECTURE OF PIC16F877

The PIC architecture is based on a configuration known as a Harvard machine

structure where separate memories are used for the program and data which are
accessed via separate buses. In the PIC16F877, the program bus is 14 bits wide,

whereas the data bus is 8 bits wide. In addition, the PIC family is based on a

Reduced Instruction Set Computer (RISC) configuration which use fewer

instructions than a Complex Instruction Set Computer (CISC). All the PIC devices

use less than 60 instructions.

In general, the PIC16XXX devices have only 35 instructions, whereas the

PIC17XXX devices have only 58 instructions. There is a substantial amount of

program code compatibility amongst 9 different devices in the PIC family. A

program written for one PIC device can easily be assembled and used in another

device type with a minimum number of modifications. The PIC families are fully

static devices, meaning that they preserve the contents of their registers when the

clock frequency is reduced to zero. In PIC microcontrollers, each instruction takes

four clock periods to execute. If a 1MHz clock frequency is used, the

corresponding clock period is 1μsec, so each instruction will take 4μsec–this time

is called the instruction cycle time ti. The fastest devices in the PIC family can

operate at clock frequencies up to 33MHz, with corresponding instruction cycle

times of 121nsec. Most instructions execute in one instruction cycle, but some

require two cycles because they need to branch to some destination other than the

next address in the PC. Instructions that need two cycles to execute are btfsc, btfss,

call, decfsz, goto, incfsz, retfie, retlw and return.


Microchip characterizes PIC microcontrollers according to their instruction

word lengths. The low-end PICs, such as the eight pin 12C5XX series, have 12 bit

word length instructions. The mid-range PICs, such as the PIC16XXX, have 14 bit

instructions and the high-end 17XXX PICs have 16 bit instructions. All PIC

microcontrollers are, however, classified as eight bit microcontrollers as they all

manipulate data in byte units on an eight bit wide data bus.

A detailed knowledge or understanding of these concepts is not essential to

actually use PIC microcontrollers; all that is needed is practice in writing programs

and some experimentation with microcontroller circuits to gain experience.


Fig 2.9: PIC16F877 Architecture.

2.6.2.2 PROGRAM MEMORY


The map of the program memory and the stack of the PIC16F877 is shown below

Fig 2.6.2.2: Shows The Program Memory.

The program counter (PC) is a 13 bit wide register which will enable 8K (8 ×

1024) program address locations to be addressed. Each program instruction is 14

bits wide, so the PC can 10 address 8K × 14 bits of memory space. However, only

1K of this program memory is physically implemented.

2.6.2.3 DATA MEMORY

The Data Memory Organization

The data memory is partitioned into multiple banks which contain the General

Purpose Registers and the Special Function Registers. Bits RP1 (STATUS<6>)

and RP0 (STATUS<5>) are the bank select bits. Each bank extends up to 7Fh (128
bytes). The lower locations of each bank are reserved for the Special Function

Registers. Above the Special Function Registers are General Purpose Registers,

implemented as static RAM. All implemented banks contain Special Function

Registers. Some “high use” Special Function Registers from one bank may be

mirrored in another bank for code reduction and quicker access.


Fig 2.6.2.3: Data Memory Organisation
2.7 I/O PORTS

Some pins for these I/O ports are multiplexed with an alternate function for the

peripheral features on the device. In general, when a peripheral is enabled, that pin

may not be used as a general purpose I/O pin. Additional information on I/O ports

may be found in the PICmicro™ Mid-Range Reference Manual, (DS33023).

2.7.1 PORT A AND THE TRIS A REGISTER

PORTA is a 6-bit wide bi-directional port. The corresponding data direction

register is TRISA. Setting a TRISA bit (=1) will make the corresponding PORTA

pin an input (i.e., put the corresponding output driver in a hi-impedance mode).

Clearing a TRISA bit (=0) will make the corresponding PORTA pin an output (i.e.,

put the contents of the output latch on the selected pin). Reading the PORTA

register reads the status of the pins, whereas writing to it will write to the port

latch. All write operations are read-modify-write operations. Therefore, a write to a

port implies that the port pins are read, the value is modified and then written to the

port data latch. Pin RA4 is multiplexed with the Timer0 module clock input to

become the RA4/T0CKI pin. The RA4/T0CKI pin is a Schmitt Trigger input and

an open drain output. All other PORTA pins have TTL input levels and full CMOS

output drivers. Other PORTA pins are multiplexed with analog inputs and analog
VREF input. The operation of each pin is selected by clearing/setting the control

bits in the ADCON1 register (A/D Control Register1).

2.7.2 PORT B AND THE TRIS B REGISTER

PORTB is an 8-bit wide, bi-directional port. The corresponding data direction

register is TRISB. Setting a TRISB bit (=1) will make the corresponding PORTB

pin an input (i.e., put the corresponding output driver in a hi-impedance mode).

Clearing a TRISB bit (=0) will make the corresponding PORTB pin an output (i.e.,

put the contents of the output latch on the selected pin).

Three pins of PORTB are multiplexed with the Low Voltage Programming

function; RB3/PGM, RB6/PGC and RB7/PGD. The alternate functions of these

pins are described in the Special Features Section.

Each of the PORTB pins has a weak internal pull-up. A single control bit

can turn on all the pull-ups. This is performed by clearing bit RBPU

(OPTION_REG<7>). The weak pull-up is automatically turned off when the port

pin is configured as an output. The pull-ups are disabled on a Power-on Reset.


2.7.3 PORT C AND THE TRIS C REGISTER

PORTC is an 8-bit wide, bi-directional port. The corresponding data direction

register is TRISC. Setting a TRISC bit (=1) will make the corresponding PORTC

pin an input (i.e., put the corresponding output driver in a hi-impedance mode).

Clearing a TRISC bit (=0) will make the corresponding PORTC pin an output (i.e.,

put the contents of the output latch on the selected pin). PORTC is multiplexed

with several peripheral functions (Table 3-5). PORTC pins have Schmitt Trigger

input buffers. When the I2C module is enabled, the PORTC (3:4) pins can be

configured with normal I2C levels or with SMBUS levels by using the CKE bit

(SSPSTAT <6>). When enabling peripheral functions, care should be taken in

defining TRIS bits for each PORTC pin. Some peripherals override the TRIS bit to

make a pin an output, while other peripherals override the TRIS bit to make a pin

an input. Since the TRIS bit override is in effect while the peripheral is enabled,

read-modify write instructions (BSF, BCF, XORWF) with TRISC as destination

should be avoided. The user should refer to the corresponding peripheral section

for the correct TRIS bit settings.


2.7.4 PORT D AND THE TRIS D REGISTERS

PORTD is an 8-bit port with Schmitt Trigger input buffers. Each pin is

individually configurable as an input or output. PORTD can be configured as an 8-

bit wide microprocessor port (parallel slave port) by setting control bit PSPMODE

(TRISE<4>). In this mode, the input buffers are TTL.

2.7.5 PORT E AND THE TRIS E REGISTER

PORTE has three pins, RE0/RD/AN5, RE1/WR/AN6 and RE2/CS/AN7, which are

individually configurable as inputs or outputs. These pins have Schmitt Trigger

input buffers. I/O PORTE becomes control inputs for the microprocessor port

when bit PSPMODE (TRISE<4>) is set. In this mode, the user must make sure that

the TRISE<2:0> bits are set (pins are configured as digital inputs). Ensure

ADCON1 is configured for digital I/O. In this mode, the input buffers are TTL.

Register 3-1 shows the TRISE register, which also controls the parallel slave port

operation. PORTE pins are multiplexed with analog inputs. When selected as an

analog input, these pins will read as ’0’s. TRISE controls the direction of the RE

pins, even when they are being used as analog inputs. The user must make sure to

keep the pins configured as inputs when using them as analog inputs.
3.5 REAL TIME CLOCK (RTC)

A real time clock is a computer clock (most often in the form of an integrated

circuit) that keeps tract of the current time. Although the term often referes to the

divice in personal computers, servers and embedded systems. RTCs are present in

almost all electronic devices which need to keep accurate time.

RTCs often have an alternate power source, so they can continue to keep time

while the primary source is off or unavailable. This alternate power source is

normaly a lithium battery in older system, but some newer system use a

supercapacitor, because they are rechargeable and can be soldered.

Most of the RTCs use a crystal ocsillator , but some use the power line

frequency. In many caces the ocsillator’s frequency is 32.768kHz. This is the

same frequency used in quarz clocks and watches.

Real Time Clock system (RTC DS1307) can be used, which counts seconds,

minutes, hours, days, day of the week, date, month, and year with leap year

compensation valid up to 2100. It also features Binary or BCD representation of

time, calendar, and alarm, a 12– or 24–hour clock with AM and PM in 12–hour

mode, Multiplex bus for pin efficiency.


The DS12C887 Real Time Clock plus RAM is designed as a direct upgrade

replacement for the DS12887 in existing IBM compatible personal computers to

add hardware year 2000 compliance. A century byte was added to memory

location 50, 32h, as called out by the PC AT specification. A lithium energy


source, quartz crystal, and write-protection circuitry are contained within a 24–pin

dual in-line package. As such, the DS12C887 is a complete subsystem replacing 16

components in a typical application. The functions include a non-volatile time-of-

day clock, an alarm, a one-hundred-year calendar, programmable interrupt, square

wave generator, and 113 bytes of non-volatile static RAM. The real time clock is

distinctive in that time-of-day and memory are maintained even in the absence of

power.
2.5 IC PC817 opto-coupler:

 Fig:4 schematic diagram of IC PC817 OPTO COUPLER

 The schematic diagram of IC PC817 opto coupler is shown above and its pin

diagram is also shown. It is a 6-pin IC which has infra-red LED and a photo

transistor internally which can be seen in the figure.


 Out of the six pins the first pin is anode, second pin is cathode. These two

pins act as supply terminals. The third terminal is given no connection as

this terminal is mainly dealt with dc supply. But here we are only dealing

with ac supply and we are no way concerned with dc supply hence we made

the third terminal dead.

2.5.1 Working of IC PC817 OPTO COUPLER:

The PC817 series opto-coupler consists of a gallium arsenide infra-red emitting

diode a silicon photo transistor in a 6-pin dual-in-line package.

This consists of a high power infrared emitting diode which emits IR

radiation when it gets 9V supply. This 9V is supplied by Zener diode which is used

in series with a 15KΩ resistor.

This is so accurate that even a pulse of voltage makes the led to emit the

radiation. And this is the reason the switch over is possible which made this device

highly accurate and fast in operation.


Whenever the supply is given to the anode, the radiation emitted by the high

power LED triggers the photo transistor. Photo transistor is one which needs

radiation to conduct. The 4, 5, 6 pins of PC817 is emitter, collector, base

respectively. Whenever the radiation falls on base the electron moment starts and

electrons flow from emitter to control logic. This gives signal to control logic

circuit and activates the logic IC.

2.5.2 Applications of PC817

A simple circuit with an opto-isolator. When switch S1 is closed, LED D1

lights, which triggers phototransistor Q1, which pulls the output pin low. This

circuit, thus, acts as a NOT gate.

Among other applications, opto-isolators can help cut down on ground loops,

block voltage spikes, and provide electrical isolation.

 One of the requirements of the MIDI (Musical Instrument Digital Interface)

standard is that input connections be opto-isolated.

 They are used to isolate low-current control or signal circuitry from

transients generated or transmitted by power supply and high-current control

circuits. The latter are used within motor and machine control function

blocks.
 Most switched-mode power supplies utilize opto- coupler for mains

isolation.

2.8 LIQUID CRYSTAL DISPLAY

A liquid crystal display (LCD) is an electro-optical amplitude modulator

realized as a thin, flat display device made up of any number of colour or

monochrome pixels arrayed in front of a light source (backlight) or reflector. It is

often utilized in battery-powered electronic devices because it uses very small

amounts of electric power. It is classified as an Electronic display as the input

information is supplied as an electrical signal. (Svenungson, 2005).

2.8.1 DOT MATRIX DISPLAYS

A dot matrix display is a display device used to display information on

machines, clocks, railway departure indicators and many and other devices

requiring a simple display device of limited resolution. The display consists of a

matrix of lights or mechanical indicators arranged in a rectangular configuration

(other shapes are also possible, although not common) such that by switching on or

off selected lights, text or graphics can be displayed. A dot matrix controller

converts instructions from a processor into signals which turns on or off lights in

the matrix so that the required display is produced.


The dots may light up, as in a Light Emitting Diode (LED) or Cathode Ray Tube

(CRT) display, or darken, as in a Liquid Crystal Display (LCD), however

multicolour LCDs are sometimes initially dark and light up. (Svenungson, 2005).

2.8.2 HD44780 CHARACTER DISPLAYS

An HD44780 Character LCD is a de facto industry standard liquid crystal

display (LCD) display device designed for interfacing with embedded systems.

These screens come in common configurations of 8x1, which is one row of eight

characters, 16x2, and 20x4, among others. They are limited to text only, with eight

customizable characters. Character LCDs can come with or without backlights,

which may be LED, fluorescent, or electroluminescent. (Svenungson, 2005).

Figure 2.9: 2 x 16 Dot Matrix LCD

PIN CONFIGURATION

Character LCDs use a standard 14-pin interface. If the screen has a backlight, it

will have 16 pins. The pin configuration is as shown in Table 2.2.


Table 1.2: Pin Configuration for HD44780 LCD from Hitachi corporation

Pin Symbol Level I/O Function

Number

1 Vss - - GND

2 Vcc - - Power Supply

(+)

3 Vee - - Contrast

Adjust

4 RS High/Low I (Register

(H/L) Select)

L –Instruction

Input

H – Data

Input

5 R/W H/L I L – Write to

LCd Module

H – Read

from LCD
module

6 E H/L I Enable signal

7 DB0 H/L I/O Data Bit 0

(LSB)

8 DB1 H/L I/O Data Bit 1

9 DB2 H/L I/O Data Bit 2

10 DB3 H/L I/O Data Bit 3

11 DB4 H/L I/O Data Bit 4

12 DB5 H/L I/O Data Bit 5

13 DB6 H/L I/O Data Bit 6

14 DB7 H/L I/O Data Bit 7

15 BL1 - - Backlight

Power Supply

(+)

16 BL2 - - Backlight

Power

supply(-)
2.9 Relay:

Contact Specifications:

 Configuration : 2CO, 2NO

 Contact rating : 30A at 240V AC/ 24V DC.

 Contact resistance : 100mΏ( max)

 Contact material : Silver alloy.

Fig20: outline structure of electromagnetic relay


General Performance:

 Operating time : 30msec Max

 Fast switching version : 10msec Max

 Release time : 10maec Max

 Life expectancy

 Electrical : 5X 10^3 operations

 Mechanical : 10^3 operations

 Dielectric strength

 Between open contacts : 1000V AC

 Between coil and contact : 2000V AC

 Between any terminal and earth : 2000V AC

 Insulation resistance : 1000MΏ

 Temp range : -40ºc

 Weight : 130g

 Mounting : Chassis mounting.


CHAPTER THREE

METHODOLOGY

3.2 Power Supply

This unit comprises of the transformer, diode rectifier, filtering capacitor and

regulators.

3.2.1 Transformer

The local main is expected to deliver 240V, the system voltage requirement

is 12V and 5V, therefore a 240V/15V transformer was used. The system
input resistance is about 200Ω, therefore the expected load current is

I = V/R = 5/200 = 250 mA

A transformer with the current rating of 500mA which is greater than load

current was used. Thus the power rating of the transformer was calculated to

be

S = VI = 12 X 500 mA = 6VA

3.2.2 Rectifier

The voltage employed is bridge rectifier arrangement. The circuit diagram is

as shown In figure3.1 below


Terminal 1
240/15V D4 D1

D3 D2
Terminal 2
+

C1

Fig. 3.1: Full-wave Bridge Rectifier

A full wave bridge rectifier of 5A is chosen for the capacity to a load up to

2A using IN4001 diodes.

Vdc = 2/∏ × Vpeak

Vdc = 2/∏ × 19.97

Vdc = 14.80v
3.2.3 The filter

This is made up of capacitor connected across the output of the rectifier to

smoothen the voltage to have the minimum ripple factor (at least 10% of the

dc voltage). It is preferable to choose a filtering capacitor that will hold the

peak-to-peak ripples at approximately 10% of the peak voltage. Therefore;

Vripple = 0.1Vpeak
Vripple = 0.1 × 16.97
Vripple = 1.697V
But also Vripple = I/2fC for full wave
Where; I = current taken by the load
f = frequency of supply
C = filtering capacitor
C = I /2fVripple
= 0.17/ (2 × 50 × 1.697)
C = 1001.7µF
From this calculation, a standard capacitor of 2200µF was chosen.

3.2.4 The Regulator

The regulator is a single chip that regulates the ripple free rectified voltage
to give a constant output voltage. Since the circuit needs a supply voltage of
12V and 5V, a 12V and 5V regulators were used. The percentage regulation
or simply regulator of a power supply is given by:
% regulation = [(Vmax – Vmin)/Vmax] × 100
Where;
Vmax = maximum dc output voltage
Vmin = minimum dc output voltage
In a general form
% regulation = [(Vno load – Vfull load)/Vfull load] × 100
The overall power supply circuit and it output wave form is shown in figure
3.2

U1
7812 Voltage
TR1
BR1 1 3
VI VO +

GND
D1 D2
AC Main
C1

2
D3 D4 1000u -
G2SB20 Time
TRAN-2P2S

Figure 3.2. Overall power supply circuit and it output wave form.

3.2.5 CONTROL UNIT

The control unit is mainly the PIC16F877A microcontroller IC and most of

it values for the design were gotten from the data sheet except in some few cases.

The design is as follows

The crystal oscillator

In applications where great time precision is not necessary, RC oscillator offers

additional savings during purchase. Resonant frequency of RC oscillator depends

on supply voltage rate, resistance R, capacitors C and working temperature. It

should be mentioned here that resonant frequency is also influenced by normal

variations in process parameters, by tolerance of external R and C components, etc.


So based on the above consideration, an RC oscillator was chosen and

design procedure is shown in figure 3.1 below

Figure 3.3 RC oscillator connections

The above diagram shows how RC oscillator is connected with PIC16F877A. With

value of resistor R being below 2.2k, oscillator can become unstable, or it can even

stop the oscillation. With very high value of R (ex.1M) oscillator becomes very

sensitive to noise and humidity. It is recommended that value of resistor R should

be between 3 and 100k. Even though oscillator will work without an external

capacitor (C=0pF), capacitor above 20pF should still be used for noise and

stability. No matter which oscillator is being used, in order to get a clock that

microcontroller works upon; a clock of the oscillator must be divided by 4.

Oscillator clock divided by 4 can also be obtained on OSC2/CLKOUT pin, and can

be used for testing or synchronizing other logical circuits.

So the recommended value of R and C for a frequency of 4MHz was gotten from a

table in the data sheet. The table is shown below


TABLE 3.1
FREQUENCY R C
455KHZ 3.0K 22uF
2.0MHZ 3.0K 25uF
4.0MHZ 3.3K 25-29uF
8.0MHZ 4.7K 30-33uF
10MHZ 5.6K 33-35uF

The master clear

The master clear (MCLR) is used for putting the microcontroller into a 'known'

condition. This practically means that microcontroller can behave rather

inaccurately under certain undesirable conditions. In order to continue its proper

functioning it has to be reset, meaning all registers would be placed in a starting

position. Reset is not only used when microcontroller doesn't behave the way we

want it to, but can also be used when trying out a device as an interrupt in program

execution, or to get a microcontroller ready when loading a program. So for this

case the connection in figure 3.4 below is utilized


Figure 3.4 resetting the PIC16FG877A via MCLR

In order to prevent from bringing a logical zero to MCLR pin accidentally (line

above it means that reset is activated by a logical zero), MCLR has to be connected

via resistor or a capacitor to the positive supply pole. If a resistor is used, the value

should be between 5 and 10K. On the other hand, if a capacitor is used the value

should be between 50-100nF. The function of the resistor or the capacitor is to

keep a certain line on a logical one as a preventive, called a pull up. So a capacitor

value of 100nF was used due its availability.

These are the design needed to set the microcontroller working.


CHAPTER FOUR

TESTS, RESULTS AND DISCUSSIONS

4.1 Introduction

This chapter deals with the description of the various tests carried out on the

functionality of the implemented project where results obtained from the exercise

are presented and discussions based on these observations were made.


4.2 Test Carried-out

The tests carried-out based on the output gotten from the digital calendar

with clock and alarm are the tests done on the clock timing, the calendar, the

alarm and then by comparing with standard equipment’s that have such

functionalities.

For the test on the clock timing the procedure carried out in doing the test

was by comparing with a standard clock and a stopwatch. The implemented digital

clock was set at the initial time of 06:00:00 and allowed to continue running for 2

weeks where the time at intervals of 24 hours were observed and compared with

that of the standard clock and the results were analyzed for accuracy as presented

in the next section.

Likewise, the calendar was checked to see if it was corresponding with the

right date and it changes at the right moment in which also analysis was made as

regard when the Digital clock would be lacking by a day. While for the alarm,

several alarm times were set and observed to see if there would sound at the right

time.

For the test done on the battery level displayed, the procedure carried out

was by also comparing with a level of the battery, if the level of the battery is

reduced the LCD will indicated the present level of the battery.
4.3 Results Obtained

This section presents the results obtained from the various measurements

taken on the clock timing, calendar, alarm and battery displayed. Then the section

rounds up with calculations of percentage error and percentage accuracy of the

meter.

4.4 TEST EQUIPMENT

Various tests were carried out on different stages of the system using the
following test equipment’s

(1) Variable DC power supply; the various voltages required to power


different points were provided by this equipment.

(2) Digital multimeter; a digital multimeter was used to measure currents,


voltages, resistances and continuity. It gives the exact value of the
measured quantity.

(3) Logic probe; the logic levels (HIGH or LOW) of all the digital
components used were tested at different points with a logic probe.

(4) Project board; the testing of different units and subsequently the
whole system were done on a project board before soldering the
components.

4.3 TEST POINTS

In order to save time and energy when troubleshooting, various stages of the
system were constructed in separate. This enables the testing of each unit
separately to determine its workability before coupling the system. For each
unit, test points were selected and used as follows:

(l) Power supply output: the outputs of the power supply were tested and
voltages of 5.02v and 12v were obtained on no-load condition. The test was
repeated on full load and the voltages obtained were 4.95v and 11.89v.
The resulting voltage regulation is given as:

VR = VNL-VFL x l00

VFL

For 5v:

VR = 5.02- 4.95 x 100- 1.40%

5.02

For 12v:

VR = 12-11.89 x 100 = 0.92%

12

4.3.1 Clock Timing Test Results

The results obtained for the clock timing as compared with the standard

clock are given in the table below with the accuracy estimated or measured from

the observed values calculated as below.

Table 4.1, Results obtained for the clock timing

Standard Constructed
Clock Clock
Day Timing Timing % Error

1 06:00:00 06:00:02 0.0023

2 06:00:00 06:00:04 0.0046

3 06:00:00 06:00:06 0.0069

4 06:00:00 06:00:08 0.0093

5 06:00:00 06:00:10 0.0116

6 06:00:00 06:00:12 0.0139

7 06:00:00 06:00:14 0.0162

8 06:00:00 06:00:16 0.0185

9 06:00:00 06:00:18 0.0208

10 06:00:00 06:00:20 0.0231

11 06:00:00 06:00:22 0.0255

12 06:00:00 06:00:24 0.0278

13 06:00:00 06:00:26 0.0301

14 06:00:00 06:00:28 0.0324


Thus from the results obtained it could be seen that there is an addition of 2

seconds every day and the accuracy of the clock timing is computed as below.

Thus given that the % Error is given by;

t cc −t sc
% Error= ×100−−−−4.1
t sc

Where, tcc is the time observed from the constructed clock in seconds

t sc is the time observed from the standard clock in seconds

Hence,

For the first day, we have:

t sc =24 ×60 × 60=86400 secs

t cc =( 24 × 60 ×60 ) +2=86402 secs

86402−86400
∴ % Error= ×100 ≈ 0.0023 %
86400

For the second day, we have:

t sc =24 ×60 × 60=86400 secs

t cc =( 24 × 60 ×60 ) + 4=86404 secs

86404−86400
∴ % Error= × 100 ≈ 0.0046 %
86400

For the third day, we have:

t sc =24 ×60 × 60=86400 secs

t cc =( 24 × 60 ×60 ) +6=86406 secs

86406−86400
∴ % Error= × 100≈ 0.0069 %
86400
For the fourth day, we have:

t sc =24 ×60 × 60=86400 secs

t cc =( 24 × 60 ×60 ) +8=86408 secs

86408−86400
∴ % Error= ×100 ≈ 0.0093 %
86400

For the fifth day, we have:

t sc =24 ×60 × 60=86400 secs

t cc =( 24 × 60 ×60 ) +10=86410 secs

86410−86400
∴ % Error= ×100 ≈ 0.0116 %
86400

For the sixth day, we have:

t sc =24 ×60 × 60=86400 secs

t cc =( 24 × 60 ×60 ) +12=86472 secs

86412−86400
∴ % Error= ×100 ≈ 0.0139 %
86400

For the seventh day, we have:

t sc =24 ×60 × 60=86400 secs

t cc =( 24 × 60 ×60 ) +14=86414 secs

86414−86400
∴ % Error= × 100 ≈ 0.0162 %
86400

For the eighth day, we have:

t sc =24 ×60 × 60=86400 secs

t cc =( 24 × 60 ×60 ) +16=86416 secs

86416−86400
∴ % Error= × 100≈ 0.0185 %
86400
For the ninth day, we have:

t sc =24 ×60 × 60=86400 secs

t cc =( 24 × 60 ×60 ) +18=86418 secs

86418−86400
∴ % Error= ×100 ≈ 0.0208 %
86400

For the tenth day, we have:

t sc =24 ×60 × 60=86400 secs

t cc =( 24 × 60 ×60 ) +20=86420 secs

86420−86400
∴ % Error= ×100 ≈ 0.0231 %
86400

For the eleventh day, we have:

t sc =24 ×60 × 60=86400 secs

t cc =( 24 × 60 ×60 ) +22=86422 secs

86422−86400
∴ % Error= ×100 ≈ 0.0255 %
86400

For the twelfth day, we have:

t sc =24 ×60 × 60=86400 secs

t cc =( 24 X 60 X 60 )+ 24=86424 secs

86424−86400
∴ % Error= × 100 ≈ 0.0278 %
86400

For the thirteen day, we have:

t sc =24 ×60 × 60=86400 secs

t cc =( 24 × 60 ×60 ) +26=86426 secs

86426−86400
∴ % Error= × 100≈ 0.0301 %
86400
For the fourteenth day, we have:

t sc =24 ×60 × 60=86400 secs

t cc =( 24 × 60 ×60 ) +28=86428 secs

86428−86400
∴ % Error= ×100 ≈ 0.0324 %
86400

Therefore, the accuracy of the clock is computed as:

0.4932
Average % Error= =0.0352≈ 0.04 %
14

Accuracy=100 %− Average % Error−−−−−−−4.2

¿ 100−0.04
¿ 99.96 %
CHAPTER FIVE:

SUMMARY, CONCLUSION AND RECOMMENDATION

5.1 Summary

In summary, this report has gone through past and similar projects done on

the design and implementation of digital clocks in which areas with shortcomings

and how this project differs from others were pinpointed in chapter two. Then,

details of the design methodology used, the implementation procedures and then

the operation of the project were also discussed in chapter three. While in chapter

four, the various tests carried out and results obtained in order to determine the

accuracy of the project and areas where lapses encountered were discussed

thoroughly

.
5.2 Conclusion
In conclusion, it could be said that the aim to design and construct a device

that is capable of switching on/off of home appliances at a programmed time. that

would be able to achieve a level of accuracy in its functionality, be simple in terms

of hardware complexity and as well show superiority in terms of flexibility and

robustness were surely achieved though with some shortcomings here and there.

5.3 Recommendations

The recommendation regarding this project is that though the project has

been built as it was intended but there is still room for improvement most

especially in providing a means by which a user can choose between either to use

the 24-hour format or the 12-hour format of timing. Also there is also room for

improvement in the power being consumed by the whole circuitry of the digital

clock.
REFERENCES:

[1] A. Z. Alkar, U. Buhur, “An Internet Based Wireless Home Automation

System for Multifunctional Devices," IEEE Consumer Electronics, vol. 51, no. 4, pp.

1169- 1174, 2005.

[2] G. S. Nhivekar and R.R.Mudholkar, “Microcontroller Based IR Remote

Control Signal Decoder for Home Application”, Advances in Applied Science

Research, vol. 2 no. 4, pp. 410-416, 2011.

[3] http://www.123eng.com/projects/microcontroller_based_

home_security_project.html, Web.

[4] R. Shahriyar, E. Hoque, S. M. Sohan, I. Naim, M. M. Akbar, and M. K. Khan,

“Remote Controlling of Home Appliances using Mobile Telephony”, International

Journal of Smart Home, Vol. 2, No. 3, July, 2008.

[5] C. K. Das, M. Sanaullah, H. M. G. Sarower and M. M. Hassan, “Development

of a cell phone based remote control system: an effective switching system for
controlling home and office appliances”, International Journal of Electrical &

Computer Sciences IJECS, Vol. 9, No. 10, pp. 37-43, 2009.

[6] M. S. H. Khiyal, A. Khan, and E. Shehzadi, “SMS Based Wireless Home

Appliance Control System (HACS) for Automating Appliances and Security”, Issues

in Informing Science and Information Technology, vol. 9, pp. 887-894, 2009.

[7] I. Kaur, “Microcontroller Based Home Automation System with Security”,

International Journal of Advanced Computer Science and Applications (IJACSA),

Vol. 1, No. 6, December 2010.

[8] www.atmel.com

[9] Bergmans S., Oisterwijk, Sony SIRC Protocol [online]. [10]

http://www.sbprojects.com/knowledge/ir/rc5.php.

You might also like