Making a Fan Smart or How to Improve the Microclimate in the Bathroom with Home Automation

A fan was chosen as the test subject.

AURAMAX OPTIMA 5

from ERA Group.

Technical characteristics of this fan:

The image below shows the appearance of the fan:

As you can see, the fan housing has a slotted area on the front side, which is ideal for installing a temperature and humidity sensor. However, the internal space is quite limited for placing the control electronics, which will need to be taken into account when designing the circuit diagram and printed circuit boards. Well, in the best DIY traditions, we will develop the control electronics ourselves.

Electronics development

The core of our management system will be

ESP8266

— a budget microcontroller from the company

Espressif Systems

with a Wi-Fi interface, which allows for integration into smart home systems or autonomous operation. And since we are limited in space for placing electronics inside the fan housing, I decided to use a transformerless solution based on a high-voltage pulse voltage stabilizer as a power source

LNK306GN

and for switching the fan power circuit we will use a triac. Below is the basic diagram of our control system.

In this circuit, a DHT22 is used as a temperature sensor, and a piezoelectric buzzer with a built-in generator is used for sound notification of turning the fan on or off. Also in the circuit, you can see the Zero Cross sensor, which is implemented on the U2 optocoupler. This sensor was supposed to be used in the implementation of a pulse-phase control system for adjusting the fan speed, but as practice has shown, the ESP8266 did not “carry out” the developer’s “wants”. It is more expedient to implement this system on a separate low-power microcontroller such as Attiny 2313 and the like. Currently, this sensor is used in the hardware interrupt function to turn the fan on/off at the moment of crossing zero.

If you are interested, here is an oscillogram of the zero cross sensor operation

Oscillogram of the zero cross sensor operation

As I wrote earlier, the power supply is implemented on a PWM controller

LNK306GN

where the output voltage of 3.3 V is set by feedback, which is formed using resistors

R1

And

R5

. We increase the denomination

R5

respectively, the output voltage of the power supply increases. For power control of the fan, a “classic” circuit based on an optocoupler with a triac output (U3) and a power triac (Q1) is used. Below are screenshots of the layout and rendering of printed circuit boards.

Wiring:

Render of 3D model:

Manufacturing of printed circuit boards

It's time to make printed circuit boards. I usually make prototypes at home using my compact laser machine, using the method I wrote about

previously

.

The photo below shows the process of photoresist activation using a 445nm laser:

After exposing the photoresist, it is necessary to develop it in a solution of sodium hydroxide (10%) or sodium carbonate, whichever you prefer.

Payments after the development process:

Next, after etching the boards, we install the radio components in accordance with the circuit diagram and then perform a test connection and debugging. To improve the dielectric characteristics of the power module, since the board operates with high voltage and to avoid breakdown, a solder mask was applied. To prevent premature annihilation of the power supply board, I recommend performing tests with a series-connected load (in my case, a 60 W incandescent lamp) in the 220 V power supply circuit. Also, do not neglect the basic rules of electrical safety when performing these works, since the power module does not have galvanic isolation from the network.

Installing printed circuit boards into the fan housing

After all tests have been completed, we install the printed circuit boards of our control system into the fan housing, not forgetting to place the sensor above the special slots. The placement option is shown below

Placement of printed circuit boards on the fan housing:

Firmware and interface

The device works on the basis of my firmware, which can already be called the standard for my smart devices. The development was carried out in the environment

Arduino IDE

. The firmware source code will be available at the end of the article.

The device configuration is classic – via the web interface. When initially connected, the device creates an access point CYBEREX-SmartFAN with password-free access. After connecting to the access point, the user will automatically open an authorization page where they will need to enter the default password “admin“. After logging in, you need to make all the necessary settings for the device. The interface is simple and intuitive. Below are screenshots of the interface.

Login and main page:

Data transfer and automatic mode configuration pages:

Wi-Fi connection configuration:

As I wrote earlier, the device can operate both as part of the Smart Home system and in standalone mode. For integration into smart home systems, the MQTT protocol is used, where data exchange is performed in JSON format. Below is an example of the output (topic “your root name”/jsondata):

{
    "c": "Off",
    "temp": "29.00",
    "hum": "49.70",
    "a": "1",
    "h_on": "65.00",
    "h_off": "52.00",
    "fan_level": "0.00"
}

The fan is controlled using a topic

“your root name”/control

where the passed value is:

0 - включает или отключает вентилятор в зависимости от текущего состояния;
    возвращаемый статус: On или Off
1 - включает автоматический режим работы;
2 - выключает автоматический режим работы;
    возвращаемый статус: 0 или 1

Below is an example of an “object card” for this fan in a smart home system.

Home Assistant

:

Relative humidity chart for the bathroom:

I would like to add that this device has a mechanism MQTT Auto Discovery allowing you to automatically add its sensors and switches to Home AssistantBelow is an example of the object card code that allows you to implement the display of sensors and controls on the Home Assistant panel:

type: entities
entities:
  - entity: switch.f_onoff
    name: Управление вентилятором
  - entity: sensor.smart_fan_temp
    name: Температура
  - entity: sensor.smart_fan_hum
    name: Влажность
  - entity: switch.smart_fan_auto_switch
    name: Автоматический режим
  - entity: sensor.smart_fan_hum_on
    name: Порог включения
  - entity: sensor.smart_fan_hum_off
    name: Порог выключения
title: Вентилятор в ванной

Results & Conclusions

Let's sum it up. As you can see, we have implemented a very useful and necessary system that allows you to automate exhaust fans with a minimal budget to achieve high-quality microclimate indicators in the bathroom. As I said earlier, this system can work both autonomously and as part of a smart home, which simplifies the automation process without using IoT infrastructure. And if you compare the financial costs of implementing my DIY project described in this article with ready-made solutions, for example, with a regular fan with a built-in humidity sensor, then DIY clearly wins not only from a financial point of view, but also in terms of functionality. Below are the approximate costs of implementing this solution:

If we compare it with a ready-made solution, the price for a regular fan with automatic control from a built-in sensor, where there is no hint of integration with smart home systems, starts from 2939 rubles or $ 33.59. The conclusion about the economic efficiency of our DIY project is obvious.

If you liked the article, support it with the up arrow. And if you have something to add, then welcome to the comments. I wish you all creativity, kindness and thank you for your attention.

Links to the article:


Read also:


News, product reviews and contests from the Timeweb.Cloud team — in our Telegram channel


Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *