From 1f64807b98b942464711d1e55f8d8a4b8cd2b938 Mon Sep 17 00:00:00 2001 From: Jan Grewe <jan@faked.org> Date: Wed, 15 Dec 2021 10:11:04 +0100 Subject: [PATCH] add README --- .gitignore | 1 + README.md | 19 +++++++++++++++++++ src/main.cpp | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 README.md diff --git a/.gitignore b/.gitignore index 89cc49c..7e3e834 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ .vscode/c_cpp_properties.json .vscode/launch.json .vscode/ipch +/.vscode/settings.json diff --git a/README.md b/README.md new file mode 100644 index 0000000..05665e1 --- /dev/null +++ b/README.md @@ -0,0 +1,19 @@ +# PH-260BD + +## Description +This PlatformIO project allows you to get the pH, EC and temperature values from the cheap online water quality monitor PH-260BD + +## Usage +Open this project in PlatformIO and write it to an ESP32. No further hardware or wiring needed. +You'll get the values from the PH-260BD, which it sends every second, written to the serial monitor every 5 seconds. + +## Hints +* The EC values are calculated based on the currently selected display unit, because that's what the PH-260BD sends. +* The PH-260BD uses the factor `700` for `mS` <-> `ppm` calculation, which seems to be the standard in the Australian (and most likely Asian) part of the world. +* You can change that factor at the top of the code to `500` (US) or `640` (EU), but that will of course only affect the calculated values, not the display on the PH-260BD. +* The most accurate units to chose on the display for the calculation are probably `uS` and `ppm`. +* The calculated values are properly rounded as expected. +* The temperature value is truncated when the device is set to display `ppt`, which is why it's ignored from that data packet (but taken from `pH`). + +## Credits +* [Bo Jeanes](https://bjeanes.com/), for his [ESPHome implementation](https://gist.github.com/bjeanes/4310d30393a093bc2f1f2bd113fa820bm) of this (which i read less than i really should have) \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 02c27c7..f0cff78 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -44,7 +44,7 @@ void bleDataCallback(const char *match, } else if (unit == "uS") { - sensorData->put("ec_ms", value.toFloat() / 1000); + sensorData->put("ec_ms", (double) value.toFloat() / 1000); sensorData->put("ec_us", value.toFloat()); sensorData->put("ec_ppm", value.toFloat() / 1000 * factorMsToPpm); sensorData->put("ec_ppt", value.toFloat() / 1000 * factorMsToPpm / 1000); -- GitLab