AirSense - the Smartest DIY Air Purifier

Published Jun 11, 2026
 10 hours to build
 Intermediate

Air Sense is a smart IoT air purifier that monitors indoor air quality in real time and automatically removes harmful pollutants using intelligent sensing, cloud connectivity, and HEPA filtration.

display image

Components Used

Waveshare Dust Sensor
1
Waveshare 2.4-inch LCD Display
1
Waveshare BME680 Environmental Sensor
1
Digital 10A Relay Module
1
Waveshare ESP32-S3
1
5V 2A Power Adapter
1
Xiaomi Smart Air Purifier 4 Lite Filter
1
Anchor Smart Air 150mm Ventilation Fan
1
Stainless Steel Open Top Dustbin - 18L
1
Description

The air we breathe indoors can often contain dust, pollutants, and microscopic particles that go unnoticed but can affect our health over time. While commercial air purifiers are becoming increasingly common, they are often expensive, difficult to customize, and provide little insight into the quality of the air around us.

To address this, I created AirSense—a smart DIY air purifier that combines air purification, environmental monitoring, and cloud connectivity into a single intelligent system. Rather than simply filtering air, AirSense continuously measures indoor air quality and provides real-time information about the environment, helping users make informed decisions about the air they breathe.

Built around the Waveshare ESP32-S3, the system uses environmental and dust sensors to monitor air quality, temperature, humidity, and atmospheric conditions. The collected data is displayed locally on a front-mounted LCD screen and can also be accessed remotely through Arduino IoT Cloud, allowing users to monitor their environment and control the purifier from anywhere using a smartphone.

To give the project a professional product-like appearance, I designed the entire enclosure in Autodesk Fusion 360. The system integrates a Xiaomi HEPA filter, a high-performance 150 mm exhaust fan, and carefully arranged electronics inside a compact custom housing that balances functionality, aesthetics, and ease of assembly.

AirSense is more than a DIY project—it is an example of how makers can build intelligent products that solve real-world problems and make technology accessible to everyone.

AirSense transforms ordinary air purification into an intelligent, connected experience—helping people breathe cleaner, healthier air every day.

Step 1: CAD & 3D Printing

First Started by designing the enclosure in Autodesk Fusion 360. My goal was to create a design that was simple, compact, and easy to assemble while maintaining a clean, modern, and product-like appearance.

The enclosure was carefully designed to accommodate all the major components, including the HEPA filter, ventilation fan, sensors, display, and electronics, while ensuring proper airflow throughout the system.

If you'd like to explore the design in more detail, you can view the model directly in your browser using the Fusion 360 Web Viewer. The design files are also available for download below.

Files

  1. Housing
  2. Motor Mount
  3. Filter Base
  4. Bottom Plate
  5. TPU Gasket
  6. Display Cover

Step 2: Disassemble the Exhaust Fan

To begin the assembly process, we first need to disassemble the 150 mm Anchor Smart Air exhaust fan and remove the parts that are not required.

Start by removing the front cover of the fan. Next, carefully remove the center cap and fan blade to expose the motor assembly inside.

Step 3: Remove the Motor

Start by unscrewing the motor from the fan housing. Once the mounting screws are removed, carefully disconnect the wires and lift the motor out of the frame.

Since the original fan housing is no longer needed, it can be set aside. For this project, we only need the motor nad the fan blade, as it will be installed into the custom 3D-printed motor mount designed for AirSense.

Step 4: Assemble the Motor Mount

Now it's time to install the motor into the 3D-printed motor mount. Start by placing the motor inside the motor mount and aligning the mounting holes with the supports provided in the printed part. Once aligned, secure the motor using the appropriate screws.

Step 5: Install the Fan Blade

Carefully slide the fan blade onto the motor shaft and ensure it is seated properly. Once the blade is in place, attach the center cap to secure it.

After installation, rotate the blade by hand to make sure it spins freely and does not rub against the motor mount or enclosure. This quick check helps ensure smooth operation once the fan is powered.

Step 6: Install the TPU Gasket

