Choosing a logging interval for sensor readings

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Choosing a logging interval for sensor readings

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. A weather station logs the temperature once every hour. Which statement about its data is correct?
A It captures every tiny change and uses huge storage
B It uses little storage but could miss a quick change between readings
2. Which logging interval produces the BIGGEST file after one day?
A Every 1 second
B Every 1 hour
3. A student wants to record how fast a ball's temperature changes when dropped into ice water over 30 seconds. Which interval suits best?
A Every 1 second
B Every 1 hour
4. A school wants to track the slow change in room temperature across a whole term while keeping the spreadsheet small. Which interval is more sensible?
A Every 30 minutes
B Every 1 second
5. What is the logging interval?
A How accurate a sensor's reading is
B How often a sensor records a reading

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1interval = 1 (seconds) AThe sensor logs a reading every second, giving lots of detail but a very large file
2interval = 3600 (seconds) BAn hourly interval can miss a spike that starts and ends between two readings, so the spike may never appear in the data.
3A short logging interval gives more detail but creates a bigger file CThe sensor logs one reading per hour, saving space but possibly missing fast changes
4A long logging interval saves storage space because fewer readings are stored Dreadings_per_day = 24 / interval_hours
5A 2-minute spike in temperature is logged every 1 hour, so every spike will be recorded. Ereadings_per_day = 86400 / interval
6Logging every second for a month is best because the file size does not matter. FFile size does matter: a very short interval over a long period creates a huge dataset that takes up storage and is slow to process.

Definitions

logging interval

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
# Log one reading every hour interval = ____
2.
perDay = 86400 _ interval
3.
interval = 10 logReading() sleep(________)
4.
if interval _ spike: print("Spike may be missed")
5.
if size > limit: interval = interval _ 2 print("Longer interval set")

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A interval = "60"
B per_hour = 3600 / interval
C print(per_hour)
Question 2
A interval = 1
B day = 86400
C count = day * interval
D print(count)
Question 3
A every_second = 3600
B every_hour = 24
C print(every_second > every_hour)
Question 4
A interval = 3600
B if interval > 60:
C print("Big file")
D else:
E print("Big file")
Question 5
A # Heart rate sensor
B interval = 3600
C log_every(interval)

Answer Key

Choosing a logging interval for sensor readings
Section A: Quick Questions
Q1
B — It uses little storage but could miss a quick change between readings
Q2
A — Every 1 second
Q3
A — Every 1 second
Q4
A — Every 30 minutes
Q5
B — How often a sensor records a reading
Section B: Match the Pairs
Q1
interval = 1 (seconds) → The sensor logs a reading every second, giving lots of detail but a very large file
Q2
interval = 3600 (seconds) → The sensor logs one reading per hour, saving space but possibly missing fast changes
Q3
A short logging interval gives more detail but creates a bigger file → readings_per_day = 86400 / interval
Q4
A long logging interval saves storage space because fewer readings are stored → readings_per_day = 24 / interval_hours
Q5
A 2-minute spike in temperature is logged every 1 hour, so every spike will be recorded. → An hourly interval can miss a spike that starts and ends between two readings, so the spike may never appear in the data.
Q6
Logging every second for a month is best because the file size does not matter. → File size does matter: a very short interval over a long period creates a huge dataset that takes up storage and is slow to process.
Section C: Definitions
Q1
logging interval — How often a sensor records a reading. Short intervals give more detail but bigger files; long intervals save space but can miss fast changes.
Section D: Fill in the Blanks
Q1
# Log one reading every hour interval = 3600
Q2
perDay = 86400 / interval
Q3
interval = 10 logReading() sleep(interval)
Q4
if interval > spike: print("Spike may be missed")
Q5
if size > limit: interval = interval * 2 print("Longer interval set")
Section E: Spot the Error
Q1
A — The interval is a number of seconds, so it must be stored as a number. In quotes it is text, and 3600 / interval would cause an error. It should be interval = 60.
Q2
C — The number of readings in a day is the seconds in a day divided by the interval. Multiplying gives the wrong answer. It should be count = day / interval.
Q3
A — There are 86400 seconds in a day, so logging every second gives 86400 readings a day. 3600 is the number of seconds in an hour, not the number of readings in a day.
Q4
C — A long interval (over 60 seconds) means fewer readings, so the file is small. Line 3 should print "Small file".
Q5
B — Heart rate changes quickly, so logging once an hour would miss most of the changes. A short interval such as 1 second is needed. It should be interval = 1.