-
1Supplies
1x Duct Fan
1x Gravity Environmental Sensor
1x Relay Module
1x DC Jack
My Tools:
Sponsored By Hon&Guan:
This project is made possible by the generous support of Hon&Guan – a leading name in the research and development manufacturing of air replacement, fresh air ventilation, and ventilation equipment. Hon&Guan is a cutting-edge, high-tech enterprise specializing in products like mixed flow inline duct fans, ventilation fans, and AC/DC fans.
Explore their range of quality ventilation solutions at https://store.honguan.com. Thank you, Hon&Guan, for being a key contributor to the success of this project!
-
2Circuit Connection
Just refer to the circuit diagram and connect the electronics on the prototyping board. I've used header pins and corresponding electronic components for easy connections and component replacement.
-
3About L7805CV
The L7805CV is a voltage regulator integrated circuit (IC) that is commonly used to provide a stable and fixed output voltage of +5 volts. This component is part of the 78xx series of voltage regulators, where "78" denotes a positive voltage regulator and "05" indicates the fixed output voltage of +5 volts.
Here are some key points about the L7805CV:
- Voltage Regulation: The primary function of the L7805CV is to regulate the input voltage and maintain a constant output voltage of +5V.
- Input Voltage Range: The typical input voltage range for the L7805CV is around 7V to 35V. It can handle higher input voltages, but the excess voltage is "dropped" or dissipated as heat.
- Output Current: The maximum output current is around 1.5 amps. It can supply a stable +5V output for electronic circuits within this current limit.
- Three-Terminal Device: The L7805CV has three terminals: Input (Vin), Ground (GND), and Output (Vout). Proper connection and orientation of these terminals are crucial for correct operation.
- Heat Dissipation: The L7805CV may generate some heat, especially when the input voltage is significantly higher than the output voltage. To prevent overheating, it's common to use a heatsink or ensure adequate ventilation.
-
4About IRF520N
The IRF520N is a power MOSFET (Metal-Oxide-Semiconductor Field-Effect Transistor) commonly used in electronic circuits for switching applications. Here are some key points about the IRF520N:
- Type: The IRF520N is an N-channel MOSFET. In N-channel MOSFETs, current flows from the drain to the source when a voltage is applied to the gate.
- Voltage and Current Ratings: It is designed to handle relatively high voltages and currents. The maximum drain-source voltage (Vds) is usually around 100 volts, and the maximum continuous drain current (Id) is typically in the range of 9-10 amperes.
- Gate Threshold Voltage (Vgs(th)): This parameter indicates the voltage at which the MOSFET starts conducting. For the IRF520N, it is typically around 2-4 volts.
- Low On-Resistance (Rds(on)): The on-resistance of the MOSFET, when it is fully conducting, is relatively low. This is beneficial for minimizing power dissipation and improving efficiency in switching applications.
- Switching Applications: The IRF520N is commonly used in electronic projects where there is a need for switching high-power loads, such as controlling motors, solenoids, or other inductive loads.
- Heat Dissipation: Like many power MOSFETs, the IRF520N may generate heat during operation. It is important to consider heat dissipation methods, such as using a heatsink, especially when dealing with higher currents.
- Pin Configuration: The IRF520N typically has three terminals: Gate (G), Drain (D), and Source (S). Proper connection and attention to polarity are essential for correct operation.
-
5About Relay
A relay is an electromechanical device that functions as a switch, using an electromagnet to control the flow of electrical current. Here are some key points about relays:
- Switching Function: Relays are used to control the opening and closing of electrical circuits. They act as an interface between low-power electronic circuits (such as microcontrollers or sensors) and high-power devices (such as motors, lights, or appliances).
- Electromagnetic Operation: Relays consist of a coil (winding) and a set of contacts. When a current flows through the coil, it generates a magnetic field that attracts a movable armature. This action causes the contacts to either close or open, completing or interrupting the electrical circuit connected to them.
-
63D Printed Parts
After measuring dimensions and consulting datasheets, I've created a basic enclosure using Fusion 360 to house the electronics.
- Feel free to examine my design, download it, and make any modifications as needed.
- I have exported the housing and cover parts as .stl files and 3D printed them in this wood-colored filament.
-
7Assembly
Once the circuit and electronics enclosure are prepared, use screws to secure the components in their designated positions.
- Before closing the housing with the cover, perform a quick test to ensure everything is functioning properly.
- Finally, close the snap-fit housing with the cover body.
Note: The Mylar enclosure includes a comprehensive instruction guide and well-labeled guides, facilitating an easy assembly process.
-
8Blynk Setup
What is Blynk?
Blynk is a platform for building and managing Internet of Things (IoT) applications. It provides a mobile app and a cloud-based infrastructure that allows users to control and monitor connected devices remotely. Blynk is popular among makers, hobbyists, and developers who want to create IoT projects without extensive knowledge of coding and networking.
Now let's setup Blynk for our device:
- Go to Blynk.io and create a free account.
- Once logged in create a new template by providing name for your template, select hardware as ESP32 and Connection Type as Wi-Fi.
- Then go to DataStream's panel and configure the DataStream's as shown in the above image.
- Now go to Devises and create a new device by selecting the template that we have created.
- Once device is created copy the Firmware Configuration, we will need this in the next step.
-
9Code
- Install the Arduino IDE and ensure that the ESP32 Board manager is installed. If you're not sure how to do this, you can refer to this article: Installing the ESP32 Board in Arduino IDE.
- Make sure you have the DFRobot/DFRobot_RTU (github.com) and cdjq/DFRobot_EnvironmentalSensor (github.com) libraries installed. To do this, go to Sketch -> Include Libraries -> Add .Zip Library, select the Zip file.
- Also install the Blynk library to do this, go to Sketch -> Include Libraries -> Manage Libraries, search for Blynk and install the one as shown in above image.
- Now copy paste the below code in the Arduino IDE.
/* Project : DIY Smart 3D Printer Enclosure Author : Mukesh Sankhla Website : makerbrains.com */ /* Comment this out to disable prints and save space */ #define BLYNK_PRINT Serial /* Fill in information from Blynk Device Info here */ #define BLYNK_TEMPLATE_ID "***********" #define BLYNK_TEMPLATE_NAME "*****************" #define BLYNK_AUTH_TOKEN "****************************" #include <wifi.h> #include <wificlient.h> #include <blynksimpleesp32.h> #include "DFRobot_EnvironmentalSensor.h" DFRobot_EnvironmentalSensor environment(/*addr = */SEN050X_DEFAULT_DEVICE_ADDRESS, /*pWire = */&Wire); // Your WiFi credentials. // Set password to "" for open networks. char ssid[] = "**********"; //Wifi Name char pass[] = "*********"; //Password #define FanPin D2 #define LightPin D3 void setup() { // Debug console Serial.begin(9600); Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass); while(environment.begin() != 0){ Serial.println(" Sensor initialize failed!!"); delay(1000); } Serial.println("Initialization success!!"); // Set the mode of pins for Fan and Light pinMode(FanPin, OUTPUT); pinMode(LightPin, OUTPUT); } void loop() { readSensor(); Blynk.run(); } void readSensor(){ // Print the data obtained from sensor Blynk.virtualWrite(V3, environment.getTemperature(TEMP_C)); Blynk.virtualWrite(V4, environment.getHumidity()); Blynk.virtualWrite(V5, environment.getLuminousIntensity()); } // Blynk function to handle incoming data from the app BLYNK_WRITE(V2) { // Read the value of Fan from the app int fanValue = param.asInt(); // Toggle the FanPin based on the received value digitalWrite(FanPin, fanValue); } // Blynk function to handle incoming data from the app BLYNK_WRITE(V1) { // Read the value of Light from the app int lightValue = param.asInt(); // Toggle the LightPin based on the received value digitalWrite(LightPin, lightValue); }
- Replace the following in the code with the copied Firmware Configuration.
/* Fill in information from Blynk Device Info here */ #define BLYNK_TEMPLATE_ID "***********" #define BLYNK_TEMPLATE_NAME "*****************" #define BLYNK_AUTH_TOKEN "****************************"
- Also enter your Wi-Fi credentials
// Your WiFi credentials. // Set password to "" for open networks. char ssid[] = "**********"; //Wifi Name char pass[] = "*********"; //Password
- Now select the board as FireBeetle 2 ESP32-E, select the port and upload the code.
- Install the Arduino IDE and ensure that the ESP32 Board manager is installed. If you're not sure how to do this, you can refer to this article: Installing the ESP32 Board in Arduino IDE.
-
10Blynk App Setup
- To set up the Blynk mobile app, log in to your account. Locate the template you created earlier in a web browser and open it. The template might appear blank initially.
- Click on the spanner icon to add widgets. Use the + icon to find various widgets, then drag and drop two buttons and three gauges onto the template. Resize them as needed.
- Click on each added widget, choose the corresponding DataStreams, and customize the design by adjusting aesthetic parameters like font and color.
- Remember to set the buttons as switches instead of push buttons.
- After these adjustments, your template should resemble mine.
- To set up the Blynk mobile app, log in to your account. Locate the template you created earlier in a web browser and open it. The template might appear blank initially.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.