Next, place the TPU gasket onto the bottom plate. Align the mounting holes on the gasket with the corresponding holes on the bottom plate and ensure it sits flat against the surface. The gasket helps create a tight seal between the filter and the enclosure, reducing air leakage and improving the overall filtration efficiency.

Step 7: Attach the Bottom Plate

With the motor assembly and bottom plate prepared, it's time to join them together. Place the motor mount onto the bottom plate, making sure all mounting holes are properly aligned. Once everything is positioned correctly, insert the M3 screws through the holes and tighten them evenly.

Make sure the assembly sits flat and secure without any gaps. The TPU gasket should remain properly aligned between the parts to maintain a good seal.

After tightening all the screws, give the assembly a quick inspection to ensure everything is firmly attached and the fan blade can still rotate freely.

Step 8: Attach the Filter Base

To support the filter and provide a mounting surface for the main assembly, attach the 3D-printed base to the back side of the HEPA filter.

Apply a small amount of super glue around the contact area of the printed base, then carefully position it on the filter. Make sure it is centered and properly aligned before the glue sets. Only a minimal amount of adhesive is required. Excess glue is unnecessary and may seep into unwanted areas.

Step 9: Install the Filter Inside the Dustbin

With the filter assembly complete, the next step is to install it inside the stainless-steel dustbin that serves as the main enclosure for AirSense.

Carefully lower the HEPA filter into the dustbin and position it in the center. The 3D-printed base should help keep the filter properly aligned and stable inside the enclosure.

Take a moment to ensure the filter sits straight and does not interfere with the walls of the dustbin. A properly aligned filter will help maintain good airflow and simplify the remaining assembly steps.

Step 10: The Power Adapter

Since the ESP32-S3 cannot be powered directly from the AC mains, we need a power supply to convert the mains voltage into a safe 5V DC output.

You can use any suitable 5V SMPS module for this purpose. In my case, I repurposed an old smartphone charger that was no longer being used. These chargers already contain a compact and reliable SMPS circuit, making them perfect for DIY projects.

Start by carefully opening the charger enclosure and removing the internal power supply board. Be gentle during this process to avoid damaging any components or tracks on the PCB.

Once removed, inspect the board and identify the AC input and 5V output connections. This compact power supply will be used to power the Arduino and other low-voltage electronics inside AirSense.

⚠️ Warning: This section involves working with mains voltage. Always disconnect power before handling the circuit and take appropriate safety precautions.

Step 11: Create Things

To enable remote monitoring and control, we need to create a new Thing in Arduino IoT Cloud and add the required cloud variables.

Sign In to Arduino IoT Cloud

Open Arduino IoT Cloud and sign in with your Arduino account.

Create a New Thing

Home → Things → Create Thing (Enter a name for your project, such as: Air Sense)

Add Cloud Variables

Click + Variable and create the following variables:

  1. AQI (Integer Number) Read Only On Change
  2. DUST (Floating Point Number) Read Only On Change
  3. Temperature (Floating Point Number) Read Only On Change
  4. Humidity (Floating Point Number) Read Only On Change
  5. Power (Boolean) Read & Write On Change

💡 Note: The free Arduino IoT Cloud plan allows a maximum of 5 cloud variables, which is why only the essential variables are used in this project. Once created, Arduino IoT Cloud will automatically generate the required code definitions for your sketch.

Step 12: Connect Board to Cloud

Open Associated Device → Add Device → Compatible Device.

Search for ESP32-S3 and select ESP32-S3 Dev Module from the list. Enter a name for your device, such as Air Sense, and continue with the setup.

Arduino IoT Cloud will generate a Device ID and Secret Key for your board. Download the provided PDF and save it safely, as these credentials will be required later in the firmware configuration.

After creating the device, open the Network Credentials page and enter your Wi-Fi SSID, Wi-Fi Password, and the Secret Key generated during device setup. Once all the details have been entered, click Save and Upload later.

💡 Note: The Device ID and Secret Key from the downloaded PDF will be used in the code setup step to securely connect Air Sense to Arduino IoT Cloud.

Step 13: Air Sense Dashboard

