I am working on a system which collects data from a set of ultrasonic sensors. Those sensors work at 40Hz frequency, and each data they send are valuable to me. I need to send those data to a mqtt broker using mqtt protocol. I use TCP/UDP connection of SIM900 in order to send data. There are two scenarios to make my system work:
1- I send the data as soon as I read it from sensors. It means I should connect to a server, send data and disconnect it in less than 1/40 seconds. I dont know, but using AT commands with SIM900; it seems pretty impossible to me.
2- I collect the data for a while, (lets say for a minute) then I send the data to server as a bulk. But there another problem arises: I am facing losing sensitive data I collect from sensor while I am making TCP/UDP connection.
My hardware consists of SIM900, an arduino and bunch of ultrasonic sensors work at 40Hz (HR-SC04)
Is there a way to save every bit of data I read from sensors and send them to Mqtt server, losslessly?