Sensors

Temperature, humidity and pressure sensor

The BME280 is a digital temperature, humidity and pressure sensor developed by Bosch Sensortec.

Specifications

Electrical characteristics Supply voltage: 3.3 V Sleep current typical: 0.1 μA Sleep current maximum: 0.3 μA

Temperature sensor Operational range: -40 ~ +85 ºC Full accuracy range: 0 ~ +65 ºC Accuracy: ±1 ºC (range 0 ºC ~ +65 ºC) Response time: 1.65 seconds (63% response from +30 to +125 °C) Typical consumption: 1 μA measuring

Humidity sensor Measurement range: 0 ~ 100% of relative humidity (for temperatures \< 0 °C and > 60 °C see figure below) Accuracy: \< ±3% RH (at 25 ºC, range 20 ~ 80%) Hysteresis: ±1% RH Operating temperature: -40 ~ +85 ºC Response time (63% of step 90% to 0% or 0% to 90%): 1 second Typical consumption: 1.8 μA measuring

Maximum consumption: 2.8 μA measuring

Pressure sensor Measurement range: 30 ~ 110 kPa Operational temperature range: -40 ~ +85 ºC Full accuracy temperature range: 0 ~ +65 ºC Absolute accuracy: ±0.1 kPa (0 ~ 65 ºC) Typical consumption: 2.8 μA measuring Maximum consumption: 4.2 μA measuring

Measurement process

The BME280 is as combined digital humidity, pressure and temperature sensor based on proven sensing principles. The humidity sensor provides an extremely fast response time for fast context awareness applications and high overall accuracy over a wide temperature range.

The pressure sensor is an absolute barometric pressure sensor with extremely high accuracy and resolution and drastically lower noise.

The integrated temperature sensor has been optimized for lowest noise and highest resolution. Its output is used for temperature compensation of the pressure and humidity sensors and can also be used for estimation of the ambient temperature.

When the sensor is disabled, current consumption drops to 0.1 μA.

To read this sensor, you should use the following functions:

Temperature: Reading code:

{
	 float temperature;
	 // Reads the BME280 sensor
	 Events.ON();
	 temperature = Events.getTemperature();	 //Return Temperature from BME280
}

Humidity: Reading code:

{
    float humidity;
    // Reads the BME280 sensor
    Events.ON();
    temperature = EventsBoard.getHumidity();	 //Return Humidity from BME280
}

Pressure: Reading code:

{
    float pressure;
    Events.ON();
    // Reads the BME280 sensor
    temperature = EventsBoard.getPressure();	 ////Return Atmospheric Pressure from BME280
}

You can find a complete example code for reading the BME280 sensor in the following link: https://development.libelium.com/ev-v30-01-bme-sensor-temperature-humidity-and-pres/

Socket 5

In the image above we can see highlighted the four pins of the terminal block where the sensor must be connected to the board. The white dot of the BME280 must match the mark on the Events Sensor Board.

Liquid level sensors (PTFA3415, PTFA3115, PTFA1103)

Specifications

PTFA3415

Measurement Level: Horizontal Liquids: Water Material (box): Propylene Material (float): Propylene Operating temperature: -10 ºC ~ +85 ºC Minimum consumption: 0 μA*

*This sensor’s consumption is included in the consumption ranges of the connectors on which they can be placed. (See section “Consumption table”).

PTFA3115

Measurement Level: Horizontal Liquids: Heavy oils, petrol and combustibles Material (box): Nylon 6, 30% glass filled Material (float): Nylon 6, 30% glass filled Operating temperature: 0 ºC ~ +85 ºC Minimum consumption: 0 μA*

*This sensor’s consumption is included in the consumption ranges of the connectors on which they can be placed. (See section “Consumption table”)

PTFA1103

Measurement Level: Vertical Liquids: Water Material (box): Propylene Material (float): Propylene Operating temperature: -10 ºC ~ +80 ºC Minimum consumption: 0 μA*

*This sensor’s consumption is included in the consumption ranges of the connectors on which they can be placed. (See section “Consumption table”)

Measurement process

