296
Part II: Advanced Hacks, Tools, and Techniques
6. Test out the hardware
Plug the probe assembly into the ADC circuit board, plug a live Ethernet
cable into the SitePlayer board, and connect the SitePlayer power supply.
You should see a power LED light up on the SitePlayer board. If you have a
multi-meter handy, check the voltage across the power and ground pins of
the ADC chip. It should read +5V; if it does not, check your wiring. Follow
each wire from the SitePlayer board over to the ADC board to ensure that
each one is connected according to the schematic diagram. Disconnect
the ADC board and use a multi-meter to measure the voltage between the
ground and +5V pins.
If you are connecting the SitePlayer’s Ethernet port to a hub, use a straight-
through cable. If you are connecting the SitePlayer directly to your PC, use a
crossover cable.
Software Setup Instructions
The SitePlayer is a single-board computer that includes a complete TCP/IP
network protocol stack and a 10BaseT Ethernet port. It needs only a small
amount of code to fetch the data from the ADC and display it on a web
page.
The basic software that runs on the SitePlayer mini web server is a set of
special configuration files and a set of HTML web pages that are served up
when an external browser makes a request. The web pages provide a simple
user interface and contain embedded commands that read the temperature
and water levels from the ADC circuit board you just constructed.
First, youll download and test the pages and configuration files to the
SitePlayer using the tools provided with the SitePlayer board. Next, test out
the complete system.
The user interface HTML provided in Exhibit C that runs on the SitePlayer
is functional but simple. Feel free to hack up the code yourself to add
desired features.
1. Program the mini web server
The web pages and configuration files for the SitePlayer are loaded using an
RS-232 serial port. Make sure you have a spare cable if you did not purchase
the evaluation board. Connect the serial cable from one PC Com port to the
SitePlayer serial port.
For the PC you’ve connected to the SitePlayer, load all of the SitePlayer tools
according to the instructions included with it (or download them from the
SitePlayer web site).
Software Setup Instructions
ch15_coffee.indd 296
1/21/2002 1:35:59 PM
297
Chapter 15, How to Build an Internet Coffeemaker
Determine if your network runs a DHCP server. The SitePlayer is config-
ured to work by default in this environment. If your network uses static IP
addresses, you will need to set the SitePlayer for this mode. Connect a serial
cable between the SitePlayer and the PC, then start the SitePlayer Serial
Tester program. Set the new static address in the IP/Status window and
press Set IP Address.
Run the Serial Port Tester tool (included with the SitePlayer tools) and set
the IP address manually.
Place these files on your PC in a single directory:
Listing 1: coffee.spd
Listing 2: Index.htm
Listing 3: SitePlayer index.spi
Listing 4: refresh_index.htm
Listing 5: refresh_index.spi
Listing 6: water.htm
Listing 7: water.spi
Listing 8: pcadef.inc
Listing 9: UDPsend_def.inc
These files can be found in Exhibit C of this chapter and on this books web
site at http://www.oreilly.com/hardwarehacking.
coffee.spd is the file used by the SitePlayer tools to build the data for the
web server. refresh_index.htm is the page that the server provides when you
first connect to it. refresh_index.spi forces a page refresh when the button
triggering the ADC read is selected. water.htm is a web page that shows
the water temperature. water.spi also forces a page refresh. pcadef.inc is
required by the SitePlayer to define the temperature/water sensor interface.
UDPsend_def.inc is used to define UDP functions on the board.
Launch the SiteLinker tool and the open the coffee.spd file. Next, under
Download, select “Make Download File. If no errors are generated and
the SitePlayer board is connected to the PC and powered on, select the
“Download SitePlayer” option under the Download menu.
2. Test out the complete system
When the programming is complete,
test out the server to make sure that it
responds with a web page. To do this,
open a web browser on the machine
connected to it, and open the IP
address you specified for the SitePlayer
board. You should see a web page that
looks like Figure 15-16.
Figure 15-16:
Internet coffeemaker web page
Software Setup Instructions
ch15_coffee.indd 297
1/21/2002 1:35:59 PM

Get Hardware Hacking Projects for Geeks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.