PROJECT
PROJECT
SENIOR PROJECT
PASSWORD
JUNE, 2018.
DECLARATION
I, Joachim Samwel declared that all works described in this project report is my own project and
has not been copied from anywhere else.
Joachim Samwel . .
i
CERTIFICATION
The undersigned certify that they have read and hereby recommend for examination of project
report entitled REMOTELY CONTROLLED ELECTRICAL SWITCH USING PASSWORD, in
fulfillment of the requirements for the degree of Bachelor of Engineering in Electronics and
Telecommunications of Dar es Salaam Institute of Technology.
Signature: …………………………..
Date: ………………………………..
ii
ACKNOWLEDGMENT
First and foremost I thank the Almighty God for the precious gift of life and for constant
guidance and strength in accomplishing this project.
Secondly, I would like to express sincere gratitude and appreciation to my project supervisor,
Mr. Jordan Hossea, and a final year project coordinator, Dr. Pesha Petro Ernest whose guidance,
encouragement, views, and recommendations helped in the achievement the project obtained.
Thirdly, I would like to give great gratitude to all lecturers, without forgetting my fellow students
and other people inside and outside the institute who have directly or indirectly provided insights
which have helped in the achievements the project attained.
Lastly, I am deeply grateful to my beloved parents, siblings, relatives, and friends for their
endless and unconditional love, prayers, and support throughout my study period, may the
Almighty God bless you all.
iii
ABSTRACT
A circuit breaker is an automatically operated electrical switch designed to protect an electrical
circuit from damage caused by an overload or short circuit. Its basic function is to detect a fault
condition and interrupt current flow. Unlike a fuse, which operates once and then must be
replaced, a circuit breaker can be reset (either manually or automatically) to resume normal
operation. When operated manually, fatal electrical accidents to the line can occur at any time
during the electric line repair due to the lack of communication and coordination between the
maintenance staff and the electric substation staff. In order to avoid such accidents, the breaker
can be so designed such that only authorized person can operate it with a password.
To prevent accidental switching ON by unauthorized workforce, this project proposes a more life
secured switching password-enabled device that strengthens working confidence and prevents an
unauthorized person from switching ON electrical power without the notice of site engineers.
The system has two parts; hardware and software. The Software part consists of Android
Application and PIC instructions. The hardware architecture consists of Android phone, GSM
Modem, Microcontroller and a driver circuit. The GSM modem provides the communication
media between the Android Application and microcontroller by means of SMS messages. The
SMS message consists of commands to be executed. The SMS message is sent to the GSM
modem via the GSM public networks as a text message initiated by the android application
installed in an android phone with a definite predefined format.
Once the GSM modem receives the message, the commands sent will be extracted and executed
by the microcontroller. The system will interpret the commands and turn the power line ON/OFF
via the switching unit.
iv
TABLE OF CONTENTS
DECLARATION ......................................................................................................................................
CERTIFICATION ..................................................................................................................................ii
ACKNOWLEDGMENT........................................................................................................................iii
ABSTRACT ........................................................................................................................................... iv
METHODOLOGY ................................................................................................................................. 4
v
3.4 System Design .................................................................................................................................. 5
vii
7.2 Simulation Software........................................................................................................................ 39
REFERENCES ..................................................................................................................................... 47
APPENDIX A ....................................................................................................................................... 50
APPENDIX B ....................................................................................................................................... 55
APPENDIX C ....................................................................................................................................... 56
viii
LIST OF FIGURES
Fig1. 1 Circuit breaker [31] ............................................................................................................ 2
ix
LIST OF TABLES
Table 2. 1 World smartphone market as provided by IDC [18]. .................................................. 13
x
LIST OF ABBREVIATIONS
APK – Android application package
Ib – Beta Current
Ic – Collector Current
IE – Emitter Current
Kb – Kilobyte
xi
CHAPTER ONE
GENERAL INTRODUCTION
1.0 Introduction.
This chapter introduces and gives the background information of the problem to be solved, the
idea behind what motivated me to do this project, the objectives of the project and significance
of this project also the scope and limitation of the project.
A circuit breaker is an automatic device used to stop the flow of current in an electric circuit as a
safety measure.
An early form of circuit breaker was described by Thomas Edison in an 1879 patent application,
although his commercial power distribution system used fuses [3]. Its purpose was to protect
lighting circuit wiring from accidental short circuits and overloads. A modern miniature circuit
breaker similar to the ones now in use was patented by Brown, Boveri & Cie in 1924. Hugo
Stotz, an engineer who had sold his company to BBC, was credited as the inventor on DRP [2].
Stotz's invention was the forerunner of the modern thermal-magnetic breaker commonly used in
household load centers to this day.
All circuit breaker systems have common features in their operation, but details vary
substantially depending on the voltage class, current rating, and type of the circuit breaker.
The circuit breaker must firstly detect a fault condition. In small mains and low voltage circuit
breakers, this is usually done within the device itself. Typically, the heating or magnetic effects
of electric current are employed. Circuit breakers for large currents or high voltages are usually
arranged with protective relay pilot devices to sense a fault condition and to operate the opening
mechanism. These typically require a separate power source, such as a battery, although some
1
high-voltage circuit breakers are self-contained with current transformers, protective relays, and
an internal control power source.
In some cases, people die as a result of occupational accidents or work-related diseases – more
than 2.78 million deaths per year [1]. Additionally, there are some 374 million non-fatal work-
related injuries and illnesses each year, many of these resulting in extended absences from work.
The human cost of this daily adversity is vast and the economic burden of poor occupational
safety and health practices is estimated at 3.94 percent of global Gross Domestic Product each
year [1]. Decent work is safe work [1] [2]. Figure 1.1 shows the circuit breaker installed in the
substation electric panel
1.2Problem Statement
Fatal electrical accidents to the lineman during maintenance can occur due to the improper
protection of circuit breakers [1]. This is due to the lack or poor communication and coordination
between the maintenance staff and the electric substation staff.
2
1.3 Project Objectives
The objective of this project is classified as the main objective and specific objectives.
To design and develop a system that will be able to ensure the safety of the maintenance staff by
isolating the equipments/machines from direct contact with the main supply remotely using an
android phone.
1.3.2Specific Objectives
I. To establish design specifications
II. To design an independent power supply for the system
III. To design and program an android application that will be used to initialize the switching
mechanism
IV. To design the interface between the control unit and android application
V. To come up with the prototype that will solve the intended problem
3
CHAPTER TWO
METHODOLOGY
3.0 Introduction
This consists of various methods that will be used to achieve the objectives of the project. These
methods include:
i. Literature review
ii. Data collection
iii. Data analysis
iv. System design
v. Circuit simulation
vi. Design implementation and testing.
vii. Report writing
4
3.4 System Design
System design will involve planning of how the system will be constructed in accordance to data
analysis conclusion. This will include defining the architecture, components, modules, interfaces
and data for the proposed system which aims at achieving the objectives set.
5
CHAPTER THREE
LITERATURE REVIEW
2.0 Introduction
This chapter gives a detailed description, feature specification and the operation of the existing
systems.
6
2.1.1 Using Keypad
KEYPAD INPUT
The keypad is employed as an external interface to the system through a user can communicate
with the microcontroller to perform an already programmed function. It is used for the
following: inputting the password and changing the password. In this project, a 3 x 4 matrix
The keypad performs two separate functions; they can serve as numeric keys and function keys.
The numeric keys are design to input numeric values into the system, they include "0 – 9". While
the function keys "*" and "#" are used to process the inputs.
The output of the button pressed on the keypad is displayed on the LCD display as a hidden
character due to privacy and it will display an asterisk (*).
When the input pin is correct it causes the control unit generates the control signal to drive the
switching unit.
7
The keypad itself consumes no power. It works by simply making connections between wires.
For example, suppose the input for the first column is grounded and a voltage is applied at the
input for the first row. If no button is pressed no current will flow through any input. Yet, if
button "1," which is located in the first row and first column, is pressed, a connection is made
between the two inputs mentioned above and current flows through each input. This will only
happen if button "1" is pressed. With this configuration, it would have been possible to connect
the keypad directly to the microprocessor and have it look for a connection across two inputs.
This system uses keypad which needs a person with the password to enter the password
manually to switch on/off the power lines. This system is not better for security because any
person with the knowledge of the password can snick and turn the power line on even if the line
is in maintenance and can still cause the electric shock to the lineman [5]. Figure 2.3 and 2.4
show the block diagram and circuit of the existing system using keypad respectively.
Switching
Powerline
Unit 1
Bluetooth Control
Module Unit
Switching
Powerline
Unit 2
Power Supply
8
Fig 2.4 Circuit system using keypad [33]
The Bluetooth was inverted by Ericson, and it is managed by the Bluetooth Special Interest
Group which has more than 30,000 companies in the area of telecommunications, computing,
and network and consumer electronics. Figure 2.5 shows the Bluetooth module device
9
This system uses Bluetooth communication which needs a person with a mobile phone having a
Bluetooth to enter the password by pairing the phone with the Bluetooth module. Also, this
system is not best for the protection because anyone with the access with the Bluetooth can
connect and turn on the power [6]. Figure 2.6 and 2.7 shows the block diagram and circuit of the
existing system using Bluetooth.
Switching
Powerline
Control Unit 1
Mobile Bluetooth
Phone Unit
Module
Switching
Powerline
Unit 2
Power Supply
10
Fig 2.7 The system using Bluetooth communication [35]
• Low level of security because anyone can snick the password and have the authority of
turning the power on when the keypad is used
• With the Bluetooth, it is limited by distance because Bluetooth communication covers a
range of not more than 100 meters [9].
A GSM modem is a device, which modulates an analog carrier signal to encode digital
information, and demodulates that carrier to decode the transmitted information signals in a
GSM system. GSM modem modulates data from microcontroller so that they will suit the GSM
network. This modem will operate at either the 900MHz or 1800MHz frequency band depends
on available GSM network at the applied area. Modem consists of two parts, which are mobile
telephone radio and Subscriber Identity Module [10].
A GSM Modem is a specialized type of modem which accepts a SIM card, and operates
oversubscription to a mobile operator, just like a mobile phone. From the mobile operator
perspective, a GSM modem looks just like a mobile phone.
11
GSM is a globally accepted standard for digital cellular communication. GSM is the name of a
standardization group established in 1982 to create a common European mobile telephone
standard that would formulate specifications for a pan-European mobile cellular radio system
operating at 900 MHz [17, 20]. Figure 2.8 and 2.9 shows Gsm module and GSM architecture
respectively.
Initially developed by Android Inc., which Google bought in 2005, Android was unveiled in
2007, with the first commercial Android device launched in September 2008. The operating
system has since gone through multiple major releases, with the current version being 8.1
"Oreo", released in December 2017.
Android has been the best-selling OS worldwide on smartphones since 2011 and on tablets since
2013. As of May 2017, it has over two billion monthly active users, the largest installed base of
any operating system, and as of 2017, the Google Play store features over 3.5 million apps [18].
Table 2.1 below shows world Smartphone operating system market.
Operating System 4Q16 Units 4Q16 Market 4Q15 Units 4Q15 Market
Share (%) Share(%)
13
Display unit
The display unit is one of the outputs of the control unit and it will be displaying the required
information from the unit.
A display is an output device for presentation of internal processed information from a particular
device or system. Display devices are categorized depending on the technology. Basically, we
have cathode ray tube display, liquid crystal display, light emitting diode display and these made
from gas plasma. Example of the display used is LCD.
A liquid – crystal display is a flat panel display, electronic visual display, or video display that
uses the light modulating properties of liquid crystal. Liquid crystals do not emit light directly
[11].
LCDs are available to display arbitrary images or fixed images with low information content
which can be displayed or hidden, such as preset words, digits and seven-segment displays as in
a digital clock. Generally, we have two categories of the liquid display which are:-
These are the ones which do not require external light to produce a visible image. In this type of
LED no backlight, I required so as to produce an image. E.g. calculators, wristwatches use this
type of LCD displays.
Active matrix LCDs displays need backlight so as to produce visible images. Active matrix LCD
uses different illumination technologies to provide the required backlight [19].
14
CHAPTER FOUR
PROPOSED SYSTEM
4.0 Introduction
This chapter describes the function of each block in the proposed system block diagram. It also
explains the functionality of the whole system and signal transfer from one end to another.
Advantages of the proposed system are also being mentioned.
Once the GSM modem receives the message, the commands sent will be extracted and executed
by the microcontroller. The system will interpret the commands and turn the power line ON via
the switching unit. Figure 4.1 shows the block diagram of the proposed system.
15
Android Phone
Display and
Notification
unit
Control
Android App GSM
Unit
Module
Switching
Powerline
Unit
Text
Power Supply
16
4.2.4 Display unit
The display unit is one of the outputs of the control unit and it will be displaying the required
information from the unit. In this project, LCD display will be used as the display unit to the
notification from the customer at the vendor side.
17
4.2.6 Power supply
The purpose of a power supply is to provide power for all the circuits used in the system. The
components of power supply are step down transformer, Rectifier, a Filter circuit and regulator
circuit [14, 26, and 27].
4.2.7 Chapterconclusion
This chapter has given the details about how the proposed system is made. It also explains how
the system works by analyzing functions of each block in the system. The next chapter gives
details about the data collection.
18
CHAPTER FIVE
DATA COLLECTION
5.0 Introduction
Data collection is a systematic approach of gathering information from a variety of sources to get
a complete and accurate picture of an area of interest.
CONCLUSION due to the above responses, it shows that the problem exists and the current
system needs to be improved.
19
5.1 Control Unit
This part will be the brain of the system. Table 5.2 shows the data collected and requirements of
the control unit.
FAMILIES
PARAMETER
Arduino PIC-Microcontroller Raspberry Pi
Current "official " Peripheral Interface Controller, Single board
Arduino USB board, with discrete I/O pins, ADC Linux computer
driverless, USB-to- and DAC modules, inbuilt with video
Summary Serial, auto power timers and communications processing and
switching. ports. Re-programmable Flash- GPIO ports.
memory capability.
Onboard USB Multiple component HD Capable
controller Multiple interfacing e.g. PWMs, LCD, Video Processor,
component 10-bit ADC, Opamp etc. HDMI and
interfacing such as Multiple communication composite
Feature PWMs, LCD, 10-bit peripherals, Linear Outputs,
ADC, Opamp etc. Programming, USB, and Onboard
Multiple Ethernet Support. Ethernet.
communication
peripherals.
20
5.2 Regulator
It is used to regulate the voltage from battery to the required voltage that will be used to operate
on the control unit. Table 5.3 shows the parameter and requirement of the regulator for power
supply
- PARAMETER - REQUIREMENT
- Current consumption - Up to 1A
PARAMETER REQUIREMENT
21
5.4 Communication Module
Table 5.5 Frequency range for uplink/downlink of mobile phone operators in Tanzania.
(DAR ONLY)
22
5.5 Android Application
Before starting Android programming, the Computer needs to have the following installed
23
CHAPTER SIX
6.1 Introduction
From the data collected and presented in the previous chapter, this chapter provides the analysis
of the collected data, selection of components, reasons for selecting a particular component or
calculations leading to the selected components to be used in the design. Also, this chapter is
going to talk about major components selection, data analysis, and design.
A regulated power supply will be used to power various section of the system.
Requirements
i. 5 volts power supply for the control unit, GSM module, Display and ON/OFF indicators.
ii. 12 volts power supply for the switching circuit
iii. Filtered (Ripple free) power supply
iv. Regulated power supply
Qualitative analysis
24
On the rectifier
25
But Vo on the Diode
Capacitor value C1
Capacitance = Vm2fRLVrms
×100%
×100%
These bases on the comparison of various dc voltage regulators as shown in table 6.1
26
6. 1 Comparison of d.c voltage regulatorsTable
Basing on the requirements, the best choices are the LM7805 and LM7812 d.c voltages
regulators.
i. Has the ability to provide a constant, regulated 5 and 12 d.c volts, respectively.
ii. 78XX series does not require any additional components to provide a constant, regulated
power, making them easy to use and economical
iii. 78XX series IC have built-in protection against a circuit drawing too much power. They
also have protection against overheating and short circuits, making them quite robust in
most applications.
27
6.1.3 Control unit
A control unit used to process the signal from the input and produce the required output in
accordance with the proposed system. Requirements for a control unit are as follows.
i. Built-in analog to digital converter ( ADC)
ii. At least 20 inputs outputs pins
iii. Speed at least 16MHz
iv. Programming memory at least 32KB
v. At least 4 pins supporting serial communication
In order to select, the suitable control unit the comparison between different Control units
available in the market shown in table below
From the comparison above the Control unit suitable for the proposed system is ATMEGA 328P
28
Figure6. 2 ATmega 328P pin mapping [32]
29
6.1.4 GSM module
The GSM module is used by the user to sends commands to the control unit remotely.
Requirements
Qualitative analysis
This considers on the comparison GSM modules and then analyzing the best choice. They differ
in various features such as SMS handling, baud rate, frequency bands, cost, size etc.
As per the qualitative analysis, the best choice of GSM module is GSM900
30
Reasons for selecting GSM900
i. SMS reception and transmission capability
ii. Quad-band frequency range
iii. Greater baud rate
[Link] Requirements
i. Display at least 16 characters per line and at least two lines to display the status of all
lines simultaneously i.e. Line1 ON/OFF, Line2 ON/OFF
ii. Low power consumption
iii. Easy to interface with a microcontroller
iv. Ability to display characters clearly
Table 6.4 shows the comparison of various display and their features.
According to the qualitative analysis, the best choice of the display system is LCD display, as it
meets the necessary requirements. Figure 6.4 show diagram of LCD display.
31
Figure6. 4 Diagram of LCD display [38]
[Link] Requirements
i. Automatic switching
ii. Small operating voltage ( 5V to 12V)
iii. Ability to trigger/connect large power system from a small power system
iv. Fast switching
v. It must be able to control the opening and closing of a solenoid valve and the starter.
32
[Link] Relay switching circuit
The relay switching device is incorporated with a transistor, protection diode and a base resistor
to enhance the switching with the control unit.
The transistor specification made the proper selection of the transistor to be used so as to provide
enough driving current for the relay.
The DC resistance of the relay is 400 ohms and its related voltage is 12V.
So,
The available resistor in the market is 10k. Figure 6.5 shows the switching circuit.
33
6.1.7 Android Application
In developing Android App, the tool that used is the MIT App Inventor which is the platform
designed by Massachusetts Institute of Technology for designing Android Applications.
i) Login dashboard
This layout contains the login options that require an Engineer to enter his username and
password.
Both password and username should be entered correctly as registered if one or both is entered
incorrectly the login will be denied and the invalid message will be displayed.
34
Figure6. 6 (b) Dashboard Layout
35
iii) Activity Power Line1
This layout contains two toggles Button that sends an SMS when toggled, the first toggle button
sends “#1” when toggled ON and “*1” when toggled OFF. Figure 6.7 below shows the line1
dashboard
Figure 6.7(a) Line1 dashboard when the buttons are pressed ON or OFF the background Color
change into green when turning on and red when turning off. Figure 6.7b below shows the color
change
38
CHAPTER SEVEN
7.1 Introduction
This chapter explains how the simulation has been done, simulation results are also attached, and
implementation of the prototype. The circuit simulations for this project are carried out in
Proteus 8.6 professional.
v. Moreover, it offers the capability to prepare printed circuit board layout for actual
realization of the prototypes of different designed systems.
The simulation results of the power supply. It is supplying 5V output required by the
microcontroller GSM module, LCD display, Interrupt Switches and 12V output for Relay
Switches
AC
RESULT DISCUSSION: The voltage obtained from the circuit output is sufficient enough to
drive the load.
40
7.8 When the system is turned OFF Remotely
By sending the commands *1, *2 and *3 to the GSM the system should be OFF turning off line1,
line2, and line3 respectively. Figures 7.6 below shows the remotely turning off process
RESULTS DISCUSSION: Since the system can receive sms with commands from the mobile
phone initialized by the android app, this implies that the circuit design is correct and working.
41
CHAPTER EIGHT
43
8.4 Test of the GSM Module
The module was tested using the voltmeter to measure Transmit (TX) and Receive (RX) signal
of the module. Transmit (TX) signal was found to be 5V when the module sends to control unit.
And Receive (RX) signal was found to be 5 V when the module receives from the control unit. It
is known the control unit like Atmega 328P gives 5V output on its pin as the rated operating
voltage. The power signal for the module was measured to be 5V.
The results of the implemented prototype based on the objectives of the project are;
iii. Designing and Interfacing the Android Application to initialize the switching;
The Android App designed and managed to send commands to the GSM module.
44
8.6Chapter conclusion
In this chapter prototype implementation and testing has been explained. Components were
mounted on PCB board and the system was tested. The results show that specific objectives of
the project have been achieved and so the main objective is achieved.
45
CHAPTER NINE
CONCLUSIONS AND RECOMMENDATIONS
9.1 Conclusions
Remotely controlled electrical switch system has been proposed in order to solve the problems of
electrical shock that may results into death or deformity.
This report provides all basic information concerning the existence of the problem and the
procedures towards solving it. Using these procedures, the system has been designed and
realized in both hardware and software. Moreover, the system has been tested and appeared to
give expected results. Considering results obtained after prototype testing, the designed system is
expected to solve the existing problem.
Success in design of this system will help both maintenance stuff to save time and eliminate
probability of electrical shock accidents which can occur at any time in existing system.
9.2 Recommendations
The proposed system has just laid a foundation, there are still more developments that can be
required to improve the system. So it is an invitation for other scholars and experts to work on it
to improve, it should not just end in the prototype.
46
REFERENCES
[1] Safety and health at work
[Link] (ilo)
[Link]
[3] Robert Friedel and Paul Israel, Edison's Electric Light: Biography of an Invention, Rutgers
University Press, New Brunswick New Jersey USA, 1986 ISBN 0-8135-1118-6 pp.65-66
pg 358-359
[7] Edwin Wright, Deon Reynders & Steve Mackay, “Bluetooth”, Practical Telecommunication
and wireless communications, Ed, London, Newnes, 2004, pp. 152 – 153
[9] Nordic semi (2016). Things you should know about Bluetooth range. [Online] available:
[Link]
range
[10] G. Heine, GSM Networks: Protocols, Terminology, and Implementation, USA, 1999.
47
[11] C. Woodford (2016, May). How do LCD works. Available:
[Link]
[12] Electronic device and circuit theory pg 129-252, Robert L. Boylestad & Louis Nashelsky
11th Edition
[13] Electronic device and circuit theory pg 783-810, Robert L. Boylestad & Louis Nashelsky
11th Edition
[14] [Link]
[15] John Matthews Introduction to the Design and Analysis of Building Electrical
[17] G. Heine, GSM Networks: Protocols, Terminology, and Implementation, USA, 1999.
[18] Mobile - CNET News (2013). Android dominates 81 percent of world smartphone market.
[ONLINE]Available: [Link]
dominates-81-percent-of-world-smartphone-market/.
[20] X. Jiang, Research and Implementation of remote controlling based on SMS technology,
2012
[22] C. Peijiang and J. Xuehua, Design and implementation of remote monitoring system based
on GSM, 2008.
[23] [Link], Electronics fundamentals: Circuits, devices, and applications,6th ed. United
48
[24] D. Yang and S. Wu, Fundamentals of Liquid Crystal Devices, 2nd ed. Chichester: Wiley,
2015.
[25] E. Priestly, Introduction to Liquid Crystals, New York: Plenum Press, 1974.
[27] M. Brown, Practical Switching Power Supply Design, California: academic Press Inc.,
1990.
[28] A.F. Molisch, Wireless Communications, 2nd ed. Chichester: John Wiley & Sons Ltd,
2011.
[29] Thomas W (2008). Electronic Communication Systems. 3rd ed.: Pearson Education Inc.
[30] S. M. Weber, GSM and personal communications handbook, Boston: Artech House,
2009.
[31] [Link]
[32] [Link]
[33] [Link]
xHYGvEpJP-rhRA-99mHVSJgBYWtTxT
[34] [Link]
[35][Link]
0NZrshlE41WKguSVi8VJgHApbQQ
[36] [Link]
[37][Link]/Mobile+devices/gprs+mobile+internet/Chapter+1+Introduction+to+the+
GSM+System/Network+Architecture
49
APPENDIX A
Microcontroller Program
#include <SoftwareSerial.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(A0,A1,A2,A3,A4,A5);
int sw1=2;
int sw2=3;
int line1=8;
int line2=9;
int flag1,flag2;
char check[2];
void setup() {
[Link](16,2);
pinMode(sw1,INPUT);
pinMode(sw2,INPUT);
pinMode(line1,OUTPUT);
pinMode(line2,OUTPUT);
digitalWrite(sw1,LOW);
digitalWrite(sw2,LOW);
flag1=flag2=0;
// [Link](9600);
// put your setup code here, to run once:
[Link]();
[Link](0,0);
[Link](" WELCOME ");
[Link](0,1);
[Link]("AUTO SWTCH SYSTM");
delay(3000);
[Link]();
[Link](0,0);
50
[Link]("INITIALIZING GSM");
[Link](9600);
[Link](9600);
gsm();
[Link]();
[Link](0,0);
[Link](" System Ready ");
delay(2000);
[Link]();
[Link](0,0);
[Link]("LINE : 1 2 ");
[Link](0,1);
[Link]("STATUS: OFF OFF");
}
void loop() {
// put your main code here, to run repeatedly:
if([Link]()>0){
char x=[Link]();
if(x=='#'){
[Link]("#");
delay(10);
x=[Link]();
if(x=='1'){
[Link]("1");
digitalWrite(line1,HIGH);
[Link](8,1);
[Link]("ON ");
[Link]("line1 =on");
flag1=0;
}
if(x=='2'){
[Link]("2");
digitalWrite(line2,HIGH);
[Link](13,1);
[Link]("ON ");
[Link]("line2 =on");
flag2=0;
}
}
if(x=='*'){
51
[Link]("*");
delay(10);
x=[Link]();
if(x=='1'){
[Link]("1");
digitalWrite(line1,LOW);
[Link](8,1);
[Link]("OFF");
[Link]("line1 = off");
flag1=0;
}
if(x=='2'){
[Link]("2");
digitalWrite(line2,LOW);
[Link](13,1);
[Link]("OFF");
[Link]("line2 = off");
flag2=0;
}
}
}else{
checkSwitch();
}
}
void checkSwitch(){
//sw1
if(digitalRead(sw1)==HIGH){
delay(300);
if(digitalRead(sw1)==HIGH){
if(flag1==0){
[Link]("sw1 = HIGH");
digitalWrite(line1,HIGH);
[Link](8,1);
[Link]("ON ");
flag1=1;
delay(1000);
}else{
[Link]("sw1 = LOW");
digitalWrite(line1,LOW);
[Link](8,1);
[Link]("OFF");
delay(1000);
}
52
}
}
//sw2
else if(digitalRead(sw2)==HIGH){
delay(300);
if(digitalRead(sw2)==HIGH){
if(flag2==0){
[Link]("sw2 = HIGH");
digitalWrite(line2,HIGH);
[Link](13,1);
[Link]("ON ");
flag2=1;
delay(1000);
}else{
[Link]("sw2 = LOW");
digitalWrite(line2,LOW);
[Link](13,1);
[Link]("OFF");
delay(1000);
}
}
}
void gsm(){
[Link]("INITIALIZING GSM..");
[Link]();
delay(15000);
[Link]("AT");
delay(20);
//check if GSM IS CONNECTED AND WORKING
check[0]=[Link]();
delay(10);
check[1]=[Link]();
delay(10);
[Link]([Link]());
while(check[0]!='O' && check[1]!='K'){
[Link]("Initialization fail");
delay(1000);
53
[Link]("AT");
delay(20);
check[0]=[Link]();
delay(10);
check[1]=[Link]();
delay(10);
}
[Link]("AT+CMGF=1"); //Sets the GSM Module in Text Mode
delay(1000);
[Link]([Link]());
[Link]("AT+CNMI=2,2,0,0,0"); // AT Command to recieve a live SMS
/* [Link](8,3);
[Link]([Link]());
[Link]("DONE");*/
delay(1000);
[Link]([Link]());
[Link]("Ready");
[Link]("HOME AUTOMATION");
}
54
APPENDIX B
Cost Estimation
55
APPENDIX C
PROJECT TIMEFRAME
i. Senior Project 1
DURATION IN WEEKS
ACTIVITIES
1 2 3 4 5 6 7 8 9 10 11 12 13 14
Project title selection
Proposal writing
Project defending
Literature review
Data collection
Report writing
Report assessment and submission
DURATION IN WEEKS
ACTIVITIES
1 2 3 4 5 6 7 8 9 10 11 12 13 14
Literature review
Data analysis and design
Simulation
Prototype implementation
Report writing
Report assessment and submission
56