I am sending data from the esp32 to a server which I first record from the sensors(4 data points per minute) to the spiffs for an interval like 30-60 minutes and then turn on the wifi, read the data from the spiff and send it to the server using HTTP requests.
The problem is when the data is 60 minutes, it works fine and transfers all the data after 60 minutes, but when I exceed it from 60 minutes it does not send the data to the server while the data is recorded correctly and printed on serial monitor.
What could be the possible reason? Is it because the data is too large?
I have used a 1.2 MB spiff partition. Also, I am monitoring the spiffs usage in my code and it is a lot, hardly 2 hours of my data will be about 40kbs.
If I were you, I'd upload the whole sketch in one piece, so someone can try use it on their own to understand the problem better, and it just makes it a little easier to understand exactly what's going on.
Are you in control of the server as far as the code ?
What response code are you getting back from the server i.e. 200 ?
Can you confirm number of sent bytes by the esp32 (client) ?
Yes, I am controlling the server side too and everything is perfect on that side.
I get 400 when I exceed the interval from 1 hour.
How may I know how many bytes are being sent? I can only see it once they are on the server.
Does your board have PSRAM? If it does, you may have to enable it, in the Tools menu, as one of the board-specific options listed below Get Board Info.
If it should fit, you might also try to reserve the space in the String in advance; the file size plus some extra for the added brackets and commas.
You are printing out payload so you should be able to see what is being sent to the server. You could also use payload.length()
You said 4 data points per hour so why is spiffs have 52k worth of data ? May try littleFS instead of spiffs.
Also, 400 response from server means it did not like the request ie. it is not correctly formatted. I would double check your print out of the payload and see if it is valid json.
There is also a service called postman that will let you send request to your server. I don't know if you are familiar with that program but it will help you sort out what is going on. It is worth learning how it works.
It's 4 data points per minute.
It works fine when I send less than one hour of data, so it is formatted correctly.
And yeah I checked it on Postman, copied the data of 3 hours from the serial monitor and sent it through Postman, it worked well, so no error on the server side too.
Now I'm sending it in chunks again, why can't I send it in one request?