Indoor air pollution is a growing health concern. With the right materials, you can build your own DIY air purifier using an Arduino for under $30.

An Arduino is an open-source microcontroller that can be programmed to control electronic components. When paired with the right sensors and filters, it can create an effective and affordable air purifying system.

In this guide, I will walk through the entire process of assembling your own DIY air purifier step-by-step. You'll learn:

Building your own air purifier is a fun electronics project that can lead to cleaner indoor air.

Benefits of a DIY Air Purifier

There are many benefits to building your own DIY air purifier:

How Air Purifiers Work

Before we get into the DIY build, let's first understand how air purifiers operate.

Air purifiers work by pulling air through a filter to capture airborne particles. This filtered clean air is then recirculated back into the room.

Most air purifiers have a few main components:

By pulling contaminated air through a high-quality filter, air purifiers can capture pollutants and provide cleaner, healthier air.

Materials Needed

You'll need the following materials to build your own DIY air purifier:




Many of these components can be salvaged from other electronics projects or purchased very affordably online.

With the right materials gathered, you're ready to start building!

Assembling the Housing

The first step is assembling a housing to mount the filters and fan.

For the housing, you can repurpose a plastic food container or cardboard box. The container should be large enough to hold your filter media.

Use a craft knife to cut an opening for the fan on one side of the container. The fan should blow air into the container.

On the opposite side, cut another opening for filtered air to exit. Make sure the openings you cut align with the placement of the filters inside the container.

Use hot glue to adhere the fan and filter media in place inside the housing. Make sure the air flows through the filter before exiting.

The housing helps direct air through the filter to trap particles. Make sure no air can bypass the filter by sealing edges with tape.

Circuit Assembly

Next, we'll assemble the circuit that controls the fan speed based on air quality readings.

1. Connect the air quality sensor

Start by connecting power and ground pins from the Arduino to the air quality sensor. Then, connect the analog output pin of the sensor to an analog input pin on the Arduino. This sends air quality readings to the Arduino.

2. Connect the fan

Power the DC fan by connecting the positive and negative fan wires to the positive and ground rails of the breadboard.

Use a transistor to modulate the fan's power based on a PWM (pulse width modulation) signal from the Arduino. Connect the transistor so it controls power flowing to the fan.

3. Connect power

Use a 9V battery connector cable to provide power to the Arduino and breadboard rails.

Add a switch to easily turn the purifier on and off.

Optional sensors

You can add additional sensors like temperature, humidity, or gas sensors. Connect these the same way as the air quality sensor.

Programming the Arduino

Now that the physical circuit is assembled, it's time to program the Arduino to control the fan speed based on sensor readings.

1. Set analog pin for air quality sensor

In your Arduino code, set the analog pin you connected the air quality sensor to as an input.

const int airQualityPin = A0;

2. Read the sensor

Add code to read the sensor value in a loop. Convert the analog voltage value to an air quality score from 0 (clean) to 500 (very polluted).

int airQuality = analogRead(airQualityPin);
airQuality = map(airQuality, 0, 1023, 0, 500);

3. Adjust fan speed

Use this air quality value to set the fan speed with PWM. Create if statements to set fan speed higher when air quality decreases.

if (airQuality < 150) {
analogWrite(fanPin, 128); // 50% speed
} else if (airQuality < 300) {
analogWrite(fanPin, 255); // 100% speed

This will ramp up fan speed as air quality worsens. Upload the code to the Arduino to control the fan!

Tips for Maximizing Effectiveness

Here are some tips to maximize the effectiveness of your DIY air purifier:


Building a DIY air purifier with an Arduino is a great electronics project that can improve your indoor air quality.

The right assortment of filters and sensors can remove particulates, allergens, odors, and gases from the air for better health.

Following this guide, you can create your own effective air purifier for under $30. With a little effort, you'll be breathing fresh, filtered air.