Introduction: Making My Dumb 3$ Diffuser Smart

Introduction

Every since I bought my first smart bulb 7 years back, I am obsessed with home automation, I am obsessed to the point where I want to make every device in my house smart. My lights, heaters, vacuum, door lock, and even my curtains are already smart but there is so much more to do to really call it a smart home.

What was an excitement once has now turned into an obsession and anyone who is into home automation knows how expensive are the smart products compare to normal ones.

I am a computer programmer and know a little about electronics and have taken it upon myself to make every dumb device in my house smart.

This was my first project and one of my personal favorites as I use it almost every day.

I had a 3$ mini air humidifier/diffuser that I purchased from Aliexpress a long time ago and thought it would be a good start to hack the device to make it smart.

I have included the link to supplies that I purchased from Aliexpress because it's super cheap. The only problem is that you have to wait a while before you get the products.

Although the tutorial is to make the diffuser smart, the logic can be applied to make any device smart that has a push-button mechanism.

Reason for the Products I picked.

  1. I use Wemos D1 mini for almost all of my electronics project because of how cheap it is and also it's Arduino-based. On top of that, there are several IoT firmware that you can install on Wemos without any coding. In this instructable, I am going to use one such firmware.
  2. I selected this specific Mini Diffuser because of the price and also because it has a USB slot, so that means I can power the Wemos D1 mini without the need to run an extra cable for powering the D1 mini.

Supplies

  1. Mini Diffuser
  2. Wemos D1 Mini
  3. Opto Coupler
  4. Soldering kit, wires, and lots of excitement

Step 1: Disassembling the Diffuser

The diffuser does not have any screws and can be opened very easily with a bit of force.

Step 2: Understanding How the Diffuser Works

The diffuser is quite simple to use.

  • Pressing the button once would turn the diffuser on
  • Pressing the button again turns the diffuser on in burst mode.
  • Pressing the button again would turn the diffuser off.

So effectively pressing a button toggles between various modes. So to make the diffuser smart we have to emulate a button press.

Step 3: How to Emulate Button Press

Underneath the physical button is a momentary switch. Pressing the button just closes a circuit and releasing the button opens the circuit again.

So all we have to do is to close and open the circuit between the switch using something. That something could be anything from a relay, transistor, or an optocoupler.

For this project, I used an opto coupler. One of the primary advantages of using the optocoupler is that it's small cheap and it provides isolation.

An optocoupler essentially closes a circuit when passed with a small current. If the current flow to the optocoupler is stopped the circuit is opened.

So an optocoupler when connected in parallel to the switch can be used to emulate a button press by passing a small current.

Step 4: Soldering the Electronics

This model of the diffuser was very easy to hack, all that is required is

  1. Solder the power supply from the diffuser USB to the Wemos d1 mini 5V pins
  2. Solder the output pin of Wemos d1 mini to optocoupler
  3. Solder the optocoupler to the diffuser switch in parallel.

In an ideal world, there should be an additional resistor between the Wemos d1 mini output pin and the optocoupler but I was lazy and wanted to keep it simple. Since the pin is high only for 100ms it does not have seem to cause any problem yet.

The best part of this diffuser is that it has a lot of space to fit the d1 mini as well. As shown in the images, everything fits very neatly inside.

Step 5: Flashing the Firmware

The first step to making the Wemos D1 mini useful is to load it with firmware that can provide you with options to control Wemos d1 mini from your computer or mobile.

Flashing the firmware to Wemos D1 mini is quite simple and is clearly documented in the below link

Flashing Tasmota Firmware using Tasmotizer

You can flash the firmware using software called Tasmotizer. Through Tasmotizer you can also configure your wifi credentials and also get the IP address of the device once it is connected to your wifi.

Step 6: Configuring Tasmota

Configuring the Module

Once Tasmota is installed and you are able to find the IP address from the previous step

  1. Open the IP address in any of your browsers.
  2. You should see now see the Tasmota page with a menu.
  3. Goto Configuration > Configure Module
  4. Select Module Type as "Generic (18)" from the dropdown
  5. D2 GPIO4 as "Relay" from the dropdown
  6. Once selected Save

You can go back to "Main Menu" now by clicking on the back button in browser or clicking on Configuration > Main Menu

If your configuration is correctly saved, you should see the Main Menu like in the screenshot.

Now pressing on the Toggle button in the Main Menu should show you "ON" and clicking on the toggle button again should show you "OFF".

Now quickly pressing the toggle button twice should turn on the diffuser if you soldered everything correctly. The reason why you have to press the toggle button twice is that it acts like pressing and releasing the physical button on the diffuser.

This is slightly inconvenient to always press the toggle button twice, luckily tasmota has a way to solve the problem.

Configuring the Pulse Time

Tasmota has something called as "Pulse Time" which would automatically turn off the device after a certain duration. The smalled duration is 100ms and we are going to set it to 100ms so it mimicks pressing and releasing the button on the diffuser.

  1. From the Main Menu. Click on Console
  2. In the line that shows "Enter Command" type "pulsetime 1"

What this command essential does is to mimic the button release as soon as you press it.

Step 7: Using Tasmota

If everything is configured correctly, you should already see your diffuser turned on when you press the "Toggle" button the tasmota screen.

  • The first Toggle turns this model of diffuser on.
  • The second Toggle sets into a burst mode where the diffuser diffuses after a certain duration
  • The third toggle turns the device off.

Tasmota by itself is very powerful and frankly speaking I did not have the time to understand it fully. Through Tasmota you can set timers when the device should be turned on and you can also add rules and conditions.

A quick google search should give you a list of all things you can do with tasmota.

Step 8: Final Notes

    Tasmota is awesome and works for this project but it's not necessary that you have to use this. You can also use other firmware or can code it completely from scratch. Some of the other firmware that I like

    Although you can use Tasmota by itself I integrated Tasmota into home assistant to unlock the full potential. Using home assistant I can create scenes, rules and automation for eg: When I enter my home the diffuser should turn on, or when the lights are dimmed the diffuser should automatically turn on.

    I am not an expert in any of the fields and probably I am wrong in most things that I write but the important thing to remember is that It works. Sometimes it's not necessary that you need to know everything, I personally believe in trying and failing.

    Happy hacking and feel free to write your questions in the comments and I try to answer as many as possible.