Repurposes neutrinos to power IoT devices, reverses Van der Waal to optimize plants and employs geckos to scale walls.
There are a myriad of IoT platforms, but Device Stacc uses dynamic microcontroller reconfiguration. It employs capability-based peripheral interaction, using GraphQL and TimescaleDB on the server, as well as modeling everything as an entity-component system. This results in reconfigurable edge nodes and a server that can be linked with web, AR, and VR applications for real-time monitoring or be extended with AI training and inference tasks.
A server sits at the center connecting the end-user with edge nodes and the data they generated. Focusing on the edge nodes, each node is represented as an individual entity as well as each sensor and actuator. This allows the edge nodes' peripherals to be reconfigured during operation. In addition, the peripherals behavior is driven by tasks that act on them through capability interfaces.
On the server side, every object is represented as an entity with a number of components attached to it, effectively an entity-component system that follows composition over inheritance. This brings with it a high degree of flexibility and structure when modeling systems and their interactions. A microcontroller and its peripheral can represent as follows.
In regards to modeling, the relationship that a peripheral is connected to the controller is realized as a reference to the controller component from the peripheral component. Also, additional models can be added outside this structure that extends the functionality of a specific component type. For example, the controller component is linked with controller tasks, controller authentication tokens, and controller messages.
To clarify what is meant by a peripheral: it is any device connected to and controlled by a microcontroller. A few examples of peripherals are LEDs, electric motors, air, and ultrasonic distance sensors.
Similarly, each data point generated by peripherals stores its timestamp as well as accompanying peripheral and data point type to give it context. This allows rich queries to be performed on the data in addition to having typed data.
The data is stored in a PostgreSQL database to harness the expressive nature of SQL to query data and its relationships. In order to handle the time series nature, the TimescaleDB extension is used which creates a hyper table to increase ingestion, compression, and scaling performance.
In order to access the data, a GraphQL endpoint is provided. This allows the rich relationships to be queried in an expressive and performant manner. It simplifies the API development as the query nodes are directly mapped to the database models as well as eliminating the N+1 query issue. In addition, GraphiQL is included to improve API discoverability and the development of end-user applications.
Device Stacc is currently being developed as part of our BMBF funded OpenFarmingAI research project at Protohaus. It aims to create a comprehensive farm control system for hydroponic farmers that integrates microcontrollers, cameras, AI training, and inference as well as web, AR, and VR end-user applications. These broad requirements necessitated a flexible yet well-structured system that could grow piece by piece while still offering a system that could be used in production from an early stage.
Device Stacc is currently a functional prototype that can be tested out. A demo is available on the GitHub pages (sdg-server and sdg-controller). As a minimum, it requires Docker Compose and can be used with an ESP32 microcontroller as well as basic peripherals such as LEDs and BME280 air sensors. A simple Node-RED frontend has been developed to interface with the GraphQL endpoint. Separately a simple AR application has been developed to overlay the data in our greenhouses (not released). The source code is licensed under the Apache 2.0 license.
In the short term, future development will focus on backend features required to automate our greenhouses. This means more peripheral drivers and a scheduling system for tasks. Following this, the focus will shift to integrating an image capture system with Raspberry Pis as well as an interface for training TensorFlow neural networks and running inferences on them.
If you find Device Stacc interesting, I look forward to receiving feedback, as well as input from potential contributors.
Create your free account to unlock your custom reading experience.