Ag xtr 08: 5TE 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 5TE sensor

Notes

- This example is only valid for Waspmote v15

Code

1
/*
2
----------- [Ag_xtr_08] - 5TE 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
- Electrical conductivity
10
- Volumetric water content
11
- Temperature of the soil
12
13
Copyright (C) 2018 Libelium Comunicaciones Distribuidas S.L.
14
http://www.libelium.com
15
16
This program is free software: you can redistribute it and/or modify
17
it under the terms of the GNU General Public License as published by
18
the Free Software Foundation, either version 3 of the License, or
19
(at your option) any later version.
20
21
This program is distributed in the hope that it will be useful,
22
but WITHOUT ANY WARRANTY; without even the implied warranty of
23
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
GNU General Public License for more details.
25
26
You should have received a copy of the GNU General Public License
27
along with this program. If not, see <http://www.gnu.org/licenses/>.
28
29
Version: 3.1
30
Design: David Gascón
31
Implementation: J.Siscart, V.Boria
32
*/
33
34
#include <WaspSensorXtr.h>
35
36
/*
37
SELECT THE RIGHT SOCKET FOR EACH SENSOR.
38
39
Possible sockets for this sensor are:
40
- XTR_SOCKET_A _________
41
- XTR_SOCKET_B |---------|
42
- XTR_SOCKET_C | A B C |
43
- XTR_SOCKET_D |_D__E__F_|
44
45
46
Example: a 5TM sensor on socket A will be
47
[Sensor Class] [Sensor Name] [Selected socket]
48
Decagon_5TM mySensor (XTR_SOCKET_A);
49
50
Refer to the technical guide for information about possible combinations.
51
www.libelium.com/downloads/documentation/smart_agriculture_xtreme_sensor_board.pdf
52
*/
53
54
// [Sensor Class] [Sensor Name] [Selected socket]
55
Decagon_5TE mySensor(XTR_SOCKET_A);
56
57
void setup()
58
{
59
USB.println(F("5TE example"));
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
// 4. Conversion of dielectric permittivity into Volumetric Water Content (VWC)
79
// for mineral soil using Topp equation
80
float VWC = ((4.3 * pow(10, -6) * pow(mySensor.sensor5TE.dielectricPermittivity, 3))
81
- (5.5 * pow(10, -4) * pow(mySensor.sensor5TE.dielectricPermittivity, 2))
82
+ (2.92 * pow(10, -2) * mySensor.sensor5TE.dielectricPermittivity)
83
- (5.3 * pow(10, -2))) * 100 ;
84
85
// 5. Print information
86
USB.println(F("---------------------------"));
87
USB.println(F("5TE"));
88
USB.print(F("Dielectric Permittivity: "));
89
USB.printFloat(mySensor.sensor5TE.dielectricPermittivity, 2);
90
USB.println();
91
USB.print(F("Volumetric Water Content: "));
92
USB.printFloat(VWC, 2);
93
USB.println(F(" %VWC"));
94
USB.print(F("Electrical Conductivity: "));
95
USB.printFloat(mySensor.sensor5TE.electricalConductivity, 2);
96
USB.println(F(" dS/m"));
97
USB.print(F("Soil temperature: "));
98
USB.printFloat(mySensor.sensor5TE.temperature, 1);
99
USB.println(F(" degrees Celsius"));
100
USB.println(F("---------------------------\n"));
101
102
delay(5000);
103
104
}
Copied!

Output

1
H#
2
5TE example
3
---------------------------
4
5TE
5
Dielectric Permittivity: 14.60
6
Volumetric Water Content: 26.94 %VWC
7
Electrical Conductivity: 0.00 dS/m
8
Soil temperature: 26.4 degrees Celsius
9
---------------------------
10
---------------------------
11
5TE
12
Dielectric Permittivity: 14.60
13
Volumetric Water Content: 26.94 %VWC
14
Electrical Conductivity: 0.00 dS/m
15
Soil temperature: 26.4 degrees Celsius
16
---------------------------
Copied!
Last modified 1yr ago