Battery voltage monitoring uses a resistor divider network connected to pin A2, scaling the 12-volt battery voltage down to the Arduino's 5-volt maximum analog input range. The divider ratio was calibrated by connecting a precision multimeter across the battery terminals while simultaneously reading the Arduino's ADC value, yielding a conversion factor. At 12.0 volts battery voltage, the ADC measured 2.53 volts, giving a ratio of 12.0/2.53 = 4.743. An additional system correction factor of 0.55846 accounts for voltage drop in the wiring between the battery and the Arduino's voltage sense point, yielding a final conversion of Vbattery = Vadc × 4.743 × 0.55846.
Because battery voltage can fluctuate rapidly due to load changes—particularly when the diesel starter motor operates, drawing perhaps 200 amperes momentarily—the measured voltage passes through an exponential moving average filter with a 45-second time constant. This filter smooths out transient variations while still tracking genuine battery discharge over the hours-long duration of a fire event. The filter implements a simple recursive equation: Vfiltered(new) = Vfiltered(old) + α × (Vmeasured - Vfiltered(old)) where α = dt/τ, dt is the time since the last update, and τ is the 45-second time constant. This means that after 45 seconds, approximately 63% of a step change in actual battery voltage will have propagated through to the filtered output, providing good noise rejection while maintaining adequate tracking of real battery state changes.
The system includes two pump pressure sensors fitted to the pump water and oil reservoirs respectively, that are required for the pump control module. Their binary output (On or OFF) is also read by AR2 to provide assurance that the diesel pump is operating on or off as expected. The oil pressure switch, normally open, closes when oil pressure exceeds a threshold indicating that the diesel engine is running. This switch connects through a PC817 optocoupler to digital pin 10 on AR2. The optocoupler provides electrical isolation between the pump controller's circuits and the Arduino, preventing ground loops or voltage transients from damaging the Arduino. When oil pressure is present, current flows through the optocoupler's LED, causing its phototransistor to conduct and pulling the Arduino input pin low. When oil pressure is absent, no LED current flows, the phototransistor remains off, and the Arduino's internal pullup resistor pulls the pin high. The code interprets LOW as oil pressure okay (engine running) and HIGH as oil pressure absent (engine stopped or failed).
The water pressure sensor provides a second pump health indicator. This transducer's signal processing circuit includes a test point that sits at approximately zero volts when the pump is running and building pressure, and rises to 1-3 volts when the pump is idle or failing to build pressure despite the engine running. AR2 connects to this test point through a high-impedance connection at analog pin A1, reading the voltage directly without disturbing the pump controller's operation.
NB - For more detail on the physical specifications of the sensors see earlier
These two measurements together — oil pressure confirming the engine operates, water pressure confirming hydraulic function—provide - provide helpful pump health monitoring that can detect both mechanical failures and hydraulic problems.
<< Sensors | | Coding >> |Table of Contents>
