Adding TVOC to the AirGradient

Once I had my baseline AirGradient sensors built and configured, I wanted to add a few more sensors to it. One of the sensors to be added is an SGP30 TVOC sensor (Total Volatile Organic Compounds).

The AirGradient Saga

  1. Making the AirGradient DIY
  2. Adding an LPS22 to AirGradient and Building a Custom Sensor in EspHome
  3. Adding TVOC to the AirGradient
  4. The Indoor Air Quality (UK) HACS Integration and Sensor


  • AirGradient DIY
  • SGP30
  • Ribbon cable


The pin layout for the SGP30 board is different from the I2C block on the AirGradient DIY PCB. The SCL and SDA pins are reversed, due to this you’ll need to use a ribbon cable to wire it in, you can’t use a pin header. VIN on the sensor should be hooked up to 3v on the AirGradient board.

The documentation says that the sensor takes 10 hours to generate a baseline value before it will start outputting data. Make sure to record this baseline value after the first startup and generation of it, then put it back into the configs so that it can be used later. This will help the startup process be faster. I didn’t encounter this behavior though in my work. I did give my sensors some time on startup though.

The AirGradient documentation mentions removing the pull up resistors on the temperature sensor in order to allow the TVOC sensor to work. I tried leaving these on to see if I could save some time and effort and below is the result.

Unknown TVOC Values

After trying to use the TVOC sensor without removing the temperature sensor’s pull-up resistors, I found the only values output by it were either “unavailable”, or “unknown”. Only after removing the temperature sensor pull-up resistors did I get proper values out of the TVOC sensor. These are the surface mount resistors shown below highlighted in red. This sensor is a bit more sensitive than others to this (I was able to get an LPS22 to work fine with the pull up resistors in place).

Step up Resistors

Be careful when removing the step up resistors to not damage the other surface mount components nearby. There is some decent space around things to make it a bit easier. I used a forceps to pull on the resistors while I was heating them to remove them.

SHT3XD mounted and ready for surgery

Even with the step up resistors removed, I still have some oddities in my sensors. I made 3 of these customized airgradient sensors, and one of them doesn’t like the TVOC sensor, so these are a bit pickier. I found most of the issues were with the solder joints in my system, reheating them and getting cleaner joints helped considerably.

Flashing with Esphome

The esphome configuration for the sensor is pretty straight forward. The sensor provides a TVOC and eCO2 values as the main outputs, though it can also output the baseline values from the TVOC sensor. We do want to store the baseline values and since the AirGradient had temperature and humidity sensors already, we can use those for compensation values to get more accurate results. The sensor uses I2C address 0x58 that cannot be changed.

- platform: sgp30
id: wco2
name: "eCO2"
accuracy_decimals: 1
id: tvoc
name: "TVOC"
accuracy_decimals: 1
store_baseline: yes
address: 0x58
update_interval: 1s
temperature_source: temp
humidity_source: humidity
name: "eCO2 Baseline"
name: "TVOC Baseline"

The page on EspHome mentions that the sensor needs to be powered on for at least 10 hours to get a baseline reading, and then it should be available as output (mine has yet to output the baseline), and it has to regenerate the baseline on each re-flash unless you put it in the EspHome config for the sensor. I haven’t had any problems with startup times after flashing, it just starts outputting the TVOC after a minute or two.

Now that it’s all working, below is all the data being published to home assistant.

Good TVOC Values

I was building 3 AirGradient kits with these custom sensors, so once I got my first working, I tackled the other two. I had to reheat a few solder joints and get better connections to 2 of these builds. Once I had gotten all my connections to be perfect, then all my TVOC sensors started working.


Next time I work with TVOC sensors, I’ll take far more care in my soldering, or I’ll try to use pin headers on them instead of ribbon cable. Though while picky about my poor soldering skills, I’m still happy with how it all turned out. My AirGradient units are more capable than before and still fit well within their cases.


Leave a Reply