How to measure data usage in development?

Hi,

I am working on a slightly customized firmware for the TrackerOne and I would like to be able to measure precisely the data consumption over one hour or one day so I can extrapolate it to one month and estimate my data usage. I want to be able to repeat this experiment as I make changes to the code.

This is what I have tried:

  • The SIM dashboard takes at least 48hours to reflect data usage which makes debugging/optimization very impractical.

  • The Celullar::getDataUsage() API always returns 0

        CellularData cellularData;
        FuelGauge fuel;
        Cellular.getDataUsage(cellularData);
        Log.info("Data usage: TX Session: %i TX Total: %i RX Session: %i RX Total: %i - Battery: %.2f", cellularData.tx_session, cellularData.tx_total, cellularData.rx_session, cellularData.rx_total, 100 * fuel.getSoC());

Output:

0062902105 [app] INFO: Data usage: TX Session: 0 TX Total: 0 RX Session: 0 RX Total: 0 - Battery: 8237.89

(even though the tracker is connected and has been sending data for a while).

Is there any other way to debug/measure data usage in development?

thanks,
thomas

The getDataUsage API is not supported on the Tracker SoM (T402 or T523), B Series SoM (B402 or B523), or LTE Cat M1 devices (E Series LTE, Boron LTE, Electron LTE) because the cellular modem hardware does not support it.

I measured the Tracker One data usage by using the Electron Cloud Manipulator which isn’t really specific to the Electron and measures all of the cloud data usage in real time. This includes cloud negotiation, publish, subscribe, functions, variables, OTA, etc…

It does not count external data using TCPClient, UDP (that is not cloud-related), and DNS.

Looks like a great solution. I was not aware of this tool. Thank you!