Lesson 5 - Growing Stage: Farm Path Light Loop

Lesson 5 Growing Stage: Farm LED Light Project

 

image3.png Challenges: 5-1, 5-2

Students will design and code pest trap lamps and farm guide lights using an LED strip.

image5.png I can control the LED strip with buttons.

image5.png I can show different colors in different ranges.

image5.png I can program moving light effects.


Engage

image7.png 2 min.

Discuss the questions below:

What can lights be used for in the field?

They can guide people, attract and trap pests, and even signal information.

image9.png

When building these smart farm lighting devices, except for the UNIHIKER K10, what else hardware do we need?


Background

image7.png 3 min.

The LED strip (WS2812) is a programmable light strip containing multiple individual LEDs. Each LED can be set to a specific color individually.

image10.png

NOTE: The strip light has two sockets. Please make sure to connect the correct side (the arrow start) to the UNIHIKER K10’s pin socket, and the other socket is for extending the strip light.

 

Initializing block: This block tells the UNIHIKER K10 to prepare the LED strip connected to pin P0. The number 7 tells it we have 7 LEDs to control on this strip.

image12.png

Show color block: This block sets a range of LEDs to a specific color.

image12.png

NOTE: We number the LEDs on the strip starting from 0. For a strip of 7 LEDs, the index numbers are 0, 1, 2, 3, 4, 5, 6.


Build and Connect

image7.png 10 min.

image13.pngBuild together by the Building instruction.


Program

image14.jpeg 25 min.


Challenge 5-1: Basic Control with Buttons

image17.pngimage18.png
Ask students to connect the LED strip to the UNIHIKER K10. Here is a sample:
image19.pngGuide students to rebuild the program and discuss:What do you notice?Does every LED light up?
image20.pngimage21.png
Ask students to change the numbers in the show color block from 0, 4 to 0, 6.
Encourage them to explain what these numbers represent.
Here is a sample:
image22.pngimage23.png
Explain that each LED on the strip needs a unique number as its index, like an address, so we can control them individually.
Ask students to number the LEDs on the strip from 0 to 6.
Here is the answer:
image24.pngimage25.png
Challenge students to add the show color blocks and modify the range and the color of the block.
Here is a sample:Remind students to choose the color that the pest likes.

NOTE: Install the LED strip on the plate to make the next project—the guide light.

image26.png


Challenge 5-2: Creating a Moving Guide Light

image27.pngAsk students to load the starter project program5-2 and predict.
Upload and discuss:Was your prediction correct?Which block makes the lights move?To move the lights, the program needs the rotate pixel block. The number means how many LEDs it moves each time.
image28.pngPrompt students to find a speed that they like best by modifying the number in the wait block.


Extra Practice

image14.jpeg 5 min.

Guide lights might be too bright and harsh. Explore other blocks in the LED strip (WS2812) library. How can we change the brightness of the LEDs to create a softer scene?

image29.png

Investigate the following block and the meaning of its parameters. What new lighting effect can you create?

image30.png

 

Next Class: Lesson 6

Current Tutorial: Click Here

icon Lesson 5.zip 3.5MB Download(0)
License
All Rights
Reserved
licensBg
0