STM32-Based Modbus RTU Soil TH/NPK and Environmental Monitor hero

STM32-Based Modbus RTU Soil TH/NPK and Environmental Monitor

STM32 · Modbus RTU · RS485 · rover field sensor

STM32 Modbus RTU soil / environment node built for the York Robotics Mars rover: RS485 multi-parameter probe (TH, NPK, pH, salinity, TDS) with robust parsing and protection.

This industrial-grade environmental monitoring node was developed for the York University Robotics Society Mars rover to measure soil health parameters in real time. An STM32 microcontroller acts as Modbus RTU master over RS485 to a multi-parameter soil probe, querying and parsing Temperature, Humidity, pH, Nitrogen (N), Phosphorus (P), Potassium (K), Salinity, and Total Dissolved Solids (TDS) for onboard processing and data forwarding on the rover platform.

  • STM32 core using UART + DMA for reliable high-rate polling and parsing.
  • Custom Modbus RTU master: packet build/parse with CRC-16 generation and validation.
  • TTL-to-RS485 transceiver for differential, noise-immune runs to the probe.
  • Register map decoding for calibrated NPK, moisture, and chemical metrics.
  • Power sequencing plus TVS protection on RS485 for outdoor transients and ground-loop stress.
  • Integrated on the York Robotics Society Mars rover as the club’s soil-sensing payload.

Dual-rail power: isolated high-voltage (5–30 V) field loop for the probe versus 3.3 V logic for the MCU and transceiver. A unified ground matrix ties domains to avoid floating RS485 receivers and common-mode corruption; level shifters guard MCU pins where needed. Bench validation used a scope and logic analyzer to verify UART timing, CRC integrity, and clean half-duplex direction changes on the RS485 transceiver.