Skip to main content

Reference

CheckoutSource code references, build configuration, hardware datasheet pointers, useful commands and the embeddedpre-deployment simplifiedchecklist. from ERC

Source Code References

If you made it till here, you a true G.☮️

Also,

Source thisCode was rather useful, check this out... ERC Embedded Simplified OfficialReferences

Main Application

File

Purpose

src/sensor_board/main.c

Main entry pointpoint, andMainTask, sensor looploop, packet handlers

Sensor and Actuator Drivers

Component

Location

IMU

components/sensor_board/imu/imu_sensor.h / .c

pH

components/sensor_board/ph/ph_sensor.h / .c

Load Cell (HX711)

components/sensor_board/load_cell/load_cell_sensor.h / .c

Pressure (FSR)

components/sensor_board/pressure/pressure_sensor.h / .c

Flow Sensor

components/sensor_board/sampling/flow_sensor/flow_sensor.h / .c

Pump

components/sensor_board/sampling/pump/pump.h / .c

Utilities

components/sensor_board/sensor_basics/sensor_basics.h / .c

Shared Components

SensorComponent

Header

SourceLocation

GPSNetworking (LwIP glue, UDP)

components/sensor_board/gps/gps_sensor.h

gps_sensor.ccommon/networking/

IMUNetwork addresses and port

components/sensor_board/imu/imu_sensor.common/networking_constants/ip_mac_constants.h

imu_sensor.c

pHPacket dispatcher

components/sensor_board/ph/ph_sensor.h

ph_sensor.ccommon/packet_dispatcher/

LoadProtobuf Cellencode/decode helpers

components/sensor_board/load_cell/load_cell_sensor.h

load_cell_sensor.ccommon/pb_message/

PressureResult codes and TRY macro

components/sensor_board/pressure/pressure_sensor.h

pressure_sensor.ccommon/result/

UtilitiesLogging

components/sensor_board/sensor_basics/sensor_basics.h

sensor_basics.ccommon/logging/

Protobuf Definitions

Message definitions (PBEnvelope, SensorBoardPHInfo, SensorBoardIMUInfo, SensorBoardLoadCellInfo, SensorBoardPressureInfo, SensorBoardFlowSensorInfo, SensorBoardPumpInfo, SensorBoardDiagnostics) live in the For detailed protobuf message format documentation, see:ERC-Protobufs git submodule and are compiled to C by nanopb during the PlatformIO build. If the build cannot find the .pb.h headers, initialize the submodule:Sensor Board Protobuf

ERC-Protobufs/components/sensor_board/git ├──submodule diagnostics.protoupdate --init 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)ERC-Protobufs

Build Configuration

File

Purpose

platformio.ini

Build configuration for all boards (env:sensor_board for this one)

.mxprojectcomponents/sensor_board/firmware/firmware.ioc

STM32CubeMX CubeMXdevice configuration

firmware.ioccomponents/sensor_board/STM32H753XX_FLASH.ld

CubeMXLinker IOC file (device config)script

TestDevelopment ReferencesWorkflow

TestUseful SuitesCommands (PlatformIO CLI)

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

Running Tests

//# Build allthe sensor board firmware
pio run -e sensor_board

# Flash to the Nucleo board
pio run -e sensor_board -t upload

# Serial monitor (115200 baud)
pio device monitor -b 115200

# Run the unit tests
pio test -e sensor_board
//

Development RunCycle

  1. Change peripherals in CubeMX (firmware.ioc), regenerate with verboseKeep outputUser pioCode
  2. Implement testor -eupdate sensor_boardthe -vdriver //in components/sensor_board/
  3. Build onlyand (norun run)unit piotests teston -ethe sensor_boardhost
  4. Flash, --no-runwatch the serial log, verify the per-sensor status lines
  5. Enable sendUDP and verify packets on the network

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

SensorDevice

Model

Protocol

Note

GPSMicrocontroller

GY-NEO6MV2STM32H753ZI (NEO-6M)NUCLEO-H753ZI)

UART 9600n/a

DefaultARM NMEACortex-M7, config480 MHz capable (running at 64 MHz), 2 MB Flash; ST STM32H7 reference manual

Ethernet PHY

LAN8742

RMII

10/100 Mbps auto-negotiation

pH

DFRobot SEN0161

Analog ADC

40-sample averaging, 5 V board (scale output below 3.3 V)

IMU

Reference design TBD

I2C/SPII2C1 (PB8/PB9)

DualPoll IMUfunction planned

pH

DFRobotis SEN0161

ADCa Analog

40-sample averagingplaceholder

Load Cell

Application specific

ADC

Dual cellsHX711 (×2)

GPIO bit-bang

24-bit, channel A gain 128

Pressure

ApplicationFSR specificpads (×2)

ADC/I2CAnalog ADC

DualCompile sensorsgated, needs ADC in CubeMX

Flow

FM-PS2216

GPIO EXTI pulses

40 to 150 ml/min, 5.5 pulses/ml

Pump

Grothen 12 V DC mini peristaltic

PWM (×2)TIM3 CH3)

Single MOSFET, unidirectional, open loop

DevelopmentNetwork WorkflowQuick Reference

Building

Item

Value

Board 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 rateIP

192.168.0.111 (115200)

Verifystatic, UARTno initialization succeeded

Sensor Shows IDLE

  1. Check physical connectionDHCP)

Destination (UART/I2C/SPI)

Verifysample baud rate (for UART sensors)Check pull-up resistors (for I2C)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 board)

192.168.0.222

UDP port

1500

Netmask 7/ notGateway

255.255.255.0 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
192.168.0.1

Quick Reference Checklist

Before Deployment

  • ERC-Protobufs submodule initialized, firmware builds clean
  • All connected sensors connectedresponding and(OPERATING responding| OK in the log)
  • Network IP/MAC configured correctlyand sendUDP enabled
  • Calibration parameters set for pH/pH (offset/slope) and load cells (tare/scale)
  • Serial monitor showing sensor data at 115200 baud
  • Heap usage monitoredhealthy (>8KBwell free)above the 4096 byte critical threshold)
  • UDP packets reaching destination
  • Protobuf192.168.0.222:1500 encodingand verifieddecoding as PBEnvelope

Monitoring in Production

  • CheckWatch per-sensor state/status codes in the log lines
  • Monitor the free heap usagetrend trendprinted each loop
  • Verify data ranges match expectations (pH 0-14, flow below 150 ml/min)
  • Track error rates per sensor
  • Review networkand packetpump/flow statisticscross-check warnings

Hope you had fun☮fun.☮ End of documentation for the Sensor Board.

ENDMay OFThe DOCUMENTATIONForce FORBe SESORWith BOARD☮️You or Live Long and Prosper, depending on what you like.... but remember the Dark Side always has cooler toys

Last Updated: April 14, 2026