Board configuration and programming
The Waspmote Agriculture v3.0 Board hardly requires a manual hardware configuration, since all the power control and sensor reading operations can be carried out digitally. It will be only necessary to ensure that the sensors are connected in the right way to their sockets for a proper measurement.
The Agriculture Sensor Board v3.0 for Waspmote has its own library which contains the set of necessary instructions to easily configure and read each one of the sensors which can be connected to the board. Next, each one of the functions is described and the process of configuration is detailed for each sensor. The specific configuration which must be applied to each one of the sensors is explained in the specific sensor's section.
When using the Agriculture Sensor Board v3 on Waspmote, remember it is mandatory to include the WaspSensorAgr_v30 library by introducing the next line at the beginning of the code:
Each agriculture sensor needs its own object. So, between the include of the library and the global variables declaration, the object must be created following the next structure:
- Name of the class:
- Name of the object: We recommend to use the name of the sensor. In this case
- Only in watermark sensor you need put in brackets the socket. For example:
- Turn on the sensor board by enable the 3.3 V and 5 V.
- Turn off the sensor board by disable the 3.3 V and 5 V.
- Read distance in cm when the ultrasound sensor is connected.
- Read temperature in ºC when the BME280 is connected.
- Read pressure in PA when the BME280 is connected.
- Read humidity in % when the BME280 is connected.
- Read luxes in lux when the TSL2561 is connected, in this case itsnecessary include the place of sensor (INDOOR or OUTDOOR) intothe brackets.
Agriculture.sleepAgr()is an adaptation of the function
deepSleep()in the library WaspPWR.cpp that allows to put Waspmote to sleep, turning the power of the board completely off or keeping the pluviometer circuits on if the interruptions of this sensor are going to be used to wake up the microcontroller. The parameters
OPTIONallow to define the time the mote will be in deep sleep mode before waking up with an RTC interruption and the modules that will be inactive during this time, like in the original function (read the Waspmote technical guide and Programming Guide for more information). To activate the pluviometer interruptions, the parameter
AGR_INTERRUPTIONmust be assigned with the value
SENS_AGR_PLUVIOMETER(remember not to deactivate the sensor board when defining the parameter
OPTIONfor a correct operation of the interruptions).
A basic program to detect events from the board will present a similar structure to the following, subject to changes in dependence of the application:
- 1.The board is switched on using the function
- 2.When the mote wakes up, disable interruptions from the board using function
- 3.Store or send via a radio module the gathered information.
- 4.Return to step 4 to enable interruptions and put the mote to sleep.
- Read the dendrometer value in Agriculture Pro.
- Read the soil temperature in Agriculture Normal.
- Read the leaf wetness % in Agriculture Normal and Pro.
- Read the soil temperature in Agriculture Pro.
- Read the solar Radiation in Agriculture Pro.
- In this case it is necessary to specify the socket where watermark is connected and also instance object.
- Read the soil water content (Hz) in Agriculture Normal and Pro.
- Read the wind speed in Agriculture Normal and Pro.
- Read the vane direction in Agriculture Normal and Pro.
attachPluvioInt()function enables the interruptions generated by the pluviometer. Take into account that this sensor is permanently powered all the time if the board is on, so it will keep on triggering interruptions as long as they are enabled.
Complementing the previous function, the aim of
detachPluvioInt()is to deactivate the interrupts generated by the pluviometer. After its execution, the microcontroller will ignore any interruption which arrives from this sensor until the
attachPluvioInt()instruction is called again.
- Read pluviometer value.
- Read pluviometer value in 1 hour.
- Read pluviometer value in 1 day.