I’ve done a couple of bandwidth tests on my application, and have got it pretty much throttled to send an amount of data that should keep me below 1 MB/month. But today I noticed it dropped the connection, and took a while to reconnect. This actually happened a couple of times today. Interestingly, it also looks like my data usage is significantly higher than it has been in my bandwidth test. Is it using a significant amount of data when it’s trying to connect?
Core, Photon, Electron?
TCP, UDP, publish?
You need to provide more information and context for us to help you.
Gotcha. Sorry for the lack of context. I figured it’s just the connect itself that’s using the data, not the publish since I’ve already done bandwidth tests on that, and I figured the photon doesn’t use any cell data.
That being said, here’s my setup…
I have an Electron collecting wind data from an anemometer and publishing a data event every 8 minutes from 8am to 8pm. The data event has a 4-character name, and it’s sending out a 7-character string of data.
I subscribe to that event with a Photon, and use it to parse that 7-character string. The Photon then forms two HTTP Get requests to send the wind data to both Weather Underground and Weatherflow.
This has been running at less than 0.03 MB of cell data per day. But today it’s used about twice that much so far. The difference appears to be due to the fact that it dropped the connection a couple of times.
Would you expect it to use extra data reconnecting?
Yes, the cloud reconnection handshake can consume a considerable amount of data when it keeps failing.
There are some threads discussing the figures.
Thanks. I tried to search, but couldn’t find them. Could you point me in that right direction?
Thanks. 6K is a lot. I don’t think I’ve been seeing that kind of data usage on my connects. But I did notice that it got itself into a state where it was trying to connect, but not succeeding. I hit the reset button and it then went through the connection sequence fairly quickly. I wondered at the time (and still do) whether this continuous failed attempt to connect was using up lots of data. If it were possible for me to detect this behavior of being stuck in a re-connect loop, perhaps I could reset the Electron rather than let it continue to try to connect on its own.
It is possible. I’d use
SYSTEM_THREAD(ENABLED) to stay ontop of the background task and handle reconnects myself rather than letting some “obscure” magic happen
Thanks. I remember reading a bit about that. I’ll look into it.
I looked over this, but have a couple of questions… when using SYSTEM_MODE(SEMI_AUTOMATIC) I take it that it will try to automatically reconnect if the connection is dropped. Is that correct? What I’d like to do is be able to determine when the connection is dropped and then I’ll call for a reset to reboot the Electron. That seems to get it out of its funk when it’s stuck trying to connect. Is it possible for me to detect when the connection is dropped?
SYSTEM_THREAD(ENABLED) or Software Timers you can have your own code run to check
Particle.connected() and do whatever you want when this returns