Ultrasonic Sensors:

  • Use high-frequency, inaudible sound waves to determine distance

  • Reliable in low-light conditions and on surfaces where optical sensors might fail

  • Like a bat using echolocation to "see" its surroundings

How Temperature Affects Ultrasonic Waves

Speed of Sound:

  • Warmer air makes molecules move faster, increasing sound speed

  • Colder air slows sound, affecting the return time of ultrasonic pulses

  • Temperature variations can alter measurement accuracy

In-Class Experiment: Flood Monitoring

Objective: Use an ultrasonic sensor to measure water levels in a container, simulating a flood

Materials Needed:

  • Arduino R3/R4 Uno, ultrasonic sensor, buzzer, container, water source, measuring tape, computer, fishing line (thin string), graphing tools (Excel/Google Sheets)

  • Procedure:

    1. Sensor Setup:

      • Mount the sensor above the container and record the initial (dry) distance

    2. Uploading the Code:

      • Upload the provided sketch that triggers the sensor, measures distance, and activates a buzzer when thresholds are met

    3. Data Collection & Analysis:

      • Pour water gradually and manually measure water level

      • Plot sensor data versus manual measurements to analyze accuracy

Code Explanation

  • Triggers the sensor, calculates the time it takes for the echo to return, converts this to a distance measurement

  • Uses conditional logic to sound a buzzer if the distance falls below a set threshold

Discussion & Real-World Applications

  • Analysis:

    • Compare sensor data with manual measurements

    • Discuss factors (e.g., temperature, water ripples) affecting accuracy

  • Applications:

    • Flood monitoring, reservoir management, coastal tide measurement

    • Broader environmental sensing and early warning systems

You’ll notice that the ultrasonic sensor has small holes in each corner. I threaded fishing line through these holes and secured it using the holes on the clip (which I believe I also left for you). Then, I suspended the sensor over the water, keeping it as level as possible. Once it's in place, we can start filling the water bucket. Note: I am using the R4 in this image as you see this is not plugged up to my computer but to an outlet.