More purifier fixes

This commit is contained in:
Tanner
2026-06-13 16:28:37 -06:00
parent 5613bdb56e
commit 2126960812
+20 -11
View File
@@ -15,21 +15,23 @@ I use motion sensors to control the lights in my house, so my home automation sy
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 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. I didn't want to get a different air purifier that was smart and have to deal with some app or let a random smart device onto my network.
## Technical Details ## 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 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](https://git.tannercollin.com/tanner/airmega-hack/src/branch/master/firmware/firmware.ino) on my Gitea. 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.
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. You can find the [source code](https://git.tannercollin.com/tanner/airmega-hack/src/branch/master/firmware/firmware.ino) on my Gitea.
An unfortunate 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. I discuss this further down.
## Hardware Hacking ## 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. 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: I removed the cover and all the filters, and then the nine Phillips 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]] ![[purifier2.jpg]]
@@ -57,17 +59,20 @@ Researching the hack was not as straightforward. I disassembled the unit and not
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. 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](https://www.digikey.ca/short/nv9wtwr9). 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. Luckily I only blew a fuse on the board and just had to solder a new one on, part number [MST 3.15A 250V](https://www.digikey.ca/short/nv9wtwr9). Then I switched to using 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 on Pin 4.
This showed me the hack was indeed possible, so I ordered a differential probe off Amazon in order to scope the signals precisely: 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 1 (+5V_1A, white) is pretty clean 5.3 V always
- Pin 2 (SIG1) doesn't seem like anything - Pin 2 (SIG1) doesn't seem like anything
- Pin 3 (CON3-2) is speed tach. 50% duty cycle, period widens as it gets slower - Pin 3 (CON3-2) is speed tach. 50% duty cycle, period widens as it gets slower
- low speed 80 Hz - low speed: 80 Hz
- medium speed 119 Hz - medium speed: 119 Hz
- high speed 200 Hz - high speed: 200 Hz
- Pin 4 (CON3-3) is PWM 0-5 V, higher duty cycle for more speed - Pin 4 (CON3-3) is speed control PWM 0-5 V, higher duty cycle for more speed
- low speed: 6.8% duty cycle
- medium speed: 8.1% duty cycle
- high speed: 13.7% duty cycle
- Pin 5 (GND_S) ground, floats 48 VAC above mains ground - 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 - Pin 6 (15VON/OFF) is 1.5 V when machine is off, noisy 5.3 V when running
@@ -77,7 +82,7 @@ I ordered 17 different 6-pin connectors with the same pitch off Digikey and test
## Future Improvements ## 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. 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 blower speed, similar to the built in functionality. The blower's speed could be ramped up gradually now that fine-grain control of the speed is possible.
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. 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.
@@ -120,4 +125,8 @@ action:
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. 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. Hit save and call it something like "Purifier automation". The slider should now be on your dashboard under a "Helpers" section.
---
AI disclosure: None of this article's content or prose was written by AI. The Arduino code that runs on the ESP8266 was written by Gemini.