Waveshare VOC Sensor Issues

edited April 10 in User projects

i am using a SGP40 VOC Sensor and i'm having loads of issues and finding it hard to find information. currently its stuck on only outputting 0 and i dont know how to properly incorporate the Sensirion VOC class index. ignore the fanpin as that is part of the air purifier that i am designing. the VOC sensor is correctly connected i have triple checked this . i am using ardunio for this

#include <Debug.h>
#include <DEV_Config.h>
#include <sensirion_arch_config.h>
#include <sensirion_voc_algorithm.h>
#include <SGP40.h>

#include "DEV_Config.h" // libary for VOC sensor
#include "SGP40.h"      // libary for VOC sensor 

UBYTE voc = 0;

void setup() {
  if (SGP40_Init() != 0) {
    Serial.print("init err!!!"); // if theres an error in the VOC sensor return this

  }

  Serial.begin(9600);                // Initialize serial communication
}

void loop() {

  voc = SGP40_MeasureVOC(25, 50); // VOC sensor MeasureR aw(25, 50);
  Serial.print("voc = ");         // prints voc = to serial
  Serial.println(voc);            // prints raw voc level

}

Tagged:
Sign In or Register to comment.