Hello,
In the framework of my project I have to realize the opening of a solenoid valve according to a water level detect.
Here are the characteristics of the sensor:
Detection Depth: 48mm
Power Rating: 2.0V ~ 5.0V
Dimension: 19.0mm * 63.0mm
I use an analog pin.
To measure the detection of the water level sensor I submerge them and it returns me the value 730.
According to the technical documentation of the sensor see attachment, it returns me a certain tension for a certain depth. (see Attachment)
Now the water level is calculated for a voltage of 1.88V at its maximum and I was wondering how to convert the detected 730 to voltage corresponding to 1.88V.
Here are my ideas for converting the analog value into voltage with for max 1.88 volt.
My first idea: (1.88 / 730) * analog_value
My second idea: analog_value / (1.88 / 0.0048)
// 0.0048 corresponds to the difference in mV between each analog value which can be read from 0 to 1023.
I hope that you can clarify
I thank you in advance.
Liquid Level Output voltage
0cm 0V
0.5cm 1.3V
1cm 1.53V
1.5cm 1.62V
2cm 1.69V
2.5cm 1.74V
3cm 1.77V
3.5cm 1.81V
4cm 1.84V
4.5cm 1.86V
4.8cm 1.88V
What sensor?
Which data sheet?
How did you get the numbers in your table?
And finally: why not reading those voltages directly with your analog input? In a 5V Arduino your 1.88V would result in an analog reading of 385, so you'd have a pretty good resolution there and then.
I would like to understand why the datasheet returns us as maximum value 1.88V for a sensor submerged at maximum 4.8cm.
I can not figure out how to convert them into tension.
helenmagnus:
http://www.waveshare.com/w/upload/7/78/Liquid-Level-Sensor-UserManual.pdf
I would like to understand why the datasheet returns us as maximum value 1.88V for a sensor submerged at maximum 4.8cm.
I can not figure out how to convert them into tension.
Why do you need to understand why the sensor acts as it does? Just accept that those are its characteristics and work with the data you have. Neither do I see any need to convert the reading into tension (voltage?). I assume that you're activating the solenoid when you reach a certain level of water and deactivating it at another level. Either keeping the water topped up in a reservoir or pumping out a bilge.
In either case, you can determine by experiment what analogRead returns at your two level points and just use the raw values to control the solenoid. If you really need to know the actual depth measured, you can either use a lookup table or use excel to calculate an equation for the graph of the sensor data since it's not linear. Then transfer that formula to your arduino sketch.
There is something odd though. As wvmarle points out, the max value you should be getting is lower than the 720 you're reading - which arduino are you using? I'd do some experiments and plot your own graph of analog readings against depth.
This is not a level sensor. It should be called liquid detector: http://www.waveshare.com/liquid-level-sensor.htm
Readings depend on the conductivity of the liquid. Unless you know very, very well how well your liquid conducts (which is just about impossible in the real world), there is no way to measure the actual level with this thing. You can merely say "it's in the water" or "it's not in the water" (in the latter case: if wet you won't get a non-zero reading). So OP getting a different voltage in their liquid is to be expected.
For OP: you can use this to switch off the solenoid when the water reaches this sensor - say if the analog value > 100 switch it off. You'll need a second sensor to detect when it's so low it's time to fill up your reservoir.
Yes wildbill you're right I'll just take 2 values. This story annihilated me.
I use an Arduino Uno.
Thank you for your answer