A poultry house is a poor place to depend on the internet. Farms are often far from towns, a mobile signal comes and goes, and a monitoring system that only works while the cloud is reachable fails at exactly the moments that matter. So the first runnable piece of Reinnder Flock is the part that has to work without the internet: the gateway.
The gateway sits between the sensor nodes in the house and the cloud. When a node sends a reading, the gateway stamps it with its own clock and the next number in an unbroken sequence, and writes it to a file on disk before it does anything else. It lets go of a reading only after the cloud has confirmed receiving it. It runs on plain Node.js with no outside packages, so it can live on a laptop or a small Linux board.
That small design gives three things we can test. Nothing is lost while the connection is down, because readings wait on disk. Nothing arrives out of order, because every reading carries its number and the gateway sends them in sequence. And nothing is counted twice: delivery is at least once, so after a bad connection a reading can arrive again, and the receiving side keeps one copy of each by gateway and sequence number.
The test, which anyone can run, goes like this. Five readings reach a stand-in for the cloud. The stand-in is switched off and ten more readings arrive and are held, and the gateway still raises its local heat alarm with no connection. The gateway is then stopped and started again part-way through the outage, as a power cut would do, and the ten held readings are still there. One more reading arrives and is numbered 16. When the cloud comes back, all sixteen readings arrive, in order, each exactly once, and the queue empties.
The same gateway checks every reading against heat, cold and humidity limits on the spot, with a small margin before an alarm clears so that it does not flicker on and off at the limit. The limits are settings in the code, and the numbers used in the test are examples, not advice for any flock. Flock is an independent watchdog beside the farm’s own controllers: it does not run a fan, a heater or a feeder.
What this does not show matters as much. It was tested on a bench, in software, against a stand-in for the cloud. It has not run in a working poultry house, the firmware for the camera and sensor node has not yet been run on hardware, and the cloud service does not exist yet. When there is a trial house, we will publish what its logs show, including anything that goes wrong.
By Reinnder Agritech