Web Based Home Monitoring And Control System - PowerPoint PPT Presentation

1 / 40
About This Presentation
Title:

Web Based Home Monitoring And Control System

Description:

... ability to observe and manipulate any home electrical system using the internet. ... Example status, 'adeg', represents the front and back lights being ON', the ... – PowerPoint PPT presentation

Number of Views:518
Avg rating:3.0/5.0
Slides: 41
Provided by: OICS
Category:

less

Transcript and Presenter's Notes

Title: Web Based Home Monitoring And Control System


1
Web Based Home Monitoring And Control System
Ryan Harbaugh And Jason Chan Project 23
2
Introduction
The Web Based Home Monitoring and Control
System is the prototype to a more complete
commercial system that will give home owners the
ability to observe and manipulate any home
electrical system using the internet.
3
Objective
To provide a web based monitoring and control
system for a home models
  • Inside Lights
  • Outside Lights
  • Alarm System
  • Web Cameras

4
Project Components
  • Web Based Graphical User Interface
  • Server Side Visual Basic To HC12 Communication
  • HC12 Control Request Processing
  • HC12 Control Interface with model
  • Realistic House Model

5
Original Design Review
  • The original components are the same as our final
    components.
  • The original design was to include temperature
    control and monitoring.
  • The alarm system was going to be able to sense
    the exact location of a tripped sensor on the
    house model and report the information to the
    home server.
  • The database used was changed from an Access
    database to a SQL database.
  • Custom programmability was not included.

6
Custom Web Interface
  • Gives User Ability to monitor and control any
    connected electrical device such as house lights.
  • Security cameras may be viewed from the web page
    at any time.
  • Stored camera images from times of tripped alarms
    may be viewed from the web page.
  • A log file lets the user monitor and track the
    activity of their alarm system.

