So I am still in the experimental phase of this setup so nothing running in production yet. I am certainly open to any suggestions as air quality is a new venture for me
The CO2 calibration was done in a different manner as I donât have a way (That I am aware of) to do zero or span calibration as I am not sure how to isolate the sensor in a 0ppm co2 environment (They recommend 100% nitrogen rich for 0). The SCD4x comes defaulted with automatic calibration which I cannot use in a greenhouse environment as it is not routinely exposed to open âclean airâ. What I did is disabled auto-calibration and set the altitude adjustments for my location, then ran the forced calibration with a target PPM of 400 with the environment completely open and monitored for a week to see fluctuations. Following that I placed it in the isolated environment and continued monitoring with a fan on constant to observe any further fluctuation being restricted from open air. Both stayed between 400-500 ppm. To test an increase in co2, I lit a candle and enclosed it in the environment for about 10 second which shot my co2 levels up towards 2000ppm, which then decreased back down to ânormalâ once the fan had time to reintroduce fresh air.
Here is a code example for anyone interested:
import time
from sensirion_i2c_driver import LinuxI2cTransceiver, I2cConnection
from sensirion_i2c_scd import Scd4xI2cDevice
class SensirionMonitor(object):
def __init__(self, i2c_port, altitude, calibrate=False, target_ppm=400):
self.i2c_transceiver = LinuxI2cTransceiver(i2c_port)
# Create SCD4x device
self.scd4x = Scd4xI2cDevice(I2cConnection(self.i2c_transceiver))
# Make sure measurement is stopped, else we can't read serial number or
self.scd4x.stop_periodic_measurement()
print("scd4x Serial Number: {}".format(self.scd4x.read_serial_number()))
sensor_auto_calibration = self.scd4x.get_automatic_self_calibration()
if sensor_auto_calibration:
print('Setting scd41 sensor self calibration mode to False')
self.scd4x.set_automatic_self_calibration(False)
sensor_altitude = self.scd4x.get_sensor_altitude()
if sensor_altitude != altitude:
print('Setting scd41 sensor altitude to {}'.format(altitude))
self.scd4x.set_sensor_altitude(altitude)
if calibrate:
self.scd4x.perform_forced_recalibration(target_ppm)
# Start a new measurement
self.scd4x.start_periodic_measurement()
time.sleep(5)
def read_scd4x(self, farenheit=True):
co2, tempC, humidity = self.scd4x.read_measurement()
time.sleep(5)
if farenheit:
return round(co2.co2, 2), round(tempC.degrees_fahrenheit, 2), round(humidity.percent_rh, 2)
else:
return round(co2.co2, 2), round(tempC.degrees_celsius, 2), round(humidity.percent_rh, 2)
def close(self):
self.i2c_transceiver.close()
API reference: (https://sensirion.github.io/python-i2c-scd/index.html)
Regarding the vent, the setup currently has a filter disc to restrict and filter airflow. For my use case i didnât need anything fancy like vents on servos as small limited flow of air does not harm anything beyond potentially humidity.
Here is the current outlet / gang box I am using. The relay here is temporary as I now have the grove i2c relay so I wont have to wire directly to GPIO. The 2 gang box is an after construction box as I am working o a wooden enclosure to put all of this in so youâll notice it has tabs instead of nails.
I have some wire coming in today to wire up the new Grave 4-channel relay.