I am currently working on a Turbidity meter that returns a value of the voltage from 0-5.0 (this number will change depending on how turbid the water so a lower voltage reading indicates a more turbid water).
What I am trying to do is take the voltage reading that I get and convert it to a reading that expresses the turbidity in the water (so a voltage reading of 4.8 would equal 0 to a voltage reading of 1.2 would equal 4000).
I have written some code using MicroLogic and I know that in there there is a box that looks at the incoming reading and will scale the outgoing reading between a Min and Max number that you put in (an example in MicroLogic is that I get a 4-20mA signal in and it will scale the output to mean a water level in a tank based on that 4mA = 0ft and 20mA = 12ft)
Is there a scaling code for python, or how to I go about doing this? Thanks!