7
How The Web Page Works
-Connects to a remote SQL Server Database to
manipulate the house status. -Takes advantage of
the power of Active Server Pages through the
VBScript Language. -The pages stay current by
refreshing automatically refreshing themselves
every 10-15 seconds.
8
Connecting to the SQL Server Database
sConnect "DriverSQL Server Serverelgamma
" sConnect sConnect "Databaseharb UIDsa
PWD"
CONNECTION CODE
Once the database is connected a server object is
created.
set cn server.CreateObject("adodb.connection") c
n.Open
OBJECT CODE
After the object is established we can run SQL
queries on our database.
9
Checking for a Tripped Alarm
This code is included at the beginning of every
page.
Set cs cn.Execute("SELECT FROM
status") alarmenable cs("alarmenable") alarm
cs("alarmstatus") IF ((alarmenable"ON") AND
(alarm"TRIPPED")) THEN Response.Redirect("ALARM.
asp") END IF
This code check the database to see whether the
alarm is both turned on and tripped, it then
sends the browser to the webpage
www.elalpha.uiuc.edu/rharbaug/ALARM.asp
10
The Tripped Alarm Page
11
The Web Page Main Menu
12
The Lighting Control Page
13
The Code Behind the Lighting Control 1
Using the database I find the current status of
the lights.
Set rs cn.Execute("SELECT FROM
status") light1rs("light1") light2rs("light2") l
ight3rs("light3")
IF light1"ON" THEN HELPER1 "00FF00" ELSE
HELPER1 "FF0000" END IF
lttrgt lttd width"99"gtltbgtBACK LIGHTSnbsp
ltfont colorltHELPER1gtgtltlight1gtlt/fontgtlt/bgtlt/t
dgt lttd width"1"gtnbsplt/tdgt lt/trgt
14
The Code Behind the Lighting Control 2
When the User presses the Submit button the
information from the dropdown menus are sent to a
hidden webpage, lightchanger.asp, that alters
the database.
IF Request.Form("L1") "ON" THEN cn.Execute
"UPDATE status SET status.light1 'ON' WHERE
status.counter LIKE '1'" ELSE cn.Execute
"UPDATE status SET status.light1 'OFF' WHERE
status.counter LIKE '1'" END IF
After the database is altered the User is
redirected back to the lighting control page.
Response.Redirect "light_and_temperature_control.a
sp"
15
Web Alarm Control Panel
16
The Alarm Log
17
Stored Camera Images
18
Web Camera Visual Basic Code
We wanted to save the webcam image every five
seconds to a special folder in our web directory.
While (alarm "ON") If (DateDiff("s", helper,
Now) lt 60) Then If (DateDiff("s", oldtime, Now)
gt 5) Then FileCopy "W\www\AutoCapture\image.jpg",
picture count count 1 path
"W\www\ALARMPICTURES\image" picture path
count ".jpg" oldtime Now End If End If Wend
19
Server Side Visual Basic HC12 Comm Program
20
Visual Basic Screen
21
Visual Basic Code 1
Connect to the HC12 by way of computer comm port
1.
Public Sub Command1_Click() Dim Instring As
String MSComm1.CommPort 1 MSComm1.Settings
"9600,N,8,1" MSComm1.InputLen
0 MSComm1.PortOpen True Text1(0).Text
"CONNECTED" programstart End Sub
After the code is complete the home server is
ready to communicate with the microcontroller
22
Communicating with the Microcontroller
Server to HC12
HC12 to Server
a front light is on
1 what is house status
b front light is off
3 turn alarm on
c inside light is on
4 turn alarm off
d inside light is off
5 turn front light on
e back light is on
6 turn front light off
f back light is on
7 turn inside light on
g alarm is enabled
8 turn inside light off
h alarm is disabled
9 turn back light on
! alarm is tripped
A turn back light off
i everything is off
reset all systems
23
Visual Basic Code Front Light Example
If light1db ltgt frontmc Then 3 If light1db
"ON" Then MSComm1.Output "5"
Else MSComm1.Output "6" End If
MSComm1.Output "1 1 While (Len(buffer) lt
4) DoEvents buffer buffer
MSComm1.Input Wend frontmc Left(buffer, 1)
If frontmc a Then 2 frontmc
ON Else frontmc OFF End IF
24
Visual Basic CodeThe Alarm Is Tripped
First, the program changes the database, so the
web page can tell that the alarm is tripped.
cn.Execute ("UPDATE status SET status.alarmstatus
'TRIPPED' WHERE status.counter Like
'1'") cn.Execute ("INSERT log (name,date_time,acti
vity) VALUES ('HOME SERVER', GETDATE(), 'THE
ALARM HAS BEEN TRIPPED')")
The alarm will stay tripped until it is turned
off by the web page or visual basic button.
While (alarm "ON") Set rst cnn.Execute("SELECT
FROM status") alarm rst("alarmenable") DoEven
ts Wend cn.Execute ("UPDATE status SET
status.alarmstatus 'NOTTRIPPED' WHERE
status.counter Like '1'")
25
HC12 Control Request Processing
  • Needed to receive and perform commands sent from
    the home server as quickly as possible.
  • Minimize communication levels between home server
    and the HC12.
  • Keep communication complexity as simple as
    possible to avoid transmission errors.

26
Command Processing Flow Chart
Wait for Alarm Reset
Sound Alarm
Wait for Command Request
Check Alarm
Program Start
Command Received
Determine Command and Process Requested Control
27
Main Command Request Routing
Command_control ldab PORTA jsr sci_read cmpa
31 check_status, ASCII character 1 lbeq
check_status cmpa 33 set_alarm_on , ASCII
character 3 lbeq set_alarm_on cmpa 34
set_alarm_off , ASCII character 4 lbeq
set_alarm_off cmpa 35 set_frontlight_on ,
ASCII character 5 lbeq set_frontlight_on cmpa
36 set_frontlight_off , ASCII character
6 lbeq set_frontlight_off cmpa 37
set_insidelight_on , ASCII character 7 lbeq
set_insidelight_on cmpa 38
set_insidelight_off , ASCII character 8 lbeq
set_insidelight_off
28
Command Processing Readiness
  • Necessary to wait until new data is received by
    the serial data register (SC0DRL).

Sci_read clra jsr check_alarm brclr
SC0SR1,RDRF,sci_read Check the receive data
register full status ldaa SC0DRL rts
29
Provide Consistent Monitoring of Alarm
  • Continually check alarm security by calling the
    check_alarm function during the waiting cycle.

Sci_read clra jsr check_alarm brclr
SC0SR1,RDRF,sci_read Check the receive data
register full status ldaa SC0DRL rts
30
Check_Alarm Process
Verify that alarm is armed
Back to sci_read loop
Check security of alarm circuit
Sound alarm if circuit is open
Return to command_control main loop
Wait for alarm reset
31
Monitoring Command
  • Outputs four ASCII characters representing front
    light, inside light, back light, alarm status.
  • Example status, adeg, represents the front and
    back lights being ON, the inside light being
    OFF, and the alarm being ARMED.

Check_status ldaa PORTA anda 01 cmpa
01 lbeq frontlights_on transmit ASCII
character a ldab 62 transmit
ASCII character b jsr transmit Inside_check
ldaa PORTA anda 02 cmpa 02 lbeq
insidelights_on transmit ASCII character
c ldab 64 transmit ASCII character d
32
Example Control Command
  • Turning the front lights of the model home
    on/off without altering the current status of the
    model homes status.

Set_frontlight_on orab 01 Sets the PORTA
0-bit to a high-level without changing current
status stab PORTA lbra command_control Set_fr
ontlight_off andb FE Sets the PORTA 0-bit to
a low-level without changing current
status stab PORTA lbra command_control
33
PORT levels to implement controls?
  • How to use the high and low level I/O of the
    HC12 to actually control the lights and monitor
    the alarm system?

USE RELAYS!
  • Simple
  • Inexpensive
  • Perform the required task perfectly

34
Light Control Relays
  • Used 5V DC triggered 120V AC relays to control
    power flow to the lights.
  • A high level (5V DC) from the PORT A outputs
    excite the relay selector coil which switches the
    relay output to the 120V AC.
  • A low level (0V DC) from the PORT A output does
    not excite the relay selector coil and the relay
    output does not conduct the 120 V AC.

35
Implementing an Alarm System Using a Relay
  • Used 12V DC triggered relay to monitor the alarm
    circuit.
  • The relay selector coil was within the alarm
    circuit of sensors which when closed conducted
    the 12V DC through the coil setting the relay to
    output a 5V DC signal to PORT B bit 0 of the
    HC12.
  • Opening any of the magnetic reed switch alarm
    sensors caused the circuit to no longer conduct
    the 12V DC causing the relay to output a low
    level signal to PORT B bit 0 of the HC12 .

36
Alarm Circuit Diagram
37
Model Diagram
38
Interface Board Diagram
39
Successes
  • Successfully completed web based control
    communication from home page to model.
  • Requested commands were processed and executed
    properly for all lights, alarm system, and web
    cameras.
  • Were able to achieve a minimal communication
    delay throughout the entire system. The home
    server to HC12 communication time averaged
    approximately 1 second and the home server to
    home page update time was no longer than 11
    seconds. There was no observable delay between
    the model and HC12.

40
Recommendations
  • Redesign the interface circuit to allow the
    system to be more easily integrated into an
    actual home CENTRALIZE.
  • More cost efficient by using a simpler
    microcontroller.
  • Add the ability to dial out using a network
    connection instead of a modem.
  • Add the ability for climate control.
Write a Comment
User Comments (0)
About PowerShow.com