Comment on page
Board configuration and programming
The Plug & Sense! Smart Water Xtreme model does not require special handling of the hardware by the user, except for placing the sensors in their corresponding socket. In the previous sections each sensor connection has been described.
It is important to remark that Smart Water Xtreme model is only available in the Waspmote Plug & Sense! Line. It is not available for Waspmote OEM line.
When using the Plug & Sense! Smart Water Xtreme model, remember that it is mandatory to include the
WaspSensorXtr
library by introducing the next line at the beginning:#include <WaspSensorXtr.h>
The library manages the power supply and communication lines between Waspmote and the sockets. Prior to read the sensor probes, the user must declare an object of the corresponding sensor class, specifying the socket where the sensor is placed. The next table enumerates each sensor class.
Sensor probe | Sensor class |
Optical dissolved oxygen and temperature OPTOD | Aqualabo_OPTOD |
pH, ORP and temperature PHEHT | Aqualabo_PHEHT |
Conductivity, salinity and temperature C4E | Aqualabo_C4E |
Turbidity and temperature NTU | Aqualabo_NTU |
Inductive conductivity, salinity and temperature CTZN | Aqualabo_CTZN |
Suspended solids, turbidity, sludge blanket and temperature MES5 | Aqualabo_MES5 |
Manta | Eureka_Manta |
Radar level VEGAPULS C21 sensor | VegaPuls_C21 |
Each sensor class manages the Smart Water Xtreme sensor board according to its needs, so there is no need to turn on or off the whole board, as is often needed with other Libelium sensor boards. After declaring the object, the sensor can be turned on or off independently from each other. Incidentally, do not forget turning off the sensors to save battery when they are no longer needed.
The next snippet shows how to declare an object for the sensor PHEHT and then how to turn on, read and turn off the sensor:
{
// 1. Declare an object for the sensor
Aqualabo_PHEHT mySensor(XTR_SOCKET_C);
// 2. Turn ON the sensor
mySensor.ON();
// 3. Read the sensor. Values stored in class variables
// Check complete code example for details
mySensor.read();
// 4. Turn off the sensor
mySensor.OFF();
}
The
read()
function stores the sensor values in a public object. It does not return the values directly. The user can refer to the dedicated sensor example to see how the sensor values can be accessed. In the case of the PHEHT sensor, values will be printed by USB with the following snippet.{
// 4. Print information
USB.println(F(\"PHEHT\"));
USB.print(F(\"Temperature: \"));
USB.printFloat(mySensor.sensorPHEHT.temperature, 2);
USB.println(F(\" degrees Celsius\"));
USB.print(F(\"pH: \"));
USB.printFloat(mySensor.sensorPHEHT.pH, 2);
USB.println();
USB.print(F(\"pH: \"));
USB.printFloat(mySensor.sensorPHEHT.pHMV, 2);
USB.println(F(\" mV\"));
USB.print(F(\"Redox: \"));
USB.printFloat(mySensor.sensorPHEHT.redox, 2);
USB.println(F(\" mV\"));
}
The Temperature, humidity and pressure, the Ultrasound and the Luminosity sensors have their own reading functions in contrast to the rest of the Smart Water Xtreme sensors. This is due to these sensors can be used in other Plug & Sense! models and they share the same functions into the Waspmote API. Refer to the dedicated sensor example for further details.
Owing to the large amount of parameters that can be read by the Plug & Sense! Smart Water Xtreme model, a special frame type must be used with the Frame class in order to send the values correctly.
{
// It is mandatory to specify the Smart Water Xtreme type
frame.setFrameType(INFORMATION_FRAME_WTR_XTR);
}
A complete example code for using the frame class can be found in the following link:
Refer to the Data Frame Guide for more information:
Last modified 3yr ago