Development

Sensors / Gases Board v30:

» Ga v30 10: SV sensor

Turn on the Gases Board v30 and read the SV sensor every second, printing the result through the USB

Required Materials

1 x Waspmote
1 x Battery
1 x MiniUSB wire
1 x Gases Board v30
1 x SV sensor

Notes

- This example is valid only for Waspmote v15

Code

/*  
 *  ------ [Ga_v30_10] Solvent Vapors Sensor reading for v30  -------- 
 *  
 *  Explanation: Turn on the Gases Board v30 and read the SV
 *  sensor every second, printing the result through the USB
 *  
 *  Copyright (C) 2016 Libelium Comunicaciones Distribuidas S.L. 
 *  http://www.libelium.com 
 *  
 *  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  
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
 *  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 <http://www.gnu.org/licenses/>.  
 *  
 *  Version:           3.0
 *  Design:            David Gascón 
 *  Implementation:    Ahmad Saad
 */
    
// Library include
#include <WaspSensorGas_v30.h>
#include <WaspFrame.h>

// Solvent Vapors Sensor must be connected physically in SOCKET_6 or SOCKET_7
SVSensorClass SVSensor(SOCKET_7); 

// Concentratios used in calibration process
#define POINT1_PPM_SV 10.0  // <-- Normal concentration in air
#define POINT2_PPM_SV 50.0 
#define POINT3_PPM_SV 100.0  

// Calibration voltages obtained during calibration process (in KOHMs)
#define POINT1_RES_SV 45.25  // <-- Rs at normal concentration in air
#define POINT2_RES_SV 25.50
#define POINT3_RES_SV 3.55

// Define the number of calibration points
#define numPoints 3

float concentrations[] = { POINT1_PPM_SV, POINT2_PPM_SV, POINT3_PPM_SV };
float voltages[] =       { POINT1_RES_SV, POINT2_RES_SV, POINT3_RES_SV };

char node_ID[] = "SV_example";

void setup() 
{
  // Calculate the slope and the intersection of the logarithmic function
  SVSensor.setCalibrationPoints(voltages, concentrations, numPoints);
  
  // Configure the USB port
  USB.ON();
  USB.println(F("Solvent Vapors Sensor reading for v30..."));

  ///////////////////////////////////////////
  // 1. Turn on the board and the SOCKET
  /////////////////////////////////////////// 
  
  // Switch ON and configure the Gases Board
  Gases.ON();  
  // Switch ON the sensor socket
  SVSensor.ON();
}

void loop() 
{  
  //////////////////////////////////////////
  // 2. Read sensors
  /////////////////////////////////////////
  
  float SVVol = SVSensor.readVoltage();       // Voltage value of the sensor
  float SVRes = SVSensor.readResistance();    // Resistance of the sensor
  float SVPPM = SVSensor.readConcentration(); // PPM value of Solvent Vapor sensor

  // Print of the results
  USB.print(F("Solvent Vapors Sensor Voltage: "));
  USB.print(SVVol);
  USB.print(F(" V |"));
  
  // Print of the results
  USB.print(F(" Solvent Vapors Sensor Resistance: "));
  USB.print(SVRes);
  USB.print(F(" Ohms |"));

  // Print of the results
  USB.print(F(" Solvent Vapors concentration Estimated: "));
  USB.print(SVPPM);
  USB.println(F(" PPM"));

  ///////////////////////////////////////////
  // 3. Create ASCII frame
  /////////////////////////////////////////// 

  // Create new frame (ASCII)
  frame.createFrame(ASCII, node_ID);
  // Add VOC PPM value
  frame.addSensor(SENSOR_GASES_SV, SVPPM);
  // Show the frame
  frame.showFrame();
  
  delay(1000);  
}




Output

