AGS02MA Air Quality Sensor

Hi there,

I'm trying to test out the AGS02MA TVOC MEMS Air Quality Sensor on Arduino UNO, but as a result I always getting 65535 ppb value.

I don't know really where is the issue.

Is someone here has the same sensor used already?

Thanks for the help!

Full documentation attached.

AGS02MA_User_Manual.pdf (441.9 KB) (7.1 KB)

You're using the example in that librry? What's your circuit?

Yes, UNO + Sensor with 2x 4.7k pull-up resistor.

At first glance, I can spot already three problems:

  1. The datasheet was updated that the I2C bus should be < 30kHz. That means that there is a bug in the sensor. I don't know if the Arduino Uno can do 30kHz. It can do 50kHz with Wire.setClock(50000L) after Wire.begin().
  2. The library function readData() has a _pWire->endTransmission() after the _pWire->RequestFrom(...). That is a bug and it might disturb the I2C bus.
  3. The library function writeCommand() has a delay(3) while writing data. That is totally useless. They are probably trying to fix something, but this solution will fix nothing.

Yeah, someone was trying to be smart here.
The provided Library was badly reworked from AGS01DB to AGS02MA

Do you know if that AGS02MA library does work, perhaps not at all.
It says that it was tested, but that is just the readme file that was copied from the AGS01DB.

The lowest clock speed seems to be 31kHz with the normal Arduino functions:

Try 31kHz with Wire.setClock and then you have to try the software until it works.

I have even doubts about the note in the datasheet that the I2C clock must be 30kHz or lower. There is probably a glitch or delay at a certain point, for example with the acknowledge. If it is something like that, then it can be solved with a software I2C library.

The AGS02MA library doesn't work at all.

I will try something about it.