Help with templating Volts to centimeters

Hi.
I dont know if this is possible.

I´m using a shelly uni with a ADC levelsensor.

Is it possible to convert ADC to centimeters.

When my level is at 0cm my sensor says 7,2ADC
When my level is at -84cm my sensor says 0ADC

It’s just maths. Your range of 7.2 ADC is the same range as 84cm.

84 CM = 7.2 ADC

So, each ADC is 84/7.2 CM, or 11.66666666666667

Now we just had to adjust for the fact that one is a scale from 7.2 to 0 and the other goes from 0 to -84

-84 + (ADC * (84/7.2) )

or simpler

-84 + (ADC * 84 / 7.2)

:slight_smile:

Thanks. So simple :slight_smile:

Now I just have to figure out how to use it in templates.