>>> Join Us in the Fight Against Air Pollution

AirGradient Forum

Adding CO2 calibration to the firmware

I just got my One v9 a while back. Since ONE_v9.ino is very readable (that’s for keeping it that way!), I decided to just keep it but point APIROOT to a local server. (Then I made some small changes so the LED displays other sensor values.)

From the most recent thread Model number for CO2 calibration? I see that CO2 recalibration isn’t done. So I wanted to add the part of C02_CALIBRATION (sic) that does this.

Is there anything irreversibly bad that can happen if I run the wrong commands in firmware? As in something that breaks the sensor?

Is this basically what’s needed? Plus error checking. EDIT: added crucial missing line.

S8_UART * sensor_S8;
S8_sensor sensor;
sensor_S8->get_firmware_version(sensor.firm_version);
sensor.sensor_id = sensor_S8->get_sensor_ID();
sensor_S8->manual_calibration()

then poll this in a loop until its true

sensor.ack = sensor_S8->get_acknowledgement();
if (sensor.ack & S8_MASK_CO2_BACKGROUND_CALIBRATION) {
  // Done calibration
}

Thanks.

Some other notes:

  1. Some of the library names at the top of ONE_v9.ino don’t quite match if you try to install it through arduino-cli instead of search inside Arduino’s UI. Here’s how I ended up installing all dependencies.

    arduino-cli lib install “Adafruit NeoPixel”
    arduino-cli lib install arduino-sht
    arduino-cli lib install S8_UART
    arduino-cli lib install “PMS Library”
    arduino-cli lib install “Sensirion Gas Index Algorithm”
    arduino-cli lib install “Sensirion I2C SGP41”
    arduino-cli lib install U8g2
    arduino-cli lib install WiFiManager

    arduino-cli lib install “AirGradient Air Quality Sensor”

  2. There’s references to the blink example on various Airgradient pages but there’s no blink example for newer hardware.

For example, here The AirGradient ONE Air Quality Sensor (Presoldered-Version, PCB Version 9) “Then flash this code the same way you flashed the BLINK example”

I’m still looking for an answer to this if anyone knows.