Connected Devices, Everyday
The Internet of Things connects sensors and devices to the internet. Learn the four-step chain and write a sensor alert.
What you will be able to do
By the end of this lesson, you can explain the sensor, network, data, action chain and write a simple sensor alert in Python.
What IoT is
The Internet of Things (IoT) means everyday objects with sensors that connect to the internet. A sensor is a small part that measures something, like temperature, motion, light, or location.
You may already live with IoT: a smart thermostat, a video doorbell, a fitness watch, a smart speaker, or the GPS tracker that shows when a school bus is near.
The four-step chain
Every IoT system follows the same chain:
- Sense. A sensor measures something. The fridge is 41 degrees.
- Send. The device sends that reading over Wi-Fi, a cell network, or another connection.
- Decide. Software compares the reading to a rule. Is 41 too warm?
- Act. The system does something. It sends a text alert or turns on a fan.
If any link breaks, the system fails. A dead battery, a weak signal, or a wrong rule can all stop the alert from coming.
Where IoT helps
| Problem | IoT approach | Example |
|---|---|---|
| Food spoils when a fridge fails overnight | Temperature sensor sends a text alert | Food banks and restaurants |
| Water leaks cause hidden damage | Leak sensor under a sink | Homes and apartment buildings |
| Families wait in the cold for a bus | GPS on buses shares arrival times | Bus tracking apps used by school districts |
| Cities do not know where air is unhealthy | Low-cost air sensors share readings | Community air monitoring networks |
Write a sensor alert
The code below checks eight hourly temperature readings from a fridge sensor. It flags any reading above the safe limit. The first run downloads the Python runtime, which is several MB.
# Temperature readings (Fahrenheit) from a sensor in a food pantry fridge
readings = [37, 38, 38, 39, 41, 43, 44, 40]
limit = 40
alerts = 0
for hour, temp in enumerate(readings):
if temp > limit:
alerts = alerts + 1
print("Hour", hour, "ALERT:", temp, "is too warm")
print("Alerts:", alerts)
The rule is the judgment. Set it too high and food spoils. Set it too low and people stop paying attention to constant alerts. A real system also needs a person who gets the text and knows what to do.
Reflection
Go deeper: The Internet of Things, Demystified
Discussion
Ask. Answer. Build together.
Loading…