The Dashboard allows you to monitor sensor values and control devices in real-time from any browser or mobile device.

Arduino Cloud → Dashboards → Create Dashboard

→ Enter Air Sense Dashboard as the dashboard name.

Add the AQI Gauge

  1. ADD: Gauge
  2. Name: AQI
  3. Set Range: 0 to 400
  4. Link Variable: Air Sense → AQI
  5. Click Done

Add the PM2.5 Display

  1. ADD: Value
  2. Name: PM2.5
  3. Link Variable: Air Sense → DUST
  4. Select the Air/Wind icon
  5. Click Done

Add the Temperature Display

  1. ADD: Value
  2. Name: Temperature
  3. Link Variable: Air Sense → Temperature
  4. Select the Thermometer icon
  5. Click Done

Add the Humidity Display

  1. ADD: Value
  2. Name: Humidity
  3. Link Variable: Air Sense → Humidity
  4. Select the Water Drop icon
  5. Click Done

Add Fan Control

  1. ADD: Switch
  2. Name: Fan
  3. Link Variable: Air Sense → Power
  4. Click Done

Step 14: Installing the Required Libraries

Before uploading the code, install all the required libraries through the Arduino IDE Library Manager. These libraries provide support for the TFT display, LVGL graphical interface, environmental sensing, Wi-Fi connectivity, and Arduino Cloud integration.

Open Arduino IDE → Library Manager and install the following libraries:

  1. TFT_eSPI
  2. LVGL
  3. Adafruit BME680
  4. ArduinoIoTCloud
  5. Arduino_ConnectionHandler

The remaining libraries such as Arduino.h, SPI, Wire, and WiFi are included with the board package and do not require separate installation.

After installing all the libraries, restart the Arduino IDE to ensure that every dependency is loaded correctly before compiling the project.

Step 15: Library Configuration

To ensure the display and graphical user interface work correctly, a few library files must be configured before compiling the firmware.

TFT_eSPI Configuration

Open the Arduino libraries directory on your computer and navigate to the TFT_eSPI folder. Replace the existing User_Setup.h file with the custom version provided in this project's GitHub repository. This file contains the display driver configuration, pin mappings, and other settings required for the Air Sense display.

LVGL Configuration

Next, open the LVGL library folder and copy the provided lv_conf.h file from the project GitHub repository into the library directory. Similar to the TFT_eSPI configuration, this is a custom file created specifically for this project. It contains the LVGL settings, memory configuration, and graphical parameters required for the Air Sense user interface.

Both User_Setup.h and lv_conf.h are included in the project's GitHub repository and must be installed before compiling the code.

Step 16: Code Configuration

Before uploading the firmware, update the Wi-Fi and Arduino Cloud credentials with your own information.

Wi-Fi Configuration

Locate the following lines in the code:

const char SSID[] = "YOUR_WIFI_SSID";
const char PASS[] = "YOUR_WIFI_PASSWORD";

Replace YOUR_WIFI_SSID and YOUR_WIFI_PASSWORD with the name and password of your Wi-Fi network. These credentials allow the Air Sense system to connect to the internet and communicate with Arduino Cloud.

Arduino Cloud Configuration

Next, update the Arduino Cloud device credentials:

const char THING_ID[] = "Your_Client_ID";
const char DEVICE_LOGIN[] = "your_device_name";
const char DEVICE_KEY[] = "Your_Client_Secret";

Replace these values with the credentials generated during the Arduino Cloud setup process. You can find them in the device configuration PDF that was downloaded earlier when the board was connected to Arduino Cloud. These credentials uniquely identify your device and enable secure communication with your cloud dashboard.

Step 17: Uploading Code

Air Sense Github

After updating all Wi-Fi and Arduino IoT Cloud credentials and installing the required libraries, your project is ready to be uploaded to the ESP32-S3.

Connect the ESP32-S3 board to your computer using a USB cable and open the project in the Arduino IDE. From the Tools menu, select the correct ESP32-S3 board and choose the appropriate COM Port.

