-
1Hardware Connections for Fan Control App
The ESP32 board is placed on a breadboard. Pin 32 of the ESP32 board gives the Analog Signal to the motor control module. Power the ESP32 board and the L293D module by connecting them to corresponding Power Rails. The M1a and M1b pins of the module sets the direction of rotation of the motor. Finally, connect the motor to the module.
If you only have the L293D IC then you can follow this tutorial and make the connections.
-
2Tuya Application Setup
We assume that you are already familiar with the Tuya Platform and have created your account. Make sure you install tuyaos-link-sdk in Python.
Tuya IoT Platform(Web)
Once logged in, create a new product (follow this simple tutorial as a getting started guide on Tuya) to get the following screen.
Now add the following functions by clicking the ‘Add’ button with the following attributes.
Next, complete the UI Studio Design. Test and Release it to resolve any errors. Following is a simple UI Design made for this Application.
Open the motorapp.py file from the GitHub repo in the editor. Edit and change the productid, uuid, authkey (obtained by license generation for Link SDK) and the COM port of your connected ESP32 device in the file. Save this edited file, to be used in the output section of this article.
Tuya Smart Application (Android)
After installing and setting up the Tuya Smart App, just click the scanner button to scan the QR code generated by the motorapp.py file.
Now the FAN Application will be added to the All Devices section of the Tuya Smart App.
-
3Arduino IDE Program
The Arduino IDE Program in the GitHub repo makes the ESP32 board listen to the commands sent by the python program via the serial port. Simply add your ESP32 board in Arduino IDE, compile and flash the motorapp.ino program.
Board Manager URL: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json
-
4Automation in Tuya Smart Application
You can automate the FAN Application as per your requirement in the Tuya Smart APP. Just Navigate to Create Scene option in the Smart section of the APP.
Here, you can set the Application to Tap-to-Run, Weather control, Location Control, Schedule it etc.
Just create a schedule and the fan will be turned on or off based on it!
Also, the Application control on a weather changes basis can prove really useful, so just explore!
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.