Why wireless is needed for IoT in Arduino - Performance Analysis
We want to understand why wireless communication is important for IoT devices.
How does using wireless affect the way IoT devices work and scale?
Analyze the time complexity of sending data wirelessly in this Arduino example.
#include <WiFi.h>
void setup() {
WiFi.begin("SSID", "password");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
}
}
void loop() {
WiFiClient client;
if (client.connect("server", 80)) {
client.print("GET /data HTTP/1.1\r\nHost: server\r\n\r\n");
client.stop();
}
delay(1000);
}
This code connects the Arduino to WiFi and sends a simple request to a server every second.
Identify the loops, recursion, array traversals that repeat.
- Primary operation: Sending a request to the server over WiFi inside the loop()
- How many times: Once every loop cycle, which repeats indefinitely
As the number of IoT devices grows, each device sends data independently over wireless.
| Input Size (n devices) | Approx. Operations (total requests) |
|---|---|
| 10 | 10 requests per cycle |
| 100 | 100 requests per cycle |
| 1000 | 1000 requests per cycle |
Pattern observation: The total wireless communication grows linearly with the number of devices.
Time Complexity: O(n)
This means the total wireless communication work grows directly with the number of IoT devices.
[X] Wrong: "Wireless communication time stays the same no matter how many devices connect."
[OK] Correct: Each device sends data separately, so more devices mean more total wireless operations.
Understanding how wireless communication scales helps you design IoT systems that work well as more devices join.
What if we changed from wireless to wired communication? How would the time complexity change?