2018-02-25, 11:23 PM
I am reading my fuel/waste/fresh water tank levels using the original resistive senders (0-190 Ohm) configured in a voltage divider.
The output voltage is then read by an ADS1115 ADC connected to an ESP8226 wireless sender running ESPEasy firmware. The ESP8226 sends the data as MQTT over WiFi and is picked up in NodeRed for presentation on my dashboard on the Pi. (All shamelessly copied from others on here
All works just great but I'd like to incorporate some correction for the non-linear nature of the sender.
In OP I know there is the option to do this for a directly connected ADC but not one sending data over MQTT
In the ESPEasy firmware there is the option for "2 point correction" but I need more plots in the curve than just "1024 = full and 0= empty".
I think that what I really need is some JSON code for a NodeRed function node that will take a raw ADC value range and convert it into a value in litres.
I'd want a small table of 8 such conversions as the sender has 8 or maybe 10 steps.
for example
ADC in value out
0-99 0
100-299 20
300-499 50
500-699 100
700-799 200
800-999 250
1020+ 320
I have no clue how to write JSON code so Im hoping that someone may have addressed this issue before.
Thanks
Steve
The output voltage is then read by an ADS1115 ADC connected to an ESP8226 wireless sender running ESPEasy firmware. The ESP8226 sends the data as MQTT over WiFi and is picked up in NodeRed for presentation on my dashboard on the Pi. (All shamelessly copied from others on here

All works just great but I'd like to incorporate some correction for the non-linear nature of the sender.
In OP I know there is the option to do this for a directly connected ADC but not one sending data over MQTT
In the ESPEasy firmware there is the option for "2 point correction" but I need more plots in the curve than just "1024 = full and 0= empty".
I think that what I really need is some JSON code for a NodeRed function node that will take a raw ADC value range and convert it into a value in litres.
I'd want a small table of 8 such conversions as the sender has 8 or maybe 10 steps.
for example
ADC in value out
0-99 0
100-299 20
300-499 50
500-699 100
700-799 200
800-999 250
1020+ 320
I have no clue how to write JSON code so Im hoping that someone may have addressed this issue before.
Thanks
Steve