Humidity control terrarium

Hey,
I have a raspberry pi 3 model B+ (2017) and want to make a humidification system where whenever humidity drops below 75% it turns on a humidifier and where it lets a fan blow every couple of hours. How would i do this?

Any help is greatly appreciated!

get a Seeed Xiao ESP32C3, or if you use Xiao ESP32S3 you can set up a webcam

May need these, depending on which module package you get, but for .20 get a few and stock up

and if you need better wifi range add

or

or

or

or

or

or

or

and

or

or

BE VERY CAREFUL WORKING WITH HIGH VOLTAGE AC ELECTRONICS

I am currently doing this but with more variables being controlled. You mention your running a fan every few hours
 what is the fan for? In a similar setup I also have to regulate fresh air exchange so what I am doing is using a Grove - Sensirion SCD41 which measures temperature, humidity, and CO2 all in the same sensor. When the CO2 ppm reaches a threshold I enable the fan to run until I achieve my target CO2 concentration. To control this all I have a Grove - 4-Channel SPDT Relay that is tied to a 2-Gang PVC Outlet Box with 2 15 Amp Residential Grade Grounding Duplex Outlets that are wired to the 4-channel relay. If this is of interest I can share some code with you.

Hi there,
That sounds like a proper setup, How do you calibrate the Co2 sensor, Span or Zero cal?
Can you show photo of it, the Gang box. So when you hit a PPM setpoint you turn on fan and Open Vent? or the reverse for some strains of GREEN plants. :sunglasses: :ok_hand:
having a greenhouse it’s been amazing how good tech can improve the results.
GL :slight_smile: PJ

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 :stuck_out_tongue_winking_eye:

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.

1 Like

Hi there,
Wow That is awesome. Yes, 100% nitrogen is plenty good for a zero calibration, What’s the max PPM detection of it. Really nice job on the code also.
GL :slight_smile: PJ

Thanks! The operating range of the SCD41 sensor is: -10~+60℃; 0-100% r.H.; 400-5,000 ppm. The SCD30 sensor is capable of: -40~+70℃; 0-100% r.H.; 400-10,000 ppm.

1 Like