Filtering sensor data noise

#1

Anyone have advice on how to tackle filtering some noisy load sensor data.
The pic attached is our load sensor setup under a constant fixed load. We’ve tested some on device filtering logic:


As well as a median value rule to throw away some of the spikes.

But we’d like to move the filter code up to a losant workflow and the Logic group of nodes, including math & mutate are super advanced and beyond my skillset.

Any advice?

#2

A common way to do this is to use a cloud workflow to filter your incoming data and store it on a different device attribute. For example, if your device has a temperature attribute, the workflow can record a filtered version of that raw data onto a temperatureFiltered attribute. The new attribute is then what’s graphed.

Here’s a high-level description of what the workflow would include:

  1. A Device State Node that triggers when your device reports the raw temperature data.
  2. A Conditional Node to check that the raw data was what caused the trigger, not the filtered data. Since this workflow results in device state being recorded, it will cause this workflow to trigger again, which will get you into an infinite loop. Losant will detect this and stop your workflow. The conditional expression will be similar to {{ data.temperature }} !== undefined, which means the raw temperature has been reported.
  3. At this point you can add whatever nodes are required to filter or modify the data.
  4. Lastly, add a Device State Node to store the temperatureFiltered value. If the raw value doesn’t need changed, set the filtered value equal to the incoming raw value. If you changed the value, set it to the modified value. If you want to just throw it away, just end the workflow without calling this node.