AgTech After the Signal Drops: See Crop Stress. Verify the Flow
STM32 devices and ITTIA DB Lite collect and connect data to verify crop stress
The Camera Sees Stress. The Field Data Tells You More.
At noon, a field camera flags possible canopy stress in Zone 7. The soil probe shows that moisture has been falling since morning. The irrigation controller reports that it sent an open command, but the flow meter shows no increase during the observation window. The cellular link is down, so the team cannot check the dashboard.
That sequence is the difference between collecting data and being able to explain what happened. The vision model spotted a symptom. The soil probe added context. The flow meter gave the grower a reason to inspect the irrigation system before assuming the crop needed another watering cycle. Each observation answers a different question, and each is more useful when the device keeps enough history to put them together.
A two-node AgTech prototype gives each workload a place to run.
Verification scenario | Evidence to capture |
Cut power during a write | Query results after restart showing the new observation is either complete or absent, with earlier committed records still readable |
Interrupt an upload and resend it | Gateway results showing one record per event key and visible gaps where records are missing |
Move a probe or update the vision model | Historical records showing the original zone, calibration reference, or model revision |
Issue a valve command with missing or invalid feedback | A service view showing delivery as unknown and preserving the reason |
Fill storage during an extended outage | The observed retention and overflow response, including any effect on sensing or control timing |
The STM32N6570-DK provides a camera-equipped development platform with ST’s Neural-ART accelerator. ITTIA DB Lite provides embedded time-series and transactional storage that can run locally on the two MCU platforms. Each node can keep its own history while disconnected. When the records come together, the application can compare observations by zone and time window while accounting for clock validity.
Field conditions can complicate that comparison. A relocated probe can make a zone appear wetter overnight. Glare can affect a camera’s classification. A missing meter reading leaves irrigation delivery unknown. Recording probe configuration, image quality, and measurement validity alongside the results gives the team a way to investigate those cases.
Make the Field History Survive the Outage
Suppose the sensor node records an OPEN command at 12:04 p.m. The next flow observation should refer back to that command and keep its own timestamp and validity flag. If the enclosure loses power before a response is measured, the command can still appear in the history with its outcome pending or unknown. The same principle applies to the vision node. Store the inference with the exact model revision and frame reference so a later firmware update does not change how engineers interpret an earlier result.
The C sample below shows an application-side logging pattern shared by both STM32Cube projects. The STM32H5 logging task calls h5_log_flow() when a flow observation arrives. The STM32N6 logging task calls n6_log_inference() after a completed camera inference. Each function writes a complete observation, including its context, using ITTIA DB Lite's generated C table API. Each generated insert manages its own transaction.
Save the following schema as agtech_observation_schema.sql. Each table uses (source_id, boot_id, event_sequence) as its primary key:
CREATE TABLE flow_observation (
source_id UINT32 NOT NULL,
boot_id UINT32 NOT NULL,
event_sequence UINT32 NOT NULL,
zone_id UINT32 NOT NULL,
captured_ms UINT64 NOT NULL,
clock_valid BOOLEAN NOT NULL,
command_source_id UINT32 NOT NULL,
command_boot_id UINT32 NOT NULL,
command_sequence UINT32 NOT NULL,
flow_ml_min UINT32 NOT NULL,
measurement_valid BOOLEAN NOT NULL,
PRIMARY KEY (source_id, boot_id, event_sequence)
);
CREATE TABLE vision_inference (
source_id UINT32 NOT NULL,
boot_id UINT32 NOT NULL,
event_sequence UINT32 NOT NULL,
zone_id UINT32 NOT NULL,
captured_ms UINT64 NOT NULL,
clock_valid BOOLEAN NOT NULL,
frame_id UINT32 NOT NULL,
model_revision UINT32 NOT NULL,
class_id UINT16 NOT NULL,
confidence_bp UINT16 NOT NULL,
image_quality_valid BOOLEAN NOT NULL,
PRIMARY KEY (source_id, boot_id, event_sequence)
);
Generate the table API with ittiadb codegen agtech_observation --schema-file=agtech_observation_schema.sql. Add agtech_observation_database.h, agtech_observation_database.impl.h, and agtech_observation_database.c to each project, and compile the generated C source with the application. The generated header supplies the row types and insert_flow_observation() and insert_vision_inference() functions used below.
#include "agtech_observation_database.h"
#include <stdbool.h>
#include <stdint.h>
typedef struct {
uint32_t source_id;
uint32_t boot_id;
uint32_t sequence;
} EventKey;
typedef struct {
uint32_t zone_id;
uint64_t captured_ms;
bool clock_valid;
} FieldContext;
dbstatus_t h5_log_flow(db_t db, EventKey key, FieldContext field,
EventKey command_key, uint32_t flow_ml_min,
bool measurement_valid)
{
flow_observation_row_t row = {
.source_id = key.source_id,
.boot_id = key.boot_id,
.event_sequence = key.sequence,
.zone_id = field.zone_id,
.captured_ms = field.captured_ms,
.clock_valid = field.clock_valid,
.command_source_id = command_key.source_id,
.command_boot_id = command_key.boot_id,
.command_sequence = command_key.sequence,
.flow_ml_min = flow_ml_min,
.measurement_valid = measurement_valid
};
/* ITTIA DB Lite insert function starts and completes its own transaction. */
return insert_flow_observation(db, &row);
}
dbstatus_t n6_log_inference(db_t db, EventKey key, FieldContext field,
uint32_t frame_id, uint32_t model_revision,
uint16_t class_id, uint16_t confidence_bp,
bool image_quality_valid)
{
/* Confidence is expressed in basis points: 0 to 10000. */
if (confidence_bp > 10000u)
return DB_EINVAL;
vision_inference_row_t row = {
.source_id = key.source_id,
.boot_id = key.boot_id,
.event_sequence = key.sequence,
.zone_id = field.zone_id,
.captured_ms = field.captured_ms,
.clock_valid = field.clock_valid,
.frame_id = frame_id,
.model_revision = model_revision,
.class_id = class_id,
.confidence_bp = confidence_bp,
.image_quality_valid = image_quality_valid
};
return insert_vision_inference(db, &row);
}
Turn Field Failures Into Verification Evidence
The certifiability value of ITTIA DB Lite is that engineers can specify what the data layer must preserve, test that behavior on the target, and retain the results as evidence. Start with a requirement a reviewer can check. For example, after power recovery, every visible flow observation shall retain its original zone, measurement validity, and associated command ID. That requirement can be traced to the record schema, the database integration, and a repeatable power-interruption test.
Verification scenario | Evidence to capture |
Cut power during a write | Query results after restart showing the new observation is either complete or absent, with earlier committed records still readable |
Interrupt an upload and resend it | Gateway results showing one record per event key and visible gaps where records are missing |
Move a probe or update the vision model | Historical records showing the original zone, calibration reference, or model revision |
Issue a valve command with missing or invalid feedback | A service view showing delivery as unknown and preserving the reason |
Fill storage during an extended outage | The observed retention and overflow response, including any effect on sensing or control timing |
Record the database version, firmware builds, model version, boards, storage media, and configuration with the test results so another engineer can reproduce them. For tractors and agricultural machinery within the scope of ISO 25119, use the machine’s hazard analysis and applicable safety requirements to determine which control functions and components need safety evidence. The manufacturer owns that determination and the verification of the integrated machine.
When the connection returns in Zone 7, the grower can see why the alert matters. The camera flagged possible stress, the soil record showed a drying trend, and the flow feedback gave the team a specific reason to investigate the irrigation equipment. That is the practical value of keeping the history in the field. The team can follow the evidence from observation to action to outcome.
Bring your AgTech use case to ITTIA
STM32 devices and ITTIA DB Lite connect field measurements, on-device vision, and irrigation outcomes in a history engineers can verify. Request a discussion about an STM32H5 and STM32N6 evaluation, including sample source code, offline retention, or recovery testing for your field device.