Board configuration and programming
Hardware configuration
The Plug & Sense! Smart Agriculture 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 Agriculture Xtreme model is only available in the Waspmote Plug & Sense! Line. It is not available for Waspmote OEM line.
API
Before starting to program
When using the Plug & Sense! Smart Agriculture Xtreme model, remember that it is mandatory to include the WaspSensorXtr
library by introducing the next line at the beginning:
The library manages the power supply and communication lines between Waspmote and the sockets. Prior reading the sensor probes, the user must declare an object of the corresponding sensor class, specifying the socket where the sensor is placed. All sensor classes inherit from the class WaspSensorXtr
. The next table enumerates each sensor class.
Sensor probe
Sensor class
Non-contact surface temperature measurement sensor probe
Apogee_SI411
Leaf and flower bud temperature sensor probe
Apogee_SF421
Soil oxygen level sensor probe
Apogee_SO411
Soil oxygen level sensor probe
Apogee_SO421
Shortwave radiation sensor probe
Apogee_SP510
Solar radiation sensor probe for Smart Agriculture Xtreme
Apogee_SQ110
Ultraviolet radiation sensor probe for Smart Agriculture Xtreme
Apogee_SU100
Temperature, humidity and pressure sensor probe
bme
Conductivity, water content and soil temperature GS3 sensor probe
Decagon_GS3
Conductivity, water content and soil temperature 5TE sensor probe
Decagon_5TE
Soil temperature and volumetric water content sensor probe
Decagon_5TM
Soil temperature and volumetric water content sensor probe
METER_TEROS11
Conductivity, water content and soil temperature TEROS 12 sensor probe
METER_TEROS12
Soil water potential sensor probe
METER_TEROS21
Vapor pressure, humidity, temperature and pressure in soil and air sensor probe
Decagon_VP4
Leaf wetness Phytos 31 sensor probe
leafWetness
Dendrometer sensor probes for Smart Agriculture Xtreme
dendrometer
Weather station sensor probe
weatherStation
Solar radiation and temperature Datasol MET probe
DatasolMET
Luminosity sensor probe
luxes
Ultrasound sensor probe
ultrasound
Each sensor class manages the Smart Agriculture 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 to turn off the sensors to save battery when they are no longer needed.
The next snippet shows how to declare an object for the sensor 5TE and then how to turn on, read and turn off the sensor:
The read()
function stores the sensor values in a public class. 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 5TE sensor, values will be printed by USB with the following snippet.
The Temperature, humidity and pressure, the Ultrasound and the Luminosity sensors have their own reading functions in contrast to the rest of the Smart Agriculture Xtreme sensors. This is due to these sensors can be used in other Plug & Sense! models and they share the same functions in the Waspmote API. Refer to the dedicated sensor example for further details.
Sending sensor values with the Frame class
Owing to the large number of parameters that can be read by the Plug & Sense! Smart Agriculture Xtreme model, a special frame type must be used with the Frame class in order to send the values correctly.
You can find a complete example code for using the Frame class in the following link: http://www.libelium.com/development/waspmote/examples/ag-xtr-19-frame-class-utility
Refer to the Data Frame Guide for more information: https://development.libelium.com/data-frame-programming-guide/
RS-232 interface
The Smart Agriculture Xtreme sensor board has an RS-232 interface available on socket F of Plug & Sense! Smart Agriculture Xtreme.
Some users may want to integrate sensors manufactured by 3rd party companies (advanced skills are required). In case the RS-232 interface needs to be used to integrate a new sensor, a basic example is included to transmit and receive data or commands. It should be noticed that it is managed in the same way as UART1 of the microcontroller. See the Waspmote Technical Guide for more information.
First, the RS-232 interface needs to be configured with parameters like baudrate or parity:
Then, 2nd block could be a function to receive some data and save it into a buffer. Notice that the UART1 multiplexer is set to Auxiliary UART 1:
Finally, a 3rd block for sending data through the RS-232, like a normal UART:
You can find a complete example code for using the RS-232 interface in the following link: https://development.libelium.com/ag-xtr-25-rs-232-tx-and-rx-example/
The user can find the RS-232 interface in socket F and the connection can be done using the Terminal Box probe or the DB9 probe. Contact our Sales department through the next link if you require more information: http://www.libelium.com/contact.
The RS-232 signals are wired on the terminal box according to the next table:
RS-232: Terminal box probe
RS-232: Terminal box
1 (orange)
RS_232_TX
2 (white)
RS_232_RX
3 (red)
-
4 (black)
GND
5 (yellow)
-
6 (green)
+12 V
4-20 mA interface
The Smart Agriculture Xtreme sensor board has two 4-20 mA interfaces available on sockets B and F of Plug & Sense! Smart Agriculture Xtreme.
Some users may want to integrate sensors manufactured by 3rd party companies (advanced skills are required). If needed, a basic example is included to read the current on the 4-20 mA loop. There is a specific class to allow the readings.
The next snippet shows how to declare an object for a generic 4-20 mA sensor and then how to turn on, read and turn off the sensor:
The read()
function stores the sensor values in a public class. The user can refer to the dedicated sensor example to see how the sensor values can be accessed. In the case of the 4-20 mA sensor, values will be printed by USB with the following snippet:
You can find a complete example code for using the Frame class in the following link: http://www.libelium.com/waspmote/examples/ag-xtr-26-4-20ma-example
The connection can be done using the Terminal Box probe or a DB9 probe. Contact our Sales department through the next link if you require more information: http://www.libelium.com/contact.
The 4-20 mA signals are wired on the Terminal Box according to the next table:
4-20 mA (socket B and F): Terminal box probe
4-20 mA (socket B and F): Terminal box
1 (orange)
-
2 (white)
-
3 (red)
-
4 (black)
GND
5 (yellow)
4-20 mA
6 (green)
+12
Last updated