but, I need to read the depth of the liquid using the arduino code in the serial monitor.
how to convert this resistance value to find out the depth.
First, You need to work through the math to get an equation for depth from resistance. The general form for a line is y = mx +b. In your case, y is the ohms resistance, and x is the inches of fluid depth. Equation of a Straight Line
For the best accuracy, you should use specific measured resisitance values for your 1" and 12" depths, but here’s the calculation using the given nominal values of the two points (1,2250) and (12,400). The slope (m) is -1850/11 = -168 ohms/inch. (I realize that this is somewhat different than the nominal -150 ohms/inch given in the data sheet).
Now that you know the slope, you just need to determine the value of b (y intercept) to use in the equation. Hint: Just project the line back to x = 0 with the slope of -168 ohm/inch. You will also want the linear equation in the form which solves for depth x = (y - b)/m where y is your measured resistance.
Second, you need to write the code to read the voltage with analogRead(), convert it to resisitance with the voltage divider equation, and plug the values into the equation for depth.
Make an effort to write some code and post it. Please remember to use the code tags [code][/code]
found at the </> in the tool bar to get your code in a window like this
your code here
and also one more doubt!
The sensor have 4 pins. pins 2 and 3 are used to read the sensor output. pins 1 and 4 are given for
temperature compensation. so, what is the connection for pin 1 and 4. They have not mentioned anything about these 2 pins in the datasheet.
I am also confused by this, and I would suggest you contact the manufacuturer’s technical support at techsupport@milonetech.com
I can only assume that the Rref which is nominally 2250 ohms changes with temperature in the same fashion as the variable resistor. If you go by the circuit diagrams posted in the data sheet, I would use the method shown as “Voltage Dividers and Microncontroller”.
You will determine how much Rref has changed from its nominal value at the measurement temperature, and adjust the variable depth resistance by the same percentage amount. For example if the reference resistor reads 5% higher than its nominal value, then adjust the depth measurement resistance value by the same 5%.
You will need to measure the reference resistor accurately at some known temperature to get a starting point.