Air Purifiers - Arduino: Speed Control a 4pin Fan

by nilnull in Circuits > Arduino

4179 Views, 7 Favorites, 0 Comments

Air Purifiers - Arduino: Speed Control a 4pin Fan

IMG_20190303_160857.jpg

I decided to make my own Air Purifiers.

The project is a basic idea, what can be done with hand tools and as cheap as possible. This is a single-fan filter, in the stores the prices of these devices are very high. I looked at several projects until I make my idea. I decided to buy a filter, not to make a filter (maybe I will make a filter in the next version). I'm using a P1 HEPA system filter. For the fan I use - Arctic 120mm PWM. I decided to do a control with NodeMCU - Arduino. My idea was to make an hourly schedule, when to blow strong and weak. I also added a temperature sensor, as there were free pins on the board. I am also waiting for a Dust Sensor PPD42NJ to see if there is a result of everything I did. The biggest problem is the management of the PWM FAN. It took me a long time to make it work and and also a long time to make it work hard.

Materials used:
Prices are approximate and by memory.

IMG_20190216_082539.jpg
IMG_20190216_094101.jpg
IMG_20190216_181840.jpg
IMG_20190216_103957.jpg

I made a wooden box of wooden profiles. It seemed to me easy and beautiful.

IMG_20190216_152707.jpg
IMG_20190218_172812.jpg
IMG_20190306_173950.jpg
IMG_20190306_174010.jpg
IMG_20190225_185138.jpg
IMG_20190225_194200.jpg

In the end, it was not very accurate. I did it on the kitchen counter. I am not very good with the saw.

IMG_20190308_183807.jpg
IMG_20190303_160910.jpg

I also put paddles on it to take the vibrations and not scratch the furniture.

Way of Connection

fan_pwm.png

Arduin Code

IMG_20190302_102358.jpg
IMG_20190302_184255.jpg
IMG_20190302_102346.jpg
2021-10-30 11_43_03-Fan PWM Weather BME680 Dust Async WEB Server.png

This is the Arduin code

https://github.com/jasenpashov/Arduino-read-out-an...

new code

What I understood based on my practices and on of many attempts

  • The NodeMCU and the fan must have a common GND.
  • I can not achieve the maximum fan speed.
  • The system operates unstable without a 560R resistor. I am not sure whether it is OK with other values.

TEST CODE:


int fanPulse = D3;

int fanControl = D2;

unsigned long pulseDuration;

int p = 0;

void setup() {

Serial.begin(9600);

pinMode(fanPulse, INPUT);

digitalWrite(fanPulse,HIGH);

pinMode(fanControl, OUTPUT); }

void readPulse() {

pulseDuration = pulseIn(fanPulse, LOW);

double frequency = 1000000/pulseDuration;

Serial.print("pulse duration:");

Serial.println(pulseDuration);

Serial.print("time for full rev. (microsec.):");

Serial.println(pulseDuration*2);

Serial.print("freq. (Hz):");

Serial.println(frequency/2);

Serial.print("RPM:");

Serial.println(frequency/2*60);

}

void loop() { analogWrite(fanControl,1200);

delay(5000);

readPulse();

analogWrite(fanControl,200);

delay(5000);

readPulse();

}

​Sources

IMG_20190302_102327.jpg