There are three liquid level sensors whose operation is based on the status of a switch which can be opened and closed (depending on its placing in the container) as the level of liquid moves the float at its end. The main differences between the three sensors, regarding its use in Waspmote, are to be found in their process for placing them in the container (horizontal in the case of the PTFA3415 and PTFA3115 sensors, vertical for the PTFA1103 sensor) and in the material they are made of (the PTFA1103 and PTFA3415 sensors recommended for edible liquids and certain acids and the PTFA3115 for heavy oils and combustibles, more specific information can be found in the sensors' manual). Being switch sensors they can be placed in any of the socket 1, socket 2, socket 3, socket 4 and socket 6.

In the figure, two examples of applications of liquid level monitoring with these sensors can be seen.

This kind of sensors are yes/no sensors, in the sense that they inform:

  • the liquid level is below the point where the sensor was installed

  • the liquid level is above

The user may also be interested in the Ultrasound sensors (indoors/outdoors), which can installed on top of a tank or silo and meter the distance from the top to the surface of liquid or grain, with great accuracy (cm). A code for reading the sensor is shown below:

uint8_t value;
//Instance Objects
liquidLevelClass liquidLevel(SOCKET_2);
{
	 Events.ON();
	 value = liquidLevel.readliquidLevel();
}

value is an integer variable where the sensor state (a high value (3.3 V) or a low value (0 V), which will depend on the liquid level and sensor setup) will be stored.

Each 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: In this case liquidLevelClass

  • Name of the object: In this case liquidLevel

  • In brackets the socket selected for the sensor. In this case SOCKET_2

You can find a complete example code for reading the Liquid Level sensor in the following link: https://development.libelium.com/ev-v30-03-liquid-level-sensor/

Presence sensor (PIR)

Specifications

Height: 25.4 mm Width: 24.3 mm Length: 28.0 mm Consumption: 100 μA Range of detection: 6 ~ 7 m Spectral range: ~10 μm

Measurement process

The PIR sensor (Passive Infra-Red) is a pyroelectric sensor mainly consisting of an infra-red receiver and a focusing lens that bases its operation on the monitoring of the variations in the levels of reception of detected infra-reds, reflecting this movement by setting its output signal high. Being a digital sensor it must be situated in socket 1, socket 2, socket 3, socket 4 and socket 6.

The 10 μm spectrum corresponds to the radiation of heat from the majority of mammals as they emit temperatures around 36 °C.

The maximum detection direction goes perpendicular to the Events Sensor Board, this is why it is advised to place Waspmote perpendicular to the ground when using the PIR sensor.

A code for reading the sensor is shown below:

uint8_t value;
//Instance objects
pirSensorClass pir(SOCKET_1);
{
	 Events.ON();
	 value = pir.readPirSensor();
}

value is an integer variable where the sensor state (a high value (3.3 V) or a low value (0 V), which will depend on the liquid level and sensor setup) will be stored.

Each 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: In this case pirSensorClass

  • Name of the object: In this case pir

  • In brackets the socket selected for the sensor. In this case SOCKET_1

You can find a complete example code for reading the PIR sensor in the following link: https://development.libelium.com/ev-v30-02-pir-sensor/

Hall effect sensor

Specifications

Length: 64 mm Width: 19 mm Height: 13 mm Maximum contact resistance (closed): 200 mΩ Minimum contact resistance (open): 100 GΩ Minimum consumption: 0 μA*

*This sensor’s consumption is included in the consumption ranges of the connectors on which they can be placed. (See section “Consumption table”)

Measurement process

This is a magnetic sensor based on the Hall effect. The sensor's switch remains closed in the presence of a magnetic field, opening up in its absence. Together with its complementary magnet it can be used in applications of monitoring proximity or opening mechanisms. Being a switch sensor it must be placed on one of the socket 1, socket 2, socket 3, socket 4 and socket 6.

The next figure shows the way of using the sensor in an application of monitoring the opening of doors or windows.

A code for reading the sensor is shown below:

uint8_t value;
//Instance objects
hallSensorClass hall(SOCKET_3);
{
	 Events.ON();
	 value = hall.readHallSensor();
}

value is an integer variable where the sensor state (a high value (3.3 V) or a low value (0 V), which will depend on the liquid level and sensor setup) will be stored.

Each 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: In this case hallSensorClass

  • Name of the object: In this case hall

  • In brackets the socket selected for the sensor. In this case SOCKET_3

You can find a complete example code for reading the Hall Effect sensor in the following link: https://development.libelium.com/ev-v30-04-hall-effect-sensor/

Water Leakage / Liquid Detection sensor (Point)

Specifications

Maximum Switching Voltage: 100 V Operating temperature: +5 ºC ~ +80 ºC Detectable liquids: Water Minimum consumption: 0 μA*

*This sensor’s consumption is included in the consumption ranges of the connectors on which they can be placed. (See section “Consumption table”)

Measurement process

This sensor bases its operation on the variation in resistance between its two contacts in the presence of liquid to commute a switch reed from open to closed, commuting to open again when the liquid disappears (take care when it is used to detect liquids of high viscosity which may remain between the terminals blocking its drainage and preventing it from re-opening). Being a switch sensor it can be placed on any of the socket 1, socket 2, socket 3, socket 4 and socket 6.

The next figure shows an image of how the sensor must be placed to detect the presence of liquid.

A code for reading the sensor is shown below:

uint8_t value;
//Instance object
liquidPresenceClass liquidPresence(SOCKET_4);
{
	 Events.ON();
	 value = lp.readliquidPresence();
}

value is an integer variable where the sensor state (a high value (3.3 V) or a low value (0 V), which will depend on the liquid level and sensor setup) will be stored.

Each 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: In this case liquidPresenceClass

  • Name of the object: In this case liquidPresence

  • In brackets the socket selected for the sensor. In this case SOCKET_4

You can find a complete example code for reading the Liquid Detection sensor in the following link: https://development.libelium.com/ev-v30-05-liquid-presence/

Liquid flow sensors

Specifications

Water Flow Medium, FS300A

Flow rate: 1 ~ 60 L/Min Working voltage: +5 V ~ +24 V Working temperature: 0 ºC ~ 80 ºC Pipe connection: 3/4" Max rated current: 15 mA (DC 5 V)

Water Flow Small, YF-S402

Libelium discontinued this sensor in March 2021, since the manufacturer declared its end of life

Flow rate: 0.3 ~ 6 L/Min Working voltage: +5 V ~ +24 V Working temperature: 0 ºC ~ 80 ºC Pipe connection: 1/8" Max rated current: 15 mA (DC 5 V)

Measurement process

The liquid flow sensors output a signal that consists of a series of digital pulses whose frequency is proportional to the flow rate of the liquid through the sensor. That digital signal, whose frequency is in the range between 0 Hz and 100 Hz, is directly read through one of the digital input/output pins of the microcontroller. This sensor must be connected in liquid flow.

A code for reading the sensor is shown below:

float value;
//Instance objects
flowClass yfs401(SENS_FLOW_YFS401);
{
	 Events.ON();
	 value = yfs401.flowReading();
}

value is an integer variable where the water flow value will be stored.

Each 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: In this case flowClass

  • Name of the object: In this case yfs401

  • In brackets the type of sensor connected (SENS_FLOW_FS400, SENS_FLOW_FS200, SENS_FLOW_FS100, SENS_FLOW_YFS401, SENS_FLOW_FS300, or SENS_FLOW_YFG1). In this case SENS_FLOW_YFS401

Interrupts for flow sensors are developed to wake up Waspmote, not for measure directly. It means that Waspmote must wake up when the liquid starts to flow or when the flow is low. If the flow rate is high, interruptions will not work properly.

You can find a complete example code for reading the Liquid Level sensor in the following links: https://development.libelium.com/ev-v30-07-water-flow-yf-s401/ https://development.libelium.com/ev-v30-08-water-flow-fs300a/ https://development.libelium.com/ev-v30-09-water-flow-yf-g1/

Water Leakage / Liquid Detection sensor (Line)

Specifications

Length: 5 meters sensor + 2 meters jumper wire Material: PE + alloy lend Weight: 18 g/meter Pull force limit: 60 kg Cable diameter: 5.5 mm Core resistance: 3 ohm/100 meters Maximum exposed temperature: 75 ºC Detectable liquids: Water Minimum consumption: 0 μA*

*This sensor’s consumption is included in the consumption ranges of the connectors on which they can be placed. (See section “Consumption table”).

Measurement process

This sensor detects conductive liquids anywhere along its length. After it is installed, once the cable senses the leakage of liquids, it will trigger an alarm. The sensor cable can detect the leakage of water. It must be situated in socket 1, socket 2, socket 3, socket 4 and socket 6.

The installation of this sensor should be done in a safe place, far away from high magnetic fields and damp environment. During installation, keep the sensor cable away from sharp material to avoid scuffing the sensor.

Next figure shows an image of how the sensor must be placed to detect the presence of liquid.

A code for reading the sensor is shown below:

uint8_t value;
//Instance objects
liquidPresenceClass liquidPresence(SOCKET_1);
{
	 Events.ON();
	 value = liquidPresence.readliquidPresence();
}

value is an integer variable where the sensor state will be stored. A high value (3.3 V) or a low value (0 V), which will depend on the liquid level and sensor setup.

Each 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: In this case liquidPresenceClass

  • Name of the object: In this case liquidPresence

  • In brackets the socket selected for the sensor. In this case SOCKET_1

You can find a complete example code for reading the Liquid Leakage sensor in the following link: https://development.libelium.com/ev-v30-06-water-leakage-line/

Relay Input-Output

Specifications

Contact Ratings VDC: 1 A, 24 V DC Contact Form: SPDT (1c) Coil Rated Current: 50 mA

Precautions for safe use

  • Do not use this feature if you do not have advanced knowledge

    of electricity and electrical automation.

  • The incorrect use of this feature can cause harm to the user or other people and damage any connected equipment.

  • The incorrect use of this feature can cause death to the user or other people!

  • The incorrect use of this feature can causes fires!

  • Use only tools and equipment with non-conducting handles when working on electrical devices.

  • Never handle this feature when hands, feet, or body are wet or perspiring, or when standing on a wet floor.

  • Do not store highly flammable liquids near this equipment.

  • Disconnect the power source before operating on this equipment.

  • Do not touch the charged relay terminal area while the power is turned on. Doing so may result in electric shock.

  • Do not use a relay for a load that exceeds the relay\'s switching capacity or other contact ratings. Doing so will reduce the specified performance, causing insulation failure, contact welding, and contact failure, and the relay itself may be damaged or burnt.

  • Make sure the number of switching operations is within the permissible range. If a Relay is used after performance has deteriorated, it may result in insulation failure between circuits and burning of the relay itself.

  • Do not use Relays where flammable gases or explosive gases may be present. Doing so may cause combustion or explosion due to relay heating or arcing during switching.

  • This Limited Warranty does not cover: (a) defects or damage resulting from accident, misuse, abnormal use, abnormal conditions, improper storage, exposure to liquid, moisture, dampness, sand or dirt, neglect, or unusual physical, electrical or electromechanical stress,defects or damage resulting from the use of Product in conjunction or connection with accessories, products, or ancillary/peripheral equipment.

Introduction

The relay inside the Events Sensor Board provides a potential free contact. This contact can be used to enable low power loads such as relays and contactors, or to enable inputs in a PLC. The Socket 6 (IN REL) is designed to be used by a potential free contact to detect on or off conditions, for example in power failure applications.

The relay output on Waspmote Events Sensor Board allows controlling small external loads or other relays through the relay contacts.

Its important to remark that the relay Input-Output is not designed for alternate current (V AC), therefore please use only continuous currents (V DC).

The changeover contact is designed to be an auxiliary contact, NEVER TO HANDLE LOADS. Please never reach the current limitations defined in the relay specifications. The Events board can be damaged permanently. The input contact is designed to be used with a relay contact (the input must go from 0 V to 3.3 V, in Socket 6 / IN REL). If you have any question about the usage of the relay, please contact Libelium before any test.

Relay input example

In this example it is used the potential free contact “normally close – nc” and external relay, whose coil is permanently connected to an external power source. When the external power supply is cut off, the contact returns to its “normally closed” resting position, and the Events Sensor Board knows that the external power source has fallen.

A code for input relay is shown below:

int value;
//Instance object
relayClass relay;
{
	 Events.ON();
	 delay(10);
 	 // Read the sensor level
 	 value = relay.readInRel();
}

value is an integer variable where the sensor state (a high value (3.3 V) or a low value (0 V)) will be stored.

Each 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: In this case relayClass

  • Name of the object: In this case relay

You can find a complete example code for use the relay input in the following link: https://development.libelium.com/ev-v30-10-relay-input/

Relay output example ‌

In this example, the commuted contact of the relay is used to interact with the external contactor coil. Then a common small load, such as a light bulb, can be controlled through the "normally open - NO" or the the "normally closed - NC" contacts.

A code for the Relay output is shown below:

int value;
//Instance objects
relayClass relay;
liquidLevelClass ll(SOCKET_2);
{
	 Events.ON();
	 delay(10);
	 if(value == 1)
		{
 	 		//Switch ON the relay OUTPUT
 	 		relay.relayON();	
	 	}
	 else
		{
 	 		//Switch OFF the relay OUTPUT
	 	 	relay.relayOFF();
		}
 	 // Read the sensor level
 	 value = ll.readliquidLevel();
}

Each 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: In this case relayClass

  • Name of the object: In this case relay

You can find a complete example code for use the relay output in the following link: https://development.libelium.com/ev-v30-11-relay-output/

The recommended pin for this application is Socket 6 (IN REL), but actually Socket 1, Socket 2, Socket 3 and Socket 4 also support this operation.

Relay Input-Output in Waspmote Plug & Sense!

To provide access to the relay contacts in the Waspmote Plug & Sense! encapsulated line, a waterproof terminal block junction box is provided as a Relay Input-Output probe, making the connections on industrial environments or outdoor applications easier. In addition, access to the socket 6 input is also provided.

It consists of 2 cable glands and 6 terminal block connectors with screw. The junction box can be easily opened by removing the four external screws and the cover. Then, the user is able to make the necessary connections using the terminal block connectors. Finally, the cable glands should be adjusted and the junction box should be closed properly to avoid water ingress.

Terminal

Signal

1

Common (yellow)

2

NC (black)

3

NA (red)

4

3v3 (white)

5

Socket 6 (IN REL) (brown)

6

GND (blue)

Please double check the terminal block connections to avoid wrong wirings or short circuits between poles. The Waspmote Plug & Sense! Unit can be seriously damaged. Besides, ensure that the junction box is properly closed to avoid damaged in outdoor applications. Libelium warranty will not cover damages caused by a wrong installation.

Ultrasound sensor (MaxSonar® from MaxBotix™)

Specifications

I2CXL-MaxSonar®-MB7040™

Operation frequency: 42 kHz Maximum detection distance: 765 cm Interface: Digital bus Power supply: 3.3 V ~ 5 V Consumption (average): 2.1 mA (powered at 3.3 V) -- 3.2 mA (powered at 5 V) Consumption (peak): 50 mA (powered at 3.3 V) -- 100 mA (powered at 5 V) Usage: Indoors and outdoors (IP-67)

In the figure below we can see a diagram of the detection range of the sensor developed using different detection patterns (a 0.63 cm diameter dowel for diagram A, a 2.54 cm diameter dowel for diagram B, an 8.25 cm diameter rod for diagram C and a 28 cm wide board for diagram D):

I2CXL-MaxSonar®-MB1202™

Operation frequency: 42 kHz Maximum detection distance: 645 cm Sensitivity (analog output): 2.5 mV/cm (powered at 3.3 V) -- 3.8 mV/cm (powered at 5 V) Power supply: 3.3 ~ 5 V Consumption (average): 2 mA (powered at 3.3 V) -- 3 mA (powered at 5 V) Usage: Indoors

In the figure below we can see a diagram of the detection range of the sensor developed using different detection patterns (a 0.63 cm diameter dowel for diagram A, a 2.54 cm diameter dowel for diagram B, an 8.25 cm diameter rod for diagram C and a 28 cm wide board for diagram D):

Measurement process

The MaxSonar® sensors from MaxBotix can be connected through the digital bus interface.

In the next figure, we can see a drawing of two example applications for the ultrasonic sensors, such as liquid level monitoring or presence detection.

The XL-MaxSonar®-WRA1TM sensor is endowed with an IP-67 casing, so it can be used in outdoors applications, such as liquid level monitoring in storage tanks.

Below a sample code to measure one of the ultrasound sensors (the XL-MaxSonar®-WRA1) is shown:

Reading code:

{
	 uint16_t distance;
	 Events.ON();
	 distance = Events.getDistance();
}

You can find a complete example code for reading the distance in the following link: https://development.libelium.com/ev-v30-13-ultrasound-sensor/

Socket

These sensors are connected in the socket highlighted in the figure below.

Luminosity sensor (Luxes accuracy)

Specifications

Electrical characteristics Dynamic range: 0.1 to 40000 lux Spectral range: 300 ~ 1100 nm Voltage range: 2.7 ~ 3.6 V Supply current typical: 0.24 mA Sleep current maximum: 0.3 μA Operating temperature: -30 ~ +70 ºC

Measurement process

This is a light-to-digital converter that transforms light intensity into a digital signal output. This device combines one broadband photo-diode (visible plus infrared) and one infrared-responding photo-diode on a single CMOS integrated circuit capable of providing a near-photopic response over an effective 20-bit dynamic range (16-bit resolution). Two integrating ADCs convert the photo-diode currents to a digital output that represents the irradiance measured on each channel. This digital output in lux is derived using an empirical formula to approximate the human eye response.

Reading code:

{
	 uint16_t luxes = 0;
	 // Reads the luxes sensor
	 Events.ON();
	 //Select the option of measure:
	 // - OUTDOOR
	 // - INDOOR
	 luxes = Events.getLuxes(INDOOR);	
	 //Return luxes from luxes sensor
}

You can find a complete example code for reading the luminosity in the following link: https://development.libelium.com/ev-v30-14-luxes-sensor/

In the image above we can see highlighted the four pins of the terminal block where the sensor must be connected to the board. The white dot on the luxes board, must match the mark of the Events Sensor Board.

Design and connections

The Waspmote Events Sensor Board has been designed with the aim of facilitating the integration of the previously mentioned sensors and others of similar characteristics. Whenever a different sensor from those indicated in this manual is added, make sure it complies with the electrical specifications that appear in the Waspmote manual. In the following sections the different board connectors are described so the connectivity and sensor integration can be fully taken advantage of.

Digital bus

In this socket you can connect any type of Digital Bus compatible devices, powered at 3.3 V. It also has a power pin to 5 V.

Socket 1, Socket 2, Socket 3, Socket 4 and Socket 6

In this socket any TTL digital sensor type (on - off, 0 V - 3.3 V range) can be connected.

Liquid flow

In this socket the Liquid Flow Sensor can be connected.

Relay Input-Output

In this socket, the contacts of the relay are available. The user can connect an external potential free contact to interact with the Waspmote Events Sensor Board and also an external load can be controlled, always meeting the technical specifications of this component described in this guide.

Sockets for casing

In case the Events board is going to be used in an application that requires the use of a casing, such as an outdoors application, a series of sockets to facilitate the connection of the sensors through a probe has been disposed.

These sockets (PTSM from Phoenix Contact) allow to assemble the wires of the probe simply by pressing them into it. To remove the wire press the slot above the input pin and pull off the wire softly.

In the figure below an image of the board with the sockets in it and the correspondence between its inputs and the sensor's pins is shown.

Socket

Pin

Function

Digital Bus

1

SCL

Digital Bus

2

GND

Digital Bus

3

VCC (3.3 V)

Digital Bus

4

SDA

Digital Bus

5

GND

Digital Bus

6

VCC (5 V)

Liquid Flow

7

GND

Liquid Flow

8

Liquid Flow Sensor

Liquid Flow

9

VCC (3.3 V)

Auxiliary ground pin

10

GND

4

11

VCC (3.3 V)

4

12

Socket 4

3

13

VCC (3.3 V)

3

14

Socket 3

2

15

VCC (3.3 V)

2

16

Socket 2

1

17

VCC (3.3 V)

1

18

Socket 1

6

19

VCC (3.3 V)

6

20

Socket 6 (Relay Input)

Auxiliary ground pin

21

GND

Output Relay

22

Normally Open Relay Contact

Output Relay

23

Normally Closed Relay Contact

Output Relay

24

Relay contact common

Library

The Events Sensor Board 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 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 Events Sensor Board on Waspmote, remember it is mandatory to include the WaspSensorEvent_v30 library by introducing the next line at the beginning of the code:

#include <WaspSensorEvent_v30.h>

Each Events 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: hallSensorClass.

  • Name of the object: We recommend to use the name of the sensor. In this case hall.

  • In brackets the socket selected for the sensor. In this case SOCKET_1.

Events class

Methods:

Turn on the sensor board by enabling the 3.3 V and 5 V.

Events.ON();

Turn off the sensor board by disabling the 3.3 V and 5 V.

Events.OFF();

Read the distance in cm when the ultrasound sensor is connected.

Events.getDistance();

Read the temperature in ºC when the BME280 is connected.

Events.getTemperature();

Read the pressure in Pa when the BME280 is connected.

Events.getPressure();

Read the humidity in % when the BME280 is connected.

Events.getHumidity();

Read luxes in lux when the TSL2561 is connected. In this case, its necessary to include the place where the sensor is being used (INDOOR or OUTDOOR) into the brackets.

Events.getLuxes(INDOOR);

The attachInt function, implemented as such in the code, enables interruptions generated by the board sensors, allowing the microprocessor to recognise and process them as such.

Events.attachInt()

Complementing the previous function, the aim of dettachInt is to disable the interruptions if the microprocessor is not required to react in the event of a change in one of the sensors. After its implementation the mote will ignore any interruption which arrives from the sensors until the attachInt instruction is activated again.

Events.detachInt()

The instruction loadInt is used to read the content of the shift register and store its output in an method of each sensor class call getInt(), in which the sensor which has caused the interruption and the other sensors that were activated when it happened appear. Once all the registers have been read, they restart from zero, not loading again until a new interruption triggers. To recognize if a sensor has produced an interruption, it is sufficient to carry out a logic comparison between the getInt() method of each sensor and true condition.

hallSensorClass

Method:

It is necessary to specify the socket where the hall sensor is connected and instance the object.

hallSensorClass hall(SOCKET_A);

Read the hall sensor value in Events board.

hall.readHallSensor();

Return interruption value of hall sensor.

hall.getInt();

liquidLevelClass

Method:

It is necessary to specify the socket where the liquid level is connected and instance the object.

LiquidLevelClass ll(SOCKET_A);

Read the liquid level sensor value in Events board.

ll.readliquidLevel();

Return interruption value of liquid level sensor.

ll.getInt();

liquidPresenceClass

Method:

It is necessary to specify the socket where the liquid presence is connected and instance the object.

liquidPresenceClass lp(SOCKET_A);

Read the liquid presence sensor value in Events board.

lp.readliquidPresence();

Return interruption value of liquid presence sensor.

lp.getInt();

pirSensorClass

Method:

It is necessary to specify the socket where the PIR is connected and instance the object.

pirSensorClass pir(SOCKET_A);

Read the PIR sensor value in Events board.

pir.readPirSensor();

Return interruption value of PIR sensor.

pir.getInt();

flowClass

Method:

It is necessary to specify the flow sensor model and instance the object.

flowSensorClass flow(SENS_FLOW_YFS401);

Read the flow sensor value in Events board.

flow.flowReading();

Return interruption value of flow sensor.

flow.getInt();

relayClass

Method:

In this case, it is necessary to instance the object.

relayClass relay();

Read the Socket 6 value in Events board.

relay.readInRel();

Return interruption value of InRel value.

relay.getInt();

Switch on the relay.

relay.relayON();

Switch off the relay.

relay.relayOFF();

A basic program to detect events from the board will present the following

  1. The board is switched on using the function Events.ON

  2. Enable interruptions from the board using the function Events.attachInt

  3. Put the mote to sleep with the functions PWR.sleep or PWR.deepSleep

  4. When the mote wakes up, disable interruptions from the board using function Events.detachInt

  5. Load the value stored in the shift register with function Events.loadInt

  6. Process the interruption

  7. Return to step 3 to enable interruptions and put the mote to sleep

In case the data acquired from the board is to be sent through any of the wireless communication modules it is highly recommended to use the Waspmote Frame format. You can find more information about how to handle the Waspmote Frame in the Programming Guide in the Development Section of the Libelium website.

The files of the Events Sensor Board itself are: WaspSensorEvent_v30.cpp, WaspSensorEvent_v30.h

They can be downloaded from: https://development.libelium.com/waspmote/sdk_and_applications

Last updated