Need Help With WaveShare VOC Sensor

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 .

#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

}

for a start initialise the Serial before attempting to initialise the SGP40, e.g.

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

what microcontroller are you using?
give a link to the particular SGP40?

if i'm honest i don't know what micro controller is. i am using an ardunio uno board. the link to the product is here. Digital SGP40 VOC (Volatile Organic Compounds) Sensor, I2C Bus

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.