After two years of service my ultrasonic hs sr04 fell apart.
It was part of a project to measure the water level in a tank so I would know when to fill the tank and when to stop the pump filling the tank.
It worked well and I want to keep this project running. However the ultrasonic module is kind of bulky and won't handle condensation for longer than 2 years.
My idea was to replace the ultrasonic with an IR module. Distance to water surface would be between 15 and 20 cm and between 80 and 85 cm. So not so high accuracy needed.
Anybody had experience with measuring distances to water surfaces with IR? Is it doable will the water reflect enough light to read anything?
I'll add a simple drawing of the setup to this post.
Paul the opening in the tank is a 20cm round hole. The water surface is 100 by 100 cm. A little 20cm disc will fload all around. except underneath the sensor when trying to measure i bet
Hammy, I will look into that. Can there be 2 installed?
One would be under water when the tank is not empty...
"Paul the opening in the tank is a 20cm round hole. The water surface is 100 by 100 cm. A little 20cm disc will fload all around. except underneath the sensor when trying to measure i bet
Hammy, I will look into that. Can there be 2 installed?
One would be under water when the tank is not empty..."
You can do similar to my irrigation tank level sensors using float switches to tell the Arduino Nano to turn on the solenoid valve to fill the tanks, or to turn the valve off.
Trying to get the post modify to show the images, but no success. Sorry.
That looks like a nice setup there Paul. Do you have a link or maybe a name to those switches? The quick search I did gave me big switches or cheap looking Styrofoam using switches.
However the waterproof ultrasonic is also only 10 bucks, just replace the sensor.
I'll do some more research with the idea's you all gave me
What feature of IR and the IR sensor is going to allow you to measure the distance to the liquid. Are you hoping to measure the time delay from transmission to reception ? If so then calculate the range of delay values you are going to be working with.
Paul_KD7HB:
"Paul the opening in the tank is a 20cm round hole. The water surface is 100 by 100 cm. A little 20cm disc will fload all around. except underneath the sensor when trying to measure i bet
Hammy, I will look into that. Can there be 2 installed?
One would be under water when the tank is not empty..."
You can do similar to my irrigation tank level sensors using float switches to tell the Arduino Nano to turn on the solenoid valve to fill the tanks, or to turn the valve off.
Trying to get the post modify to show the images, but no success. Sorry.
Paul
Paul do you have some example code of your setup for me to look at? Switches are ordered.
Sure. Simple code that ran flawlessly all last season:
/* Program to control the irrigation system tank filling procedure. Checks the low water and full water switches regularly, and
* turns on the relay which turns on the piloted solenoid valve to allow well water into the storage tanks.
* Checked with breadboard on June 26, 2018. Logic seems correct.
*/
int lowerSwitch = 7;
int upperSwitch = 8;
int relayControl = 9; // This pin controls a SSR that controls the solenoid valve for fill water.
byte lowLevelsw = HIGH; // switch at bottom of tank. High = magnet hanging down, needs more water
byte highLevelsw = HIGH; // switch at top of tank. LOW= magnet floating = turn off the fill water
boolean fillingTank = false; // current relay setting. TRUE if water coming in. FALSE if no water coming in.
boolean almostFull = false; // Stops the float switch from bouncing open/closed
void setup() {
// Serial.begin(9600);
pinMode (lowerSwitch, INPUT_PULLUP); // use internal pullup resistors
pinMode (upperSwitch, INPUT_PULLUP);
pinMode (relayControl, OUTPUT);
}
void loop() {
// get the conditions of the water level reed switches.
lowLevelsw = digitalRead(lowerSwitch);
highLevelsw = digitalRead(upperSwitch);
if((lowLevelsw == HIGH) & (highLevelsw == HIGH)) // reed switch magnets are both hanging down, tank is empty
{
fillingTank = true; // begin filling
almostFull = false; // but don't cycle off and on
}
if((lowLevelsw == LOW) && (highLevelsw == HIGH)&&(almostFull == false)) // bottom magnet is floating, top magnet hanging, keep filling tank
{
fillingTank = true;
}
if((lowLevelsw == LOW) && (highLevelsw == LOW)) // both magnets are floating, so tank is full
{
fillingTank = false;
almostFull = true; // stop the float switch from bouncing
}
if ((fillingTank == true) && (almostFull == false)) // keep filling the tank
{
digitalWrite (relayControl,HIGH); // SSR is active when LED turns on
}
if(fillingTank == false) // stop filling the tank
{
digitalWrite (relayControl,LOW); // turn SSR off
}
}
When shining light on water perpendicularly (which you need to stand a chance of getting back a reflection) it doesn't reflect much if anything. In case of clean water you'll be looking at the bottom of the tank. In case of muddy water you may actually get a reflection thanks to the mud. I'm assuming the OP has clear water in the tank.
When shining at an angle water of course becomes reflective (thanks to the difference in speed of light in the water and in air) but you would not get any reflection back to the source, and the position of the reflection would change with the water level.