Ag xtr 27: Teros 11 sensor reading
Basic example that turns on, reads and turn off the sensor. Measured parameters are stored in the corresponding class variables and printed by the serial monitor.

Required Materials

- 1 Waspmote Plug & Sense! Smart Agriculture Xtreme - 1 Teros 11

Notes

- This example is only valid for Waspmote v15

Code

1
/*
2
---------- - [Ag_xtr_27] - Teros 11 sensor reading --------------------
3
4
Explanation: Basic example that turns on, reads and turn off the
5
sensor. Measured parameters are stored in the corresponding class
6
variables and printed by the serial monitor.
7
8
Measured parameters:
9
- Volumetric water content
10
- Temperature of the soil
11
12
Copyright (C) 2020 Libelium Comunicaciones Distribuidas S.L.
13
http://www.libelium.com
14
15
This program is free software: you can redistribute it and / or modify
16
it under the terms of the GNU General Public License as published by
17
the Free Software Foundation, either version 3 of the License, or
18
(at your option) any later version.
19
20
This program is distributed in the hope that it will be useful,
21
but WITHOUT ANY WARRANTY; without even the implied warranty of
22
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
GNU General Public License for more details.
24
25
You should have received a copy of the GNU General Public License
26
along with this program. If not, see < http : //www.gnu.org/licenses/>.
27
28
Version : 3.0
29
Design : David Gascón
30
Implementation : A.Falo
31
*/
32
33
#include <WaspSensorXtr.h>
34
35
/*
36
SELECT THE RIGHT SOCKET FOR EACH SENSOR.
37
38
Possible sockets for this sensor are:
39
- XTR_SOCKET_A _________
40
- XTR_SOCKET_B |---------|
41
- XTR_SOCKET_C | A B C |
42
- XTR_SOCKET_D |_D__E__F_|
43
44
45
Example: a 5TM sensor on socket A will be
46
[Sensor Class] [Sensor Name] [Selected socket]
47
Decagon_5TM mySensor (XTR_SOCKET_A);
48
49
Refer to the technical guide for information about possible combinations.
50
www.libelium.com/downloads/documentation/smart_agriculture_xtreme_sensor_board.pdf
51
*/
52
53
// [Sensor Class] [Sensor Name] [Selected socket]
54
Meter_TEROS11 mySensor(XTR_SOCKET_A);
55
56
void setup()
57
{
58
USB.println(F("Teros 11 example"));
59
60
}
61
62
void loop()
63
{
64
// 1. Turn ON the sensor
65
mySensor.ON();
66
67
// 2. Read the sensor
68
/*
69
Note: read() function does not directly return sensor values.
70
They are stored in the class vector variables defined for that purpose.
71
Values are available as a float value
72
*/
73
mySensor.read();
74
75
// 3. Turn off the sensor
76
mySensor.OFF();
77
78
79
// 4.1 Conversion of the RAW output sensor value into Volumetric Water Content (VWC)
80
// for mineral soil using calibration equation
81
float VWC = ((3.879 * pow(10, -4) * mySensor.sensorTEROS11.calibratedCountsVWC)) - 0.6956;
82
83
// for soilless media using calibration equation
84
// float VWC = ((6.771 * pow(10, -10) * pow(mySensor.sensorTEROS11.calibratedCountsVWC, 3))
85
// - (5.105 * pow(10, -6) * pow(mySensor.sensorTEROS11.calibratedCountsVWC, 2))
86
// + (1.302 * pow(10, -2) * mySensor.sensorTEROS11.calibratedCountsVWC))
87
// - 10.848;
88
89
// 4.2 Conversion of the RAW output sensor value into Volumetric Water Content (VWC)
90
// for mineral soil using calibration equation
91
float DP = pow(((2.887 * pow(10, -9) * pow(mySensor.sensorTEROS11.calibratedCountsVWC, 3))
92
- (2.080 * pow(10, -5) * pow(mySensor.sensorTEROS11.calibratedCountsVWC, 2))
93
+ (5.276 * pow(10, -2) * mySensor.sensorTEROS11.calibratedCountsVWC)
94
- 43.39), 2);
95
96
97
// 5. Print information
98
USB.println(F("---------------------------"));
99
USB.println(F("Teros-11"));
100
USB.print(F("Dielectric Permittivity: "));
101
USB.printFloat(DP, 2);
102
USB.println();
103
USB.print(F("Volumetric Water Content: "));
104
USB.printFloat(VWC, 2);
105
USB.println(F(" m3/m3"));
106
USB.print(F("Soil temperature: "));
107
USB.printFloat(mySensor.sensorTEROS11.temperature, 1);
108
USB.println(F(" degrees Celsius"));
109
USB.println(F("---------------------------\n"));
110
111
delay(5000);
112
113
}
Copied!
Last modified 1yr ago