FluidDB Fluid Monitor
From NortHACKton
The FluidDB Fluid monitor is a small project worked on by Widget and ntoll to attempt to access the FluidDB server from an Arduino, find an object on there, and regularly update it with new information. The example application is a moisture sensor for a plant, but any analogue or digital input of the Arduino can be used.
Contents |
Website
Hardware
- Arduino Duemilanovae
- Arduino Ethernet Shield
- Support circuitry from Botanicalls.com (Creative Commons)
To allow the project to be easily recreated, we have used an Arduino and requisite shield for Ethernet access. Yes, other micros are available, and no, there's nothing special about the Arduino. Using the Ethernet Shield does however allow concentration on the HTTP interface, and not implementing a TCP/IP stack or being stuck with SLIP instead of Ethernet. Also even the uIP stack would use most of the 2kB of DATA memory in the Duemilanovae and have totally filled the Diecimila. The mbed would be a good target.
Faults
- Ethernet Shield doesn't power correctly. Needs more capacitance on the reset line. Fixed in very latest version.
- Non-linear moisture sensing.
FluidDB
Write explanation of how FluidDB works that other people will understand.
Software
The software can be split into two halves. One half performs specific interaction with FluidDB, and the other half does everything else. The FluidDB code has been split into its own library for easier use in other projects.
Overview
- Powerup, initialise hardware
- Configure Ethernet Shield with IP info
- Lookup FluidDB server
- Find object on FluidDB server
- Store ID
- Loop:
- Read ADC value
- Normalise
- Update FluidDB object
- Set feedback LEDs
- Sleep
FluidDB
The FluidDB protocol is performed via HTTP, using the Basic authentication scheme. This is relatively easy for an Arduino (or other micro) to manage, as the headers are all plain-text, delimited by newlines, and can be read in e.g. Wireshark. A blank line separates headers and payload, along with some length information in the FluidDB headers. Most returned headers can be ignored, reducing processing overhead.
FluidDB access is done with a FluidDB object, and its call() function. This takes an HTTP action, a URL, and optional input payload and returned payload strings, with limiting lengths. When searching for objects, a list is returned in JSON, and the first UID occurs 10 characters in, and lasts for 36 characters. This is copied away, and null-terminated (to make it a C string of its own).
Source code
Source is at github under a MIT licence.

