intro

Document Sample
intro Powered By Docstoc
					 MEng Final Year Project                                                                           Page 1
 ‘Remote environmental monitoring/control using the Internet’                                  May 2000



1.0 Introduction

The primary objective of this project is to develop an application to demonstrate the feasibility of
using the Internet, or Intranet, to remotely monitor the status and exercise control, of a given
environment. One example is to monitor and regulate the temperature of offices or greenhouses,
from a control centre.


Many people have used a WEB browser (for example Netscape or Internet Explorer), to access the
Internet and are familiar with retrieving information from the World Wide Web (WWW). This
process usually consists of the user clicking on a hyperlink within a WEB browser, which initiates a
document request to the WEB server. The WEB server then returns a document to the user for
display in the browser. WEB servers can also invoke external programs or scripts, in response to a
user request, with the results returned to the user browser as an HTML document.


In this project, the design of the environmental monitoring and control system shall adopt similar
operations and user interface to accessing the WWW. Essentially the project involves the design of
a PC based WEB server and control device, which provides the ability to monitor and interact with
a remote environment, using a WEB browser interface.


With the increasing trend towards the requirement of ‘information on the move’, where people and
services can be accessed ‘anytime, anywhere’, thanks to the increased use of the internet and
mobile communications, it seems that the next step is to extend this accessibility to include our
environment – be that our home, workplace or other location.


This project aims to investigate what is involved in achieving this and determine if it is feasible, as
well as the development and demonstration of the aforementioned control system.


A copy of the original project description can be found in Appendix 1 at the end of this report.




 Daniel John McAuley                                                            Queens University Belfast
 MEng Final Year Project                                                                            Page 2
 ‘Remote environmental monitoring/control using the Internet’                                    May 2000



2.0 Background

This section is intended to give the reader an introduction to some of the key areas of this project.
The format of WEB communications using HTTP and HTML is discussed and a brief introduction
to the operation of WEB Server software and application interfaces given.


          CLIENT                                                                         SERVER

                           Server Response                       Client Request




                                                Internet

             Client Request                                           Server Response


                  Figure 2.0 Simplified view of WEB based communications



Figure 2.0 gives an overview of WEB based communications, where the user, or client, initiates a
request (e.g. by clicking on a hyperlink). This request is made to the server, which processes it and
returns a response to the user. The Hypertext Transfer Protocol (HTTP) is the language used in this
client – server communication. This language is discussed next, as is the Hypertext Mark-up
Language (HTML), which is used to encode documents for the WEB.



2.1 HTTP

The Hypertext Transfer Protocol is the language that Web clients and servers use to communicate
with each other. It is essentially the backbone of the Web.


While HTTP is largely the realm of server and client programming, a firm understanding of HTTP
can be useful for web server - application interfaces such as CGI. It can also prove useful when
server errors are reported in browser windows.




 Daniel John McAuley                                                              Queens University Belfast
    MEng Final Year Project                                                                           Page 3
    ‘Remote environmental monitoring/control using the Internet’                                  May 2000


All HTTP transactions follow the same general format. Each client request and server response has
three parts:


     the request or response line
     a header section
     the entity body


The client initiates the transaction as follows:


     The client contacts the server at a designated port number (usually port 80). It then sends a
      document request by specifying an HTTP command called a method, followed by a document
      address and an HTTP version number.


     Next, the client sends optional header information to inform the server of its configuration and
      document formats it will accept. All header information is given line by line, each with a header
      name and value. A blank line is sent to end the header.


     The client may send additional information, perhaps for use by CGI programs, to the server
      after the request and headers have been sent.


The server then responds to the client’s request as follows:


     The server replies with a status line containing three fields; HTTP version, status code and
      description. HTTP version indicates the version of HTTP that the server is using to respond, the
      status code is a three-digit number, which indicates the server’s result of the client’s request and
      the description is human readable text to describe the status code.


     After the status line, the server sends header information to the client about itself and the
      requested document. Again a blank line ends the header.


     If the client’s request is successful, the requested data is sent. This data may be a copy of a file
      or the response from a CGI program. If the client’s request could not be fulfilled, additional
      data may be a human readable explanation of why the server could not fulfil the request.



    Daniel John McAuley                                                            Queens University Belfast
    MEng Final Year Project                                                                    Page 4
    ‘Remote environmental monitoring/control using the Internet’                            May 2000


