Files
personal-site/content/Hacking my Air Purifier onto Wifi.md

8.4 KiB

Title: Hacking my Air Purifier onto Wifi Date: 2026-05-27 Category: Creations Summary: Hardware hacking my Airmega 200M Purifier onto Wifi. Image: purifier1.jpg Wide: true

My Airmega 200M air purifier has four speed settings: useless, less useless, annoying and SCREAMING BANSHEE. I was able to connect an ESP8266 Arduino to the motor driver board and get direct fine-grained control of the speed over Wifi. I use this to vary the speed based on my distance to the air purifier so I don't have to listen to it.

!purifier1.jpg

Home Automation

I use motion sensors to control the lights in my house, so my home automation system somewhat has an idea of what room I'm in. I use this data to control the purifier's speed based on how far away I am from it. If I'm on the same floor, it runs very quietly (~12% power). If I'm one floor away, it runs at 50%. If I'm two floors away (or I'm not home), it runs at 100%.

I live alone, but my automation system has a "Guest Mode" which prevents the motion sensors from turning lights off. If this mode is enabled, the purifier only runs quietly.

I didn't want to get a different air purifier that was smart and have to deal with some app or let a smart device onto my network.

Technical Details

The power supply and motor driver board originally connect to a board that has the buttons and LEDs via a 6-pin ribbon cable. Pin 4 of that cable expects a PWM signal that controls the speed of the purifier's blower motor proportional to the duty cycle. Pins 1 and 5 happen to be 5 V and Ground, which are used to power the Wemos D1 Mini ESP8266.

The Wemos boots up and connects to an MQTT broker on my Wifi network. It subscribes to the iot/purifier/mega_1234/speed topic where 1234 is part of the MAC address so different purifiers on the network can be addressed easily. It listens to messages that are numbers 0-100 and maps them linearly to 60-140 which correspond to the PWM duty cycle range that the motor driver expects. You can find the source code on my Gitea.

A side effect of this is that the control board is completely dead and manual control of the purifier no longer works except for unplugging it. I actually don't mind this because it also kills the blue LEDs and I just use my smart watch or phone to control it instead. The built-in dust sensor also no longer works, but it should be possible to also read this with the Arduino over serial in the future.

Hardware Hacking

Hacking the purifier is actually fairly straightforward. My purifier was already over a year old, so I didn't care about voiding my warranty. The power supply isn't isolated and the electronics' ground is floating at something like 48 VAC (learned this the hard way), so I keep it unplugged while I'm modifying it.

I removed the cover and all the filters, and then the nine Philips screws holding the case together. I lifted the blower half up and propped it up at an angle. You can see a photo of it below, with the ribbon cable plugged into the control board at the bottom right:

!purifier2.jpg

I didn't want to destroy the cable by cutting it to connect it to the Arduino, so I ordered some connectors off of Digikey. Both 25SH-B-06-TR and 51125-06-0200-01 mate well with the white ribbon cable connector. I soldered the connector to a bit of 0.1" perf board and wired it to the Arduino:

!purifier3.jpg !purifier4.jpg

The wiring is:

Wemos   Cable
5V    - Pin 1 (white)
G     - Pin 5
D1    - Pin 4

I then simply unplugged the control board, plugged in my perf board connector, and secured it with some of the tape inside the purifier as you can see in the first photo. I reassembled the case and reinstalled the filters.

Research

Researching the hack was not as straightforward. I disassembled the unit and noticed the blower motor was wired to the same board where the power supply was. I then saw the ribbon cable between that board and the control board, so chose to target it first. The pins were labelled on the board's silkscreen and I soldered some jumper cables to the back so I could scope them easier.

!purifier5.jpg

I attached my oscilloscope's ground lead to the GND_S pin and probe to the SIG1 pin, expecting that to be a signal. I plugged the purifier in and immediately heard a POP! That's when I learned the power supply isn't isolated and I had just shorted 48 volts through my oscilloscope to ground.

Luckily I only blew a fuse on the board and just had to solder a new one on, part number MST 3.15A 250V. From then on I used two probes, one on the signal and one on the ground pin and used my oscilloscope's math feature to subtract them. This made a noisy and imprecise trace, but it was enough to tell the speed was controlled by PWM.

This showed me the hack was indeed possible, so I ordered a differential probe off Amazon in order to scope the signals precisely:

  • Pin 1 (+5V_1A, white) is pretty clean 5.3 V always
  • Pin 2 (SIG1) doesn't seem like anything
  • Pin 3 (CON3-2) is speed tach. 50% duty cycle, period widens as it gets slower
    • low speed 80 Hz
    • medium speed 119 Hz
    • high speed 200 Hz
  • Pin 4 (CON3-3) is PWM 0-5 V, higher duty cycle for more speed
  • Pin 5 (GND_S) ground, floats 48 VAC above mains ground
  • Pin 6 (15VON/OFF) is 1.5 V when machine is off, noisy 5.3 V when running

I wrote a quick Arduino sketch to see if the 0-3.3 V PWM it outputs was enough to control the speed and it was. This, combined with the fact there's 5 V supplied by the ribbon cable meant that the Arduino could be connected simply with three wires, without the need for level shifters or a power supply.

I ordered 17 different 6-pin connectors with the same pitch off Digikey and tested each one until I was satisfied with the fit. I programmed the Arduino, soldered it all up, and the hack was complete! I've been using it for almost a year now.

Future Improvements

As I mentioned before, it should be possible to communicate directly with the integrated particulate sensor over its cable. I didn't bother to do this because I already had my own Custom Air Quality Monitor running. The sensor data could then be used as feedback to control the fan speed, similar to the built in functionality.

The control board is completely disabled after doing this hack which might be inconvenient for house guests or spouses. An improvement could be using the Arduino to intercept the speed control signal instead by putting it in the middle. It could read the control board's PWM signal by timing the pulse width, or as a voltage on one of its analog pins after low-pass filtering it. Then whenever there's a change to the MQTT speed or control board speed, output the latest value.

Appendix: Home Assistant

I don't actually use Home Assistant for this, but here's how one could configure it. This assumes you have an MQTT broker (ie. mosquitto) running. If you don't, Home Assistant can be configured to run a broker by installing the Mosquitto broker add-on from the Add-on Store.

Set up MQTT

Go to Settings > Devices & Services > MQTT > Configure > Re-configure MQTT.

Enter your MQTT broker details. If you are using the broker add-on, it should be automatically discovered.

Add the Slider

  1. Go to Settings > Devices & Services > Helpers
  2. Click + Create Helper (bottom right) and select Number
  3. Set the Name (like "Purifier Speed") and Icon (I used "mdi:air-purifier")
  4. Set Minimum value to 0 and Maximum value to 100
  5. Click Create

Note the Entity ID of the slider. Mine is "input_number.purifier_speed".

Add the Automation

Go to Settings > Automations & Scenes > + Create Automation > Create new automation.

You can do this with the UI but I prefer entering YAML code. Click the three dots at the top right and select "Edit in YAML". Paste this in:

trigger:
  - platform: state
    entity_id: input_number.purifier_speed
action:
  - service: mqtt.publish
    data:
      topic: "iot/purifier/mega_1234/speed"
      payload: "{{ states('input_number.purifier_speed') | int }}"

Note that input_number.purifier_speed has to match the Entity ID of the slider and mega_1234 should be changed to the ID the purifier Arduino reports over serial after programming.

Hit save and call it something like "Purifier automation". The slider should now be on your dashboard under a "Helpers" section.