Development v12

Warning - Product Update

All the resources present on this section belong to Waspmote v12, Waspmote Plug & Sense! v12 and Meshlium v3.8.

If you have a Waspmote v15, Waspmote Plug & Sense! v15 or Meshlium v4.0 please go to the new Development Section.

Check what is your version and what are the differences between the old and the new one in this document.

» SW 05: Conductivity Sensor

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
#define point1_cond 10500
// Value 2 used to calibrate the sensor
#define point2_cond 40000

// Point 1 of the calibration 
#define point1_cal 197.00
// Point 2 of the calibration 
#define point2_cal 150.00

conductivityClass ConductivitySensor;



void setup()
{ 
  USB.ON();
  USB.println(F("EC example for Smart Water..."));
  
  // Configure the calibration parameters
  ConductivitySensor.setCalibrationPoints(point1_cond, point1_cal, point2_cond, point2_cal);

  ///////////////////////////////////////////
  // 1. Turn ON the Smart Water sensor board 
  ///////////////////////////////////////////  
  Water.ON(); 
}

void loop()
{
  ///////////////////////////////////////////
  // 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 results
  USB.print(F("Conductivity Output Resistance: "));
  USB.print(ECRes);
  
  // Print of the results
  USB.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

Quick Publish: