In order to expand, farms have historically depended on getting more land. More acreage meant bigger crop yields. Farmers embraced technologies like irrigation, fertilizer, and pest control to improve their ability to grow more food of better quality more reliably. Recently, as the amount of available arable land has grown, some organizations have looked to adopt software technologies to grow vertically, not horizontally.
Vertical farming is part of the larger AgTech industry that takes modern technology, like data science and automation, and applies it to farms, ranches, and other traditional agriculture businesses. Vertical farming uses software engineering and robotics to up (see what I did there?) farmers’ game and run a warehouse full of crops using technology.
I reached out to Jim Frederick, Director of Software Engineering at Bowery Farming (and a personal friend), to talk about the tech stack that grows lettuce in vertically-integrated farms. This article will discuss how they run an integrated and automated farming operation and what software engineering looks like when your code powers kale.
Software engineering for farmers
In industries where the end product is software, tooling and internal processes are in place to monitor the software and keep it running. You’ve got your application performance monitoring and observability platforms keeping track of how the software is running, cloud computing systems or other infrastructure making sure that the software has enough resources to handle traffic, and CI/CD systems to get changes into production efficiently. It’s software supporting software, for the most part.
On some level, software on a vertical farm looks the same as other software-driven industries. Vertical farms automate processes and manage data. They have front-end and back-end code, databases, and job schedulers. They use and contribute to open-source software. “We use common things like React and Vue.js for some of our front ends,” said Frederick. “We have contributed back to the Elixir community because there aren't so many Elixir shops, and we are proud to be one.”
But in AgTech, the software also supports biological processes that require real-world measurements. You monitor metrics like humidity, temperature, and soil pH. Your infrastructure is the water you irrigate with and the soil itself. Your CI/CD systems are planting and harvesting operations. It’s software supporting a physical process, and there’s a translation layer there from a digital world to an analogue one.
Farming takes a vast amount of data—soil conditions, rainfall, daily temperatures, plants per acre—and requires a large amount of physical work—tiling soil, planting crops, watering and crop maintenance, harvesting. Both areas, the data and the work, are ripe for the sort of productivity improvements that software can provide.
At the center of the Bowery Farming software system is BoweryOS, a proprietary cloud-based application with an on-premise supervisory control and data acquisition (SCADA) software layer that controls everything that happens at the farms. Written in Elixir, it provides a level of abstraction over the programmable logic controllers (PLC) that tend to the farms. “From a software perspective, you don't necessarily want to know about each and every robot, each and every vendor,” said Frederick. “They all have different specifications, so it's helpful to create an abstraction layer there. The software doesn't really want to know about who made the PLC, who made the robot.”
Sometimes, Bowery Farming are the ones building the robots. Some of what they were using to move and manage crops was designed for inventory management, moving pallets of finished goods from shelf to shelf using automated storage and retrieval systems (ASRS). But they found that they were regularly making improvements to the vendor equipment and looked to bring aspects of that and other robotics work in house. “Over a year ago, we acquired this company out of California called Traptic whose specialty was robotic arms with AI/ML to harvest strawberries,” said Frederick. “While we have that unique technology, the team is also just great at making all sorts of robotics to power our farms.”
The goal, as in many software operations, is to automate the business as much as possible, to minimize the number of human touches on systems.
End-to-end tests on spinach
“Spinach is a really tricky crop to grow,” said Frederick. “It requires obscenely clean water and is particularly finicky about the nutrients in the water. So if you have a farm that's set up for lettuce and arugula, how do you isolate your irrigation system so that you can grow spinach in one area and get that pristine, clear water that it needs? From a physical perspective, that's challenging, but that's also challenging from a software perspective. In our farms, every crop sits on a tray and they all get moved around like a giant game of Tetris.”
Like many software shops, Bowery Farming tests their changes to validate that they work before moving them into production (they don’t test in production; failing over to a new spinach operation takes weeks). “Our R&D team will validate something on a small scale enough that we think it’s going to work, said Frederick. “But then it is important to start doing it at a larger scale. We've definitely seen times where it does not work when you move to scale, and also where it is not sustainable to do it at scale.”
Bowery Farming’s R&D department has to figure out how to optimize the growing conditions for each crop and then productionalize those cases in a way that can play nice with other crops. The systems have really granular control over the farm parameters—temperature, humidity, iron in the water—so the farms can create optimum conditions for any given plant. “If we can get an extra 2% here, an extra 2% there, these do start to add up, but you just have to be very mindful of the maintainability of those systems,” said Frederick.
Of course, their data platform doesn’t just analyze the best conditions in which to grow each crop. The farms are businesses, after all, and have to balance scientific analysis with commercial analysis: not just understanding the ideal conditions, but assessing how long they take to produce and what the market requires. “Our consumers—grocery stores—are ordering 10,000 cases of one thing and 20,000 cases of another,” said Frederick. “We also have to overlap our ideal growing conditions and formulas with market needs. Our data platform incorporates both of those to find the perfect thing to grow today for an order that we know will come in a bit.”
A career with growth opportunities
While there’s a lot about his role at Bowery Farming that’s similar to other software engineering jobs Frederick has had, all the focus on physical agriculture makes this a broader role. The job by necessity is cross-functional, encompassing engineering, agriculture science, and product. And not just software engineering—he interacts with mechanical and industrial engineers as well. “It's a unique space to work in as a software engineer,” he said. “We don't have to worry about ads. We don't have to worry about our home page. We don't have to worry about the analytics of our users. We just worry about growing conditions and how to make all that repeatable at scale.”
Vertical farming takes a lot of knowledge spread across a lot of different domains, so Bowery Farms uses Stack Overflow for Teams to manage that. They store runbooks and useful scripts for engineers in production, but the farmers get a chance to share, too. “If a farmer wants to switch this crop to a longer lighting session or has more iron,” said Frederick, “then they can get those questions answered in Stack Overflow of how to technically do it. Maybe we don't have a button in the UI to do that yet. But from a software engineer perspective, there's a way to do it.”
At Bowery Farming, Frederick gets to use his engineering skills in service of something he’s already passionate about. “In my backyard, my wife and I grow tons of vegetables, fruits, and flowers—blueberries, black raspberries, kale, spinach. We grow at least 40 kinds of food back there, which is a little ridiculous. We should not be trying to grow a pumpkin in a Brooklyn backyard. Starting the plants off indoors is a lot less of an automated environment and definitely involves me adjusting the lights every couple of days as the plants get taller, regularly watering, cleaning off mold, things like that.”
His job at Bowery Farming a source of pride for Frederick. He gets a wide variety of greens to take home, but even if he forgets, he still buys them from the store. “There's definitely been times in the past where maybe I use the software I work on, maybe I don't. That's fine, but it's definitely nice to work on something you can take pride in. And we make amazing products. Sometimes I’ll be at the grocery store and accidentally spy on somebody buying lettuce. ‘Oh, which one are they going to get?’ Then they reach toward yours and reach toward another one. It's very dramatic!”