Once everything is configured, click the Upload button and wait for the compilation and upload process to complete. After a successful upload, the Air Sense device will automatically connect to your Wi-Fi network, synchronize with Arduino IoT Cloud, and begin monitoring air quality data in real time.

Step 18: Microcontroller Assembly

Place the ESP32 S3 onto the dedicated mounting platform inside the enclosure. Align the mounting holes of the board with the printed standoffs.

Once aligned, secure the board using M3 screws. Tighten the screws carefully until the board is firmly held in place. Avoid over-tightening, as this may damage the PCB or the mounting posts.

Step 19: Dust Sensor Assembly

The dust sensor is responsible for measuring the concentration of fine particulate matter in the air, helping the system monitor air quality and calculate the Air Quality Index (AQI) in real time.

Place the dust sensor module onto its dedicated mounting platform inside the enclosure, directly beneath the air intake channel. This position ensures that airflow passes smoothly through the sensor, allowing accurate particle detection.

Align the mounting holes with the printed standoffs and secure the module using M3 screws. Make sure the sensor is firmly mounted and that the connector remains accessible for wiring.

Step 20: BME680 Sensor Assembly

The BME680 is a compact environmental sensor that measures temperature, humidity, air pressure, and gas resistance. These readings help monitor indoor environmental conditions and improve overall air quality analysis.

Place the BME680 sensor module onto its designated mounting location beside the dust sensor assembly. This position keeps the sensor exposed to the airflow inside the enclosure, ensuring accurate environmental measurements.

Align the sensor board with the mounting area and secure it in place. Ensure the connector faces outward for easy cable routing and future maintenance.

Step 21: Relay Module Assembly

The relay module acts as the switching interface between the Air Sense system. It allows the microcontroller to safely control high-voltage equipment such as exhaust fan.

Position the relay module on its dedicated mounting platform inside the enclosure, ensuring the terminal block faces outward for convenient wiring access. This placement keeps the control and power connections organized while maintaining a compact internal layout.

Secure the relay module using M3 screws and verify that it is firmly mounted. Ensure adequate clearance around the terminal block so external wires can be connected easily during final assembly.

Step 22: 5V Adapter Assembly

To power the electronics safely, install the 5V AC-to-DC power supply module inside the dedicated compartment of the enclosure. Position the module below the cable channel and secure it firmly in place.

The adapter converts the mains AC voltage into a stable 5V DC output, which powers the ESP32-S3, sensors, display, and relay module. This eliminates the need for external power supplies and keeps all electronics neatly integrated inside the enclosure.

Step 23: Display Assembly

The TFT display serves as the primary user interface of the Air Sense system, providing real-time information such as AQI, PM2.5 concentration, temperature, humidity, device status, and system alerts.

Begin by placing the display module into the dedicated display Cover. Ensure the screen sits flush within the frame and that the display area is properly aligned with the viewing window.

Once the display is secured in the 3d printed cover, carefully insert the assembled display unit into the display opening located on the top side of the enclosure. Press it gently into position until it fits securely and aligns with the enclosure surface.

Step 24: AC Power Cord Installation

To provide mains power to the system, install the AC power cord through the dedicated cable entry slot in the enclosure. Route the cable neatly inside the housing.

The power cord serves as the main power source for the Air Sense purifier, delivering AC power from the wall outlet to the internal power supply & Exaust Fan.

Step 25: Wiring Connections

Now it's time to connect all the modules to the ESP32-S3-Zero. Follow the wiring carefully and double-check every connection before powering the system.

Display Connections

Connect the display module to the ESP32-S3 as follows:

  1. VCC → 3.3V
  2. GND → GND
  3. DIN → GPIO11
  4. CLK → GPIO12
  5. CS → GPIO10
  6. DC → GPIO9
  7. RST → GPIO8
  8. BL → 3.3V

BME680 Air Quality Sensor

The BME680 communicates using the I²C interface.

  1. VCC → 3.3V
  2. GND → GND
  3. SDA → GPIO43
  4. SCL → GPIO44

Dust Sensor

Connect the dust sensor according to the following wiring:

  1. VCC → 3.3V
  2. GND → GND
  3. ILED → GPIO5
  4. AOUT → GPIO6

