Turn on the Smart Water Board and reads the Conductivity sensor printing the result through the USB.
Required Materials
1 x Waspmote
1 x Battery
1 x Smart Water Sensor Board
1 x Conductivity Sensor
1 x Conductivity Sensor Kit
Notes
- The calibration values selected in the code are an example for a specific sensor, each unit will require its own calibration parameters. Other conductivity solutions of the kit can be used, depending on the target environment conductivity.
- Calibration can be replaced by the theoretical approximation when calling function conductivityConversion at the expense of a loose of accuracy. Take a look at section “API” of the Smart Water Technical Guide for more information.
- This example is valid for Waspmote v12 and Waspmote v15.
Code
/* * ------ [SW_05] - Conductivity sensor Reading for Smart Water-------- * * Explanation: Turn on the Smart Water Board and reads the Dissolved Oxygen * sensor printing the result through the USB * * Copyright (C) 2016 Libelium Comunicaciones Distribuidas S.L. * http://www.libelium.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * Version: 3.0 * Design: David Gascón * Implementation: Ahmad Saad */#include<WaspSensorSW.h>float ECRes;float ECValue;// Value 1 used to calibrate the sensor#definepoint1_cond10500// Value 2 used to calibrate the sensor#definepoint2_cond40000// Point 1 of the calibration #definepoint1_cal197.00// Point 2 of the calibration #definepoint2_cal150.00conductivityClass ConductivitySensor;voidsetup(){ USB.ON();USB.println(F("EC example for Smart Water..."));// Configure the calibration parametersConductivitySensor.setCalibrationPoints(point1_cond, point1_cal, point2_cond, point2_cal); ///////////////////////////////////////////// 1. Turn ON the Smart Water sensor board /////////////////////////////////////////// Water.ON(); }voidloop(){ ///////////////////////////////////////////// 2. read the sensors ///////////////////////////////////////////// Reading of the Conductivity sensor ECRes =ConductivitySensor.readConductivity();// Conversion from resistance into us/cm ECValue =ConductivitySensor.conductivityConversion(ECRes); ///////////////////////////////////////////// 3. Print the output values ///////////////////////////////////////////// Print of the resultsUSB.print(F("Conductivity Output Resistance: "));USB.print(ECRes);// Print of the resultsUSB.print(F(" Conductivity of the solution (uS/cm): "));USB.println(ECValue); }
Output
H#
Conductivity Output Resistance: 776.4951171875 | Conductivity of the solution (mS/cm): 1587.4520263671