Projects / Mushroom grow room humidity keeper

Mushroom grow room humidity keeper

Intermediate2 hGuided buildReviewed

Build it step by step

0 of 8 done
  1. NANOLM2596

    Set the buck output

    Adjust the LM2596 to 5.0 V with a meter.

  2. NANOSHT31ON24.7°C

    Wire the relays

    Connect the mist maker and fan through the two relays.

  3. NANO

    Test each load

    Switch them from a test sketch.

  4. NANO

    Add the sensor

    Mount it in the tent at mushroom height.

  5. NANOSHT3124.7°C

    Upload

    Breathe near the sensor to see the humidity rise.

  6. NANOSHT3124.8°C

    Check the fresh-air break

    Shorten FRESH_EVERY_MS to a minute and watch the fan run.

  7. NANOSHT3124.8°C

    Restore the times

    Set it back to one hour and five minutes.

  8. NANO

    Install

    Keep the electronics in a dry box outside the tent.

In short

How do you build a mushroom grow room humidity keeper?

A small 5 V mist maker and a fan keep a mushroom tent at 85 to 90 percent humidity with fresh air breaks for CO2. You need Arduino Nano, SHT31 temperature and humidity sensor, Relay module 2-channel 5 V, 5 V DC fan 40 mm, 12 V 2 A DC adapter, LM2596 Buck Module and 16x2 LCD with I2C backpack (PCF8574). It takes 8 steps and about 120 minutes.

Level
Intermediate
Time
About 120 min
Parts
7

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
12 V adapter +LM2596 IN+Supply
12 V adapter -LM2596 IN-Ground
LM2596 OUT+Nano 5V, relay module VCC and both relay COM terminalsSet to 5.0 V with a meter first
LM2596 OUT-Nano GND, relay module GND, fan - and mist maker -Common ground
Relay IN1Nano D6Mist maker control
Relay IN2Nano D7Fan control
Relay 1 NO5 V USB mist maker +Switched positive
Relay 2 NO5 V fan +Switched positive
SHT31 VCC and GNDNano 5V and GNDPower
SHT31 SDA and SCLNano A4 and A5I2C
LCD I2C SDA and SCLNano A4 and A5Display

Code

Oyster mushrooms fruit best at about 85 to 90 percent humidity with regular fresh air, because CO2 builds up in a closed tent and causes long stems and small caps. The controller turns the mist maker on below 85 and off above 90, and every hour runs the fan for five minutes with the mist off. If the sensor fails the mist stops. A small 5 V ultrasonic mist maker (the kind in a USB humidifier) keeps everything at low voltage; do not use a mains humidifier here without a qualified electrician. Keep the electronics and relays out of the wet air in a separate dry box, run the sensor on a short cable, and use clean water for the mist maker. Arduino IDE, board "Arduino Nano" (processor ATmega328P, or ATmega328P (Old Bootloader) for clones).

Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

// Libraries: Adafruit SHT31, LiquidCrystal_I2C.
#include <Wire.h>
#include <Adafruit_SHT31.h>
#include <LiquidCrystal_I2C.h>

Adafruit_SHT31 sht;
LiquidCrystal_I2C lcd(0x27, 16, 2);
const byte FOG = 6, FAN = 7;
const bool ACTIVE_LOW = true;
const float LOW_RH = 85.0, HIGH_RH = 90.0;
const unsigned long FRESH_EVERY_MS = 3600000UL;   // every hour
const unsigned long FRESH_LENGTH_MS = 300000UL;   // for five minutes
unsigned long lastFresh = 0;
bool fogOn = false, freshing = false;

void out(byte pin, bool on) { digitalWrite(pin, (on == ACTIVE_LOW) ? LOW : HIGH); }

void setup() {
  pinMode(FOG, OUTPUT); pinMode(FAN, OUTPUT);
  out(FOG, false); out(FAN, false);
  sht.begin(0x44);
  lcd.init(); lcd.backlight();
  lastFresh = millis();
}

void loop() {
  float h = sht.readHumidity(), t = sht.readTemperature();
  unsigned long now = millis();

  if (!freshing && now - lastFresh >= FRESH_EVERY_MS) { freshing = true; lastFresh = now; }
  if (freshing && now - lastFresh >= FRESH_LENGTH_MS) freshing = false;

  if (!isnan(h)) {
    if (!fogOn && h < LOW_RH) fogOn = true;
    if (fogOn && h > HIGH_RH) fogOn = false;
  } else {
    fogOn = false;                       // sensor failed: stop misting
  }
  out(FOG, fogOn && !freshing);          // no mist while the fan clears the air
  out(FAN, freshing);

  unsigned long next = (FRESH_EVERY_MS - (now - lastFresh)) / 60000UL;
  lcd.setCursor(0, 0);
  lcd.print(h, 0); lcd.print("% "); lcd.print(t, 1); lcd.print("C ");
  lcd.print(fogOn ? "FOG" : "   "); lcd.print("   ");
  lcd.setCursor(0, 1);
  lcd.print(freshing ? "Fresh air now   " : "Fresh air in "); if (!freshing) { lcd.print(next); lcd.print("m "); }
  delay(2000);
}

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Below 85 percentMist on
Above 90 percentMist off
Every hourFan runs for 5 minutes with the mist off
Sensor unpluggedMist stops

If it does not work

Mist never starts

Check the relay logic and the 5 V supply.

Humidity never reaches the target

The tent leaks air or the mist maker is too small.

Reading stuck at 100

The sensor is wet; move it away from the mist.

LCD blank

Try address 0x3F.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the mushroom grow room humidity keeper?

Arduino Nano, SHT31 temperature and humidity sensor, Relay module 2-channel 5 V, 5 V DC fan 40 mm, 12 V 2 A DC adapter, LM2596 Buck Module and 16x2 LCD with I2C backpack (PCF8574).

How long does the mushroom grow room humidity keeper take to build?

About 120 minutes for a intermediate maker, in 8 steps.

How do I know the mushroom grow room humidity keeper works?

Below 85 percent: Mist on. Above 90 percent: Mist off. Every hour: Fan runs for 5 minutes with the mist off.

Mist never starts: what should I check?

Check the relay logic and the 5 V supply.

Humidity never reaches the target: what should I check?

The tent leaks air or the mist maker is too small.

Reading stuck at 100: what should I check?

The sensor is wet; move it away from the mist.

LCD blank: what should I check?

Try address 0x3F.