Turn on the Smart Water Ions Sensor Board and reads the pH sensor extracting the value from the calibration values and temperature compensation
Required Materials
1 x Waspmote
1 x Battery
1 x Smart Water Ions Sensor Board
1 x Reference Probe
1 x pH Sensor Probe (for Smart Water Ions)
1 x pH Calibration Kit (for those sensors which require calibration)
1 x PT1000 temperature sensor (for temperature compensation)
Notes
- The pH Sensor Probe for Smart Water Ions can not be used with the Smart Water Board.
- The pH Sensor can be used with both references probes (Single and Double).
- Calibration process of the pH sensor is described in the Smart Water Board technical guide.
- This example can be executed in Waspmote v12 and Waspmote v15.
Code
/* * ------ [SWI_02] - pH sensor Reading for Smart Water Ions -------- * * Explanation: Turn on the Smart Water Board and reads the pH sensor * extracting the value from the calibration values and temperature * compensation * * 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>// Calibration values#definecal_point_101.405#definecal_point_72.048#definecal_point_42.687// Temperature at which calibration was carried out#definecal_temp25.0socket1Class pHSensor; //<------ Define the connection SOCKETpt1000Class temperatureSensor;voidsetup(){// Configure the calibration pointspHSensor.setpHCalibrationPoints(cal_point_10, cal_point_7, cal_point_4, cal_temp);// Turn ON the Smart Water Ions Sensor Board and start the USBSWIonsBoard.ON(); USB.ON();}voidloop(){// Read the pH sensorfloat pHVoltage =pHSensor.read();// Read the temperature sensorfloat temperature =temperatureSensor.read();// Print the output valuesUSB.print(F("pH value: "));USB.print(pHVoltage);USB.print(F("volts | ")); USB.print(F(" temperature: "));USB.print(temperature);USB.print(F("degrees | ")); // Convert the value read with the information obtained in calibrationfloat pHValue =pHSensor.pHConversion(pHVoltage, temperature);USB.print(F(" pH Estimated: "));USB.println(pHValue);}