home scoping with x10


change created a web highway for traffic.
Some embedded programmers
EPC
adopted web technology early in the
game and demonstrated the  Net as a
Feature Article
connectivity medium for virtual
scoping. Virtual scoping is a new term
for using browsers to investigate web
appliances. It means using a remote
Dennis Wilkison
browser to visually interrogate a home
page that is interactive with hardware.
I have used X-10 for years to control
my home. The lights, wake-up alarm,
and security controls haven t always
made me popular. Forgetting to change
the settings on the controller interface
after a vacation can be embarrassing,
Home Scoping with X-10
especially sitting in a dark room after
the controller turns out the lights. Now,
I control those functions from anywhere.
From the office, I can make the house
ready for my return by turning on the
heater, lights, and a pot of tea.
There is a gap between many em-
o you want to
bedded programmers and web brows-
scope your house
d
ers. Engineers often use a browser to
from the outside
locate information or buy and sell
Today, it seems like
world? Home scoping is
goods. But, many haven t used it to
a simplified way to connect a web
provide an interface with their em-
everybody is racing to
browser and its complex TCP/IP pro-
bedded designs. In this article, I ll
tocol to your X-10 modules. The X-10
present an overview of the process.
put everything pos-
protocol has been around for years, and
The included sidebar covers the basics
interest in it is growing exponentially.
of what makes embedded web servers
sible on the Internet in
The 1970s brought the microproces-
tick. Then, you can develop web pages
sor revolution, the  80s unveiled the PC,
that can virtually scope the world.
the form of web appli-
and the  90s introduced a web of com-
The task seemed daunting at first.
puters. This decade will witness web
All those languages, TCP/IP, LAN
ances. As Dennis ex-
appliance invasion. Converting to web
networking, hardware, Ethernet, web
programming is a challenge faced by
connections, URLs, scripts, and so on
plains, embedded
embedded programmers. At first, con-
were required before I could begin. But,
nections among computers and peripher-
the solution was simple when I discov-
programmers are
als used proprietary hard-wired
interfaces. Then, modems
learning to face the
Bit 3 Bit 0 Unit code
and RS-232 allowed phone
Bit 7 Bit 4 House code (where house code A = 000B,
lines to be used for remote
B = 001B, and C = 010B)
challenges and open-
connections; increased mo-
Bit 12 Bit 8 Future
dem speed and cost reduc- Bit 15 Bit 13 Action code (where on = 010B, off = 011B
ing new avenues based on unit number, dim = 100B,
tions made long distant
bright = 101B, general commands without
communications possible.
unit number requirements are: all lights off
along the way.
000B, and all lights on = 001B)
Enhanced protocols, high-
speed backbones, and a need
Table 1 This table shows the X-10 information that is passed to
for broad information ex- the driver.
www.circuitcellar.com CIRCUIT CELLAR® Issue 122 September 2000 1
ered Advanced Web Communications
Listing 1 Check out the example of a button call to X-10.
(AWC) Slim-Link Server module, sup-

port software, and evaluation board.

Xecom s new division developed a way

to circumvent the trials and pitfalls.

Developing a dynamic home page to an

X-10 interface with a house was fun.



HARDWARE

I chose the AWC module concept

because it provides an Ethernet con-

nection via TCP/IP to the gateway.


The module requires at least 600 mA

and can be run off a battery and a solar


cell. It measures 2.75 × 1.38 × 0.42 and

fits anywhere. The connectors and

interface to the outside are bigger than

the module. The evaluation board was

a natural choice due to the breadboard


area (see Figure 1).
Unlike other servers, embedded
web servers lack a moving platter hard application code. The program is web server to any location in the
drive. This usually means they have flash downloaded from the flash into the world. It also provides for connections
memory for the web pages and the oper- SRAM at powerup, and runs from the to pagers and other dial-up services.
ating system. Embedded web servers SRAM. The hardware interface part of The dial-in capability allows for a
require compressed files and minimized the system uses 32 ports to communi- backdoor connection if the web is
code space, keeping graphics to a mini- cate with, control, and measure the down, or it can be programmed for a
mum. The missing mechanical quality in world attached to the server. security measure to change the embed-
a hard drive allows embedded servers to An optional XE5614 modem that ded server code. AWC is developing a
go where desktop servers fear to tread. replaces COM B is provided with PPP protocol connection for the mod-
The hardware functions of the Slim- AWC89A. This uses six of the 32 ports, ule that will eliminate the need for a
Link (see Figure 2) consist of a micro- two for data and four for modem hard- dedicated Ethernet connection to the
controller with communication and I/ ware handshaking. The complete Internet. A browser can dial in to this
O ports. For this article, I ll use 56,600-bps modem supports data com- PPP port directly, connecting to the
AWC86 as the example. The communi- pression, error correction, and fax stored web pages.
cation section consists of two RS-232 transfer. This unique feature allows You control the remaining 26 user-
serial ports, an Ethernet port, and an transmission of fax messages from the programmable input, output, time, and
RS-485 port. COM A and B are the RS-
232 serial ports. The COM ports use Listing 2 Here s a CGI subroutine tool kit example of a password.
autobaud for line speed detection.

