X
Home > Blog > STEM for Arduino > HOW to Simulate Rainwater Detection with KidsIOT

HOW to Simulate Rainwater Detection with KidsIOT

By r November 8th, 2024 46 views
This station monitors weather conditions in real time.
In this experiment, we combine a steam sensor and a passive buzzer to achieve a rain detection function for this mini meteorological station. When the steam sensor detects rain, the buzzer alarms.

Flow

4101

Assembly

line1

Required Parts

41_00

line1

Step 1

41_01

line1

Step 2

41_02

line1

Step 3

41_03

line1

Step 4

41_04

line1

Step 5

41_05

line1

Step 6

41_06

line1

Step 7

41_07

line1

Step 8

41_08

line1

Completed

41_09

line1

Wiring Diagram

4102

Test Code

Open KidsBlock and connect the board to your computer. Click File –> Load from your computer.

3111

Choose D:\Code\2.Code_kidsIOT to open 4.1Rain detection.sb3 file.

4103

ClickUnconnected to connect to port and then 2210.

Explanations

5top

Conceive:

Set a threshold of voltage to determine the water volume. When there is too much water, the voltage exceeds the threshold, rain is detected, and the buzzer alarms. The buzzer will stop alarming when the voltage is lower than the threshold.

line2

Code structure:

  1. Initialization. Set the pins of the steam sensor and the passive buzzer, set the voltage value of a single scale, and set the frequency of the passive buzzer.

    4104

  2. Loop.

    Print the analog value and voltage of the steam sensor.

    Determine whether the voltage exceeds 1 (Herein, we set 1 as the threshold, which is adjustable according to needs).

    • voltage > 1: buzzer alarms.

    • voltage ≤ 1: buzzer does not emit sounds.

    4105

5bottom

Test Result
4top
After uploading the code, the steam sensor will detects the ambient water volume and converts it to a voltage output. When the voltage is greater than 1, the buzzer alarms. If not, the buzzer will not emit sounds.
ATTENTION: Be careful when using water, please do not to drip to any other place outside the detection area to aviod a short circuit.
4106
4bottom
HOW to Detect Air Pressure with Kidsuno
Previous
HOW to Detect Air Pressure with Kidsuno
Read More
HOW to Make a Track Alarm with KidsIOT
Next
HOW to Make a Track Alarm with KidsIOT
Read More
Message Us