Introduction: Soldering Air Filter

About: I am a hobbyist, maker, tinkerer, and generally curious person. I make Arduino projects and 3D print things as well. I’ll probably try something new next month

Hello there,

In this Instructable I will walk through how I built a simple air filter fan to help remove smoke and other particles from the air while I'm soldering.

If you want to build one, read on, I hope to make it simple and easy.

I'll note here before we get too far that this filter while it does work to remove the small amount smoke from soldering I would not expect this to be a replacement for proper ventilation.

Supplies

I have linked all the parts I used, however some are left from older projects.

None of these links are affiliate links so I make nothing from them. If you want to support me directly you can do so here.

Supplies

Tools

*I have not used these specific items but they will fit and look like they would work well for this project.

Step 1: Background

Why would anyone care about having an air filter when soldering?

My biggest reason is it makes soldering projects overall more enjoyable to do as smoke isn't blowing in your face every 3 seconds.

I started to get more interested in this project after listening to a Freakonomics episode called This IsYour Brain on Pollution (link) I found it very interesting and decided it was time that I finally did something about my soldering smoke to help keep the air in my tiny apartment clean. What the episode boils down to is: air quality is important to general health and cognitive function* (*I think this was based on only one study so some 'grain of salt' here but still).

Step 2: Printing the Parts

One of the first things to do is to start printing off the parts. This can take some time so best to have them ready when you need.

All of the parts are here, (printables link).

They should all be oriented correctly.

I printed all of these out of polymaker polyterra paper white PLA and the front grate out of Inland PLA+. So any filament should work.

I've also included a version of the base with and without the spot for the OLED, you chose what you want. If you choose to forgo the OLED just exclude it from the wiring diagram.

Step 3: Design Complications

When looking at parts for this project I knew early on that I wanted to use a Noctua fan because they are really quiet, and if I'm building something to make soldering projects more enjoyable I don't want a fan whining in my ear the whole time. I also knew I wanted it to be adjustable in speed and position. And while I'm at it I want to add an on/off switch.

I wanted a large fan because I want to force a decent amount of air across the carbon filter I will be using so 120mm seemed like a good size for it.

One issue with this Noctua fan is that their speed is controlled by a pulse width modulated (PWM) signal. If you work with electronics I'm sure you know about PWM and how common it is. It can be used for controlling lots of things, like servo position, LED brightness, and motor speed (on an H-Bridge). But this means we need a way to generate a PWM signal and my first thought was an Arduino Nano, they are able to run at 12v input and create a PWM signal no problem. The nano also gives us the option to add other controls easily.

The controls I deiced I need are, a switch to turn the fan on and off, a potentiometer to control the speed of the fan. And I figured why not add a read out of enabled condition and speed so a small OLED screen to look cool.

Another issue I ran into while building this circuit is that the nano clones, while rated up to 12v, aren't very happy about being there. This caused quite a few issues with the circuit when I first built it and eventually resulted in smoking a nano. I decided to add an adjustable buck converter to drop the voltage from the incoming 12v down to 5v for the nano input. I haven't had any issues since. I mention in the video that you could use a fixed regulator and if I were to build this again that is what I would use.

Step 4: Solder Everything

Soldering this circuit is fairly simple.

I've provided the circuit diagram here above.

All of the parts can be directly wired to the Arduino, the only issue you will run into is that there will not be enough ground pins, you can tackle this in a few ways: glob all the ground pins onto extra space on the GND IN (the 5v side) of the buck converter, do the same on the Arduino, use a short wire to act as a ground rail, or do what I did, and use a small section of protoboard connected to the ground and Vin pins. It's connected to two pins for stability.

Another 'issue' I ran into is that the barrel jack needs to be installed before you can solder it to the buck converter, if you are using the same ones I am. Noted for next time, get ones that get threaded onto the outside.

Something I mentioned in the video is that the voltage regulator on the nano doesn't really like being at 12v. I should make it clear this is, I believe only on the clones. I added the buck converted to drop the 12v incoming to 5v for the Arduino and stuff. To use the buck convert just wire the fan +12v and gnd to the incoming 12v barrel jack. Adjust the buck converter before connecting the out put to anything.

The fan that I chose has four wires, a 12v in, ground, PWM signals, and a tachometer return. I am only using the first three, and just cut down the tachometer wire so it was out of the way. I'm not sure how to implement it in code but I think it could be done.

If there are questions, please leave a comment!

Step 5: Code

The code is bellow. In the next step I'll walk through it in more detail, but simply it does the following

Setup the inputs/outputs

Check if the switch is on
If it is read the potentiometer
do some math to the value
set the fans speed using that info
Update the screen with the info
Otherwise
turn the fan off
Update the screen

I use platform.io in VScode to work on this code but you should be able to copy paste the text over to the Arduino IDE and upload it from there.

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 32

int fanPWM = 3;
int potPin = A0;
int enable = 11;
int newspeed = 0;
int currentspeed = 0;
int percent = 0;

Adafruit_SSD1306 oled(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);

int fanPercent(int speed){
  int percent = 0;
  percent = (speed/255.0)*100;
  return percent;
}

void setup() {
  // put your setup code here, to run once:
  pinMode(fanPWM, OUTPUT);
  pinMode(potPin, INPUT);
  Serial.begin(9600);
  pinMode(enable, INPUT_PULLUP);
  oled.begin(SSD1306_SWITCHCAPVCC, 0x3c);
}