H#
Solvent Vapors Sensor reading for v30...
Solvent Vapors Sensor Voltage: 2.3680553436 V | Solvent Vapors Sensor Resistance: 6057.3320312500 Ohms | Solvent Vapors concentration Estimated: 92.3876037597 PPM
===============================
Current ASCII Frame:
Length: 46
Frame Type: 134
frame (HEX): 3C3D3E860123343131383730363344393337343246342353565F6578616D706C6523302353563A39322E33383823
frame (STR): <=>�#41187063D93742F4#SV_example#0#SV:92.388#
===============================
Solvent Vapors Sensor Voltage: 2.3680553436 V | Solvent Vapors Sensor Resistance: 6057.3320312500 Ohms | Solvent Vapors concentration Estimated: 92.3876037597 PPM
===============================
Current ASCII Frame:
Length: 46
Frame Type: 134
frame (HEX): 3C3D3E860123343131383730363344393337343246342353565F6578616D706C6523312353563A39322E33383823
frame (STR): <=>�#41187063D93742F4#SV_example#1#SV:92.388#
===============================
Solvent Vapors Sensor Voltage: 2.3680553436 V | Solvent Vapors Sensor Resistance: 6057.3320312500 Ohms | Solvent Vapors concentration Estimated: 92.3876037597 PPM
===============================
Current ASCII Frame:
Length: 46
Frame Type: 134
frame (HEX): 3C3D3E860123343131383730363344393337343246342353565F6578616D706C6523322353563A39322E33383823
frame (STR): <=>�#41187063D93742F4#SV_example#2#SV:92.388#
===============================
Solvent Vapors Sensor Voltage: 2.3680553436 V | Solvent Vapors Sensor Resistance: 6057.3320312500 Ohms | Solvent Vapors concentration Estimated: 92.3876037597 PPM
===============================
Current ASCII Frame:
Length: 46
Frame Type: 134
frame (HEX): 3C3D3E860123343131383730363344393337343246342353565F6578616D706C6523332353563A39322E33383823
frame (STR): <=>�#41187063D93742F4#SV_example#3#SV:92.388#
===============================
Solvent Vapors Sensor Voltage: 2.3680553436 V | Solvent Vapors Sensor Resistance: 6057.3320312500 Ohms | Solvent Vapors concentration Estimated: 92.3876037597 PPM
===============================
Current ASCII Frame:
Length: 46
Frame Type: 134
frame (HEX): 3C3D3E860123343131383730363344393337343246342353565F6578616D706C6523342353563A39322E33383823
frame (STR): <=>�#41187063D93742F4#SV_example#4#SV:92.388#
===============================
Solvent Vapors Sensor Voltage: 2.3680553436 V | Solvent Vapors Sensor Resistance: 6057.3320312500 Ohms | Solvent Vapors concentration Estimated: 92.3876037597 PPM
===============================
Current ASCII Frame:
Length: 46
Frame Type: 134
frame (HEX): 3C3D3E860123343131383730363344393337343246342353565F6578616D706C6523352353563A39322E33383823
frame (STR): <=>�#41187063D93742F4#SV_example#5#SV:92.388#
===============================
Solvent Vapors Sensor Voltage: 2.3680553436 V | Solvent Vapors Sensor Resistance: 6057.3320312500 Ohms | Solvent Vapors concentration Estimated: 92.3876037597 PPM
===============================
Current ASCII Frame:
Length: 46
Frame Type: 134
frame (HEX): 3C3D3E860123343131383730363344393337343246342353565F6578616D706C6523362353563A39322E33383823
frame (STR): <=>�#41187063D93742F4#SV_example#6#SV:92.388#
===============================
Solvent Vapors Sensor Voltage: 2.3680553436 V | Solvent Vapors Sensor Resistance: 6057.3320312500 Ohms | Solvent Vapors concentration Estimated: 92.3876037597 PPM
===============================
Current ASCII Frame:
Length: 46
Frame Type: 134
frame (HEX): 3C3D3E860123343131383730363344393337343246342353565F6578616D706C6523372353563A39322E33383823
frame (STR): <=>�#41187063D93742F4#SV_example#7#SV:92.388#
===============================
Solvent Vapors Sensor Voltage: 2.3680553436 V | Solvent Vapors Sensor Resistance: 6057.3320312500 Ohms | Solvent Vapors concentration Estimated: 92.3876037597 PPM
===============================
Current ASCII Frame:
Length: 46
Frame Type: 134
frame (HEX): 3C3D3E860123343131383730363344393337343246342353565F6578616D706C6523382353563A39322E33383823
frame (STR): <=>�#41187063D93742F4#SV_example#8#SV:92.388#
===============================
Solvent Vapors Sensor Voltage: 2.3680553436 V | Solvent Vapors Sensor Resistance: 6057.3320312500 Ohms | Solvent Vapors concentration Estimated: 92.3876037597 PPM
===============================
Current ASCII Frame:
Length: 46
Frame Type: 134
frame (HEX): 3C3D3E860123343131383730363344393337343246342353565F6578616D706C6523392353563A39322E33383823
frame (STR): <=>�#41187063D93742F4#SV_example#9#SV:92.388#
===============================
Solvent Vapors Sensor Voltage: 2.3680553436 V | Solvent Vapors Sensor Resistance: 6057.3320312500 Ohms | Solvent Vapors concentration Estimated: 92.3876037597 PPM
===============================
Current ASCII Frame:
Length: 47
Frame Type: 134
frame (HEX): 3C3D3E860123343131383730363344393337343246342353565F6578616D706C652331302353563A39322E33383823
frame (STR): <=>�#41187063D93742F4#SV_example#10#SV:92.388#
===============================
Solvent Vapors Sensor Voltage: 2.3680553436 V | Solvent Vapors Sensor Resistance: 6057.3320312500 Ohms | Solvent Vapors concentration Estimated: 92.3876037597 PPM
===============================
Current ASCII Frame:
Length: 47
Frame Type: 134
frame (HEX): 3C3D3E860123343131383730363344393337343246342353565F6578616D706C652331312353563A39322E33383823
frame (STR): <=>�#41187063D93742F4#SV_example#11#SV:92.388#
===============================
Solvent Vapors Sensor Voltage: 2.3680553436 V | Solvent Vapors Sensor Resistance: 6057.3320312500 Ohms | Solvent Vapors concentration Estimated: 92.3876037597 PPM
===============================
Current ASCII Frame:
Length: 47
Frame Type: 134
frame (HEX): 3C3D3E860123343131383730363344393337343246342353565F6578616D706C652331322353563A39322E33383823
frame (STR): <=>�#41187063D93742F4#SV_example#12#SV:92.388#
===============================
Solvent Vapors Sensor Voltage: 2.3680553436 V | Solvent Vapors Sensor Resistance: 6057.3320312500 Ohms | Solvent Vapors concentration Estimated: 92.3876037597 PPM
===============================
Current ASCII Frame:
Length: 47
Frame Type: 134
frame (HEX): 3C3D3E860123343131383730363344393337343246342353565F6578616D706C652331332353563A39322E33383823
frame (STR): <=>�#41187063D93742F4#SV_example#13#SV:92.388#
===============================
Solvent Vapors Sensor Voltage: 2.3680553436 V | Solvent Vapors Sensor Resistance: 6057.3320312500 Ohms | Solvent Vapors concentration Estimated: 92.3876037597 PPM
===============================
Current ASCII Frame:
Length: 47
Frame Type: 134
frame (HEX): 3C3D3E860123343131383730363344393337343246342353565F6578616D706C652331342353563A39322E33383823
frame (STR): <=>�#41187063D93742F4#SV_example#14#SV:92.388#
===============================
Solvent Vapors Sensor Voltage: 2.3680553436 V | Solvent Vapors Sensor Resistance: 6057.3320312500 Ohms | Solvent Vapors concentration Estimated: 92.3876037597 PPM
===============================
Current ASCII Frame:
Length: 47
Frame Type: 134
frame (HEX): 3C3D3E860123343131383730363344393337343246342353565F6578616D706C652331352353563A39322E33383823
frame (STR): <=>�#41187063D93742F4#SV_example#15#SV:92.388#
===============================
Solvent Vapors Sensor Voltage: 2.3680553436 V | Solvent Vapors Sensor Resistance: 6057.3320312500 Ohms | Solvent Vapors concentration Estimated: 92.3876037597 PPM
===============================
Current ASCII Frame:
Length: 47
Frame Type: 134
frame (HEX): 3C3D3E860123343131383730363344393337343246342353565F6578616D706C652331362353563A39322E33383823
frame (STR): <=>�#41187063D93742F4#SV_example#16#SV:92.388#
===============================
Solvent Vapors Sensor Voltage: 2.3680553436 V | Solvent Vapors Sensor Resistance: 6057.3320312500 Ohms | Solvent Vapors concentration Estimated: 92.3876037597 PPM
===============================
Current ASCII Frame:
Length: 47
Frame Type: 134
frame (HEX): 3C3D3E860123343131383730363344393337343246342353565F6578616D706C652331372353563A39322E33383823
frame (STR): <=>�#41187063D93742F4#SV_example#17#SV:92.388#
===============================
Solvent Vapors Sensor Voltage: 2.3680553436 V | Solvent Vapors Sensor Resistance: 6057.3320312500 Ohms | Solvent Vapors concentration Estimated: 92.3876037597 PPM
===============================
Current ASCII Frame:
Length: 47
Frame Type: 134
frame (HEX): 3C3D3E860123343131383730363344393337343246342353565F6578616D706C652331382353563A39322E33383823
frame (STR): <=>�#41187063D93742F4#SV_example#18#SV:92.388#
===============================
Solvent Vapors Sensor Voltage: 2.3680553436 V | Solvent Vapors Sensor Resistance: 6057.3320312500 Ohms | Solvent Vapors concentration Estimated: 92.3876037597 PPM
===============================
Current ASCII Frame:
Length: 47
Frame Type: 134
frame (HEX): 3C3D3E860123343131383730363344393337343246342353565F6578616D706C652331392353563A39322E33383823
frame (STR): <=>�#41187063D93742F4#SV_example#19#SV:92.388#
===============================
Solvent Vapors Sensor Voltage: 2.3680553436 V | Solvent Vapors Sensor Resistance: 6057.3320312500 Ohms | Solvent Vapors concentration Estimated: 92.3876037597 PPM
===============================
Current ASCII Frame:
Length: 47
Frame Type: 134
frame (HEX): 3C3D3E860123343131383730363344393337343246342353565F6578616D706C652332302353563A39322E33383823
frame (STR): <=>�#41187063D93742F4#SV_example#20#SV:92.388#
===============================
Solvent Vapors Sensor Voltage: 2.3680553436 V | Solvent Vapors Sensor Resistance: 6057.3320312500 Ohms | Solvent Vapors concentration Estimated: 92.3876037597 PPM
===============================
Current ASCII Frame:
Length: 47
Frame Type: 134
frame (HEX): 3C3D3E860123343131383730363344393337343246342353565F6578616D706C652332312353563A39322E33383823
frame (STR): <=>�#41187063D93742F4#SV_example#21#SV:92.388#
===============================
Solvent Vapors Sensor Voltage: 2.3680553436 V | Solvent Vapors Sensor Resistance: 6057.3320312500 Ohms | Solvent Vapors concentration Estimated: 92.3876037597 PPM
===============================
Current ASCII Frame:
Length: 47
Frame Type: 134
frame (HEX): 3C3D3E860123343131383730363344393337343246342353565F6578616D706C652332322353563A39322E33383823
frame (STR): <=>�#41187063D93742F4#SV_example#22#SV:92.388#
===============================
Solvent Vapors Sensor Voltage: 2.3680553436 V | Solvent Vapors Sensor Resistance: 6057.3320312500 Ohms | Solvent Vapors concentration Estimated: 92.3876037597 PPM
===============================
Current ASCII Frame:
Length: 47
Frame Type: 134
frame (HEX): 3C3D3E860123343131383730363344393337343246342353565F6578616D706C652332332353563A39322E33383823
frame (STR): <=>�#41187063D93742F4#SV_example#23#SV:92.388#
===============================
Solvent Vapors Sensor Voltage: 2.3680553436 V | Solvent Vapors Sensor Resistance: 6057.3320312500 Ohms | Solvent Vapors concentration Estimated: 92.3876037597 PPM
===============================
Current ASCII Frame:
Length: 47
Frame Type: 134
frame (HEX): 3C3D3E860123343131383730363344393337343246342353565F6578616D706C652332342353563A39322E33383823
frame (STR): <=>�#41187063D93742F4#SV_example#24#SV:92.388#
===============================
Solvent Vapors Sensor Voltage: 2.3680553436 V | Solvent Vapors Sensor Resistance: 6057.3320312500 Ohms | Solvent Vapors concentration Estimated: 92.3876037597 PPM
===============================
Current ASCII Frame:
Length: 47
Frame Type: 134
frame (HEX): 3C3D3E860123343131383730363344393337343246342353565F6578616D706C652332352353563A39322E33383823
frame (STR): <=>�#41187063D93742F4#SV_example#25#SV:92.388#
===============================
Solvent Vapors Sensor Voltage: 2.3680553436 V | Solvent Vapors Sensor Resistance: 6057.3320312500 Ohms | Solvent Vapors concentration Estimated: 92.3876037597 PPM
===============================
Current ASCII Frame:
Length: 47
Frame Type: 134
frame (HEX): 3C3D3E860123343131383730363344393337343246342353565F6578616D706C652332362353563A39322E33383823
frame (STR): <=>�#41187063D93742F4#SV_example#26#SV:92.388#
===============================
Solvent Vapors Sensor Voltage: 2.3680553436 V | Solvent Vapors Sensor Resistance: 6057.3320312500 Ohms | Solvent Vapors concentration Estimated: 92.3876037597 PPM
===============================
Current ASCII Frame:
Length: 47
Frame Type: 134
frame (HEX): 3C3D3E860123343131383730363344393337343246342353565F6578616D706C652332372353563A39322E33383823
frame (STR): <=>�#41187063D93742F4#SV_example#27#SV:92.388#
===============================
Solvent Vapors Sensor Voltage: 2.3680553436 V | Solvent Vapors Sensor Resistance: 6057.3320312500 Ohms | Solvent Vapors concentration Estimated: 92.3876037597 PPM
===============================
Current ASCII Frame:
Length: 47
Frame Type: 134
frame (HEX): 3C3D3E860123343131383730363344393337343246342353565F6578616D706C652332382353563A39322E33383823
frame (STR): <=>�#41187063D93742F4#SV_example#28#SV:92.388#
===============================
...

Quick Publish: