Arduino based grove ORP prometheus exporter, that can be easily integrated into home assistant. It allows you to remotely measure the ORP value of your pool or hot tub, providing a good indicator of water quality. See what is orp in water testing for further details.
This project provides a simple to assemble ORP (Oxidation Reduction Potential) monitoring system. It has four main design principles:
- Be easy to assemble - no soldering, no drilling.
- Be 'not too expensive' - be cheaper than many of the commercial smart ORP monitoring systems.
- Expose reading as a HTTP interface - so it can be easily interfaced with different platforms (e.g. home assistant, grafana)
- Be 'safe' next to the hot tub - In my case it'll be in a rattan storage unit next to the hot tub, so the case I've used is IP56, which isn't waterproof but is sealed. Depending on your specific setup, you might want to pick a different enclosure that is waterproof (IP68).
At it's heart it uses a Grove ORP sensor kit.
See CONSTRUCTION for assembly instructions.
The board used is a Seeeduino Lotus Cortex-M0+. Follow the board setup instructions on the page to configure the board in the Arduino environment.
The Wifi shield used is a Wifi Shield V2.0. Follow the setup instructions on the page and download the Wifly library to your Arduino library manager.
Upload the sketch to the board, enssuring you've amended:
#define SSID "YOUR_AP"
#define KEY "YOUR_PASSWORD"
At this point, it should successully associate with the Wifi and you should be able to see the board output on the 'Serial Monitor'.
The Grove ORP sensor kit outlines how to calibrate the sensor and calculate the probe offset. To note, hold and press the black button to get a consistent offset value. Once you have the probe offset, add this to the configuration in the Arduino Sketch:
#define OFFSET -42 //add your value here
You can then use callibration solution to check the sensor is measuring accurately.
The software exposes three endpoints:
Endpoint | Usage |
---|---|
/metrics |
Exposes the ORP reading in prometheus exporter format |
/enable |
Enables readings to be taken (default) |
/disable |
Disables readings, causing the /metrics endpoint to 404 |
This endpoint returns metrics that can be integrated into Grafana:
# HELP orp_sensor_value_mv Returns the sensor value from the ORP sensor in mV
# TYPE orp_sensor_value_mv gauge
orp_sensor_value_mv 215.83
# HELP orp_sensor_free_memory Returns the board free memory in Kb
# TYPE orp_sensor_free_memory gauge
orp_sensor_free_memory 24607
# HELP orp_sensor_wifi_associations Returns the number of times the wifi has reassociated
# TYPE orp_sensor_wifi_associations gauge
orp_sensor_wifi_associations 0
# HELP orp_sensor_crashes Returns the number of times the board has crashed
# TYPE orp_sensor_crashes gauge
orp_sensor_crashes 1
# HELP orp_sensor_uptime Returns the board uptime in seconds
# TYPE orp_sensor_uptime gauge
orp_sensor_uptime 3867
# UPTIME (DD:HH:MM:SS) 00:01:04:27
These endpoints can be used to stop the ORP sensor from taking readings and cause the /metrics
endpoint to return a 404 when set to disabled. This can be used in an automation to stop readings if the probe is removed from the water (e.g. if the Hot Tub is turned on).
The ORP reading can be easily integrated into home assistant using a REST sensor:
sensor:
- platform: rest
resource: http://YOURSENSORIPADDRESS/metrics
name: hottub_orp
unit_of_measurement: "mV"
timeout: 5
value_template: '{{ value | regex_findall_index("orp_sensor_value_mv (\d+.\d+)\n") }}'
- The wifi shield does crash from time to time, but is recovered in the sketch.
- It should be trivial to add a Grove PH sensor.