Arduino Style Map function block for Edge Workflow



When we start dealing with MODBUS, depending on the device when doing Analog reads especially 4-20ma we see devices representing data in a number of forms, 2 in particular are the driver for a new feature request. These forms are

  1. the result of a basic ADC, for instance 10bit. So the value is 0-1024, or they could be 12 or 14bit accuracy
  2. the value in milliamps (4-20) or (0-20)

In these cases they represent something like flow rate or depth. So 0-1024 could map to 0 - 50 (floating point). As in litres per second.

an arduinio style map function would be really useful. I am defining this in a Javascript function block, but with the current state of play it means code is repeated everywhere.

This would be an ideal node in the Edge workflow.

In the example above we would typically convert 0-1024 -> 4-20ma so we can test without gear, (compare multi meter with reading) as well as output as the scaled value - for instance 0 - 120 litres per second.



1 Like