Projects / Mushroom humidity fogger

Mushroom humidity fogger

Beginner1.5 hGuided buildReviewed

Build it step by step

0 of 7 done
  1. NANOSHT3129.0°C

    Test the sensor

    Print temperature and humidity.

  2. NANOON

    Wire the relay

    Channel 1 fogger, channel 2 fan.

  3. NANO

    Write the hysteresis

    Start at 85, stop at 92.

  4. NANO

    Add the fan run-on

    One minute after fogging.

  5. NANO

    Add the fault alarm

    Ten minutes with no rise.

  6. NANO

    Seal the electronics

    Splash-proof box.

  7. NANOSHT3129.0°C

    Run a day

    Watch the humidity trace.

In short

How do you build a mushroom humidity fogger?

A fogger switches on whenever humidity drops under 85 %, with a fan to spread it. You need Arduino Nano, SHT31 temperature and humidity sensor, Relay module 2-channel 5 V, 12 V DC fan 80 mm, 12 V 2 A DC adapter and Active buzzer 5 V. It takes 7 steps and about 90 minutes.

Level
Beginner
Time
About 90 min
Parts
6

Parts list

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

Wiring

FromToWhy
SHT31 SDA and SCLNano A4 and A5Humidity sensor
SHT31 VIN and GNDNano 5V and GNDPower
Relay IN1Nano D5Fogger (own low-voltage supply)
Relay IN2Nano D6Fan
Relay VCC and GNDNano 5V and GNDRelay power
12 V adapter plusFuse (2 A), relay 2 COM, NO to fan plusSwitched fan
Fan minusAdapter minusReturn
BuzzerNano D7 and GNDFault alarm

Code

The fogger starts below 85 percent humidity and stops above 92, so it does not click on and off around one number, and the fan runs for a minute afterwards to spread the mist; if humidity has not risen after ten minutes of fogging, the water tank is probably empty or something has stuck, so the sketch stops and sounds the buzzer. Run the fogger from its own low-voltage supply, as ultrasonic foggers use about 24 V DC, and switch only that low-voltage side with the relay. Never use this relay for a mains fogger unless a qualified electrician wires the mains side in a proper enclosure. Mushrooms like clean water, so use fresh water in the fogger, wash the tank often, and keep every connector out of the mist in a splash-proof box. Wear a mask when working with spawn and in very damp rooms, since mould spores can cause breathing problems. Arduino IDE, board "Arduino Nano" (try the Old Bootloader option if the upload fails).

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).

// Mushroom chamber: hold humidity between 85 and 92 percent. Library: Adafruit SHT31. Board: Arduino Nano.
#include <Wire.h>
#include <Adafruit_SHT31.h>
Adafruit_SHT31 sht;
const int FOG = 5, FAN = 6, BUZ = 7;
const float LOW_RH = 85.0, HIGH_RH = 92.0;
unsigned long fogStart = 0, fanUntil = 0;
bool fogging = false;
void setup() {
  pinMode(FOG, OUTPUT); pinMode(FAN, OUTPUT); pinMode(BUZ, OUTPUT);
  digitalWrite(FOG, LOW); digitalWrite(FAN, LOW);
  Serial.begin(9600);
  sht.begin(0x44);
}
void loop() {
  float rh = sht.readHumidity(), t = sht.readTemperature();
  if (!isnan(rh)) {
    if (!fogging && rh < LOW_RH) { fogging = true; fogStart = millis(); }
    if (fogging && rh > HIGH_RH) { fogging = false; fanUntil = millis() + 60000UL; }   // keep the fan on for 1 minute after
    if (fogging && millis() - fogStart > 600000UL && rh < 70.0) {                    // 10 minutes with no rise: stuck relay or empty tank
      fogging = false; tone(BUZ, 1500, 2000);
    }
    digitalWrite(FOG, fogging);
    digitalWrite(FAN, fogging || millis() < fanUntil);
    Serial.print(t, 1); Serial.print(" C  "); Serial.print(rh, 0); Serial.println(" %RH");
  }
  delay(5000);
}

What the serial monitor should show

Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual Arduino Nano with its sensors at their default values. Your numbers will follow your real readings, but the format should match.

0.0 C  0 %RH

Test checklist

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

CheckExpected
Humidity below 85Fogger and fan start
Above 92Fogger stops and the fan runs a minute more
Empty tankAlarm after ten minutes
Sensor unpluggedNo output change

If it does not work

Relay chatters

Widen the 85 to 92 band.

Humidity never rises

Check the tank and the fogger supply.

Sensor reads high

Keep it out of direct mist.

Corrosion

Seal the box and use conformal spray.

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

Ask Lark AI

Common questions

What parts do I need for the mushroom humidity fogger?

Arduino Nano, SHT31 temperature and humidity sensor, Relay module 2-channel 5 V, 12 V DC fan 80 mm, 12 V 2 A DC adapter and Active buzzer 5 V.

How long does the mushroom humidity fogger take to build?

About 90 minutes for a beginner maker, in 7 steps.

How do I know the mushroom humidity fogger works?

Humidity below 85: Fogger and fan start. Above 92: Fogger stops and the fan runs a minute more. Empty tank: Alarm after ten minutes.

Relay chatters: what should I check?

Widen the 85 to 92 band.

Humidity never rises: what should I check?

Check the tank and the fogger supply.

Sensor reads high: what should I check?

Keep it out of direct mist.

Corrosion: what should I check?

Seal the box and use conformal spray.