From 8f08db4d4b45696e9ebf8a2f55c3a1e943171d57 Mon Sep 17 00:00:00 2001 From: mboyer85 Date: Wed, 27 Jan 2016 18:23:09 +0100 Subject: [PATCH 1/4] Adding Water Quality For pool/aquarium water management --- libraries/MySensors/core/MyMessage.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libraries/MySensors/core/MyMessage.h b/libraries/MySensors/core/MyMessage.h index 2d7b96f..09839d7 100644 --- a/libraries/MySensors/core/MyMessage.h +++ b/libraries/MySensors/core/MyMessage.h @@ -92,6 +92,7 @@ typedef enum { S_INFO, // LCD text device / Simple information device on controller, V_TEXT S_GAS, // Gas meter, V_FLOW, V_VOLUME S_GPS, // GPS Sensor, V_POSITION + S_WATER_QUALITY,// V_TEMP, V_PH, V_ORP, V_EC, V_STATUS } mysensor_sensor; /// @brief Type of sensor data (for set/req/ack messages) @@ -154,6 +155,9 @@ typedef enum { V_CUSTOM, // Custom messages used for controller/inter node specific commands, preferably using S_CUSTOM device type. V_POSITION, // GPS position and altitude. Payload: latitude;longitude;altitude(m). E.g. "55.722526;13.017972;18" V_IR_RECORD // Record IR codes S_IR for playback + V_PH, // S_WATER_QUALITY, water PH + V_ORP, // S_WATER_QUALITY, water ORP : redox potential in mV + V_EC,// S_WATER_QUALITY, water electric conductivity μS/cm (microSiemens/cm) } mysensor_data; @@ -336,4 +340,4 @@ uint8_t array[HEADER_SIZE + MAX_PAYLOAD + 1]; #endif #endif -/** @}*/ \ No newline at end of file +/** @}*/ From 9fc81a327df3842879aa44ae737db18a82719692 Mon Sep 17 00:00:00 2001 From: mboyer85 Date: Wed, 27 Jan 2016 18:27:55 +0100 Subject: [PATCH 2/4] Adding water quality management --- libraries/MySensors/core/MyMessage.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/MySensors/core/MyMessage.h b/libraries/MySensors/core/MyMessage.h index 09839d7..8a68c56 100644 --- a/libraries/MySensors/core/MyMessage.h +++ b/libraries/MySensors/core/MyMessage.h @@ -154,7 +154,7 @@ typedef enum { V_TEXT, // S_INFO. Text message to display on LCD or controller device V_CUSTOM, // Custom messages used for controller/inter node specific commands, preferably using S_CUSTOM device type. V_POSITION, // GPS position and altitude. Payload: latitude;longitude;altitude(m). E.g. "55.722526;13.017972;18" - V_IR_RECORD // Record IR codes S_IR for playback + V_IR_RECORD, // Record IR codes S_IR for playback V_PH, // S_WATER_QUALITY, water PH V_ORP, // S_WATER_QUALITY, water ORP : redox potential in mV V_EC,// S_WATER_QUALITY, water electric conductivity μS/cm (microSiemens/cm) From 6aa1fb6e886dc075601c6cf57f72c8ae623b23f2 Mon Sep 17 00:00:00 2001 From: mboyer85 Date: Wed, 27 Jan 2016 19:25:04 +0100 Subject: [PATCH 3/4] Adding water quality management PHSensor example --- libraries/MySensors/examples/PHSensor.ino | 79 +++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 libraries/MySensors/examples/PHSensor.ino diff --git a/libraries/MySensors/examples/PHSensor.ino b/libraries/MySensors/examples/PHSensor.ino new file mode 100644 index 0000000..9e7a6c6 --- /dev/null +++ b/libraries/MySensors/examples/PHSensor.ino @@ -0,0 +1,79 @@ +/** + The MySensors Arduino library handles the wireless radio link and protocol + between your home built sensors/actuators and HA controller of choice. + The sensors forms a self healing radio network with optional repeaters. Each + repeater and gateway builds a routing tables in EEPROM which keeps track of the + network topology allowing messages to be routed to nodes. + + Created by mboyer85 + Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors + + Documentation: http://www.mysensors.org + Support Forum: http://forum.mysensors.org + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + version 2 as published by the Free Software Foundation. + + ******************************* + + DESCRIPTION + + Example sketch showing how to send PH readings back to the controller +*/ + +// Enable debug prints to serial monitor +//#define MY_DEBUG + +// Enable and select radio type attached +#define MY_RADIO_NRF24 +//#define MY_RADIO_RFM69 + +#include +#include + +#define COMPARE_PH 1 // Send PH only if changed? 1 = Yes 0 = No + +unsigned long SLEEP_TIME = 60000; // Sleep time between reads (in milliseconds) +float lastPH; +boolean receivedConfig = false; +boolean metric = true; +// Initialize PH message +MyMessage msg(0, V_PH); + +void setup() +{ + //Setup your PH sensor here (I2C,Serial,Phidget...) +} + +float getPH() { + //query your PH sensor here (I2C,Serial,Phidget...) + float dummy = 7; + return dummy; +} + +void presentation() { + // Send the sketch version information to the gateway and Controller + sendSketchInfo("PH Sensor", "1.1"); + present(0, S_WATER_QUALITY); + +} + +void loop() +{ + float ph = getPH(); + +#if COMPARE_PH == 1 + if (lastPH != ph) { +#endif + + // Send in the new PH value + send(msg.set(ph, 1)); + // Save new PH value for next compare + lastPH = ph; + +#if COMPARE_PH == 1 + } +#endif + sleep(SLEEP_TIME); +} From b6de017bb64292ee2a95f10ca303e3a66d677aba Mon Sep 17 00:00:00 2001 From: mboyer85 Date: Wed, 27 Jan 2016 19:26:07 +0100 Subject: [PATCH 4/4] Rename libraries/MySensors/examples/PHSensor.ino to libraries/MySensors/examples/PHSensor/PHSensor.ino --- libraries/MySensors/examples/{ => PHSensor}/PHSensor.ino | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename libraries/MySensors/examples/{ => PHSensor}/PHSensor.ino (100%) diff --git a/libraries/MySensors/examples/PHSensor.ino b/libraries/MySensors/examples/PHSensor/PHSensor.ino similarity index 100% rename from libraries/MySensors/examples/PHSensor.ino rename to libraries/MySensors/examples/PHSensor/PHSensor.ino