Close

Humble beginnings

A project log for ATLAS

Built the tricorder I actually wanted in the field: one that warns, not just measures.

apollo-timbersApollo Timbers 06/10/2025 at 23:240 Comments

     So I was able to find one of the sensors I would like to have at the local Microcenter, The SGP30 Gas sensor. Took it home and found out it was a dud, after returning the new one started reporting right away. The following readings were a very "professional" test of me lighting a paper recipe near it lol...

This is just a prototype/get it working situation, I plan on getting all of them hooked up to a Pi Pico and working together/reporting. I then can expand the code to the display. Once all of that is goo I can look at the Sensor PCB. The switch PCB however should be able to be done sooner then later as it is relatively simple. 

I had a thought that once I do have them going it may be good to record sample sets in various areas, like a forest, my lab, the kitchen and so for so I build up a data set needed to help train the AI. 

eCO2: 406 ppm, TVOC: 0 ppb

✅ Air quality is excellent. No ventilation needed.

✅ No significant VOCs detected. Air is clean.

eCO2: 741 ppm, TVOC: 0 ppb

✅ Air quality is excellent. No ventilation needed.

✅ No significant VOCs detected. Air is clean.

eCO2: 2595 ppm, TVOC: 397 ppb

🚨 CO₂ is dangerously high! Leave within 5 min.

✅ No significant VOCs detected. Air is clean.

eCO2: 5655 ppm, TVOC: 1810 ppb

🚨 CO₂ is dangerously high! Leave within 5 min.

⚠️ Chemical odors detected—address within 15 min.

eCO2: 2683 ppm, TVOC: 1219 ppb

🚨 CO₂ is dangerously high! Leave within 5 min.

⚠️ Chemical odors detected—address within 15 min.

eCO2: 847 ppm, TVOC: 586 ppb

✅ Air quality is excellent. No ventilation needed.

⚠️ Chemical odors detected—address within 15 min.

Code...

import time
import board
import busio
import adafruit_sgp30

# Initialize I2C and sensors
i2c = busio.I2C(board.SCL, board.SDA)
sgp30 = adafruit_sgp30.Adafruit_SGP30(i2c)

# Function to classify risk level
def get_warning(eCO2, TVOC):
    warning = ""

    # CO₂ Alerts
    if eCO2 < 1000:
        warning += "✅ Air quality is excellent. No ventilation needed.\n"
    elif 1000 <= eCO2 < 2000:
        warning += "⚠️ CO₂ levels rising—consider ventilating within 10-15 min.\n"
    else:
        warning += "🚨 CO₂ is dangerously high! Leave within 5 min.\n"

    # VOC Alerts
    if TVOC < 500:
        warning += "✅ No significant VOCs detected. Air is clean.\n"
    elif 500 <= TVOC < 2000:
        warning += "⚠️ Chemical odors detected—address within 15 min.\n"
    else:
        warning += "🚨 High VOC levels! Leave within 5 min.\n"

    return warning

print("SGP30 Sensor Ready")

while True:
    eCO2, TVOC = sgp30.iaq_measure()
    print(f"eCO2: {eCO2} ppm, TVOC: {TVOC} ppb")

    # Generate warning message
    alert_message = get_warning(eCO2, TVOC)
    print(alert_message)

    time.sleep(1)

Discussions