What follows is a summary of how some of the key sensor and control functions are coded in the Arduino sketches constructed for Arduinos AR1, AR2 and AR3.

Further information can be found in the Coding Technical Appendix

In order to develop and test coding whilst the system was actually deployed a small module of 3 Arduinos "TestSys" was constructed, where in lieu of relays LEDs were turned on and off. The communication system was the same as in the production system, and a separate Raspberry Pi, actually installed for other purposes at home, was used to provide Home Assistant connectivity. Sketches were made aware of which system they were operating by the simple expedient of grounding one Arduino pin.

TestSys

The TestSys module for code development

It is Arduino AR2 in Module 3 which is responsible for processing sensor inputs as they arrive. The sensor processing pipeline runs at 10 hertz in AR2's main loop. Each iteration begins by requesting temperature conversions from all three DS18B20 sensors via the Dallas library, a blocking operation that takes approximately 750 milliseconds at 12-bit resolution.

While the sensors convert, AR2 performs other tasks: reading the water level analog voltage, sampling the battery voltage analog input, reading the oil pressure digital state, and reading the water pressure analog voltage.

When temperature conversions complete, AR2 retrieves all three values and validates them against the acceptable range, substituting defaults if any sensor has failed.

<< Sensors cont | | Coding cont >>      |Table of Contents>


Page last modified on February 17, 2026, at 03:50 am