X
Home > Blog > STEM for Arduino > HOW to Simulate Thunder Detection with Kidsuno

HOW to Simulate Thunder Detection with Kidsuno

By r November 4th, 2024 63 views
Thunder is the atmospheric sound produced by lightning. When thunder is detected, it sends an alert that rain may be coming.
In this experiment, we integrate a sound sensor and a white LED module to construct a thunder detector. When the thunder volume exceeds a set threshold, the white LED will lights up.

Flow

4401

Assembly

line1

Required Parts

44_00

line1

Step 1

44_01

line1

Step 2

44_02

line1

Step 3

44_03

line1

Step 4

44_04

line1

Step 5

44_05

line1

Step 6

44_06

line1

Step 7

44_07

line1

Completed

44_08

line1

Wiring Diagram

4402

Test Code

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

3111

Choose D:\Code\1.Code_kidsuno to open 4.4Sound detection.sb3 file.

4403

Click Unconnectedto connect to port and then 2210.

Explanations

5top

Conceive:

Set a threshold of analog value to determine the thunder volume. When thunder is detected, the analog value exceeds the threshold, and the white LED lights up as an alarm. The LED will go off when the value is lower than the threshold.

line2

Code structure:

  1. Initialization. Set the pins of the sound sensor and the white LED module.

    4404

  2. Loop.

    Print the analog value of sound volume detected by the sound sensor.

    Determine whether the analog value is greater than 100 (Herein, we set 100 as the standard threshold of thunder volume, which is adjustable according to needs).

    • analog value > 100, the white LED lights up.

    • analog value ≤ 100, the white LED goes off.

    4405

5bottom

Test Result
4top
After uploading the code, the sound sensor detects whether there is a thunder. When the analog value of the sound exceeds 100, a thunder is detected and the white LED will light up.
Here we stimulate thunder by playing music. When the value is greater than 100, LED lights up.
4406
4bottom
HOW to Detect Magnetic Field with Kidsuno
Previous
HOW to Detect Magnetic Field 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