Week 2

Week 2: Software Development and Wi-Fi Integration

In the second week, we focused on developing the software for the Arduino microcontroller. We successfully configured the Arduino to connect to Wi-Fi, enabling remote communication with a mobile application. This app, which can be installed on a smartphone, allows users to monitor temperature and humidity levels and control various humidifier components, including turning the device on and off.

Lab Session (Thursday):
During this week's lab, we discussed the functionality of our code and refined our approach to software development. To enhance our understanding, we studied the Arduino Uno R4 Wi-Fi and explored its capabilities to optimize our function design.

We then proceeded to write the initialization and setup code for the DHT22 temperature and humidity sensor using Arduino IDE 2.0.4. The implementation steps were as follows:

  1. Including the DHT Library:

    • The code begins by importing the required DHT.h library using #include <DHT.h>.
  2. Defining Sensor Connection:

    • We assigned pin 7 as the connection point for the DHT22 sensor on the Arduino Uno R4 Wi-Fi.
  3. Reading Humidity and Temperature Data:

    • Inside the loop, the code continuously reads the humidity and temperature values from the sensor.
  4. Validating Sensor Readings:

    • The program includes a condition to check whether the readings are valid. If the reading fails, the system prints an error message and skips the current loop iteration to prevent invalid data from being processed.
  5. Displaying Data:

    • Once validated, the temperature and humidity data are printed to the serial monitor, allowing us to verify the sensor’s output.

With this foundational coding structure in place, we ensured that the DHT22 sensor was properly initialized and functioning as expected. This step was crucial in preparing for further development, including integrating Wi-Fi connectivity and additional automation features.












Comments

Popular Posts