Week 4
Week 4: Hardware Testing and Mobile App Control Integration
This week, we focused on hardware testing by connecting the Arduino Uno R4 Wi-Fi with the DHT22 sensor and troubleshooting the Wi-Fi connectivity issues. Additionally, we developed a new function to enable mobile phone control of the humidifier using Blynk, a cloud-based IoT platform.
1. Connecting and Testing the DHT22 Sensor
To properly interface the DHT22 sensor with the Arduino Uno R4 Wi-Fi, the following connections were made:
- Pin 1 (VCC) → Connected to 5V or 3.2V power supply
- Pin 2 (Data) → Connected to the Arduino data pin
- Pin 3 (GND) → Connected to ground (GND)
After completing the wiring, we executed the test code. However, we encountered Wi-Fi connectivity issues, where the connection function failed to operate as expected. To resolve this, we modified the Wi-Fi confirmation parameters:
- Confirmation time was reduced from 1 second to 0.5 seconds
- Maximum connection attempts were increased from 10 to 20
After implementing these changes, the Wi-Fi function worked successfully, ensuring a stable connection.
2. Implementing Mobile Phone Control via Blynk
This week, we also developed a new function that allows users to control the humidifier via a smartphone app. This functionality was achieved using Blynk, and the implementation steps were as follows:
Wi-Fi and Blynk Server Connection
- Before attempting to connect to Blynk, the system first verifies the Wi-Fi connection using:
- If the Wi-Fi is not connected, an error message is displayed, and the system does not attempt to connect to Blynk.
- If the Wi-Fi is connected, the system proceeds to establish a connection with the Blynk cloud server using the
config(auth)
function, whereauth
is the Blynk authentication token. - Once configured, the function checks the connection status with Blynk using:
- If the connection is successful, the system prints "Blynk connection successful!"; otherwise, an error message is displayed.
Manual and Automatic Humidifier Control
- A callback function was implemented to allow users to toggle between manual and automatic operating modes through the Blynk mobile app.
- The function retrieves the V1 virtual pin value from Blynk, which determines the operation mode:
- Manual Mode: The relay switch is directly controlled by user commands from the mobile app, allowing users to manually turn the humidifier on or off.
- Automatic Mode: The system autonomously regulates humidity based on predefined humidity thresholds. If the humidity falls below the set limit, the humidifier activates automatically.
By the end of the week, these functions were successfully implemented, and the system was tested to ensure seamless operation. The resulting output confirmed that Wi-Fi connectivity, Blynk integration, and remote control functionality were working as expected.
Comments
Post a Comment