To measure the water level of our cistern, I started to build a little cistern monitor based on a hacked TP-Link MR3020 router running OpenWrt and a SRF05 ultra sonic range finder. The software project mainly consists of a kernel module and a web service to access the
data through a simple web-ui or by CSV download. The sources for both (and some build instructions) could be found on github.
Since the TP-Link has some unused GPIOs, the SRF05 could be connected directly to the TP-Link by using a single line for triggering/data acquisition. The values from the sensor are exported to sysfs by the kernel module. Then, the web-service reads out the data from there and provides them as JSON. Also the web service provides a simple static HTML page using microAjex to retrive and display the JSON. The web service is written in plain C and uses the excellent mongoose as a foundation. Thus, the whole thing is only about 110k small. To create a long-term statistic, the measured data is written to a CSV file every hour.