The server is organized as a web site, SensorServer, with the Arduino code in an identially named subdirectory of this site. On a mac, this can be downloaded as follows:
Open the Terminal program
cd Sites
git clone clone address from GitHub
Enable Web Sharing in the Control Panel
Test that this site is accessible by fetching some pages from your brower:
http://localhost/~your-login/ -- should include SensorServer
http://localhost/~your-login/SensorServer/about.html
The SensorServer runs on a USB arduino with the Ethernet shield.
You will want to use the Arduino development environment to program the device.
Install Arduino IDE from www.arduino.cc
Install the OneWire library in /hardware/library
Use File>Open to open SensorServer/SensorServer/SensorServer.pde
Edit the mac address to be unique on your network
Edit the ip address to be unique your network (e.g. 10.0.0.201 in this example)
Download the compiled program into your Arduino
Test your work so far by fetching the tsv and json pages:
http://10.0.0.201/g -- all data in tab-separated fields
http://10.0.0.201/j -- all data and some stats in json hash
If you are behind a firewall, open a port to your arduino. Test that you can access the json page through your router.
You will want to run the sampling script on an always-on server.
Edit the sample.pl script to fetch from your Arduino
Create a
results
directory in the same directory as the script
Test the sample.pl script by running it from the command line. It will create subdirectories in results for devices discovered by your Arduino.
Edit your crontab (crontab -e) to run your script every 5 minutes.
For each device in the results directory add the following files:
name.txt -- One word name for the sensor.
info.html -- Paragraph describing the location and purpose of the sensor.
location.jpg -- Photograph of the sensor in its current location.
The script, mkthumb.sh
, will make low resolution thumbnails of location pictures. Run it whenever adding new images.
Test that the website is configured properly and collecting data by viewing the main page, index.cgi
.
Consider editing about.html to refer to your Arduino for live data.
We like to hear about successful installations. Send us mail. Let us know if we can add your site to the list of SensorServers. Consider contributing to the codebase by forking the project and requesting pulls.
Best regards, Ward Cunningham