2.1.1 METHODS

A method is an HTTP command that begins the first line of a client request. The method tells the
server the purpose of the client request. There are three main methods defined


     GET
     HEAD
     POST


Other methods, such as LINK, UNLINK, PUT, DELETE, OPTIONS and TRACE are defined but
not widely supported nor used.


GET - this method is a request for information located at a specified URI on the server. This is the
most commonly used method for browsers to retrieve documents for viewing.


A typical GET request is shown below:


GET /some/url.html HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel,
application/msword, application/vnd.ms-powerpoint, */*
Referer: http://www.delorie.com/web/
Accept-Language: en-gb
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)
Host: www.delorie.com:81
Connection: Keep-Alive

The server would then respond (if request is successful) with something like this:


HTTP/1.1 200 OK
Date: Tue, 01 Feb 2000 00:54:56 GMT
Server: Apache/1.3.9 (Win32)
Last-Modified: Wed, 20 May 1998 08:59:42 GMT
ETag: "0-689-35629b7e"
Accept-Ranges: bytes
Content-Length: 1673
Connection: close
Content-Type: text/html

(Document body here)


    Daniel John McAuley                                                      Queens University Belfast
 MEng Final Year Project                                                                         Page 5
 ‘Remote environmental monitoring/control using the Internet’                                 May 2000


The GET command can also be used to send input to programs such as CGI, by the use of form
tags. In this case input data is appended to the URL in the GET line of the request. Extra-path
information can also be supplied in the same manner.


An example of this is shown below:


GET /cgi-bin/birthday.pl?month=december&date=30 HTTP/1.1


The above statement causes the server to send the birthday.pl CGI program the month and date
values specified in a form on the client (in this case december and 30).


HEAD - this method is functionally like GET, except that the server will not send anything in the
data portion of the reply. This has uses in cache-related queries, getting information on document
type and size as well as server queries.


POST - this method allows data to be sent to the server in a client request. Data is directed to the
required data handling program that the server has access to. The data sent is in the entity-body
section of the client request. Thus, after the server has processes the POST request and headers, the
entity-body is passed to the URI specified program.


It is useful to know the difference between each of the HTTP methods, so the appropriate one can
be selected for use in passing information between the browser and application interface required in
this project.



2.2 HTML

The Hypertext Markup Language (HTML) is the language used to encode World Wide Web
documents. It is a document layout and hyperlink-specification language that defines the syntax and
placement of special embedded directions, that are not displayed by a Web browser, but tell it how
to display the content of the document including text, images and other media. The language also
allows the incorporation of hypertext links to make documents interactive, linking with other
documents in the local system, the web or even other Internet resources.




 Daniel John McAuley                                                           Queens University Belfast
    MEng Final Year Project                                                                   Page 6
    ‘Remote environmental monitoring/control using the Internet’                           May 2000


An HTML document consists of text, which is the content of the document and tags, which define
the structure and appearance of the document. The basic structure of an HTML document is shown
below.


<HTML>
<HEAD>
<TITLE>Basic HTML Document</TITLE>
</HEAD>
<BODY>
This page illustrates the basic structure of a HTML document,
as well as showing some <i>italics<i>.
</BODY>
</HTML>

This code produces the page shown in figure 2.1 when viewed using a WEB browser.




          Figure 2.1 Basic HTML Document viewed in WEB browser [Internet explorer 5]


HTML provides various TAGS to control the formatting and other features of documents. Some of
the most widely used TAGS include those to cater for the following:


     Links
     Forms – radio buttons, checkboxes, submit buttons, password and browse fields
     Formatting – alignment, style, font
     Image/Graphics handling and mapping
     Tables
     Frames


Information on HTML formatting is widely available and will not be discussed in detail within this
report.

    Daniel John McAuley                                                     Queens University Belfast
    MEng Final Year Project                                                                             Page 7
    ‘Remote environmental monitoring/control using the Internet’                                     May 2000


2.3 WEB Server

The WEB Server can be regarded as a computer, for example an IBM compatible PC, connected to
the Internet, which runs some type of WEB Server software to provide the following functions:


     Host necessary HTML documents and associated files.
     Respond to HTTP requests from the client by returning requested HTML documents.
     Provide support for common server-application interfaces such as CGI, SSI
     Configurable in terms of operation and security measures.


A more in depth look at actual WEB Server applications is given in Chapter 4.



2.4 Application Interface

In order to increase the functionality of web pages, by allowing users to access other programs
running on the server (e.g. Database), an application interface between the WEB server and desired
program must be established. Figure 2.2 shows this concept.




                                                      WEB                             External
                                                      Server                          Program
                                                     Program                            e.g.
                                                                                      Database


       SERVER


                                                                   Application Interface


                    Figure 2.2 Illustration of Application Interface concept, e.g. CGI.




    Daniel John McAuley                                                               Queens University Belfast
 MEng Final Year Project                                                                                 Page 8
 ‘Remote environmental monitoring/control using the Internet’                                         May 2000


There are a number of ways of implementing this interface, including the Common Gateway
Interface (CGI), some of which are discussed later in chapter 4.



3.0 Interpretation of Requirements

This section aims to clarify exactly what is required in this project. An overview of the entire set-up
is given, with detailed description of the requirements in each area. Figure 3.0 shows the interpreted
project configuration.

                                                                   WEB Server
                                                                   Application Interface
         CLIENT                                                    Link to Control            SERVER
                                                                    Device




                                                Internet
  WEB Browser
  User Interface




                                                       ENVIRONMENTAL
                                                       CONTROL DEVICE




                   Temperature & Humidity
                          Sensors
                                                                                            To other networked
                                                                                                  devices
                                                           Inputs & Outputs

                            Figure 3.0 Interpreted Project Configuration




 Daniel John McAuley                                                                   Queens University Belfast
    MEng Final Year Project                                                                      Page 9
    ‘Remote environmental monitoring/control using the Internet’                              May 2000


There are three main sections in the project:


     User Interface
     Server
     Environmental Monitoring & Control Device


A discussion on the requirements of each section given next.



3.1 User Interface

This is basically a website, that contains a webpage or HTML document, that can be used to issue
control commands to and retrieve status information from the remote environment. For example,
the user could be able to read the current temperature or humidity of the remote environment, or
have the ability to turn on and off appliances.
A simple button could be used to initiate the control request and any information returned be
formatted in HTML for seamless display within the website.
For the purposes of this project, other information could be included to inform the user of the
objectives and configuration of the project.



3.2 Server

Essentially this section of the project can be regarded as a computer located in the vicinity of the
desired environment to be controlled or monitored. This location could be your home, workplace or
other environment. The computer (e.g. an IBM compatible PC) would be required to provide the
following three functions:


Web Server
The PC should operate as a web server - therefore, it should carry out the required functions as
described in Chapter 2.3, namely hosting necessary HTML documents and responding to HTTP
requests from the client by returning requested HTML documents. It should be flexible,
configurable and have measures for security available to restrict access to authorized users only.




    Daniel John McAuley                                                        Queens University Belfast
 MEng Final Year Project                                                                         Page 10
 ‘Remote environmental monitoring/control using the Internet’                                 May 2000


Application Interface
An interface between the web server and the environmental monitoring/control device is necessary
in order to transfer commands to and information from the control devices. A software application
can be produced to interface with the microcontroller devices, however the application must also
interface in an appropriate manner with the web server, so seamless transfer of information can
occur. Options here include application interfaces such as CGI.


Link to Control Device
A physical link between the PC and control device network must be established, so communication
can occur. The type of link is flexible, as long as both the PC and control device supports it
network.



3.3 Environmental Monitoring & Control Device

The purpose of the environmental monitoring devices is to provide a means by which
environmental details can be monitored and controlled. As mentioned previously, these devices
should provide temperature and humidity monitoring capability, as well as I/O for appliance
control.


The design of the control device involves two main areas:


Hardware Design
The hardware design of the control devices will most likely be based on a programmable
microcontroller, which will allow the connection of a number of sensors and external appliances.
The design must also incorporate support for the chosen link to the PC (e.g. RS-232, radio,
infrared) and any sensors to be incorporated.


Embedded Software
With the hardware design likely to be based around a programmable microcontroller, software for
this microcontroller must be produced. The software is required to support the communications link
and protocol between the control device and the PC, as well as providing control over any devices
connected to the microcontroller.




 Daniel John McAuley                                                           Queens University Belfast
 MEng Final Year Project                                                                        Page 11
 ‘Remote environmental monitoring/control using the Internet’                                  May 2000


4.0 Design

In order to successfully design a system to satisfy the objectives of this project, it was necessary to
carry out research into what options are available in each of the project areas. Informed design
decisions could then be made, so that the best solution could be adopted for development and
implementation in each area.


Therefore the following design approach, shown in figure 4.0 was taken.




                                            RESEARCH


                                     DESIGN DECISIONS


                       DEVELOPMENT & IMPLEMENTATION


                                     Figure 4.0 Design approach




 Daniel John McAuley                                                            Queens University Belfast
    MEng Final Year Project                                                                                           Page 12
    ‘Remote environmental monitoring/control using the Internet’                                                    May 2000



4.1 Research

Research into the three main project areas was carried out. The findings of these investigations are
presented in this section.



4.1.1 Server

From the interpretation of requirements, there are three main demands from the server:


     Web Server software
     Application Interface
     Link to Control Device


4.1.1.1 Web Server Software


Through investigating into the WEB server market, using books (see Bibliography) and on-line
resources, it was found that the most popular or most widely used server applications are from three
main developers:

                                           Note
     Apache                               iPlanet is the sum of sites running iPlanet-Enterprise, Netscape-Enterprise, Netscape-
                                           FastTrack, Netscape-Commerce, Netscape-Communications, Netsite-Commerce &
     Microsoft                            Netsite-Communications.

     iPlanet                              Microsoft is the sum of sites running Microsoft-Internet-Information-Server,
                                           Microsoft-IIS, Microsoft-IIS-W, Microsoft-PWS-95, & Microsoft-PWS.



The Netcraft web Server survey is a survey of Web server software usage on Internet connected
computers. Data is obtained by collecting and collating as many hostnames providing an HTTP
service and systematically polling each one with an HTTP request for server name.
The results of this survey between August 1995 and April 2000 are shown in figure 4.1




    Daniel John McAuley                                                                           Queens University Belfast
    MEng Final Year Project                                                                            Page 13
    ‘Remote environmental monitoring/control using the Internet’                                      May 2000




                  Figure 4.1 Netcraft Web Server Software usage over the past 5 years


A more detailed breakdown of the most recent market share results is shown in table 4.0.


                  Server                March 2000        Percent      April 2000     Percent       Change
    Apache                                  7870864            60.05       8812961         61.53          1.48
    Microsoft-IIS                           2739901            20.91       3017373         21.07          0.16
    Netscape-Enterprise                      909645             6.94       1002631          7.00          0.06
    Zeus                                     245255             1.87         265870         1.86         -0.01
    Rapidsite                                234985             1.79         256129         1.79          0.00
    thttpd                                   208536             1.59         214376         1.50         -0.09
    WebSitePro                                94763             0.72         106300         0.74          0.02
    Stronghold                                81403             0.62          85586         0.60         -0.02
    WebSTAR                                   73734             0.56          78496         0.55         -0.01
    ConcentricHost-Ashurbanipal               31385             0.24          43780         0.31          0.07

                 Table 4.0 Web Server software market share for March & April 2000

4.1.1.2 Application Interface


A means of transferring commands to and information from the environmental monitoring device
and the Web server program is required. This is essentially a way of transferring user commands
issued from the WEB browser into another program running on the server, via the WEB Server
program. Information from the external program can then be passed back to the WEB Server
through this interface, where it is returned for display in the WEB browser.


There are a few techniques that can be considered:


     SSI (Server Side Include)
     ISAPI (Internet Server Applications Programming Interface)
     JAVA/JavaScript
     CGI (Common Gateway Interface)

    Daniel John McAuley                                                                Queens University Belfast
 MEng Final Year Project                                                                      Page 14
 ‘Remote environmental monitoring/control using the Internet’                                May 2000


SSI
Server Side Include is made up of a series of commands that you can include within your HTML
document. These are normally contained within a section tag:
                                                    <!--# -->
This is similar to the comment HTML tag, the difference being the ‘#’ character which tells the
HTTP server that this is a SSI command. When a server has SSI enabled, it parses HTML
documents to search for embedded SSI commands, executing each comment embedded command
and replacing the comment with the output of the command. Thus SSI allows the creation of
dynamic HTML documents and execution of external programs. Programs to be executed by SSI
are often required to reside in the same directory, or use the same naming convention, as the CGI
‘scripts’ located on the server.


SSI is not governed by a standard, so each server manufacturer is free to implement SSI in their
own manner. Thus a complete list of SSI commands is not available, but SSI commands and syntax
supported by particular server applications should be available in the server documentation. The
fact that HTML documents are parsed also increases the server overhead in processing requests.


Like CGI, SSI can pose security risks - usually in that malicious visitors can execute programs or
view files not intended for their access. The mechanism for SSI is slightly different that CGI as the
visitor cannot just edit the HTML and submit a form (due the client not having access to
preprocessed HTML files).


ISAPI
Internet Server Application Programming Interface proposes an alternative way of transferring
information between the web server and external programs - using dynamic link libraries (DLLs) so
there is no need for an executable. This technique is primarily intended for Windows based servers.


JAVA/JavaScript
Although, for the most part, Java and JavaScript have been used on the client side, they can also be
used on the server side.
A situation in that Java is used through the CGI interface, where the Java Virtual Machine
continuously runs in the background, serving requests on demand can be used to transfer
information between server and Java programs - allowing the creation of dynamic HTML files
especially when JavaScript is also used.

 Daniel John McAuley                                                          Queens University Belfast
    MEng Final Year Project                                                                         Page 15
    ‘Remote environmental monitoring/control using the Internet’                                   May 2000


Using Java as CGI requires the same capabilities of any other CGI program:


     The HTTP server must be able to invoke the Java program
     The Java CGI program must be able to access standard I/O
     The Java program must have access to environmental variables.


CGI
The Common Gateway Interface is the part of the Web Server than can communicate with other
programs that are running on the server. With CGI, the Web server can invoke an external program,
while passing user-specific data to the program. The program then processes the data and the server
passes the program response back to the Web server (see figure 4.2).



                      WWW Browser                           Server                   Application
                        [Client]



                                                                                       C
                                                                                       G
                                          Request/Form                Call CGI
                                             submit                                    I


               USER
                                       CGI Program                    CGI Program
                                        Response                       Response


                                            Figure 4.2 CGI Overview

Parameters to a CGI program are transferred either in the URL or in the body text of the request,
depending on which method the form request uses. The program then carries out its function using
the user data. The CGI program must then create a new document to be served to the browser, or
point to an existing one.


It does not matter to the Web server what language the CGI program is written in, as long as there
is a way in the programming language to get data from the server and send it back, you can use it
for CGI. The most common languages used for CGI programming are:


     C/C++
     Perl (Practical Extraction and Report Language)
     Visual Basic
    Daniel John McAuley                                                             Queens University Belfast
    MEng Final Year Project                                                                   Page 16
    ‘Remote environmental monitoring/control using the Internet’                             May 2000




4.1.1.3 Link to Control Device


The type of link between the Control Device and PC is flexible, in that any type of data link could
be used, as long as it is supported at both ends. Some options to consider are:
     Parallel
     Serial
     Wireless
     Infra-red


Factors likely to influence the choice include link speed, features, ease of implementation, cost,
relative location of PC and control device and the actual environment in which the control device is
to be located.



4.1.2 Control Device

The control device is to be based around a programmable microcontroller. A microcontroller can be
regarded as a microprocessor, which has additional parts that allow it to control external devices.
The term microcontroller and microprocessor are often used interchangeably and will be considered
to be the same in this report.


There are a wide variety of microcontrollers available, from many different manufacturers, however
the most popular include those from the following suppliers:


     Motorola
     Intel
     Microchip
     Parallax


The chosen microcontroller will be required to be flexible in configuration, in order to support
simple I/O as well as interface to communication links and sensors. Other factors that must be
considered when choosing an appropriate microcontroller for implementation in this project
include:


    Daniel John McAuley                                                       Queens University Belfast
    MEng Final Year Project                                                                   Page 17
    ‘Remote environmental monitoring/control using the Internet’                             May 2000


     Required number and type of I/O
     Operation Speed
     In-built features
     Power consumption
     Physical size
     Availability of development tools,
     Requirement of additional hardware for circuit construction
     Popularity (related to availability of support)
     Cost




4.1.2.1 Sensors


One of the requirements outlined in the project objectives is that the control device should be able
to measure the temperature or humidity of the environment. Sensors, which help translate between
the physical world and the abstract world of microcontrollers are therefore required to perform the
appropriate measurement and enable the microcontroller to send this information back to the user.


There are 2 categories of sensors that could be used:


     Analogue Sensors
     Digital Sensors


The choice of sensor type will largely depend on the application, although the use of analogue
sensors requires analogue to digital conversion for use with microcontrollers.




    Daniel John McAuley                                                       Queens University Belfast
    MEng Final Year Project                                                                        Page 18
    ‘Remote environmental monitoring/control using the Internet’                               May 2000



4.1.3 Interface

Results of the investigation into options available for the user interface implementation are
summarised in this section.


The basic background for the construction of the user interface is HTML, as discussed in Chapter 2.
Frames, radio buttons, selection boxes, graphics and other formatting techniques can be used to
improve the look and feel of the interface.


Other enhancement options that can be embedded into the basic HTML structure include:


     Java/JavaScript
     Flash.


A detailed description of these techniques and their abilities will not be given in this report,
although more information is readily available from many online sources and in written material.


When implementing the user interface, it must be noted that the project uses dynamic HTML, in
that the response to user commands is generated within the CGI script. Therefore, careful
consideration to the desired content of the dynamic part of the interface must be applied.




    Daniel John McAuley                                                         Queens University Belfast
    MEng Final Year Project                                                                     Page 19
    ‘Remote environmental monitoring/control using the Internet’                               May 2000



4.2 Design Decisions

This section summarises some of the major design decisions made in this project. The decisions
were made according to information obtained through research into the related area, advice from
staff within the University and for reasons given in each case.



4.2.1 WEB Server

Choice:            Apache HTTP Server


The Apache project is an effort to develop and maintain an open-source HTTP server for various
modern desktop and server operating systems, such as UNIX and Windows NT. The goal of this
project is to provide a secure, efficient and extensible server, which provides HTTP services in sync
with the current HTTP standards.


As indicated in the Netcraft review (Chapter 4.1.1.1), the Apache HTTP server is the most widely
used Web server application. This is backed up by many review articles on-line, with Apache hailed
as ‘the most popular and fastest-growing server in use on the Web’.


This may be largely due to the fact that it is free, but its popularity may have a lot to do with other
advantages over some commercial Web server applications, for example:


     Open source - the source code is freely available and well documented
     Large user base - hence well supported
     Small size and efficient use of computing resources
     Ported to variety of operating systems
     SSL Support
     Feature rich


Due to the widespread use, numerous recommendations and range of documentation available, it
was decided to use the Apache Web Server in this project. Apache is freely available for download
from www.apache.org



    Daniel John McAuley                                                         Queens University Belfast
    MEng Final Year Project                                                                    Page 20
    ‘Remote environmental monitoring/control using the Internet’                              May 2000




As most home computers run MS-Windows, it was decided to use the latest Win32 port of Apache
(1.3.9) [Since upgraded to 1.3.12]. Apache is also available for many other operating systems, such
as UNIX, OS2, Apple, HP-UX etc. It was mentioned in the accompanying documentation that the
Windows port of Apache has not been optimised for performance and therefore may be inferior, in
terms of performance and stability, to the UNIX version. This possibility was noted, though should
not effect the overall objective of the project.




4.2.2 Application Interface

Choice:            CGI


Of the techniques described in the research section regarding the required application interface, it
has been decided to use CGI.
The main reasons for choosing CGI include the fact that it offers a standardised approach to WEB
Server application interfacing and is therefore supported by most servers (including Apache).
The flexibility in programming language and wealth of information available regarding CGI should
prove useful in successfully implementing the program.




4.2.3 PC to Control Device Link

Choice:            Serial (RS-232)


As mentioned in the research section, the type of link is flexible, provided support is present at both
the PC and controller ends.
For the purposes of this project, it was decided to use a serial (RS-232) link between the PC and
control device. This type of link has the following advantages over other types of link such as
wireless or infrared:


     Highly configurable in terms of speed and operation
     Relatively easy to implement

    Daniel John McAuley                                                        Queens University Belfast
    MEng Final Year Project                                                                         Page 21
    ‘Remote environmental monitoring/control using the Internet’                                   May 2000


     Built in hardware support on most PCs.
     Facilities for debugging readily available.
     Microcontrollers available with serial communication support built in


It is recognised that the RS-232 link may be somewhat limited compared to other link types, in
terms of maximum distance, lack of multi-drop capability and the fact that a physical cable is
required. However, it is felt that its advantages outweigh these disadvantages for this application
and this link is ideal for demonstrating the concept of the project. If necessary, it is possible to
convert from RS-232 to RS-485, which provides multi-drop capability.




4.2.4 Control Device

Choices            Microcontroller:          Microchip, PIC16F876
                   Sensors:                  Digital, Dallas Semiconductor DS1820
                   Link support:             RS-232


Microcontroller
It was decided to use a microcontroller from the Microchip PIC range.
The decision to use a micro from Microchip PIC range was made, not only because of their
excellent reputation for performance, reliability and low cost, but also due to the availability of
development tools and programmers within the University.
The actual choice of device depends on the desired task and consideration must be given to:


     Interfaces required, e.g. serial, parallel etc.
     Memory, for storing programs etc.
     I/O ports
     Processing speed
     Power consumption.


The microcontroller used in this project will be required to interface with a serial controller;
therefore a built in USART would be desirable. A relatively large number of I/O ports would be
desirable as would low power consumption (or low power mode) and the inclusion of an interface


    Daniel John McAuley                                                             Queens University Belfast
    MEng Final Year Project                                                                    Page 22
    ‘Remote environmental monitoring/control using the Internet’                              May 2000


which could be used for communicating with sensors.


One such device, which satisfies the requirements for use in this project, is the Microchip
PIC16F873. This is a 28-pin device with in built USART, SPI and I2C capable serial port and a low
power sleep mode among other properties (see Datasheet reference in Appendix 2).


The Microchip development tool ‘MPLAB’ can be used to develop the software for this device, as
well as other third party compilers – see Chapter 4.3 for more information.


Sensors


A digital temperature sensor was chosen for implementation in the project, to provide an example
of remote environmental monitoring.


The digital sensor was chosen over an analogue solution due to:


     Simple interface (no analogue to digital conversion required)
     Choice of accuracy available, some configurable
     Ability to ‘network’ sensors


The main suppliers of these digital temperature sensor ICs are:


     Dallas Semiconductors
     National Instruments


Link support


Link support within the control device must match that from the PC. Therefore serial
communication using RS-232 must be implemented on the control device.


To accomplish this, the microcontroller requires a USART – either software or hardware, for serial
communications. An RS-232 line driver must also be located on the control device, for voltage
level conversion.



    Daniel John McAuley                                                       Queens University Belfast
 MEng Final Year Project                                                                     Page 23
 ‘Remote environmental monitoring/control using the Internet’                               May 2000


With these decisions made, it was possible to continue with the project. Chapter 4.3 deals with the
next stage in the project, development.




 Daniel John McAuley                                                         Queens University Belfast

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:4
posted:9/14/2011
language:English
pages:23