An Exhaust Fan That Switches On Automatically On Detecting Smoke

Exhaust fans installed in kitchens, including restaurant kitchens, usually continue to run constantly – whether smoke is present or not. Here’s how to build a small electronic device that turns on the exhaust fan automatically only when there is smoke in the air. Turns off the exhaust fan after the smoke is removed.

circuit and work

Figure 1. The circuit diagram of an automatic exhaust fan switch. It has a 5V 7805 voltage regulator (IC1), an AVR ATtiny85A microcontroller (IC2), a gas sensor MQ2 (SEN1), a dual-colour common cathode LED (BICO1), a 5V single-shift relay (RL1), a NPN BC547 transistor (T1), and a number of Few other ingredients.

pie chart
Figure 1: Circuit Diagram

The ATtiny85A turns the exhaust fan connected through the relay on or off based on how much smoke is in the air. The resistance supplied by the MQ2 sensor changes with smoke concentration near the sensor and thus the voltage at analogue input pin 3 (PB4) on IC1 changes. The VR1 potentiometer is used to adjust the sensitivity of the sensor during calibration.

When the circuit is turned on, the bi-color LED BICO1 flashes red for 20 seconds, indicating that the circuit is in the necessary pre-heating stage (see Figure 1). The microcontroller then constantly checks if the voltage at the analogue input (pin 3) is above the threshold value set using the potentiometer VR1 during calibration. When the sensor detects enough smoke, its digital pin 5 (PB0) goes “high” and activates the relay to operate the exhaust fan connected to CON2. The bi-color LED BICO1 constantly glows red to indicate the presence of smoke.

When the smoke concentration near the sensor drops below the preset level, PB0 goes to a “low” level after 1 minute. The exhaust fan continues to run during this minute to ensure that the smoke is completely removed from the kitchen. During this 1 minute period, BICO1 flashes orange to indicate that the exhaust fan is now working to remove smoke that may be present elsewhere in the kitchen. After this period, the digital pin goes down and disconnects the relay, which turns off the exhaust fan. The BICO1 bi-color LEDs now emit green to indicate there is no smoke in the air.

The Pushbutton S1 switch can be used to reset the microcontroller. Capacitor C4 is used to turn off the switch S1 and helps to turn the power back on with the resistor R1.


The source code for ExhaustFanSwitch.ino was written in the Arduino programming language using the Arduino IDE. By default, the Arduino IDE does not support ATtiny85, so an ATtiny board must be added to the Arduino IDE. To add ATtiny support to the Arduino IDE, open the  Preferences file and in the Additional Panel Manager URLs, add the link.

Next, open Tools->Board->Board Manager. Scroll down the list and find “attiny by Davis A. Mellis.” Click on that and install it. After installing it, ATtiny will be listed in the panel menu. Select ATtiny25/45/85 under Tools->Board, then select ATtiny85 under Tools->Processor option, then select 8 MHz (Internal) under ToolsClock option.

Now, to turn your Arduino Uno into an ISP programmer, open the Arduino IDE (make sure you have selected Arduino/Genuino Uno as your board) and open the example Arduino ISP sketch. Upload the sketch to your Ardunio Uno. Your Arduino Uno is now an ISP programmer.

By default, the ATtiny85 operates at 1MHz. To run at 8MHz, select ToolsBurn Bootloader. Make sure the Arduino Uno board is programmed as an ISP and connected to the ATtiny85 through the ISP pins. Now, upload the ExhaustFanSwitch.ino source code to the ATTiny85A using the Arduino board programmed as the ISP.

Build and test

The actual size PCB layout of the automatic exhaust fan switch is shown in Figure 2 and the layout of its components in Figure 3. Assemble the circuit on the printed circuit board, install it in a suitable plastic box, and place it near the smoke-filled area.

PCB layout
Figure 2: PCB layout

PCB Component Layout
Figure 3: Component layout of a PCB

Download PDFs for PCB and Component Layout: click here

Make a suitable hole in the canister for the sensor to detect smoke. Power the circuit using a 12-volt transformer with an output current of at least 500 mA. Switch S1 should be available to reset the circuit, whenever required.

Please note:

  • Gas sensors require a preheat time of about 20 seconds. Therefore, IC1 is programmed in such a way that after turning on the circuit, there will be a preheating time of 20 seconds.
  • In addition, the temperature sensor in this circuit can be used to automatically operate the exhaust fan.
  • An ATtiny25 or ATtiny45 microcontroller can be used instead of IC1.
  • The MQ2 sensor alone was used in this circuit. If necessary, the MQ2 sensor module (Fig.

MQ2 Sensor Module (Optional)
Figure 4: MQ2 Sensor Module (Optional)

4) Can be used in this circuit. Connect the digital output of the module to pin 3 of IC1 and discard resistor R5 and potentiometer VR1.

Loading Code source

A. Samiuddhin, Circuit Designer, is a B.Tech in Electrical and Electronic Engineering. His interests include LED lighting, power electronics, microcontrollers, and Arduino programming.

Leave a Comment