void loop() {
  if(digitalRead(enable)==1){
    newspeed = (analogRead(potPin)/4);
    if (newspeed != currentspeed){
      currentspeed = newspeed;
      analogWrite(fanPWM, currentspeed);
    }
  } else {
    currentspeed = 0;
    analogWrite(fanPWM, currentspeed);
  }

  percent = fanPercent(currentspeed);
  oled.clearDisplay();
  oled.setTextSize(1);
  oled.setTextColor(WHITE);
  oled.setCursor(0,10);
  oled.print("Fan Speed: ");
  oled.print("Fan Enabled: ");
  if(digitalRead(enable) ==1){
    oled.println("True");
  } else {
    oled.println("False");
  }
  oled.display();
  Serial.print("Fan speed: ");
  Serial.println(percent);
}

Step 6: Code Walk Through

Here is a more detailed walk through of the code. You don't have to read this step but I think it can help to know what's under the hood so to speak. It makes issues a bit more easy to fix.

First off at the start of the code we need to import a bunch of libraries to make everything work. All of these libraries are for the OLED screen. I know they look scary but I just figured them out by installing the Adafruit_SSD1306 library and looking at the examples.

I also define the size of the OLED screen.

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 32

Now I need to tell the arduino where everything is. This is done by creating variables with reasonable names and setting them equal to the pin value.

I also created a few helper variables to hold information that we can refer to later. I set it up here, so its there at a known value when I need it.


int fanPWM = 3;
int potPin = A0;
int enable = 11;
int newspeed = 0;
int currentspeed = 0;
int percent = 0;

Now I define the screen object, it'll do a lot of the hard work of writing to the screen for us.

Adafruit_SSD1306 oled(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);

Here I created a small function outside of the code so we can do some math to our values without needing to call it every time in our code. This would be more useful if I needed to do the same math to multiple values but here I am using this for only one value, so it doesn't save a lot of time. But it's generally better to have small pieces of code like this separate. It also makes the code easier to debug.

int fanPercent(int speed){
  int percent = 0;
  percent = (speed/255.0)*100;
  return percent;
}

Now for our setup loop, this will run once and then move on. In here I set up the outputs for the fan PWM signal and the OLED and the input for the pot and power switch.

Then start the service for the OLED screen.

void setup() {
  // put your setup code here, to run once:
  pinMode(fanPWM, OUTPUT);
  pinMode(potPin, INPUT);
  Serial.begin(9600);
  pinMode(enable, INPUT_PULLUP);
  oled.begin(SSD1306_SWITCHCAPVCC, 0x3c);
}

Now we go into the loop, this will run over and over and where the bulk of the code that does work is.

First thing to do is check if the switch is enabled. This is the first thing to do because if it's off I don't have to do anything else.

If it is on I can read the value from the potentiometer, and I know the range for this value, 0-1023, and I know the range for the PWM signal has to be between 0 and 255, exactly 1/4 of the other range. So I divide the read value by 4 to get the PWM speed.

Then I can check if the new speed that we just read is different from the old speed. If it is I can set the speed of the fan with the new speed. A note here, is that there is no 'smoothing' to this value, this means that sometimes the values on the screen will flicker a little bit.

void loop() {
  if(digitalRead(enable)==1){
    newspeed = (analogRead(potPin)/4);
    if (newspeed != currentspeed){
      currentspeed = newspeed;
      analogWrite(fanPWM, currentspeed);
    }
  } else {
    currentspeed = 0;
    analogWrite(fanPWM, currentspeed);
  }

If the switch is off, I set the current speed to 0 and set the fan PWM signal to 0.

Next I use the function I built earlier to put the PWM signal value into the range of 0-100 because that's a more meaning full present to a user.

  percent = fanPercent(currentspeed);

The rest of this is just to to write things to the OLED. First clear the screen, set the text size, and color. Then place the cursor, print the first line. Note here that some of the lines use print instead of println. Print will keep the cursor on the same line, and println will move the cursor to the next line. So I use println after I am done writing on the first line.

  oled.clearDisplay();
  oled.setTextSize(1);
  oled.setTextColor(WHITE);
  oled.setCursor(0,10);
  oled.print("Fan Enabled: ");
  if(digitalRead(enable) ==1){
    oled.println("True");
  } else {
    oled.println("False");
  }
  oled.display();
  Serial.print("Fan speed: ");
  Serial.println(percent);
}

Everything in the loop will just keep running forever until the Arduino is unplugged. This will be the functional block of code that takes care of everything.

Step 7: Assembly of Everything Else

With your printed parts done we can slap'em all together.

Start by sliding the bottom of the T-Piece into the base and slide the snap ring (open side first) into the slot in the back of the base. It will be a tight fit but it should snap in at some point. Then you'll be able to rate the T-Piece with just a bit of resistance to hold it in place. If the snap ring doesn't want to go in you can slip off one side a bit to make the opening larger, it shouldn't need much if its too tight.

Now take the larger section of the filter box and put super glue around the edge and place the filter box cover on top and hold it until the glue sets up.

Use two of the screws that came with the fan to attach the filter box to the back of the fan (the side the air will blow out of). The screws cut threads into the plastic on the fan, so it takes some elbow grease to get them in all the way. I would recommend doing screws in opposite corners.

Flip the fan over and install the grate on the front of the fan (air going in) and again, put the screws in opposite corners.

The two 'sub-assemblies' are done. Install the electronics in the base. To install the screen, tip one side into the little tray then the other side should snap in. The pot and switch should slide in then thread the nuts on the top to hold them in place. I always use two pairs of pliers to get everything locked down so it won't move.

Place the filter box on the T-Piece and slide the bolt through the hole and screw on the nut. The nut should tighten down and hold the fan upright.

Use some M3 screws to attach the bottom, and optionally, install some lil rubber feet.

Almost forgot, slide the filter into the top of the filter box.

Step 8: Test It Out

It should be done at this point. Power it up and take it for a test drive.

If you have questions please leave them below. Thanks for your time!

Feel free to follow me over on YouTube or Instagram.