Board configuration and programming
Last updated
Last updated
The Smart Water Ions Sensor Board does not require any other manipulation than the sensor connection to its corresponding socket. There are two kinds of connectors on the Smart Water Ions Sensor Board:
First of all, the temperature sensor is connected through two ways PTSM connectors, which allow to easily assemble the wire by pressing it into the pin. To remove the wires press the slot above the input pin while pulling off the wire softly.
Secondly, SMA-RP connectors have been used for the other four kinds of sensors. Since the sensors are supplied with a BNC connector, it is necessary to connect a pigtail in between.
All the software functions necessary to operate the Smart Water Ions Sensor Board have been compiled in a library added to the Waspmote API, so the supply of the board and its components and the reading of the sensors can be easily managed.
When using the Smart Water Ions Sensor Board, remember it is mandatory to include the smartWaterIons.h
library by introducing the next line at the beginning of the code:
#include <smartWaterIons.h>
The Smart Water Ions library includes different classes for managing the different sockets and sensors of the board:
Next, the different functions that make up the library are described:
Power control functions
The power control functions must be managed with the SWIonsBoard
object.
Calibration configuration functions
This functions can be used by creating different objects
socket1Class calciumSensor;
socket2Class pHSensor;
Read sensor functions
socket1Class pHSensor;
socket2Class NO3Sensor;
pt1000Class temperatureSensor;
Conversion functions
For easy use with the Plug & Sense! platform, the library include specific declaration methods. In the example below, we can see how to associate an Ions Sensor Probe with the corresponding socket in Plug & Sense!.
Example:
You can find a complete example code for Plug & Sense! reading from following link:
https://development.libelium.com/waspmote/swi-07-plugsense-reading/
WaspSensorSWIons
This class is used for power control functions
ionSensorClass
This is the general class witch derive the other classes
pt1000Class
This class is for managing the temperature sensor
socket1Class
This class derives from ionSensorClass
, and is used for managing the socket1 of the Smart Water Ions Sensor Board
socket2Class
This class derives from ionSensorClass
, and is used for managing the socket2 of the Smart Water Ions Sensor Board
socket3Class
This class derives from ionSensorClass
, and is used for managing the socket3 of the Smart Water Ions Sensor Board
socket4Class
This class derives from ionSensorClass
, and is used for managing the socket4 of the Smart Water Ions Sensor Board
SWIonsBoard.ON()
Turns on the sensor board by activating the 3.3V and 5 V supply voltage lines
SWIonsBoard.OFF()
Turns off the sensor board by cutting the 3.3 V and 5 V supply voltage lines
CalciumSensor.setCalibrationPoints(const float calVoltages[],const float calConcentrations[],uint8_t numPoints)
Calculate the slope and the intersection of the approximated logarithmic function
pHSensor.setpHCalibrationPoints(float _calibration_point_10,float _calibration_point_7,float _calibration_point_4,float _calibration_temperature)
Configures the calibration points of the pH sensor
temperatureSensor.read()
Returns the temperature value from Soil/WaterTemperature (Pt-1000) Sensor
pHSensor.read()
Returns the voltage value from the socket1
NO3Sensor.read()
Returns the voltage value from the socket2
NO3Sensor.calculateConcentration(float input)
Calculates the concentration in ppm from the voltage value measured
pHSensor.pHConversion(float input, float temp)
Returns the pH value from a voltage input