📖 Scenario: You are working on a smart home project where various IoT devices connect to the internet. You want to decide when it is best to use WiFi for these devices based on their power needs, data usage, and range.
🎯 Goal: Build a simple program that lists IoT devices and identifies which ones are suitable to use WiFi based on their power consumption and data requirements.
📋 What You'll Learn
Create a dictionary of IoT devices with their power consumption (in mW) and data usage (in MB per day).
Add a configuration variable for maximum power consumption allowed for WiFi devices.
Use a loop to select devices suitable for WiFi based on power consumption and data usage.
Print the list of devices suitable for WiFi.
💡 Why This Matters
🌍 Real World
In smart homes and offices, choosing the right network for IoT devices helps save power and ensures reliable connections.
💼 Career
DevOps and IoT engineers often decide network protocols for devices based on power and data needs to optimize performance and battery life.
Progress0 / 4 steps
1
Create IoT Devices Data
Create a dictionary called iot_devices with these exact entries: 'Thermostat': {'power_mw': 500, 'data_mb': 50}, 'SecurityCamera': {'power_mw': 1500, 'data_mb': 500}, 'SmartLight': {'power_mw': 300, 'data_mb': 5}, 'DoorLock': {'power_mw': 200, 'data_mb': 1}
IOT Protocols
Hint
Use a dictionary with device names as keys and another dictionary for power and data values.
2
Set Power Consumption Threshold
Create a variable called max_power_wifi and set it to 600 to represent the maximum power consumption in milliwatts suitable for WiFi devices.
IOT Protocols
Hint
This variable helps decide which devices can use WiFi based on power limits.
3
Select Devices Suitable for WiFi
Create a list called wifi_devices that includes device names from iot_devices where the device's power_mw is less than or equal to max_power_wifi and data_mb is greater than 10.
IOT Protocols
Hint
Use a list comprehension to filter devices by power and data usage.
4
Display Suitable WiFi Devices
Write a print statement to display the wifi_devices list.
IOT Protocols
Hint
Use print(wifi_devices) to show the final list.
Practice
(1/5)
1. Which situation is best for using WiFi in IoT devices?
easy
A. Indoor devices with stable power and close to the router
B. Outdoor devices far from any network
C. Devices that need very low power consumption
D. Devices that only send data once a day
Solution
Step 1: Understand WiFi range and power needs
WiFi works best indoors where devices are near the router and have stable power.
Step 2: Match device environment to WiFi strengths
Devices far away or with low power needs are less suitable for WiFi.
Final Answer:
Indoor devices with stable power and close to the router -> Option A
Quick Check:
WiFi = indoor + stable power [OK]
Hint: Choose WiFi for indoor, powered devices near router [OK]
Common Mistakes:
Thinking WiFi works well outdoors far from router
Choosing WiFi for low power devices
Ignoring power stability needs
2. Which of these is the correct way to describe WiFi suitability for IoT?
easy
A. WiFi is best for devices with unstable power outdoors
B. WiFi is only for devices that send data once a day
C. WiFi works best for devices that move frequently outdoors
D. WiFi is suitable for indoor devices with stable power
Solution
Step 1: Recall WiFi environment needs
WiFi requires stable power and works best indoors near routers.
Step 2: Eliminate incorrect options
Unstable power and outdoor mobility reduce WiFi effectiveness.
Final Answer:
WiFi is suitable for indoor devices with stable power -> Option D
Quick Check:
Indoor + stable power = WiFi suitable [OK]
Hint: WiFi = indoor + stable power, not outdoor or unstable [OK]
Common Mistakes:
Confusing outdoor use as good for WiFi
Ignoring power stability
Assuming WiFi fits all IoT devices
3. What is the main reason WiFi is preferred for some IoT devices?
medium
A. It requires no security settings for safe use
B. It uses very low power and works well outdoors
C. It provides fast and reliable internet with stable power
D. It works best when devices are far from the router
Solution
Step 1: Identify WiFi advantages for IoT
WiFi offers fast, reliable internet but needs stable power and close range.
Step 2: Compare options to WiFi features
Low power and outdoor use are not WiFi strengths; security is needed.
Final Answer:
It provides fast and reliable internet with stable power -> Option C
Quick Check:
WiFi = fast + reliable + stable power [OK]
Hint: WiFi = fast, reliable, needs stable power [OK]
Common Mistakes:
Thinking WiFi uses low power
Ignoring security needs
Assuming WiFi works well far from router
4. A developer sets up an IoT device with WiFi but it keeps losing connection outdoors. What is the likely problem?
medium
A. WiFi is not suitable for outdoor devices far from the router
B. The device has too much power supply
C. WiFi does not need security settings
D. The device is too close to the router
Solution
Step 1: Analyze WiFi range limits
WiFi signals weaken outdoors and far from routers causing connection loss.
Step 2: Check other options for errors
Too much power or proximity issues are unlikely; security settings don't cause connection loss.
Final Answer:
WiFi is not suitable for outdoor devices far from the router -> Option A
Quick Check:
Outdoor far = WiFi connection loss [OK]
Hint: WiFi struggles outdoors far from router [OK]
Common Mistakes:
Blaming power supply instead of range
Ignoring WiFi range limits
Assuming security affects connection stability
5. You want to deploy an IoT sensor network in a large indoor factory with stable power. Which WiFi setup is best to ensure coverage and security?
hard
A. Use WiFi outdoors and rely on default security settings
B. Use multiple WiFi access points spread evenly and enable strong WPA3 security
C. Use WiFi only on some devices and no security on others
D. Use a single WiFi router at one corner without security
Solution
Step 1: Ensure full indoor coverage
Multiple access points spread evenly cover large indoor areas well.
Step 2: Apply strong security
Strong WPA3 security protects devices from unauthorized access.
Final Answer:
Use multiple WiFi access points spread evenly and enable strong WPA3 security -> Option B
Quick Check:
Coverage + strong security = best WiFi setup [OK]
Hint: Spread access points + strong security for large indoor WiFi [OK]
Common Mistakes:
Using single router for large area
Ignoring security settings
Mixing WiFi use without plan
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.