A modem is an option on the

AWC86. The AWC86A s modem con-

nects to serial port COM B and con-


nects to the outside world using a

phone line. COM A connects to a ter-


minal. The terminal needs to be set

with disabled hardware controls be-

cause there are no RS-232 hardware

lines (DSR, DTR, DCD) for this port.

The connection to the Internet is made


through the Ethernet LAN port J1. An

RS-485 link is available for remote


device serial connections.

The microcontroller is an AMD186

processor running with a 40-MHz

clock. The firmware powering this web

site is stored in the 512-KB flash


memory at the factory. You can repro-
gram the flash memory to include
2 Issue 122 September 2000 CIRCUIT CELLAR®
www.circuitcellar.com
serial ports. They consist of two according to the X-10 Powerhouse
J2 J13
J12 J7 J1
Power
USB
timers (four pins), one serial specification. You may find the
Phone RS-485 LAN
supply
port with no hardware controls TW523 interface manual at
COM Wire-wrap
B area
(COM A, two pins), two multi- www.X-10.com/support/
Modem Web controller
XE5614 AWC86A
function PIO/IRQ ports (two support_manuals.htm.
COM
pins), eight PIO ports (eight The AWC Slim-Link Server
A
pins), eight A/D converter in- evaluation module provides the
puts (eight pins), and two D/A necessary hardware to interface
Reset button
outputs (two pins). between a LAN on the Internet
The D/A and A/D bit resolu- and the X-10 specification re-
Figure 1 Here s a closer look at what comes with the AWC86A
tion is 12 bits, giving enough evaluation board. quired by the TW523 module.
range for most applications. Several of tion about the IBM PC version of a The last hardware necessary is a cable
the 22 digital I/O lines can be used to driver that connects to a parallel port. (standard RJ11 telephone extension
connect to a more complex converter. It wiggles the port lines according to cable) that connects the interface cir-
This would allow specific applications the X-10 specification. Figure 3 shows cuit to the TW523. Figure 4 also shows
to use more resolution or dynamic how each of the two X-10 interfaces the necessary connection points on the
range than that offered by the 12 bits can be connected to the Slim-Link. AWC Slim-Link Server module.
in the internal converters. A tempera- There s a specification for the TW523 The prewritten driver required the
ture probe or thermistor could be to help you understand how the X-10 use of pins D20, D21, and IRQ1 on the
added and monitored from this port. protocol communicates throughout the AWC module for the TW523 interface.
house wiring (read the TW523 manual at The zero crossing needed a high-level
TW523 smarthome.com). Reading past Circuit interrupt to ensure synchronization
I needed an inexpensive hardware Cellar articles, there is more than with the power line; IRQ1 was the best
method to connect the AWC module to enough information to rewrite the choice in the real-time operating sys-
the X-10 protocol. An excellent article, driver for the Slim-Link. The code for tem (RTOS).
 A Temperature-Sensing Control De- the TW523 driver is now part of the A house code must be selected and set
vice by Donald Blake (Circuit Cellar AWC library. AWC is collecting a signifi- with each transmission for the interface
113), described the tone sequence X-10 cant number of useful drivers, simplify- to X-10. I discovered the AWC module
uses around the zero crossing of the ing the interface to standard modules. has provision for special variables that
power line. A serial port driver version are stored in flash memory after the code
connected to the CP290 or the CM11 HARDWARE INTERFACE is compiled. IP addresses, passwords, log
hardware also could have been used. TW523 uses several components to on identification information, and the
The TW523 costs $15 to $20 and the interface with a TTL-level micropro- like are part of the RTOS. I took advan-
CM11 is closer to $100. The interface cessor. These components were tage of this storage location and used it
driver for each has to be written or at mounted on the Slim-Link Server for the house code for X-10.
least modified for the AM186 proces- evaluation breadboard area. The inter- This information is input using the
sor. face consists of three circuits that pro- console port (Port A) at powerup. The
The code in Ken Davidson s article vide level shifting and diode protection X-10 driver module also has two other
(Circuit Cellar 3) provided a good for the AWC module. Figure 4 shows inputs. The unit code selects the actual
starting place. It has detailed informa- the components and values needed X-10 module to be addressed for con-
trol and the action for the X-10 module
Listing 3 Here you see the CGO subroutine for a basic password page. to execute. (You can download the
software code of these functions from

the Circuit Cellar web site.)


