Hopefully this thread isn’t tooooo dead…
Basic setup, taking GPS cords and throwing them onto a server I’m hosting using TCPClient. Setup hasn’t changed much since my previous post but briefly, its an Argon with an SD card (which I have for this purpose but haven’t really been using). Running 1.5.4rc2 (holding on to my mesh as long as I can). I have a wifi hotspot mounted that’s just always on - I already had it and adding a boron just seemed like an unnecessary complication/expense.
I’m having trouble turning the SDFat example into something my monkey brain understands. Basically, after a bunch of logic that decides whether or not to actually do somethin with the GPS data (stuff like, don’t send when it’s sitting in the garage because I already know it’s in the garage… or stop sending if the car is off etc.), there’s a point where the TCP client (ignoring the obvious security hole for the moment) sends the payload to my server. It looks something like this:
client.connect(INFLUXDB_HOST, INFLUXDB_PORT);
client.println("POST /write?db=" + String(INFLUXDB_DB) + "&u=" + String(DB_USER) +"&p=" + String(DB_PASS) + " HTTP/1.1");
client.println("Host: " + String(INFLUXDB_HOST));
client.println("User-Agent: Argon/1.0");
client.println("Connection: close");
client.println("Content-Type: application/json");
client.printlnf("Content-Length: %d", payload.length());
client.println();
client.print(payload);
client.println();
client.stop();
The payload is made up of a bunch of concatenated string data formatted so the server can read it and is only getting the data I want it to have; lat, lon, alt, speed, some other stuff, the kitchen sink, etc.
Now, I’m sure there’s a way more “correcterish” way of doing all that, but, well… see the monkey brain bit.
I’ve included the bits mentioned many posts back for setup but I’m trying to figure out if I need to include the buffer size (retained uint8_t publishQueueRetainedBuffer[somenumber]; where somenumber is… what, the size of the memory card? Unnecessary? Do I wrap up the code above for sending the payload in… something…? I think I need a very simplified example as I’m missing something that I think is supposed to be obvious.
The payload would end up looking about like this if I print the whole thing out (made up values)
GPSTracking,device=monkeybrain count=123,lat=37.123456,lon=-121.1234567,alt=100,speed=50,sat=12,doors=locked,dist=100,distKM=123,distPrev=100
Some of that data doesn’t actually do anything at the moment but the db doesn’t like it when I change certain things and I got tired of fiddling with it, so ‘doors’ usually equals the same thing all the time, and yes, sending distKM is totally unnecessary (monkey brain).
I’m not totally opposed to starting over, but if I just have it sending GPS data all the time, I think the size of the SD card would be the least of my concerns…
Suffice to say, most of the time, I’m in range of a cellular signal, but when I go out of range, I’m usually waaay out of range for days at a time, so there’d likely be 2-3 days worth of data piling up. Just storing all that raw GPS data would just be a mess to deal with. Ok, the cat has “that look” on her face that makes me think I might need to stock up on band aids soon… think this about covers it anyway… thoughts?