Turn on the Smart Water Ions Sensor Board and reads the Ions sensor connected in the SOCKET4 printing the result through the USB. In this case we are going to measure Chloride Ion, but all Ions can be connected in the four available sockets.
Required Materials
1 x Waspmote
1 x Battery
1 x Smart Water Ions Sensor Board
1 x Chloride Sensor Probe
1 x Single Junction Reference Probe
1 x Chloride Calibration Kit (for those sensors which require calibration)
Notes
- The Chloride Sensor Probe must be used with the Double Junction Reference Probe.
- The Chloride Sensor, can be connected in any of the four available sockets.
- The calibration process of the ions sensors is described in the technical guide.
- It advisable to measure the temperature of the calibration solution.
- This example can be executed in Waspmote v12 and Waspmote v15.
Code
/* * ------ [SWI_06] - SOCKET4 reading for Smart Water Ions-------- * * Explanation: Turn on the Smart Water Ions Sensor Board and reads the Ions sensor * connected in the SOCKET4 printing the result through the USB * In this case we are going to measure Chloride Ion, but all Ions * can be connected in the four available sockets * * 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<smartWaterIons.h>// Connect the Chloride Sensor in the SOCKET4// All Ion sensors can be connected in the four socketssocket4Class ChlorideSensor;// Calibration concentrations solutions used in the process#definepoint110.0#definepoint2100.0#definepoint31000.0// Calibration Voltage values#definepoint1_volt_Cl3.115#definepoint2_volt_Cl2.834#definepoint3_volt_Cl2.557// Define the number of calibration points#definenumPoints3float calConcentrations[]= {point1, point2, point3};float calVoltages[]= {point1_volt_Cl, point2_volt_Cl, point3_volt_Cl}; voidsetup(){// Turn ON the Smart Water Ions Board and USBSWIonsBoard.ON();USB.ON(); // Calculate the slope and the intersection of the logarithmic functionChlorideSensor.setCalibrationPoints(calVoltages, calConcentrations, numPoints);}voidloop(){// Reading of the Chloride sensorfloat chlorideVoltage =ChlorideSensor.read();// Print of the resultsUSB.print(F(" Chloride Voltage: "));USB.print(chlorideVoltage);USB.print(F("volts |"));float concentration =ChlorideSensor.calculateConcentration(chlorideVoltage);USB.print(F(" Chloride concentration Estimated: "));USB.print(concentration);USB.println(F(" ppm / mg * L-1"));delay(1000); }