This is actually on an old project I wrote back in 2006 using uIP v0.9. It uses a DS1820 sensor to measure my storage room temperature and send it in UDP packet to my database server. Database server then has software to alert me if temperature gets too low during winter.
Project has now been rewritten to use my picoos-net library, which allowed me to add a simple web server to system quite easily. I still use original hardware, which is either Olimex LPC-E2129 or Embedded Artists Ethernet Quickstart board (this is not available any more I think). To simplify testing, it is also possible to compile project for native unix program.
Main task of system sets up networking and initializes OneWire bus. After that it periodically scans the bus for sensors, reads temperatures from those and sends a UDP packet to database server. Main loop calculates also hourly average from temperatures and maintains history of those averaged values for one day.
Webserver is very simple. After new connection arrives, a new task is started to serve it. After reading HTTP request line and headers, it writes requested content to client. Webpages are stored in flash memory by converting them into C source code during build. To save space, text files are compressed during conversion and served with gzipped content transfer encoding, which instructs web browser to uncompress them.
Tabbed user interface is created with jQuery library. First tab displays sensor address and values as text, second shows a simple chart displaying last 24-hour history and third just shows program version info. Sensor data is delivered to user interface in JSON format, which is both easy to create using nosPrintf statements in server and easy to parse in web browser side (jQuery does it automatically).
First load of user interface in browser takes some time, as performance of uIP stack is a little bit limited with modern TCP/IP stacks (because of delayed acks). But as the static content is cached by browser subsequent views work very quickly.
Webserver has also code which uses FAT filesystem code from micro-layer, but it is currently used in my Unix test environent only. However, once I get a suitable Cortex-M CPU card with both ethernet and memory card slot the system will be changed to get it’s web pages from FAT disk.
System has also a simple command line interface, which can be used to query network and operating system statistics. More commands should be added, at least for printing temperature information.
To build this thing, charting library from amcharts.com is needed in addition to my source code. Also, web page conversion uses program called ‘file2c’, which is included in FreeBSD.
Source code is available at Github.