Firmware WiFi Data usage
-
Hello everyone,
I'm building a low data IoT device, it calls an API around 100 times a day. A single API call consumes around
500 bytes
(see details on how I measured this below). My expectation is that the daily consumption (in KB) is500 bytes * 100 / 1024 = ~49KB
for 100 API calls.To my surprise, after one day of testing, the device used around
1.5MB-2MB
. This is way too much compared to my expectation. My device uses a SIM card so I really have to keep the data usage as low as possible.I'm suspecting the m5stack firmware is sending some telemetry by default. This makes sense because when I look at UiFlow 2.0, and I click on available devices, I can see that UiFlow know if the device is Online or not. That means at least there is some keepalive call is being done to M5Stack servers for this.
Then I created a simple application that just connects to the WiFi router and just blinks the RGB LED, without any WiFi or internet access, and after some time (few minutes) I see data being used, 30KBs.
Questions
Has anyone else seen this same issue?
And do you know what's the best way to handle it?Details on how I measured my API usage:
I measured my API call data usage using CURL and a few options to extract the data usage and request/response trace, and the call is around 500 bytes
curl -X POST "http://0.0.0.0:8000/api/example” -H "Authorization: Bearer MY_API_KEY" --write-out "\nSize of response body: %{size_download} bytes\nSize of request body: %{size_upload} bytes\n" --trace curl_trace.log -o /dev/null \ -s
Output:
Size of response: 16 bytes Size of request: 0 bytes
From the curl_trace.log file the total size estimate:
* Request headers: 174 bytes * Response headers: 317 bytes * Response body: 16 bytes * Thus, the total size for the transaction is: 174 + 317 + 16 = 507 bytes
Device:
Atom S3 Lite
Firmware:v2.1.3-ATOMS3-LITE
Language:MicroPython
Thanks,
Carlos -
Hi @cchakons
As you said, the UiFlow firmware will periodically send heartbeat packets to the server to ensure that the device is online, and sometimes synchronize some information. Please forgive me I can't provide you precise parameters.
UiFlow is just an easy-to-use development platform. If you want to accurately control these parameters, it is recommended to use traditional programming methods such as Arduino IDE or ESP-IDF. -
@cchakons is the packet sent increasing with each transmission? It could also be the buffer is not being emptied and it’s sending the buffer consisting of old and new data
-
@ajb2k3 said in Firmware WiFi Data usage:
@cchakons is the packet sent increasing with each transmission? It could also be the buffer is not being emptied and it’s sending the buffer consisting of old and new data
@ajb2k3 its actually consuming data even if I am just toggling the RGB LED. So, its all coming from the UiFlow firmware.
@kuriko
I have a pretty functional code already in MicroPython so it would be nice if the M5stack Team can provide a way to disable WiFi usage by their firmware. If not I'm going to have to migrate all my code to C.