I just put the finishing touches on a weather station built using the Electron and the Sparkfun Weather shield and Weather station sensors.
My question is that after 10 hours of sending reports to Weather Underground for web posting of the data, Particle Dashboard reports that I used 180KB of data. for 60 messages (one update report every 10 minutes) during that 10 hours that’s 3KB per message with less than 300bytes of ASCII data per message. Is this level of overhead to be expected?
No OTA uploads where made for about 10 hours prior to the measurement period.
A months total is about 14MB, way more than I expected. (my fault of course as I am hopelessly optimistic)
BTW I do not use sleep, as power is an not an issue, This is for installation at my Radio Control Model Aircraft Club’s flying field. We do not have internet access (hence the Electron), but do have a good size solar system, with backup storage batteries available.
There are some ways but I’d do it like that with snprintf()
char buf[1024]; // if your message is longer split it into smaller chunks
// if it's shorter you can reduce the buffer
snprintf(buf, sizeof(buf), "%sID=%s&PASSWORD=%s&dateutc=now&tempf=%.2f&dewptf=%.2f&humidity=%d&...",
WEBPAGE, ID, PASSWORD, tempF, dewptF, humidity, ...);
client.println(buf);
It is called every 10 minute, in between calls it reads the various sensors (some are interrupt driven–wind speed and wind dir) does some peak determination and averaging but mostly it sucks its thumb, idling away in non blocking delays. I do not use deep sleep
.
Thanks for the info on snprint() . I will give it a try!
I played with this today and now have it working , but it did take awhile as sizeof [buf] should be sizeof (buf). sizeof[buf] produces a large number of (to me at least )of indecipherable complier errors. It does identify the line, of course, but there is a lot on that line. sizeof[buf] sure looks right…hey buf is an array and they use [] don’t they, or at least that’s what the code trouble shooting part of me was leading me to believe for a long time, until ah ha!.
But the up side is I am now comfortable with snprintf() and the others of its ilk.
Following the advice of several responders, I managed to get to get a monthly usage down to 5 MB of data. A really big decrease. But, the hourly usage seems to depend on when I ask Dashboard for a report (steadily sending a fixed size report every 10 minutes) :
time last night at 11:03PM --0.18 MB (just rolled over from last month)
today 11:10AM --0.22 MB --12hours , used 40 KB or 3KB/ hr
today 5:40PM --0.31 MB --18.7 hours ,used 130KB or 6.95KB/ hr ??