Thursday, 6 February 2025

Weekly Activity Update: Flood Detection System Development Week 2 (Settimana 2)

 Overview of Week 2 Activities

This week, we focused on testing the components, troubleshooting code integration, and ensuring that all parts worked together effectively. After delays in delivery, we finally received most of the components from the lab technician. However, some components had not been ordered, which could have slowed down our progress. To overcome this, we reached out to one of our demonstrators, Will, who generously provided us with the missing components. This allowed us to proceed with testing without further delays.

Despite these setbacks, we remained committed to ensuring that we made the most of the week. We worked as a team to begin integrating the sensors with the ESP-32 microcontroller and debugging initial coding challenges. We also tried developing the code with a flowchart of its working procedure to make further progress.

Figure 1: Flood detection system components before testing, including the ESP-32 microcontroller, sensors, battery, and other essential hardware

Component Collection and Setup

Once we collected the components, we started organising and setting up the hardware for testing. The key components included:

  • DFRobot Development Board (DFR0478)

  • HC-SR04 Ultrasonic Sensor

  • VL53L0 Infrared TOF Sensor

  • Soil Moisture Sensor

  • RGB LED

  • ABT-414-RC Buzzer

  • 800mAh LiPo Battery

We systematically tested each component to confirm functionality before integrating them into the full system.

Figure 2: Close-up of the HC-SR04 ultrasonic sensor, VL53L0 infrared sensor, soil moisture sensor, and RGB LED, highlighting their integration in the system.

Team Responsibilities and Progress


 Task

Responsible Member

Status

 

 Managing project timeline & blog documentation

 Sayed

 In progress

 Sensor integration & TOF Sensor code

 Sayem

 Completed

 Hardware setup & HC-SR04 sensor code RGB LED troubleshooting

 Cian

 Completed

 Component delivery follow up

 Sayed

 In progress




This week, we focused on refining the microcontroller code to allow seamless sensor integration. Our coding efforts revolved around:

  • HC-SR04 Ultrasonic Sensor Integration: Sayem worked on writing and testing the ultrasonic sensor code, ensuring that it provided accurate distance measurements within the range of 20mm to 4500mm. The sensor successfully communicated with the microcontroller, outputting expected values.

  • VL53L0 TOF Sensor Integration: Cian took charge of writing the code for the VL53L0 infrared time-of-flight (TOF) sensor, which provides high accuracy distance measurements. We encountered compatibility issues with the libraries, as the Arduino IDE didn’t immediately support the correct drivers. After manually downloading and installing the required packages, we successfully got the sensor working.

  • RGB LED Troubleshooting: One of the biggest challenges was getting the RGB LED to function correctly. Initially, we struggled to program it to display multiple colours simultaneously. We called over Will, who guided us through different approaches to coding the LED. After troubleshooting, we successfully programmed it to cycle through different colours based on water level thresholds.

Figure 3: Team member connecting the sensors to the ESP-32 microcontroller to begin testing sensor accuracy.

Component Testing

Once the coding was functional, we tested each sensor individually before integrating them together. The results:

  • HC-SR04 Sensor: Provided reliable distance measurements with a ±2mm accuracy.

  • VL53L0 TOF Sensor: High precision, with a range of 30mm to 2000mm.

  • Soil Moisture Sensor: Successfully detected different levels of moisture.

  • Buzzer & RGB LED: Functioned correctly to indicate warnings when flood conditions were simulated.

We were pleased with the accuracy of our sensors, though further real-world testing is needed to confirm performance under actual flood conditions.

Figure 5: Testing the HC-SR04 ultrasonic sensor by measuring distance to an obstacle and verifying the accuracy of readings.

Secondary Version of the Code

This version includes only the core functionalities without complete implementations. It serves as a starting point for the full version.

Key Features of Secondary Code Version

Reads sensors (Soil Moisture, Ultrasonic, ToF)
Initialises components
Does not yet control LEDs or Buzzer
Lacks advanced processing or decision-making

Sets up I2C and ToF sensor                                                Reads analogue value from A0



Gets distance from D2 & D3
Reads the 3 sensors                                                             Loop Function

 


  • This version is only collecting data.
  • It does not process or act on sensor values.
  • There is no LED/Buzzer control.
  • It does not store or log data.


  • 4. Challenges and Problem-Solving
    1. Library Compatibility Issues

      • We faced difficulties getting the correct software libraries for our sensors in Arduino IDE. Initially, the IDE did not support the required packages, which prevented the microcontroller from recognising the sensors. The solution was to manually search for the correct libraries, install them, and configure them to match our components.

    2. RGB LED Coding Difficulties

      • We initially coded the RGB LED to output colours based on sensor readings, but we could not get it to show multiple colours simultaneously. Will assisted us in debugging the issue, and we managed to fix it by adjusting the code to manipulate individual LED pins correctly.

    3. Simulation Limitations

      • Tinker CAD and Fritzing did not have exact equivalents for some of our components, making it challenging to simulate real-world behaviour accurately. We overcame this by testing directly with physical components as soon as we received them.

    Figure 6: Demonstrator Will assisting with debugging the RGB LED code to enable simultaneous multi-colour output.

    Next Steps & Action Plan


    We plan to test the flood detection system under real conditions next week. This will involve simulating different water levels and verifying whether the sensors trigger alerts accurately. Additionally, we will start working on the project poster, which will summarise our work and findings.

    Conclusion

    Despite initial setbacks due to missing components, we made significant progress this week. Thanks to Will’s assistance, we were able to acquire missing parts and resolve technical difficulties with the RGB LED. Our sensors performed well in initial tests, and we are now focusing on fine-tuning integration and preparing for real-world testing.

    With steady progress and strong teamwork, we are on track to complete the project successfully.

    No comments:

    Post a Comment

    Poster