|
Home Toys Article - August 2004 - [Home Page] |
Read All About It News Announcements - Updated Hourly [Click Message To Learn More] |
|
|
Use that old computer you couldn’t part with for a home or office Web Enabled monitor controller!
By Gary Drake – www.BroadbandSentry.com |
|
1) Introduction If you are like most people you probably have and old desktop or laptop that technology has passed by. Perhaps it has a previous version of operating systems or like me a version or two back, they are hard to part with, far to much time and money went in to that machine to simply throw it out. With a little care, free software and Automation from www.BroadbandSentry.com these machines can be converted to monitor the Status of your home or office. These old machines (a new machine works as well) can be used to implement a home, office, and vacation home status monitor. In a previously article (Internet based Monitoring using low cost solutions. ) we discussed how to use off the shelf network hardware for a status monitor, in this article we will present a method to use a general purpose computer as a status monitor for use with www.BroadbandSentry.com.
www.BroadbandSentry.com monitors and alerts you to changes on the status monitor you create from this article. Your alerts are delivered using Email, SMS, MMS, and voice messages and are automatically generated based on your requirements. 2) Hardware Requirements The computer you choose has a couple of basic requirements.
The speed of the computer is not a serious concern, old and slow is just fine. 3) Software required We will be using Java, keep reading even if you have never used Java it really will be painless! First we need the Java SDK, it is available for down load at Java.Sun.com. The SDK we want is J2SE 1.4.2 SDK, I recommend downloading the offline installation version (write it to CD or a USB Memory). Installing the SDK is much like installing any other program, the defaults are fine, just keep clicking the next button. We are going to assume you will be using a Microsoft operating system, at http://java.sun.com/j2se/1.4.2/install-windows.html is the Installation notes for use with Microsoft Windows. An excellent tutorial has been written at http://javatrek.com/hints-java-setup.html. The Batch file example presented by javatrek.com ( http://javatrek.com/setenv.bat.txt ) is presented below with the minor change to the current version of the SDK done.
Note: javatrek.com suggest at the beginning of this file to use a batch file for NT, or 2000. I recommend that in NT, 2000, and XP one should set these variables using the control panel. For Win98 copy and paste creating a batch file or copy into your autoexec.bat. Because Windows in general attempts to isolate the hardware of the computer from user level programs we need one more building block to enable the reading of the Parallel port. Juan Gabriel Del Cid Portillo has written and placed on the web a very useful routine to access the Parallel Printer port via Java. His code is available at http://www.geocities.com/Juanga69/parport/, you need to download parport from http://www.geocities.com/Juanga69/parport/parport-win32.zip and follow the instructions. For Win98 users it is very simple, for NT, 2000 and XP users a second step is required as described in Juan Gabriel Del Cid Portillo documentation. The installation notes for parport do not call out the current SDK version, the correct directory to store the parport.ddl is C:\j2sdk1.4.2_05\bin. 3) Simple Http Server The Simple Http Server uses the software services built into the Java SDk to build the HTTP server, and to get the real world status via the Parallel Printer Port we will use the parport support library. The Simple Http server responds to a request from a browser, use the URL address: http://xxx.xxx.xxx.xxx:7170/ Note: the TCP/IP port number is required in the URL, with the following response: Simple HTTP Server Be sure to substitute your machines IP address for xxx.xxx.xxx.xxx Depending on your home or office network configuration you may have a static or dynamic IP address assigned. We recommend you set up a static IP address in your Status Monitor Server. The Date, time and the contents of the status register are returned. The :7170 is the port at which the server is lessening, the standard port address is 80 but is blocked some ISP’s as well should you have more then one server you may need to use port numbering to address them. The Server code follows:
Copy and Paste the above in to a file named “c:\httpserver\httpServer_io.java” . Only two commands are needed from here, one to compile and one to execute the Java code. Note: install parport as a subdirectory within c:\httpserver\. Open a DOS window then: Compile: Next: Execute the complied code: Now from your favorite web Browser “http”//127.0.0.1:7170” will display: Simple HTTP Server 5) Connecting the Wires: The Parallel port uses a 25 pin “D” connector, we are reading the status bits only.
Pin’s 18-25 are grounds. It is important to remember that these input pins are TTL!!! Only other TTL signals (+5V dc) or a switch or relay from one of the status bits to one of the grounds in the connector are allowed. ANYTHING ELSE CAN CAUSE PERMANENT DAMAGE TO THE COMPUTER OR PERSONNEL !!!!!!! For more information on interfacing to the Parallel port a quick web search will surface a very large number of useful sites. An excellent site is www.beyondlogic.org. My previous article “Internet based Monitoring using low cost solutions” Suggests a collection of ideas for interfacing to the TTL interface of an Ethernet enabled PrintServer. The ideas in that article are applicable here; your computer has exactly the same electrical interface. Simple Temperature Sensor:
Simple Water Sensor:
6) Pulling it all together This article presents a small Java program that reads the 5 status bits of the parallel port at lpt1 and presents them as a string of 1 & 0's on a simple web page. You can use httpServer_io with www.BroadbandSentry.com which is web based service that you configure from your web browser. www.BroadbbandSentry.com works with the Web server you build in this article, off the shelf network hardware as described in our previous article, or any web enabled device. Messages can be generated by www.BroadbandSentry.com based on the content of Web pages. Email, SMS, MMS, and Voice messages can be generated by www.BroadbandSentry.com alerting you to important events at your home, vacation home or office, some examples are a simple temperature alert or water alert could be setup using the techniques from our previous article. The following example show setting up three sensors; temperature, water and a door switch. Individual messages are defined for each sensor. Also note the overall device state of "no response", a message can be generated should the httpSever be unreachable.
-
Enabled
120832 /
http://1.2.3.3:7170/ /
...
String Found
& |