Humidity Activated Bathroom Fan

bathroom humidifier

[Andrea] recently moved into an apartment with a few of his friends. Unfortunately the bathroom lacks one of the most important things — A fan. Or at least a window!

Using the case of an air freshener, a simple DHT11 Humidity/Temperature sensor, an LCD, a 12V fan, and ATmel328 microcontroller, he created this handy gadget.

When the humidity in the bathroom passes the 50% threshold, an LED flashes to prompt the user to open the door. After a short delay, one of the transistors flips causing the moist air to circulate out of the room.

We’re surprised the little 12V fan is powerful enough to clear the room, but apparently it helps a lot and can clear the room in less than 20 minutes.

To see it in action, stick around after the break.

This isn’t the first smart bathroom sensor though! We covered a project last year that uses a very similar setup.

35 thoughts on “Humidity Activated Bathroom Fan

    1. haha let me explain :D this bathroom basically was designed with a fan built into the ceiling, but apparently the previous tenants did something to damage it, and now the landlord says it’s too expensive to replace it… but no mold actually, my guess is that even without the fan, the existing pipe is enough to take the humidity out

      1. as a bath without some kind of ventilation is outside regulations you should be able to force the landlord to repair it. if you have a regular contract, that is.

        btw, how long does it take for the bathroom “to clear” without the fan working?
        it looks quite a small fan to be actually doing much difference.

    1. yeah :D this is because that very day I had gotten a 4×20 display in my mail, and before that moment I’ve always had only 2×16. Since the I2C interface works with arbitrary sized displays, I just plugged the new one and added one line of code to see it do something !

    1. That’s a sorta urban myth, there’s not so much methane comes out yer arse. Mostly it’s CO2, air, hydrogen, and some other bits. The smell is from indoles and skatoles, since methane is of course odourless.

      Plus dampness works for damp from the shower etc. I dunno that it’s gonna detect toilet use, I suppose you could rig a sensor up. A rugged one might be a tip-sensor on the lever inside the tank that connects to the handle.

      And like Darius says, I thought it was illegal in most places to have no outside ventilation, either a duct or a window, in a bathroom.

        1. Technically, NO person produces any gas, it’s the trillions of intestinal flora that produces the gas, averaging 1 liter (or more) a day, and most produce methane, along with CO2, H2. The wiki article that states that some people don’t produce methane is another fine wiki oddity that takes ONE (and only one) study and tries to state that as a given fact.

    1. Humidity is a relative thing. Around here humidity levels seldom get below 50%, and are usually over 90% during the summer months. I imagine it would be difficult to make a device that would work well in all regions. It’s far easier (and far more robust) to just wire a 120v fan into a standard wall switch.

      1. A contractor friend of mine puts a push-button timer in place of the fan switch in all his bathroom builds, so when you take a shower you can just set the timer for an hour and forget it. It really takes quite a while to clear the humidity out — it’s not just a matter of exchanging the air once, as you still have plenty of wet surfaces once you’ve pulled that first batch out.

      2. You can still achieve the desired affect by monitoring the rate of change of humidity and the rate of change of temperature. If humidity goes up it’s usually because temperature goes down, until you hit the dew point where relative humidity pegs the 100% mark.

        However if humidity goes up and temperature goes up and all of this happens in a matter of seconds or minutes rather than hours then it’s likely something is causing steam.

        That said it wouldn’t be possible with a DHT11 since they aren’t sensitive enough to pick up changes in really high humidity.

  1. Cool project. I have a DHT11 that’s been collecting dust – since I have roommates and similar issues with bathroom moisture I may rig something similar in the window (my bathroom window is fused shut due to caulking from poor construction before I moved in.)

  2. Pardon my noobishness (still learning a lot about electronic engineering,) but I noticed something strange – the schematic on the site shows an ATMega168, but he says he used an 328. I realize there are very minor differences between these, especially that you get twice the programmable memory on the 328, but I’m wondering which was actually used, and if he needed the 32k memory over 16k?

    I’m assuming you could use either, but I thought I’d check with the gurus first.

    1. Might be he planned on needing a 168 but had a 328 available, or his supplier only had a 328 available, etc. Since you can nearly always swap for a better component.

      Looking at it, this app doesn’t need as many pins as the Mega has, and I’d bet you could do it with hardly any ROM and no RAM. But people use the stuff they like, and have, and have the hardware / software / knowledge to program.

      1. precisely. also, the schematic shows a 168 cause I guess it’s the default one in Fritzing, which I used to (badly) draw the schematic. probably forgot to change the part name, sry for that. It’s also most likely not the only mistake in that schematic

    2. You do not need the extra memory. I have a device that reads temp, humidity, has an I2C display, multiple outputs controlled via I/O pins, a piezo buzzer, a voltage monitor (again I2C) and it all talks to the computer via serial comms. Fits on an ATMEGA88 with comfortable room to spare and I haven’t put any method into optimising my code.

      That said I don’t have the overhead of the Arduino bootloader. But surely that can’t take up 16k.

  3. “one of the transistors flips causing the moist air to circulate out of the room.”

    I didn’t see any details on the magic transistor that can cause moisture to leave an area – do you have a spec sheet on that?

    Otherwise swishing moist air around with a tiny fan would have little to no effect since their isn’t an exit for the moist air to leave thru. Probably clears the room in 20 minutes because THE DOOR IS OPEN.

    1. > I didn’t see any details on the magic transistor that can cause moisture to leave an area – do you have a spec sheet on that?

      You use the moisture sensor with the voltage connected backwards.

    2. easy mate.
      Let me reword: “the microcontroller activates the fan through a darlington switch”. This would probably be more correct.

      You may also be right when saying that possibly the open door is enough. Now let’s put it this way, the fan really has a nice output and at the very least it may help a little bit to let the air circulate.
      As you may notice by having a quick walk at your closest electronics store, they don’t really make such devices for everyday use, and this one shall be considered as just some random excuse to get better at electronics, as I’m a quite a beginner. cheers

      1. Get a ceiling exhaust fan at any home improvement shop, add your humidity sensor and switch and voila! there’s a ACTIVE solution.

        The sensor and switching part are great, it’s just that I doubt the small fan without a guided exhaust is doing much of anything but swirl moist air around.

  4. Please note – that the 1N4004 Diode, D1, is incorrectly oriented across the Motor.
    As is shown, when Transistor Q2 is turned ON, via the µController, only 0.6 Vdc will be applied across the Motor; and, a large amount of Current will flow from the Battery through the D1 and Q2 to Ground.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.