Ag xtr 03: SO-411 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 SO-411 sensor

Notes

- This example is only valid for Waspmote v15

Code

1
/*
2
----------- [Ag_xtr_03] - SO-411 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
- Calibreted oxigen
10
- Body temperature
11
- Sensor millivolts
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 .
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
Apogee_SO411 mySensor(XTR_SOCKET_A);
56
57
void setup()
58
{
59
USB.println(F("SO-411 example"));
60
}
61
62
void loop()
63
{
64
// 1. Turn ON the sensor
65
/*
66
ON() function turns on the sensor and the heater before take a read.
67
Sensor response time is 60 seconds.
68
Dont forget to turn it off after read it.
69
*/
70
mySensor.ON();
71
delay(60000);
72
73
// 2. Read the sensor
74
/*
75
Note: read() function does not directly return sensor values.
76
They are stored in the class vector variables defined for that purpose.
77
Values are available as a float value
78
*/
79
mySensor.read();
80
81
// 3. Turn off the sensor and the heater
82
mySensor.OFF();
83
84
// 4. Print information
85
USB.println(F("---------------------------"));
86
USB.println(F("SO-411"));
87
USB.print(F("Calibrated Oxigen: "));
88
USB.printFloat(mySensor.sensorSO411.calibratedOxygen, 3);
89
USB.println(F(" %"));
90
USB.print(F("Body temperature: "));
91
USB.printFloat(mySensor.sensorSO411.bodyTemperature, 1);
92
USB.println(F(" degrees Celsius"));
93
USB.print(F("Sensor millivolts: "));
94
USB.printFloat(mySensor.sensorSO411.milliVolts, 4);
95
USB.println(F(" mV"));
96
USB.println(F("---------------------------\n"));
97
98
delay(5000);
99
100
}
Copied!

Output

1
H#
2
SO-411 example
3
---------------------------
4
SO-411
5
Calibrated Oxigen: 22.569 %
6
Body temperature: 27.6 degrees Celsius
7
Sensor millivolts: 52.1624 mV
8
---------------------------
9
---------------------------
10
SO-411
11
Calibrated Oxigen: 22.600 %
12
Body temperature: 27.8 degrees Celsius
13
Sensor millivolts: 52.2304 mV
14
---------------------------
Copied!
Last modified 1yr ago