Mushroom grow room humidity keeper
Build it step by step
0 of 8 doneSet the buck output
Adjust the LM2596 to 5.0 V with a meter.
Wire the relays
Connect the mist maker and fan through the two relays.
Test each load
Switch them from a test sketch.
Add the sensor
Mount it in the tent at mushroom height.
Upload
Breathe near the sensor to see the humidity rise.
Check the fresh-air break
Shorten FRESH_EVERY_MS to a minute and watch the fan run.
Restore the times
Set it back to one hour and five minutes.
Install
Keep the electronics in a dry box outside the tent.
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
- Development BoardsBuyArduino Nano × 1
- SensorsBuy
- InterfacesBuy
- Motors & ActuatorsBuy5 V DC fan 40 mm × 1
- PowerBuy
- PowerBuy
- DisplaysBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| 12 V adapter + | LM2596 IN+ | Supply |
| 12 V adapter - | LM2596 IN- | Ground |
| LM2596 OUT+ | Nano 5V, relay module VCC and both relay COM terminals | Set to 5.0 V with a meter first |
| LM2596 OUT- | Nano GND, relay module GND, fan - and mist maker - | Common ground |
| Relay IN1 | Nano D6 | Mist maker control |
| Relay IN2 | Nano D7 | Fan control |
| Relay 1 NO | 5 V USB mist maker + | Switched positive |
| Relay 2 NO | 5 V fan + | Switched positive |
| SHT31 VCC and GND | Nano 5V and GND | Power |
| SHT31 SDA and SCL | Nano A4 and A5 | I2C |
| LCD I2C SDA and SCL | Nano A4 and A5 | Display |
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.
| Check | Expected |
|---|---|
| Below 85 percent | Mist on |
| Above 90 percent | Mist off |
| Every hour | Fan runs for 5 minutes with the mist off |
| Sensor unplugged | Mist 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 →
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.