Relay Module

The relay is used to automatically control the fan based on the measured air quality.

  1. VCC → 3.3V
  2. GND → GND
  3. Signal → GPIO7

Fan AC Wiring

⚠️ Warning: This section uses mains AC voltage. Proceed only if you are experienced with high-voltage wiring and ensure power is disconnected before making any connections.

Connect the relay and fan as follows:

  1. Wall Outlet Phase (Live) → Relay COM
  2. Relay NO → Fan Phase (Live)
  3. Wall Outlet Neutral → Fan Neutral

When the relay turns ON, the Phase line is connected through the relay, allowing power to reach the fan and start it automatically.

Step 26: Close the Housing

With all electronics, wiring, and internal components installed, the final step is to close the enclosure. Carefully align the upper housing with the motor assembly section, making sure the power cord and internal wires are routed properly and do not get pinched during assembly.

Once aligned, match the locking tabs of the housing with the corresponding slots on the base. Gently press the two sections together and rotate until they lock securely into place. The enclosure uses a twist-lock mechanism, so no screws are required.

Step 27: Final Assembly

For the final assembly, place the completed Air Sense housing onto the HEPA filter unit. Carefully align the housing with the top rim of the filter assembly, ensuring it sits evenly and securely in position.

Once aligned, gently lower the housing onto the filter and rotate it until the locking tabs engage with the corresponding slots. The twist-lock mechanism securely joins both sections together, eliminating the need for screws while maintaining a clean, product-like appearance.

Before use, verify that the assembly is stable and that the HEPA filter is properly seated inside the purifier. The fan assembly will now draw contaminated air through the filter and exhaust clean air from the top of the unit. Whenever maintenance or filter replacement is required, simply rotate the housing in the opposite direction and lift it off for quick access to the internal components.

Step 28: Arduino Remote App

To monitor and control Air Sense directly from your smartphone, install the Arduino Remote app from the Google Play Store or Apple App Store and sign in using the same Arduino account connected to your Arduino IoT Cloud project.

After signing in, the app will automatically detect your Air Sense Thing and display all the cloud variables configured earlier. You can view real-time AQI, dust concentration, temperature, and humidity data, as well as remotely control the purifier's power state from anywhere with an internet connection.

Step 29: Testing

Now it's time to test the completed Air Sense Smart Air Purifier. Connect the AC power cord to a mains power outlet and switch it on. As soon as power is applied, the ESP32-S3, sensors, display, and fan will start automatically.

Within a few seconds, the front display will come to life and begin showing real-time air quality information, including AQI, PM2.5 concentration, temperature, humidity, pressure, IAQ level, Wi-Fi status, and filter life. The device will also connect to Arduino IoT Cloud and start updating data remotely.

At the same time, the fan will begin drawing in surrounding air through the filter system. Dust particles and other airborne pollutants are captured by the filter, while the cleaned and safer air is pushed back into the room.

You can also verify the live readings and control the purifier remotely using the Arduino Remote app or the Arduino IoT Cloud dashboard.

Conclusion

Air Sense is more than just a DIY air purifier—it's my attempt to use technology to create a healthier and smarter environment for everyone. Clean air is something we all deserve, and this project helps monitor air quality while automatically improving it in real time.

Throughout this project, I focused on making every step as clear and beginner-friendly as possible. My goal was to ensure that anyone, even with limited electronics experience, could successfully build and understand this project. I put a lot of effort into documenting each stage so that learning and building become equally enjoyable.

From the custom 3D-printed design created in Autodesk Fusion to the cloud-connected monitoring system, Air Sense combines practical functionality with a product-like appearance and user experience. It is not just a prototype—it is a real-world solution that can be used every day.

For me, dreaming of a better world means creating technology that improves people's lives in a meaningful way. By helping people monitor and improve the air they breathe, Air Sense contributes to a cleaner, healthier, and more informed future. I hope this project inspires others to learn, innovate, and build solutions that make a positive difference in the world.

Codes

Downloads

Connection Diagram Download
Comments
Ad