BubblesNet is a system for the monitoring and automatic control of a secure, indoor deep-water-culture hydroponic setup using either a hard cabinet or a tent. It has some unique features (i.e. door security, odor control) but is mostly applicable to any plant that you want to grow under tightly controlled and monitored conditions.
I strongly recommend that before you clone any of these repos and try to hack your own BubblesNet system, that you set up an instance of the system running pre-built images from our Balena public fleet.
To get started with the public BubblesNet fleet, start here
If you blew past that suggestion, I'm going to suggest it again: To get started with the public BubblesNet fleet, start here
If you're sure you know what you're doing, and you're in a super-duper hurry to start hacking on BubblesNet, start here
You're here, so you probably already have an idea what requirements you're looking to fulfill, but to see what was top of my mind developing this, see the requirements list.
This repository contains only the documentation for bubblesnet, no code.
The actual code for this system resides in 2 other repos:
I structured the repositories this way because of the very distinct nature of the edge-device and controller and more importantly because of the significant documentation required by the physical components of the system. I may live to regret this.
The most ambitious aspiration for this project is to use data science/ML to correlate the substantial data collection with the results seen in the pictures collected.
Here's a picture of the cabinet - a wood box.
The reservoir sits in the bottom of the cabinet, grow light in the top, all sorts of stuff mounted in various places on the cabinet ....
For detail on the cabinet click here
Here is what the user interface of the system looks like in operation:
The Station Control screen is where I spend 99% of my time in the system. See here for the full user interface.
The system software runs on 3 devices:
- Controller - A Raspberry Pi 4 8GB that contains the data storage, web user interface and alerting functions.
- Edge-device (cabinet) - A Raspberry Pi 3B+ that contains the actual sensors and relay controls to monitor and control the environment in the grow space. Designed to run on a Pi (3CMM, 3B, 3B+, 4), port to another type of device would be painful.
- Edge-device (external) - A Raspberry Pi 3B+ that contains the sensors to monitor the environment outside the cabinet.
Within the system these devices are typically referred to as "edge_device".
The controller is a single Raspberry Pi 4 running the control user interface, and data collection and analysis services designed to work with the bubblesnet edge-device. The controller user interface can be accessed from a browser on any device on the same network.
The controller uses seven containers (which balena calls micro-services), 1 user interface, 2 with prepackaged balena blocks for database and queue and 3 containers with custom nodejs express applications:
- ui - a web user interface for controlling one or more edge devices and viewing the data from those devices. Written in React.
- database Postgresql 11 database container
- activemq ActiveMQ 5.17 queue system container
- api API server - takes measurement and event messages from edge-devices and queues them for processing. Also serves UI data requests.
- queue Queue server - takes measurement and event messages off the queue and stores them in the database and also publishes those messages to a "topic" (queue) for the web socket server to consume.
- websocket WebSocket server - pushes messages from the "topic" out to any Client instance (UI) that has connected to it. This is what gives the user interface its ability to show environment changes in real-time.
- wifi-connect - a pre-cooked balena utility which runs an access point that allows you to connect this device to your wifi.
The edge device is one or more Raspberry Pi devices running BalenaOS (Yocto). The device runs at least 4 containers:
- sense-go - sensor code written in Go along with relay control, sends all measurement to store-and-forward container via gRPC
- sense-python - sensor code written in Python3, sends all measurement to store-and-forward container via gRPC
- store-and-forward - stores messages from the sensor containers until it can forward them via the Edge-Server API
- wifi-connect - a service to let you connect the device to the correct wifi network
We do the typical "hack on feature branch off develop", "PR back to develop for integration testing", "PR back to main for release".
Words matter. I buy into the notion of using "main" instead of "master" and have done so for all my repos except ... this one which I just noticed uses "master". Sigh. I'll get around to it.