Introduction: X-tractor the Smart Air Extractor ** Updated Nov 2016 **

About: come visit me!

Mold on the bathroom walls? It's a common condition.

Cigarette smoking in the bathroom ? It's a deprecable habit.

For few money i could have bought a basic air extractor but it isn't what I was going for, exactly.

I needed something "smart", not based on a fixed sensors value that trigger the air extractor. Expecially during the summer, when humidity level can fluctuate aroud the threshold presetted level of a cheap device.

So i've imagined a device that starts air extraction when sensor levels increase over a specific percentage from sensors value samples arithmetic mean.

This project uses basically: Arduino and air extractor


Added new sketch of Xtractor without MQ2 sensor. Some bugs fixed, too.

Step 1: First Thing

Before start, i should understand humidity and smoke accumulation evolution during the day.

To do that, i left in the bathroom an Arduino board with smoke and humidity sensors, SD equipped to store data.

After data analisys, i was able to understand that:

  1. Humidity threshold level had to be +20% of previous one
  2. Smoke sensor threshold level had to be +15% or little bit less of the previous one, because smoke accumulation in the room is very slow
  3. Humidity level affect MQ2 sensor too.

Step 2: Start

The main component is a good air extractor.

I had already purchased something like this , but you can use a basic bathroom vent too.

Arduino pro mini, MQ2 sensor, DHT11 and a SSR relay make the rest.

I've exactly adopted these equipments:

Arduino Pro Mini

MQ2 gas sensor module

DHT11 module

SSR relay

Transistor NPN TIP102

Diode 1N4001

Servo motor SG90

Three leds

1 x 1Kohm resistor

3 x 220 ohm resistors



1 x Electrolytic capacitor 470uF

5V 2A power supply

2 x PC case slot bracket

CD pack spindle plastic cover

Microswitch SPDT-NA/NC

power cord





Hot glue

Cable ties

Step 3: Build

Find an escape way for the bathroom air. In my case, the air extractor pump the bathroom air inside external blind compartment. Then i have had only to perforate the compartment wooden panel to fit the extractors and cables.

Relay and Arduino are on the back side of the panel. Extractor, sensors and leds will be, consequently, on the opposite side.

When i was ready to complete the project, a windy day rasied the issue. Northern wind entering through extractor. Problem solved with a plastic round panel driven by servo that open extractor hole when needed.

Motorized cap has been created starting from two metal PC case slot bracket, CD plastic spindle cover, circular sponge, double adesive tape and a cd (support for sponge). Twist first bracket to create the arm for spindle cover and second one to create support for servo motor. Apply sponge in the internal side of spindle cover. Find the exact place and screw everything on the air extractor.

A normally open microswitch applied to the window frame, connected between positive cable that starts from 5V power supply and Arduino, get the system up and running only when the window is closed.


This step is dedicate only for safety.

The air extractor is connected to 220VAC trough SSR relay.

When its plug is disconnected, cut one of two cables in the cord and connect two ends to the normally open relay.

Feel free to touch cable ends and relay connection only when the plug is disconnected.

Step 5: Xtractor Sketch

Load the attached sketch on Arduino and the job's done.

Library needed:

Servo.h (included in Arduino IDE)

DHT.h (download latest from IDE library managment)

As said, there isn't a specific humidity and smoke value that trigger extractor but, basing on my data analisys, i've set these trigger values:

Humidity : more than 20% of previous 60 samplesarithmetic mean (one sample per minute)

Humidity : more than 85%

Smoke accumulation : more than 15% of previous 60 samples arithmetic mean (one sample per minute)

Smoke accumulation : more than value 250 (values available from 0 to 1023)

Another parameter that can be changed is PreSetTime. This parameter establishes the maximum time of extractor activation. I've settend this parameter to 420000, this means that, in any case, after 7 minutes extractor turn off, wait for 5 minutes, then system restart creating a new arithmetic mean based on the actual sensor values readed.

Three leds give activity info. One led is powered at system start , the other two when start air extraction caused by smoke or humidity exceeding.

** UPDATE NOV 2016 **

Xtractor V 1.4

- removed MQ2 sensor (humidity interfere with this sensor)

- bug fixes

Step 6: Next Step: Re-paint Bathroom Wall

Some bugs related to interaction between servo activation and DHT11 reading values seems had been

successfully overcome adding a capacitor (see schematic) and some delay in the sketch.

Part of the work has been done. Now i have only to paint over the wall !


Internet of Things Contest 2016

Runner Up in the
Internet of Things Contest 2016

Automation Contest 2016

Participated in the
Automation Contest 2016

Sensors Contest 2016

Participated in the
Sensors Contest 2016