Sensors

The sensors are connected to Waspmote through the microcontroller’s analog and digital inputs. Some of Libelium Sensor Boards can be used to generate interruptions:

  • Agriculture v30

  • Events v30

  • Smart Cities

  • Video Camera

  • Radiation

Enable interruption

The Agriculture Board interrupts through the pluviometer sensor interruption. The attachPluvioInt() function enables both pluviometer interruption (PLV_INT is enabled in intConf) and RXD1 interruption pin.

The Events Board interrupts through one of the different sensor which can be plugged to several sockets available in this board. The attachInt() function enables both Sensor Board interruption (SENS_INT is enabled in intConf) and RXD1 interruption pin

The Smart Cities Board interrupts through one of the different sensors which can be plugged into several sockets available in this board. Do not confuse this board with the Smart Cities PRO board, which does not support interruptions. The attachInt() function enables both Sensor Board interruption (SENS_INT is enabled in intConf) and RXD1 interruption pin. Besides, it is necessary to set a threshold for each sensor to set up the interruption generation as needed. The function used to set thresholds is SensorCities.setThreshold(sensor, threshold).

The Video Camera Board interrupts through the PIR sensor. The _3G.enablePIRInterrupt() function enables both PIR interruption (PIR_3G_INT is enabled in intConf) and RXD1 interruption pin.

Interruption event

All Sensor Boards generate a rising-edge interruption through the RXD1 pin. All interruption sources have a unique monitoring pin which permits to know which sensor provoked the alarm. When the interruption occurs in RXD1 pin, the subroutine ‘onHAIwakeUP’ is run marking the corresponding flags.

Disable interruption

Each Sensor Board uses a specific function so as to disable the interruption:

The Agriculture Board uses the detachPluvioInt() function to disable both pluviometer interruption (PLV_INT is disabled in intConf) and RXD1 interruption pin. It is mandatory to power down the Agriculture Board when UART1 is being used in order to avoid interferences in this line.

The Events Board uses the detachInt() function to disable both Sensor Board interruption (SENS_INT is disabled in intConf) and RXD1 interruption pin.

The Smart Cities Board uses the detachInt() function to disable both Sensor Board interruption (SENS_INT is disabled in intConf) and RXD1 interruption pin.

The Video Camera Board uses the disablePIRInterrupt() function to disable both PIR interruption (PIR_3G_INT is disabled in intConf) and RXD1 interruption pin.

Check Sensors interruptions

Depending on the board:

The Agriculture Board needs the following checking:

if (intFlag & PLV_INT)
 {
 // Pluviometer interruption treatment
 }

The Events Board needs to load the interruption register after the alarm is generated in order to know which of the sensors in the board caused the interruption:. Once the information has been loaded, the user needs to check out the interruption for each sensor individually. The getInt() function permits to confirm the interruption event. The function returns a boolean value indicating true I the case of the event.

 // Check Sensor Board interruption
 if (intFlag & SENS_INT)
 {
 // Load the interruption register
 Events.loadInt();
 // check sensor interruption
 if (hall.getInt())
 {}
 // check sensor interruption
 if (liquidLevel.getInt())
 {}
 ...
 // check sensor interruption
 if (liquidPresence.getInt())
 {

The Smart Cities Board needs to load the interruption register after the alarm is generated in order to know which of the sensors in the board caused the interruption. In this case it is necessary to check directly the SensorCities.intFlag because the general intFlag is not useful:

{
// Load the interruption register
 SensorCities.loadInt();
 // check SENS_CITIES_HUMIDITY interruption
 if( SensorCities.intFlag & SENS_CITIES_HUMIDITY )
 {}
 // check SENS_CITIES_AUDIO interruption
 if( SensorCities.intFlag & SENS_CITIES_AUDIO )
 {}
 ...
 // check SENS_CITIES_TEMPERATURE interruption
 if( SensorCities.intFlag & SENS_CITIES_TEMPERATURE )
 }

The Video Camera Board needs the following checking:

if (intFlag & PIR_3G_INT)
 {
 // PIR interruption treatment
 }

Sensor board interruptions are managed quite differently from the rest of the interruptions, so it is recommended to check the sensor boards technical guides.

All the documentation is located in the Development section in the Libelium website.

Last updated