FIRMWARE


You ve had a basic tour of the hard-

ware, now let s talk about the operat-

ing firmware. The flash memory

provides a real-time task manager,

dynamic web page host, and user web


page CGI tools to support applications.

Monitor firmware that uses serial port


(COM A) is provided to support devel-

opment and debug.

There is room left in the flash

memory for the application firmware

and web pages created for the user
interface. Applications use the task
www.circuitcellar.com CIRCUIT CELLAR® Issue 122 September 2000 3
manager to organize and simplify in- ing for Ethernet card drivers and mak- stack, and the real-time kernel. It ac-
terface code development with the I/O ing them compatible with the operat- cepts user application information,
lines and communication ports. The ing system, the entire system has been merges that information into dynamic
Slim-Link Server processor runs the configured, with the exception of the web pages, and passes the pages to re-
server code and the application code at external Internet connection param- mote users using TCP/IP and network
the same time. eters. The Internet configuration is protocols. The real-time kernel includes
located in a well-documented file that a preemptive scheduler to handle mul-
RTOS, THE SYSTEM BACKBONE requires minimal editing. tiple tasks running within the system.
The AWC module uses MicroRTOS The embedded web server interacts The demo board comes preloaded
(XeRTOS), which allows real-time with the user application, the TCP/IP with the AWC demo web site running
control of multifunction tasks. Product
development moves smoother and
The Basics
Let s start at the beginning. The world wide web is just a network an immense network. In
quicker when tested in an RTOS. The
a local area network (LAN) a hub is cabled to a file server and all work stations. The network
AWC module also provides a useful
can expand by connecting hubs together with routers, developing a wide area network (WAN).
multitasking capability. Multitasking
The next level connects WANs with high-speed backbones. This hardware needed a language to
communicate and unique addresses for each workstation, hub, and WAN, hence the Internet.
allows the embedded web server to
Local access points, called point of presence (POP), provide dial-in access. The user worksta-
simultaneously provide more than the
tion communicates using the Internet Protocol (IP). Each connected computer runs a copy of IP
interface to X-10. Embedded applica-
to communicate with other connected computers or servers. Each IP has a unique address com-
posed of four sets of numbers (maximum of three digits) separated by periods. A unique number
tions always grow from the original
is assigned to each telephone instrument.
concept, so expansion is useful.
The world wide web is the most popular use of the IP. It uses web browsers to move informa-
The second phase of my selection
tion from the selected server to the client. I ll use this part of the Internet to provide a virtual
connection to scope the X-10 system in the house.
process was finding a well-developed
The Internet relay chat allows conferencing over the network, and the NFS (network file
communication module. A TCP/IP
system) interconnects files among hosts. Telenet allows for a remote login to a host. As the
communications protocol stack is
world wide web changes, there will be more paths to hardware under virtual control.
The AWC module provides a clear way to understand CGI (Common Gateway Interface) and
provided in the AWC module for the
HTML and how they interact in an appliance web device. The first issue is how everything
server to communicate with the  Net.
connects (see Figure 8).
The Ethernet device drivers and a
Many embedded programmers have little experience in web programming, especially active
or dynamic web pages. HTML is not complicated for writing static web pages. Author tools help
server protocol were included. These
you develop a web page based on presentation so you don t have to program in C or CGI. The
are part of the RTOS in the Slim-Link
document displayed on the browser is stored in the server flash memory as HTML.
Server. It is a full-featured software
Programs like Microsoft FrontPage are expensive, but less expensive programs like WebPage
Construction Kit 5.0 work well, too. Later versions of Netscape allow access to HTML code and
platform consisting of a preemptive
provide for modification. And, several HTML editors are on the Internet as shareware.
real-time kernel, TCP/IP stack, and the
AWC embedded web server.
Static and Dynamic Web Pages
There s an important difference between a static and dynamic web page. Changing pages that
Writing a driver is usually what an
have information you can t type ahead to the server web site is a problem unless you use a
embedded programmer does best. The
dynamic web page. Providing active stock quotes, text from a book in a database, logic decisions
driver interface is the beginning of
based on user input, and a shopping cart are examples that require dynamic web pages.
what web appliance programming is
CGI Scripts
about. A dynamic HTML page genera-
CGI scripts add to the functionally of the web server by allowing you to add custom func-
tor needs to be connected to this
tionality, like forms and dynamic HTML pages. Until recently, CGI was a Unix innovation.
Under Unix, CGI scripts are not in the server and are executed from the file system. The server
driver. Flexible CGI seems to be the
is set up so the execution environment for CGI scripts runs as standard output. But, in the AWC
best solution for the C programmer.
system, the CGI script runs as compiled code on the server and generates HTML, which is di-
People who are unfamiliar with C but
rected to the client browser over the network.
understand script languages may prefer
How It All Connects
Perl, which is more simple. However,
Figure 8 shows how a dynamic HTML web page is generated. The CGI code has buried ASCII
Perl is slower, because the server, must
text in the form of HTML lines, which are output when the code is run. Actions are performed
using GCI standards that can be found in books like CGI How-To. These are used to develop
interpret, or compile, each time a page is
parsing and other programming functions needed to act on the information transferred from the
generated. Perl has an interpreter that
I/O drivers to the TCP/IP stack. When a box, verbiage, button, or other HTML function is
must reside in the server and AWC
needed, the code that provides the visual attribute is embedded in the CGI script.
The development of CGI improved web page programming. CGI is a mechanism by which
doesn t support it on the Slim-Link.
you connect script to your web server. A CGI script causes the following five things to occur in
Setting up the AWC server involves
a web server. First, the server creates a new session to execute the script. Second, a set of stan-
entering the IP address using the con-
dard environment variables is set, including the remote host IP address and the URL that was
sole port. The settings allow the em- specified. The script is then executed and the parameters are passed. Then, the web server cap-
tures any output generated by the script. And last, when the scripts end, the session is termi-
bedded web server to provide an
nated and the captured output is sent to the browser.
attachment to the network, which
CGI programs are script files that are written in a scripting language like Perl, or even C.
enables an external browser to com- Depending on the server, it may accept Visual Basic or batch files. The key is no user interven-
tion is allowed during the execution.
municate with the data in the server.
I chose the CGI scripts to interface with the X-10 module to simplify the code and make it
The details and view of how to config-
modifiable in the future. Application tools like Cold Fusion simplify writing CGI scripts. As
virtual scoping advances, interfacing will be easier.
ure the web server are simplified with
the AWC approach. Instead of search-
4 Issue 122 September 2000 CIRCUIT CELLAR®
www.circuitcellar.com
on the web server. I replaced the appli- executes the CGI
COM A
cation code with my X-10 application code, the output is
or I/O
Micro- 512 KB 512 KB 10Base-T
web pages. The AWC kit instructions piped back to the RJ45
controller SRAM flash Ethernet
to
AMD186 memory
guide you through bringing up the mod- browser as HTML,
COM B
LAN
or I/O
Hub
ule and loading your application, which is presented as a
HTML, and CGI codes. Because of the new screen.
limited space in an embedded web The second set of
server, the files are highly compressed; bold text in Listing 1
8 Analog/digital 22 Selectable 2 Channels
input channels I/O channels D/A output
the maximum application code space is shows the submit
64 KB. The building process AWC uses button, which is an
Connections to applications and process signals
in the make files monitors the space. input type.
Figure 5 shows how to connect the
Figure 2 The AWC86 block diagram provides some insight into the
server to load it and test the application MicroRTOS PRO-
hardware functions of the Slim-Link.
code. I used the development kit s con- VIDES
figuration because it only required a TW523 INTERFACE The zero-crossing interrupt starts the
crossover cable to make the connection. The MicroRTOS contains the firm- 1-ms timer. When the timer elapses, it
Listing 1 is an example of code from ware driver interface to the power line starts the 1.778-ms timer. Expiration
the AWC tool kit. It provides a button (for more information, read Donald of the latter indicates the first phase of
call to the file . This is the Blake s article in Circuit Cellar 113). a three-phase power grid. The 1-ms
basic interface with the X-10 driver. The You would have to write and debug a timer process is then restarted. A 6-bit
first important line, the control passing time-consuming driver for the PIC register keeps track of the 1-and 1.778-
line, is in bold text. It furnishes the infor- processor, per X-10 specification. ms timers.
mation to the server to execute the CGI Choosing the Slim-Link module elimi- Completion of the second set of
code. The line begins with the form tag, nated this development cycle. time-outs indicates the second phase of
which encloses all the elements in the The MicroRTOS driver uses preci- the power. Next, the third phase is
form. The action attribute ensures the sion background timers (1 ms and indicated by a counter value of six.
browser will receive the file. 1.778 ms) to measure the alternate Counter values are used to control the
You want the form generated by the phase zero crossings. The TW523 (Pin receiver and start the transmitter code
CGI script returned to the browser. 1 with reference to ground Pin 2) gives accurately according to X-10 specifica-
After  action , the CGI file name is a square wave representing the tion. Transmission of each bit takes
given so the server can locate it. Then, sinewave in the power outlet. This 1 ms, which is driven by odd values of
 get retrieves the file from the server. signal is sensed by the AWC module the counter. The silent time between
