Hi,
I have interfaced gas sensor through I2C interface to arduino due board. When I compiled this program, I got all values 0. Please help me to read the sensor data. I have attached the sensor datasheet document. Below is my code what I have written to read the sensor data, if there is any mistake please give me the solution.
iAQ-core_Datasheet_EN_v1.pdf (613 KB)
Perhaps you might get more help if you post your wiring diagram.
Hi,
Herewith I have attached my wiring diagrams. If there is any mistake please let me know as soon as possible.
Give this a try:
#include "Wire.h"
#define iaqaddress 0x5A
uint16_t predict;
uint8_t statu;
int32_t resistance;
uint16_t tvoc;
void setup()
{
Serial.begin(9600);
Wire.begin();
}
void loop()
{
readAllBytes();
checkStatus();
Serial.print("CO2:");
Serial.print(predict);
Serial.print(", Status:");
Serial.print(statu, HEX);
Serial.print(", Resistance:");
Serial.print(resistance);
Serial.print(", TVoC:");
Serial.println(tvoc);
delay(2000);
}
void readAllBytes()
{
Wire.requestFrom(iaqaddress, 9);
predict = (Wire.read()<< 8 | Wire.read());
statu = Wire.read();
resistance = (Wire.read()& 0x00)| (Wire.read()<<16)| (Wire.read()<<8| Wire.read());
tvoc = (Wire.read()<<8 | Wire.read());
}
void checkStatus()
{
if(statu == 0x10)
{
Serial.println("Warming up...");
}
else if(statu == 0x00)
{
Serial.println("Ready");
}
else if(statu == 0x01)
{
Serial.println("Busy");
}
else if(statu == 0x80)
{
Serial.println("Error");
}
else
Serial.println("No Status, check module");
}
I have the same module, and that is working for me. The 0xB5 address mentioned in the data sheet is misleading as it's just referring to the 0x5A address with a 1 added to the rightmost side or rather the address with a read bit added on, which wire.read() does automatically. I borrowed your bit math to figure the rest out. The key point in the data sheet is that the module has an internal timer that waits about 5 minutes before the module is warmed up and ready. I added a function that checks the status. Hope that helps.
Looking more closely at your photo, it looks like you have 47 Ohm resistors (Yellow,Violet,Black) as your pull-ups. You should switch those out for some 4.7KOhm resistors (Yellow,Violet,Red). That's a more standard value for pull-ups. If that doesn't work then the module may be damaged. I powered mine with 5V accidentally, but it seems to have survived.
Joel_E_B:
Looking more closely at your photo, it looks like you have 47 Ohm resistors (Yellow,Violet,Black) as your pull-ups. You should switch those out for some 4.7KOhm resistors (Yellow,Violet,Red). That's a more standard value for pull-ups. If that doesn't work then the module may be damaged. I powered mine with 5V accidentally, but it seems to have survived.
Those resistors are 4.7kΩ.
5-band resistor colour chart
Thank you all. Now its working. Problem is with the 3.3V power circuit.
Hi, I am new to arduino progrogramming. I am using LGAQS-HT01 CO2/VOC/Temp/Humidity gas sensor which is similar to iAQ-Core used here. The difference is that of pins, LG has 10, iAQ has 6. But the details supplied by supplier for LG are practically the same as that are for iAQ. The pin connections to microcontroller are exactly the same. I followed the code posted by Joel_E_B and the connections from LGAQS-HT01 to Arduino Due as done by sarathkumark77.
I get the following error
No Status, check module
CO2:65535, Status:FF, Resistance:-1, TVoC:65535
Can anyone help?
Hi,
LGAQS-HT01 although being externally visually similar to iAQ-Core, has a totally different hardware.
After serching a while and reading chinese datasheet for this sensor, it is in fact a combination of a CCS811 C02/tVOC sensor chip from AMS and a Si7021 (or compatible) from Sillicon Labs in a compact shell.
This sensor reply to 2 different I2C addresses, 0x40 and 0x5A, which are effectively addresses of these two chips.
You can gather data using Arduino libraries for these 2 sensors. I successfully tested it myself.
Thanks weirdchaos for the reply. Good that you told about the the temp/humidity IC, i could not find it anywhere. I used the Arduino code for CCS811 and it gives values for CO2 and TVOC but I could not get the values for temp and humidity. Now as you explain it must be some other way around. Can you please share with me the Arduino code that you say works for you? my email ahmedriazku@yahoo.com My work is non-commercial and purely academic.
For the Temperature/humidity you can use Adafruit's library: GitHub - adafruit/Adafruit_Si7021: Arduino library for Adafruit Si7021
And for the CCS811 you can use SparkFun's library: https://github.com/sparkfun/CCS811_Air_Quality_Breakout/tree/master/Libraries/Arduino
Concerning this sensor, there is also a formaldehyde sensor inside, it's analog and is connected to pin 1 (C2D). But I don't know which kind of sensor it is nor how to compute the formaldehyde concentration from the analog reading.
Temperature/Humidity values reported by this sensor are somewhat altered by the presence of the formaldehyde sensor which seems to produce some heat inside the sensor.
weirdchaos:
Hi,
LGAQS-HT01 although being externally visually similar to iAQ-Core, has a totally different hardware.
After serching a while and reading chinese datasheet for this sensor, it is in fact a combination of a CCS811 C02/tVOC sensor chip from AMS and a Si7021 (or compatible) from Sillicon Labs in a compact shell.
This sensor reply to 2 different I2C addresses, 0x40 and 0x5A, which are effectively addresses of these two chips.
You can gather data using Arduino libraries for these 2 sensors. I successfully tested it myself.
any chance you could post the datasheet you used?