The Box in the Barn
The agritech industry has a stubborn habit of announcing every few years that farming is about to be disrupted. First it was precision agriculture, then the smart farm, and now it is artificial intelligence that will apparently tell a cow how to feel about Tuesday. The farmer, meanwhile, still walks to the greenhouse in the rain to check whether the heater is on. So we decided to start from the other end, without a dashboard of the future or yet another platform, with nothing more than a box. Inside it sits a Raspberry Pi 5 with one gigabyte of memory, a small memory card, a LoRaWAN gateway board and a display the size of a postage stamp that shows four short lines of text. There is no touchscreen and there are no buttons, because nothing survives a dusty barn and a curious goat better than the absence of things to break. The _advance_farm hub is meant to sit on the farm, gather data from sensors and send commands to devices, and it is open source, because a farmer should own the box that runs the farm.
The first real fight turned out to be with memory rather than with technology. One gigabyte sounds generous until every component asks for just a little more. The radio stack runs ChirpStack in its lightest form, with a simple file database instead of a full database server, because a server idling in a barn is a luxury nobody asked for, and our own services use around thirteen megabytes each. Then came the most underrated part of any product, which is the first five minutes. The industry loves onboarding flows decorated with confetti, while we wanted one that needs no instructions at all. When a network cable is plugged in, the hub simply works. When there is no cable, it opens its own Wi-Fi hotspot and shows the name and password on that tiny screen, so the farmer joins from a phone, creates an account, saves a recovery file and picks the farm's network. Reading the screen already proves that you are standing next to the box, which means there is no pairing code to type, and physical presence turns out to be a security feature that costs nothing and needs no subscription.
Security in general became a small lesson in humility. The temptation is always to build one clever service that does everything, so we did the opposite and split the hub into small containers, each living in its own zone. Only the web interface listens to people, the part that holds the keys has no network port at all, and the radio stack lives on an internal network that nobody can reach. Between them stands a single gatekeeper that checks every request against a short list of who may ask for what and politely refuses everything else, leaving a note in the log. This is not zero trust from a vendor brochure, only the old habit of not trusting anything by default. The data got a home of its own as well, and when the database restarts, readings from the radio wait in a buffer until the database confirms that it has stored them. We tested this the boring way by pulling the plug in the middle of the stream, and not a single reading was lost. Nobody will ever give a keynote about that, which is probably the best sign that it matters.
Adding a device works the way it should have worked all along. The farmer switches the sensor on near the hub, sees it appear in a list of devices asking to join, and adopts it by giving it a name and typing the key printed on its label. That key proves the device is really in the farmer's hands, and the hub passes it straight to the radio stack without keeping a copy. Once it has joined, the device tells the hub what kind of device it is, because it knows better than the person holding it, so nobody has to choose a type from a long list. The interface follows the look of the advance.farm website with clean type and plenty of white space, and it shows data as read only until someone presses the edit button with a small pencil on it. There is no JavaScript at all, so a page is just a bit of HTML, one stylesheet and two cached fonts, which loads quickly even on a farm connection that still remembers dial up fondly. Removing a device leads to a red danger zone where its name has to be typed first, a small piece of friction that saves a great deal of regret.
The honest part, usually missing from launch posts, is that all of this still runs in containers on a laptop, with a simulated radio and imaginary cows. Adoption works with the simulator but not yet with the real radio stack, the gateway board has not met a real Raspberry Pi, the web page still speaks plain HTTP, and synchronisation with the cloud is a separate project for later. It is a well organised prototype that has never seen rain, and that is perfectly fine. Every new system eventually becomes something that somebody has to keep alive, and a box in a barn will be kept alive by people in muddy boots rather than by a support hotline. The goal is therefore not to look futuristic but to be simple enough to fix, and the next step is a real sensor in a real greenhouse doing its best to break every assumption we have made so far.