Hello,
I have a set of sensors that output data on a RS232 port. I currently have my Particle Electron setup to listen to the Serial1 port, read data, then publish it to the particle cloud. In order to save bandwidth, I would like to encode or compress the data. Does anyone have any thoughts on this? Below is my code, and also sample data from my sensor bank…
void setup()
{
Serial1.begin(9600);
}
void loop()
{
if (Serial1.available())
{
String value = Serial1.readStringUntil('\n');
Spark.publish("RS232", value);
}
}
Here is the sample sensor data. The sensor will output the following line once per second:
Sensor Base 13,1,2016-12-16T04:19:37.3776272Z,22:19:41,38.885101,0.000000,-12.271728,4.136775,12.032262,-11.670198,2.966006,0.000000,659.422241,16.759348,-3827.473633,0.000000,0.000000,3.893688,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.004073,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,673.229980,0.000000,1328.050049,0.000000,292.260010,0.000000,1620.310059,10.000000,0.000000,2468.239990,0.000000,0.130000,7.829093,0.000000,0.000000,0.000000,0.129811,4.454684,0.000000,0.023872,4.454684,0.023872,1.000000,0.000000,91.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,20.000000,0.000000,0.000000,0.000000,0.129811,8.348372,0.023872,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000001,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,2468.239990,-15.000000,127.198952,-25.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000