Hi all,
I am working on a project that uses VOC (Volatile Organic Compounds) sensor to sense the indoor air quality. Specifically, I want to connect my Arduino ethernet board to the VOC sensor from AppliedSensor Inc.. The VOC sensor from AppliedSensor I bought is called iAQ-engine, which only supports I2C communication. (product link: http://www.appliedsensor.com/pdfs/APS_iAQEngine_0411.pdf)
There is no datasheet for the iAQ-engine. However, there is another VOC sensor called iAQ-2000 from the same company and is acclaimed by the company staff that both are exact the same sensor except that iAQ-2000 could support more communication protocols such as RS232.
Therefore, I followed the application note of iAQ-2000 (see the attachment PDF file and please only look at the I2C part). However, there is only limited information there, and I am also new to I2C.
Based on the application note and what I am understanding to I2C, I wrote the code. However, the sensor readings are constant 0.
I have two confusions:
- I am not sure if my understanding to the I2C address of the VOC sensor is right. My guessed I2C address is: 0xB5
- I could not find the register number and the read command from the application note. If they are necessary, why the note does not provide them?
Here is my code:
#include <Wire.h>
#define VOC_ADDRESS 0xB5 // I2C address of iAQ-engine: 10110101
void setup()
{
Serial.begin(9600);
Wire.begin();
}
void loop()
{
// read the VOC value
int VOCValue = readVOC();
Serial.print("VOC Value: ");
Serial.println(VOCValue);
// wait for 5 seconds for next reading
delay(5000);
}
///////////////////////////////////////////////////////////////////
// Function: int readVOC()
// Returns : VOC Value
///////////////////////////////////////////////////////////////////
int readVOC()
{
int voc_value = 0;
Wire.beginTransmission(VOC_ADDRESS);
Wire.write(0);
Wire.endTransmission();
delay(20);
Wire.requestFrom(VOC_ADDRESS, 2);
byte i = 0;
byte buffer[2] = {0, 0};
while(Wire.available()){
buffer = Wire.read();
i++;
}
voc_value = (int) buffer[0]<<8 | buffer[1];
return voc_value;
}
Please help me and I appreciate your helps very much.
Sincerely,
Michael
Moderator edit:
</mark> <mark>[code]</mark> <mark>
</mark> <mark>[/code]</mark> <mark>
tags added.
iAQ-2000_VOC_Interface_I2C.pdf (335 KB)