I am developing a project with the esp32, that is measuring sensor data, saving this data to an sd and also publishes the data to the web (to Google cloud IOT core). The measuring and saving of the data works already very well, but I am facing some issues regarding the sending to the web.
To measure the data (max frequency should be 500 Hz), I am using a timer, that measures the data periodically and sends the measured data to a queue. A separate task reads the data from the queue and then saves this data formatted to the sd card. So far so good.
I am using esp-idf for the development and therefore implemented the web framework esp-google-iot. Connecting to the cloud worked very well and I am able to receive commands already (in the first approach just a command to stop or start with measuring). Now I tried to create another queue, where the data, that should be published is hold. Then I created a delayed publish task, that should send all the data, stored in the queue every second to the cloud. Unfortunately I am always receiving the error "heap out of memory".
As I thought this could appear due to to big data amount, I removed the second queue and just sent the message "dummy" every second. This worked perfectly.
Does anyone know, how to handle these amount of data or had similar issues?
Probably I am also doing the completely wrong approach.... Probably sending more than just one value per publish, so that I do not have to send 500 requests per second?
Any help is appreciated