X
Home > Blog > STEM for Arduino > HOW to Detect Ultraviolet Index with Kidsuno

HOW to Detect Ultraviolet Index with Kidsuno

By r November 6th, 2024 65 views
In daily life, when the UV index is greater than 3, you’d better do sunscreen measures when going out. This station will calculate the UV index in real time to make timely reminders.
In this experiment, we detect the UV index with an ultraviolet sensor and a traffic light module. When the detected UV index is higher than a set threshold, the red LED will light up.

Flow

4601

Assembly

line1

Required Parts

46_00

line1

Step 1

46_01

line1

Step 2

46_02

line1

Step 3

46_03

line1

Step 4

46_04

line1

Step 5

46_05

line1

Step 6

46_06

line1

Step 7

46_07

line1

Completed

46_08

line1

Wiring Diagram

4602

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.6Ultraviolet detection.sb3 file.

4603

Click Unconnectedto connect to port and then 2210.

Explanations

5top

Conceive:

When the UV index is within 0 ~ 2, the ultraviolet light is the weakest, and it does not have much effect on the human body. When the index increases to 3 ~ 4, the ultraviolet light is weak, but remember to wear sunscreen when going out.

Herein, we set the threshold of the UV index to 3. If the value exceeds 3, the red LED will light up to remind you to wear sunscreen. If the value does not reach 3, the LED will go off.

line2

Code structure:

  1. Initialization.

    4604

  2. Loop:

    if elif statement to determine the range of UV index, and output the value.

    Determine whether the UV index exceeds 3.

    • UV index > 3: the red LED lights up as a reminder.

    • UV index ≤ 3: the red LED goes off.

    4605

5bottom

Test Result
4top
After uploading the code, when the UV index is greater than 3, the red LED will light up to remind you to take sun protection measures when going out.
4606
4bottom
HOW to Detect Ambient Temperature with Kidsuno
Previous
HOW to Detect Ambient Temperature 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