The typical directory location for an interrupt IRQ1 pin. The MicroRTOS each bit is 1.778 ms, which is the even
Apache server would be activates the driver, which consists of bits of the counter. This background
The AWC RTOS simplifies an Interrupt Service Routine (ISR). The RTOS timer code allows the ISR in the
things to only a root directory. X-10 ISR is compiled in the code as MicroRTOS to handle the transmis-
If a question mark was included after part of a table. Although many ISRs are sion and reception of X-10 informa-
the file name, the server would pass provided by the tool kit, the X-10 ISR tion.
everything after it to the CGI script. fit my application. The CGI code passes the unit,
The plus between one and two clarifies Then, the RTOS assigns a timeslot house, and action codes to the driver
spaces sent. Be careful with the charac- for the ISR and begins processing it. ( provided with tool kit) in
ters. The slash should be MicroRTOS. It uses three
represented as the hex %2F 4-bit bytes that are the
Serial peripheral
World
or it could be confused as a binary values of each code.
Wide
Serial peripheral
Web
separator between directo- They are combined into a
Future expansion
Future connection to
ries. Rafe Colburn s CGI 16-bit word. The
additional hardware
Programming in a Week J12 J7 J1 J12 module pro-
Phone RS-485 LAN USB
discusses this in detail. vided in the tool kit has
COM
B
The name attribute sets the details of how to use
User
Modem Web
a definition for this form so this code when called by a
breadboard
CP 290 XE5614 controller
area
or CM11
not installed AWC86A
the server can identify it. In COM CGI page. The command
serial
X-10 control A
this case, it is  memform. format for the
tells the form to driver module in
3 wire I/O interface
run the return MicroRTOS is seen in
AC house wiring TW523
function when you press Table 1.
X-10
interface
the submit button. This Alarm The CGI page that is
Computer Heat Lights
system
tests the input to make sure calling the
it s valid. When the server Figure 3 Connecting the two X-10 interface modules is a rather simple process. driver must preset the
www.circuitcellar.com CIRCUIT CELLAR® Issue 122 September 2000 5
HTML was not designed to it s an improvement.
5 V
" "
align text, tables, or even im- However, the background offset still
TW523
Pin (#)
10 K
ages. As HTML became popular, plagued me. The final solution was to
Transmit
10 K
output
it provided additional features. use frames and split the picture into two
port "
(D21)
100
Pin 51
Despite advancement, I had parts. A stationary right section shows
Transmit
"
input (4)
trouble generating the house the floor plan and a right frame shows
Slim-Link 10 K
Server
floor plan (see Figure 6) and the action of changing the X-10 modules.
"
5 V
"
placing icons for switches, con- I chose the dual frame window, and
Receive 5 K&!
100
input trols, and sensors. Specific made the left frame the action area
Receive
port " "
output (3)
(D20) Pin 50
places relative to the floor plan where all X-10 changes are made. The
"
just didn t exist and the screen right frame remains static and the floor
" 5 V
Interrupt
moved with no predictable plan shows the location of the sensors.
100
5 K&!
input
Zero crossing
port " "
output (1) pattern. Alignment in HTML is Developing the floor plan is not
(IRQ1) Pin 20
not a simple issue. I compro- difficult. A line draw program like
Ground (2)
" "
mised to make it work because Corel Draw or Word works best. The
absolute control is not possible lines for the walls are placed on top of
Figure 4 According to the X-10 Powerhouse spec, this is
with pure HTML. a set of temporary boxes. When the
what you ll need for components and values.
Each platform acts differ- final lines are in place, the temporary
values for this word. The AWC ex- ently when it comes to tables and boxes are removed allowing doorways
ample in file uses xt = forms for positioning. Microsoft and and halls to appear. Then locations of
0x4020 to set up the house code to C, Netscape selected a different starting switches are indicated with codes that
unit code to 1, and action to on. This place for the upper left corner. I tested refer to the buttons in the left frame.
value is placed in the MicroRTOS que each concept in all the browsers before Save your work as GIF files. A notice
and sent according to its timeslot. I was convinced my solution worked. will state the size is larger than the
Software for the file is My first attempt was to place a area open, but this is OK.
available for downloading. floorplan in the background.
But, it was impossible to con-
Slim-Link Server
development kit
HTML CODE trol the position of items in the
The HTML and CGI code for the foreground. Next, I attempted A
RS-232
AWC web site is provided for you with to use tables. I used a 10 × 15
B
the Slim-Link demo board. Sams table, which I assumed would
Laptop or PC with
Ethernet port
Teach Yourself CGI, by Rafe Colburn, position over the background on eCOM port
Ethernet crossover cable
details the CGI language. exactly. However, the tables
The HTML that represents the home moved and changed size and Figure 5 This is all it takes to connect the Slim-Link for testing.
page for the X-10 site (see Photo 1) may font with each browser. The
be downloaded. It supplies links to buy fonts set the size of the table cells and
X-10 hardware. It also links to Circuit therefore lose relative position to the SECURITY
Cellar, where much of the early X-10 left edge. Linked words for the controls The security of the floor plan page is
code for the  x86 processors reside. moved around the floor plan. critical. Having hackers come in the
Listing 2 is the CGI code that makes Pixel-transparent GIFs, which en- middle of the night to turn on your
this site function. It was originally sure better positioning, are a clever lights will produce the same feelings as
written as HTML code using the Web idea. But, working with pixels is mo- a real burglar. Protection begins with
Express Web Page 5.0 Construction notonous. My next idea was to use the fact that this is an embedded web
Kit. tables by integrating the pixel system controller. The first level of security is
inside each cell. This requires cell the lack of a hard drive. After every-
HTML: FRIEND OR FOE? building with pixels. Although slow, thing is converted to assembly code and
stored in flash memory, changes can be
made only from the console port, which
Porch Light
ET
Living Rm Lt
isn t connected to the Internet.
Cl
Heater
Liv Bed1 Bed2
The second security measure is a
Dining Rm Lt
Rm
Kitchen Light
Cl
password. The MicroRTOS system
LR
Coffee Pot
B1 B2
PL
Bk Porch Lt allows you to change a password using
HL
H
Bedrm 1 Lt MC1
the console port. To foil a hacker s
Bath Lt
DR KT BAL MB
Bedrm 2 Lt
attempt, I implemented a double pass-
M Bath Lt
Din Bath
COF
word system (see Figure 7).
M Bedrm Lt
Kit M Bed
Hall Light Figure 6 Here s
MBL The double password system begins
Sprinkler 1
M Bath an overview of the
with entering the first password. The
Sprinkler 2
SP 1,2,3
floor plan, using a
BPL
Sprinkler 3
CGI page allows three tries, after which
dual frame window.
6 Issue 122 September 2000 CIRCUIT CELLAR®
www.circuitcellar.com
"
Figure 7 With the
WRITING AN INTERACTIVE
Example Enter password
dual password setup,
example.html password.cgi
WEB PAGE
your site is safer.
Writing HTML web pages isn t as
Test password
password.cgi
exciting as embedded web pages. Vi-
Links
links.html
Homepage
sual scoping provides a new way to
Incorrect password
[index.html]
"Password Error"
you could use a remotely see and change the world.
enter reset password
password.cgi Browser gets
bookmark to get Typically, embedded web pages are
"Password Error"
Correct
Floorplan
password #1 password.cgi
around the pass- used to get information quickly. The
password.cgi
word. worst mistake for an embedded web
Is it the reset Is it the third
password? incorrect password?
Appliances Yes No Yes No
To prevent this page is to overload it with unnecessary
from happening, information. I keep my audience fo-
use a subroutine cused on the data being transferred. I
call from the password page to the floor make all supportable data in either
the CGI code requires a second password
plan page. This shows the web address HTML code or small visual images.
(reset password). The second password
for the password page when the browser Complicated sites need an opening
entered resets the CGI code enabling the
is looking at the floor plan. page like a star map to allow immedi-
first password to allow entrance into the
floor plan page. The scheme works be- When the home page is selected ate one-click access. Figure 9 shows
cause a hacker doesn t know the pass- from the floor plan page, it requires re- how any of the functions can be ac-
entry of the password. Listings 2 and 3 cessed with a single view.
word has changed. After the third
give basic guidelines for writing a CGI When you plan your home scoping
erroneous entry, there is no difference in
page that performs this.
the  Password Error screen.
You need additional C
If the reset password is entered, there
A. Web browser B. The request C. Web server
D. The script
code to provide the logic requests a script for the script is executes the
are still only three chances to get into communicates
to be run. sent by Internet. requested script.
with the X-10 driver.
to incorporate the second
the floor plan page. If someone tries to
Web Web
Internet Script
browser server
hack in, you ll know. Your usual pass- password scheme.
word will not work on the first try and
G. The browser F. The web E. The X-10 driver
parses the script server sends the changes the lamp,
X-10
CGI CODE
you will need to use the reset password and displays it script through notifies the script,
driver
for the user. the Internet, back and the script
Web servers started to the browser. creates an output
to clear the hacker s actions. After the
to the Web Server.
with static HTML web
reset password is entered, the correct
Appliance Lamp
pages. Then, programmers
password will work.
Figure 8 Virtual scoping on the Internet is accomplished with a
An improvement would be to en- began applying scripting
set pattern of steps.
code or encrypt the password. Al- languages. The output of
the CGI script is HTML. Then, the page, visualize how you ll access the
though unlikely, a hacker could read
your password over the Internet. Pub- server returns the script s HTML out- controls. In Figure 9, the map for the site
lic Key systems for  x86 code are avail- put to the browser (see Figure 8f). Writ- shows the index. A clever part of AWC s
ing server script in a more complex web pages uses framed sections that give
able on the  Net and could be added as
language than HTML allows logic to be guidance among pages, but do not have
part of the CGI web page.
added to the web page, creating a dy- to be downloaded with each new page.
A final security feature is the link
namic visual effect for the viewer.
between the password and floor plan
A CGI script may have subroutines GETTING STARTED
pages. If the floor plan page used a
that interact with the browser and AWC provides many examples of
standard link from the password page,
keep the same URL. both CGI script and HTML code with
This interaction al- the Web-Controller Development Kit.
lows one URL to have The best way to get started is to do
many functions for any development in real time. AWC
example, turning on offers the Slim-Link Server Evaluation
one of many lamps in Board Prototype kit that contains
the house. Creating a everything you ll need to get things up
number of web pages and running. The AWC89 is a good start
with the lamps on and if you don t want a modem. The
off in different combi- AWC89A is the offering for developers
nations isn t practical. who want a 56k auxiliary modem port.
It s better to write a When it comes to choosing a com-
CGI script that makes piler, the Borland C version 3.0 or 4.5
a lamp a parameter and is inexpensive and works well with
returns the correct on the AMD186 processor. The old
or off state. TASM assembler completes the tools
to begin writing code.
Photo 1 This is the homepage where I begin my virtual scoping.
www.circuitcellar.com CIRCUIT CELLAR® Issue 122 September 2000 7
I included several references at the
APPLYING THE TECHNOLOGY
Example Enter password
example.html password.cgi
end of the article that will help you.
X-10 can give a freezer alarm or
AWC provides further aid in identify-
provide details of the home alarm
Links Floorplan
links.html Homepage password.cgi
ing compatibility among hardware
system. Temperature control of the
[index.html]
and compilers.
house, oven, water heater, and refrig-
erator can be monitored. With an addi-
Appliances
INITIAL SETUP
tional file and voice application
Figure 9 Here s the homepage again. A block
Setting up the initial test and
software/hardware, it can dial and play
diagram is helpful in the planning stages to maintain
bringing up the Slim-Link Server mod-
an emergency message to your cell
a logical flow of the web site.
ule required two connections to my
phone. X-10 can monitor the moisture
computer. There are several ways to code is more difficult. A working web
content of the lawn so you can re-
connect to communications ports on server and browser may be needed to
motely adjust the sprinkler timing. If
the Slim-Link. The simplest way (see emulate the code and web pages to
any of your appliances have RS-232
Figure 10) is used for development and make sure they work properly.
service ports, Slim-Link could be used
testing. The Slim-Link LAN port is
for remote access by technicians for
connected to a reversed Ethernet TESTING
diagnostics.
cable, which attaches to an Ethernet After testing, it was time to connect
With this technology, geological
the AWC module to my real
stations can gather data about earth-
RS-232 network. I have a simple
quakes, high water conditions, and so
COM2 COM1
PC
firewall on the DSL line. Of-
AWC on. Heavy rainfall detected prior to
running
Ethernet
terminal LAN
card ten, there is no firewall, yet the
program 10Base-T flash flood conditions can be used to
reversed cable
diagram is the same.
generate automatic warnings.
You can access the Slim-
This article shows that using a mod-
Figure 10 Here s the basic connection scheme.
Link throughout the LAN
ule with a prewritten RTOS and driver
card in the PC. within the firewall by using a fictitious
saved months of toil. Programming is
A second path from the PC is added IP assigned to it (see Figure 11a). A
work, but it becomes fun when the
by attaching one of the unused PC COM fictitious IP address would be common
code is simple. I
ports to the Slim-Link COM a serial port only to the LAN and not be registered
with an RS-232 cable. The house code on the Internet. Nobody beyond the Dennis Wilkison works at Geometrics, a
manufacturer of geological instruments.
needs to be set in each of the X-10 mod- firewall can access the Slim-Link s web
He has helped develop products that the
ules and each module s unit code must server. All LAN participants can access
first telephone credit verification termi-
be coordinated with the floor plan page. FTP servers or hosts depending on the
nal and first Ethernet switch. You may
The first step is to test the AWC Internet connection. This step makes
reach Dennis at wilkison@att.net.
module. You can exercise the AWC final testing easy. For final activation
module using a terminal program like of the embedded server, a gateway is
SOURCES
Hyperterminal or PCPlus. The needed to connect to the outside
X-10
module s command line functions on world.
X10 Inc.
the console port include PING, FTP The diagram in Figure 11b shows
(201) 784-9700
client, e-mail, AWC Monitor, and Tele- how the web server accesses the world.
Fax: (201) 784-9464
monitor. You can enable or disable the Here, the server uses a real static IP
www.x10.com
web server functions from the console address.
Slim-Link Server
port, which is where you enter the pass-
Advanced Web Communications
words, IP address informa- A division of Xecom Inc.
RS-232 (408) 945-6640
tion, and X-10 house code.
Fax: (408) 942-1346
COM2 COM1
After the console port
PC
AWC WWW
running www.xecom.com
Ethernet
information is entered, set terminal LAN
card
program
Compilers and software tools
up a browser window as a
Borland C++ 3.0, 4.5/4.52 and Turbo
TCP/IP connection to access
a)
Assembler
Firewall to
Hub
Internet
the Slim-Link Server s web
Microsoft MSVC++ 1.0/1.52
10Base-T
LAN port. Follow the in-
Microsoft FrontPage
RS-232
Web Express WebPage Construction
structions in the demo kit
Kit 5.0
COM2 COM1
for initial testing in demo PC
AWC WWW
running
Ethernet
terminal LAN
mode before loading your
REFERENCES
card
program
compiled code through the
Rafe Coburn, Sams Teach Yourself
Gateway to
console port. Then, you Hub
b) Internet
CGI, Sams, Indianapolis, IN, 1998.
10Base-T
download your new program
Fred Eady,  Embedded Internet Part 1:
and begin testing it.
Figure 11a This is the typical test connection to the Internet.
On the Network, Circuit Cellar
b And, here s the outside connection using a gateway.
Debugging the embedded
106, May, 1999.
8 Issue 122 September 2000 CIRCUIT CELLAR®
www.circuitcellar.com
Fred Eady,  Embedded Internet Part 2:
On the Network, Circuit Cellar
107, June, 1999.
Ken Davidson,  Power-Line-Based
Computer Control, Circuit Cellar 3,
May/June, 1988.
Ken Davidson,  The X-10 TW523
Two-Way Power Line Interface,
Circuit Cellar 5, September/October,
1988.
Don Blake,  A Temperature-Sensing
Control Device, Circuit Cellar 113.
Warren Webb,  Embed the Web for Fun
and Profit, EDN, March 18, 1999.
Slim-Link Server Development Kit
User Manual, AWC, December, 1999.
Circuit Cellar, the Magazine for Computer Applica-
tions. Reprinted by permission. For subscription
information, call (860) 875-2199,
subscribe@circuitcellar.com or
www.circuitcellar.com/subscribe.htm.
www.circuitcellar.com CIRCUIT CELLAR® Issue 122 September 2000 9


Wyszukiwarka

Podobne podstrony:
Buy real estate, bank and home foreclosures with our real estate investing techniques
2008 08 Getting Inside Customizing Your Home Router with Openwrt
2009 03 Parental Guidance Filtering Home Internet Access with Squid
2005 11 Safe Harbor Implementing a Home Proxy Server with Squid
Home Power 43 p24 Barbecuing With Hydrogen Gas
2006 10 Tv in Linux Building a Home Media Center with Mythtv
Kidney Stones Cure Cure Your Didney Stones With My Natural Home Remedy
2002 09 Creating Virtual Worlds with Pov Ray and the Right Front End
Building web applications with flask
110 Amazing Magic Tricks With Everyday Objects
Headlights, Pickup with daytime running light
Golden Dawn Meditation with the Archangel Gabriel
Some Problems with the Concept of Feedback
Grid Power Quality with Variable Speed Wind Turbines
Wireless Hacking with backtrack 3

więcej podobnych podstron