Lesson 4 - Seedling Stage: Getting Network Time

Lesson 4 Seedling Stage: Getting Network Time

 

 

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

Students learn to connect the UNIHIKER K10 to the Internet, obtain the local time, and display it on the screen.

image5.png I can program the UNIHIKER K10 to connect to the Internet.

image5.png I can explain what the meaning of the IP address is.

image5.png I can create a watering reminder model using the obtained local time.


Engage

image7.png 2 min.

Plants need water at the right time to grow strong. If you wanted to build a device to remind you to water your plants every day at 9:00 AM, what would your device need to know?

image9.png

Today, we'll program the UNIHIKER K10 to get the time from the Internet, just like your phone or computer does, and use it to build a smart watering reminder.


Background

image7.png 3 min.

We can get the current from the internet using the Network Time Protocol (NTP).

What is the Protocol?A protocol is a set of rules that allows two or more devices to talk to each other. Wi-Fi is a protocol that defines how devices connect wirelessly, and NTP is the specific set of rules for asking a time server "What time is it?" and understanding the answer.

image10.png

image11.png

Wi-Fi connect block: This block tells the UNIHIKER which network to join.

image12.png

NTP blocks set up a connection to a time server and tell it our time zone and obtain the specific data of time.

image13.png

Speaker

The UNIHIKER K10 has a built-in speaker. We can program it to play sounds or melodies.

image14.png


Build and Connect

image7.png 5 min.

image15.pngNo new construction is required. Reuse structures from Lessons 1 & 2 and optionally connect with matching building blocks.


Program

image16.jpeg 30 min.


Challenge 4-1: Connect to the Network

image19.pngAsk students to do the preparation for programming.
Provide students with the correct network name (SSID) and password.
Encourage students to give the program a way to tell us the connection status.
image20.pngimage21.png
Guide students to optimize their program.
Here is a sample:
image22.pngAfter uploading the program, guide students to discuss: Press button A. What does the string of numbers represent?Press it again. Does the IP address change? Is everyone's address the same?

image23.png Introduce the key vocabulary: IP address.

Explain that the IP address is like your device's unique "mailing address" on the local network. It allows data to find its way to the correct device.


Challenge 4-2: Get and Use the Local Time

image25.pngimage26.png
image27.png
Ask students to load the starter project program4-2 and upload it.
Challenge students to search for the current timezone and modify the timezone in the program to get and display their local time.
Here is a method to check the current time and time zone around the worldFrom the link: https://checktimezone.com/HINT: the “+” and “-” symbols in the UTC Offset match the East and West in the program, respectively.
image28.pngimage29.png
Challenge students to program a reminder after 5 minutes.
Here is a sample if the current time is 10:45:Give students several minutes to choose their favorite sound.


Extra Practice

image16.jpeg 5 min.

How often does your watering reminder play a sound? Every day or every hour? How could you program a daily watering reminder at 9:00 AM? The required boolean block is shown below:

image30.png

 

Next Class: Lesson 5

Current Tutorial: Click Here

icon Lesson 4.zip 1.27MB Download(1)
License
All Rights
Reserved
licensBg
0