diff --git a/content/Hacking my Air Purifier onto Wifi.md b/content/Hacking my Air Purifier onto Wifi.md index 727a0d9..254b93a 100644 --- a/content/Hacking my Air Purifier onto Wifi.md +++ b/content/Hacking my Air Purifier onto Wifi.md @@ -1,7 +1,7 @@ Title: Hacking my Air Purifier onto Wifi Date: 2026-05-27 -Category: Writing -Summary: Hardware hacking my Airmega 200M Purifier onto Wifi +Category: Creations +Summary: Hardware hacking my Airmega 200M Purifier onto Wifi. Image: purifier1.jpg Wide: true @@ -73,4 +73,51 @@ This showed me the hack was indeed possible, so I ordered a differential probe o 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 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. \ No newline at end of file