Skip to main content

Reference

Source Code References

If you made it till here, you a true G. Also, this was rather useful, check this out... ERC Embedded Simplified Official

Main Application

File

Purpose

src/sensor_board/main.c

Main entry point and sensor loop

Sensor Drivers

Sensor

Header

Source

GPS

components/sensor_board/gps/gps_sensor.h

gps_sensor.c

IMU

components/sensor_board/imu/imu_sensor.h

imu_sensor.c

pH

components/sensor_board/ph/ph_sensor.h

ph_sensor.c

Load Cell

components/sensor_board/load_cell/load_cell_sensor.h

load_cell_sensor.c

Pressure

components/sensor_board/pressure/pressure_sensor.h

pressure_sensor.c

Utilities

components/sensor_board/sensor_basics/sensor_basics.h

sensor_basics.c

Protobuf Definitions

For detailed protobuf message format documentation, see: Sensor Board Protobuf

ERC-Protobufs/components/sensor_board/
├── diagnostics.proto       - Board-level diagnostics and health status
├── sensor.proto            - Aggregated sensor state message
├── gps_sensor.proto        - GNSS positioning data
├── imu_sensor.proto        - Inertial measurement (acceleration, gyro, mag)
├── ph_sensor.proto         - Water quality pH measurement
├── load_cell.proto         - Force measurement (gripper control)
└── pressure_sensor.proto   - Pressure measurement (gripper control)

Build Configuration

File

Purpose

platformio.ini

Build configuration for all boards

.mxproject

STM32 CubeMX configuration

firmware.ioc

CubeMX IOC file (device config)

Test References

Test Suites

test/sensor_board/
├── test_gps_sensor/
├── test_imu_sensor/
├── test_load_sensor/
├── test_ph_sensor/
├── test_pressure_sensor/
└── test_sensor_basics/

Running Tests

// Build all tests
pio test -e sensor_board

// Run with verbose output
pio test -e sensor_board -v

// Build only (no run)
pio test -e sensor_board --no-run

Hardware References

Microcontroller

  • STM32H753ZI - ARM Cortex-M7, 480 MHz, 1 MB Flash
  • Datasheet: ST Microelectronics STM32H7 reference

Ethernet

  • LAN8742 - Ethernet PHY
  • Interface: RMII (Reduced Media Independent Interface)
  • Link Speed: 10/100 Mbps auto-negotiation

Sensors

Sensor

Model

Protocol

Note

GPS

GY-NEO6MV2 (NEO-6M)

UART 9600

Default NMEA config

IMU

Reference design TBD

I2C/SPI

Dual IMU planned

pH

DFRobot SEN0161

ADC Analog

40-sample averaging

Load Cell

Application specific

ADC

Dual cells (×2)

Pressure

Application specific

ADC/I2C

Dual sensors (×2)

Development Workflow

Building Firmware

// Build for sensor_board
pio run -e sensor_board

// Upload to board
pio run -e sensor_board --target upload

// Monitor serial output
pio device monitor -b 115200 -p COM4

Development Cycle

// 1. Edit source code
// 2. Build
pio run -e sensor_board

// 3. Upload
pio run -e sensor_board --target upload

// 4. Monitor
pio device monitor

// 5. Run tests
pio test -e sensor_board

Useful Commands

PlatformIO CLI

// List available boards
pio boards

// Show board info
pio boards nucleo_h753zi

// Clean build
pio run -e sensor_board --target clean

// Full rebuild
pio run -e sensor_board --target clean --target upload

Troubleshooting Guide

Serial Monitor No Output

  1. Check USB connection
  2. Verify COM port in platformio.ini
  3. Check baud rate (115200)
  4. Verify UART initialization succeeded

Sensor Shows IDLE

  1. Check physical connection (UART/I2C/SPI)
  2. Verify baud rate (for UART sensors)
  3. Check pull-up resistors (for I2C)
  4. Verify device address (for I2C/SPI)

Network Packets Not Received

  1. Check IP address configuration
  2. Verify MAC address filtering
  3. Check firewall settings
  4. Verify UDP port 7 not blocked

Low Heap Warning

  1. Check for memory leaks in sensor drivers
  2. Reduce buffer sizes
  3. Verify UDP queue sizes
  4. Check for recursive allocations

Quick Reference Checklist

Before Deployment

  • All sensors connected and responding
  • Network IP/MAC configured correctly
  • Calibration parameters set for pH/load cells
  • Serial monitor showing sensor data
  • Heap usage monitored (>8KB free)
  • UDP packets reaching destination
  • Protobuf encoding verified

Monitoring in Production

  • Check sensor status codes
  • Monitor heap usage trend
  • Verify data ranges match expectations
  • Track error rates per sensor
  • Review network packet statistics

Hope you had fun☮️

END OF DOCUMENTATION FOR SESOR BOARD☮️

Last Updated: April 14, 2026