Development v12

Warning - Product Update

All the resources present on this section belong to Waspmote v12, Waspmote Plug & Sense! v12 and Meshlium v3.8.

If you have a Waspmote v15, Waspmote Plug & Sense! v15 or Meshlium v4.0 please go to the new Development Section.

Check what is your version and what are the differences between the old and the new one in this document.

» Ga 07: Socket2B Sensor Reading

In this example the Gases 2.0 board and socket 2B are turned on, waiting for the minimum heating time and then reading the sensor every second while printing the output voltage and sensor resistance through the USB.

Required Materials

1 x Waspmote
1 x Battery
1 x Gases 2.0 board
1 x Socket 2B valid sensor:
- MiCS 2610
- MiCS 5521


* Remember to connect the battery to Waspmote for proper operation.
* The connection of the sensor is described in the Gases 2.0 technical guide.
* The sensor gain and load resistor have been adjusted to operate with a given unit of a MiCS 2610 sensor, they will depend on the sensor used and the application, for more information about how to select this parameters take a look at the Gases 2.0 board technical guide.
* This example can only be executed in Waspmote v12


 *  ------ [Ga_7] - Socket2B Reading for Gases v20-------- 
 *  Explanation: Turn on the Gases Board v20 and reads the sensor
 *  placed on socket 2B every second, printing the result
 *  through the USB
 *  Copyright (C) 2012 Libelium Comunicaciones Distribuidas S.L. 
 *  This program is free software: you can redistribute it and/or modify 
 *  it under the terms of the GNU General Public License as published by 
 *  the Free Software Foundation, either version 3 of the License, or 
 *  (at your option) any later version. 
 *  This program is distributed in the hope that it will be useful, 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of 
 *  GNU General Public License for more details. 
 *  You should have received a copy of the GNU General Public License 
 *  along with this program.  If not, see <>. 
 *  Version:           0.1 
 *  Design:            David Gascón 
 *  Implementation:    

#include <WaspSensorGas_v20.h>

#define GAIN  1      //GAIN of the sensor stage
#define RESISTOR 20  //LOAD RESISTOR of the sensor stage

// Variable to store the read value
float socket2BVal;

void setup()
  // Turn on the USB and print a start message

  // Turn on the sensor board

  // Configure the 2B sensor socket
  SensorGasv20.configureSensor(SENS_SOCKET2B, GAIN, RESISTOR);

  // Turn on the RTC
  // Turn on the sensor on socket 2B and wait for stabilization and
  // sensor response time
  SensorGasv20.setSensorMode(SENS_ON, SENS_SOCKET2B);
void loop()
  // Read the sensor 
  socket2BVal = SensorGasv20.readValue(SENS_SOCKET2B);
  // Print the result through the USB
  USB.print(F("SOCKET2B: "));
  USB.print(F("V - "));
  // Conversion from voltage into kiloohms
  socket2BVal = SensorGasv20.calculateResistance(SENS_SOCKET2B, socket2BVal, GAIN, RESISTOR);
  USB.println(" kohms");


SOCKET2B: 1.8903225898V - 9.8295774459 kohms
SOCKET2B: 1.8806451797V - 9.9852657318 kohms
SOCKET2B: 1.8741933822V - 10.0899553298 kohms
SOCKET2B: 1.8677419662V - 10.1953611373 kohms

Quick Publish: