Home › Forums › Mayfly Data Logger › Low Cost EC sensor Station upgrade › Reply To: Low Cost EC sensor Station upgrade
2020-05-12 at 12:06 PM
#14156
Thanks Chuck for getting my Sensorex RTD voltage divider output converted to °C. I plan to leave the EC as the raw value from the AtlasScientific EZO circuit. Attached is the code addition to DRWI_CitSci.ino to get the Sensorex probe data published to MonMW:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
//================================================== // Atlas Scientific EZO //============================================= #include <sensors/AtlasScientificEC.h> //create EZO Object AtlasScientificEC atlasEC(22, 0x64, 5); // ========================================================================== // calculate temperature from RTD voltage divider // ========================================================================== #include <sensors/ExternalVoltage.h> const int8_t ADSPower = sensorPowerPin; // Pin to switch power on and off (-1 if unconnected) const int8_t ADSChannel = 2; // The ADS channel of interest const float dividerGain =1; // Default 1/gain for grove voltage divider is 10x // const uint8_t ADSi2c_addr = 0x48; // The I2C address of the ADS1115 ADC const uint8_t VoltReadsToAvg = 1; // Only read one sample //float testVar = 2.123; // Create an External Voltage sensor object ExternalVoltage extvolt(ADSPower, ADSChannel, dividerGain, 0x48, VoltReadsToAvg); ExternalVoltage_Volt sensorVoltage(&extvolt); // Linear correction coeficients of RTD with 10K ohm voltage divider const float TemperatureMultipiler = -30.141; //m, Sensorex RTD const float TemperatureConstant = 75.359; //b, Sensorex RTD // Create a function to calculate centigrade from the voltage float calcTemp(void) { float voltage = sensorVoltage.getValue(true); return voltage = TemperatureMultipiler * voltage + TemperatureConstant; } // ========================================================================== // Creating the Variable Array[s] and Filling with Variable Objects // ========================================================================== Variable *variableList[] = { new MaximDS3231_Temp(&ds3231), new ProcessorStats_Battery(&mcuBoard), new Modem_RSSI(&modem), new Variable(calcTemp, 1, "temperature", "Degree Celsius", "waterTemp",""), new AtlasScientificEC_Cond(&atlasEC), // new Modem_SignalPercent(&modem), }; |