TARGET water level game

Thread Starter

Tom2459

Joined May 23, 2020
16
As part of an eacape room game, i need to be able to sense when a water level reaches a specific volume, so not any lower, not any higher.

When this TARGET level is reached, a relay will be triggered.

To be sure there is no false trigger as the water level rises through the TARGET level to a level too high, i need to be able to have a timed delay before the trigger.

Im wondering if this is achievable with an ultra sonic sensor.. Has anyone attempted this and even better are there any projects known out there that have arduino code available?
Thanks for any help!
 

ZCochran98

Joined Jul 24, 2018
303
I'm definitely no expert on this, and have never done something like this, but I do know there are water level sensors that work with Arduino - you could possibly use one of those (or multiple for a fail-safe - for instance, use 3 and take 2/3 majority). There are a bunch of tutorials on how to use those, too. If you place your sensor(s) at the specified height you want, when they sense the water is at that level, they could turn off the mechanism.

You could even use a hybrid system (water level sensor + ultrasonic), but I will warn you: the speed of sound in water is 4.3 times faster than the speed of sound in air (1480 m/s in water and 343 m/s in air), so if your ultrasonic sensor gets submerged, its distance readings will likely be off by that factor (for instance, if your ultrasonic sensor is 1 meter off the ground (facing down to measure the distance between the sensor and the water level), then, if it gets submerged, it'll read the distance between the floor and the sensor to be about 1/4 meter. Just a consideration to make.

It's also possible that you'd also have an echo or ringing, like with sonar, when it's not submerged (depends on how much of the ultrasonic wave is reflected off or transmitted through the surface of the water), with each echo corresponding to your system measuring a larger and larger distance. So, as an example, if your sensor was 1 meter off the ground, and the water level was 1/2 meter, then you'd first measure a time between send/receive pulses of 2.91 ms (for a round-way trip to and from the surface - 0.5/343 * 2), then another pulse at 3.59 ms (0.5/343 + 2*0.5/1480 + 0.5/343), and another at 4.27 ms (0.5/343 + 2*2*0.5/1480 + 0.5/343), another at 4.94 ms (0.5/343 + 3*2*0.5/1480 + 0.5/343), and so on and so forth (basically, one every 2.91 + 0.676n ms, where n is the nth echo). Based on how the software would (ideally) calculate distances you'd take time between pulse sent and pulse returned, divide by 2, and then multiply by 343. For these pulse times I gave, you'd find your water distance to be .5m, 0.616m, 0.732m, and 0.847m (these are distances between the sensor and the measured surface of the water). Now, each echoed pulse would be weaker than the previous (assuming my calculations are correct, see the attached .txt file for some "back of the envelope" calculations for the pulse amplitude levels, if you care). The first echo you'd definitely see, but the others...depends on how the ultrasonic sensor works, I suppose.

Again, I'm no expert and have never worked with this kind of system - these are only suggestions.

Tl;dr: yes, it's possible with an ultrasonic sensor, but you may have echos that cause issues with distance measurement. Also when submerged your distances measured will suddenly change. There are water level sensors that work with Arduino that are triggered when submerged, but you'd have to do a little digging on those to figure out how to use them. Multiple sensors may be prudent, to prevent false positives or to act as failsafes.

Hope this helps or gives you some ideas for your project!
 

Attachments

Last edited:

Thread Starter

Tom2459

Joined May 23, 2020
16
Thank you for the depth of detail in your reply! I like the idea using 3 level detectors, i think i can make that work! Simpler the better..its now been a long day and the maths is melting my head a little.
Thank you again, will refer back if i need to
 

Reloadron

Joined Jan 15, 2015
7,515
Since your only concern is level and you want a time delay (delay on make) I would just go to any home improvement store and buy a float switch. You can buy a simple delay on make module to drive your relay. Your concern is level and not volume and all you seem to want is at a preset level do something and avoid false triggering. A simple Google of delay on make timer should get you a dozen hits.

Yes, if you want you can use a uC (micro-controller) like an Arduino or similar and if you want you can use a simple cheap ultrasonic sensor like an HCSR04 in conjunction with an Arduino or similar. This can be as simple or complex as you want it to be. It can also be as inexpensive or expensive as you want. Seems I answered this question earlier today? Maybe the Arduino forums. :)

Ron
 

Thread Starter

Tom2459

Joined May 23, 2020
16
Since your only concern is level and you want a time delay (delay on make) I would just go to any home improvement store and buy a float switch. You can buy a simple delay on make module to drive your relay. Your concern is level and not volume and all you seem to want is at a preset level do something and avoid false triggering. A simple Google of delay on make timer should get you a dozen hits.

Yes, if you want you can use a uC (micro-controller) like an Arduino or similar and if you want you can use a simple cheap ultrasonic sensor like an HCSR04 in conjunction with an Arduino or similar. This can be as simple or complex as you want it to be. It can also be as inexpensive or expensive as you want. Seems I answered this question earlier today? Maybe the Arduino forums. :)

Ron
You guys have helped me get there, got the brain ticking over.. Simpler that i had imagined!
Just need 2 water level sensors, TARGET level one attached to N/C of a relay with a time delay, the one above wired to switch the relay into N/O if water is detected.
 

Reloadron

Joined Jan 15, 2015
7,515
Some float switches do have a N/O and N/C output. This allows driving two relays with one active below a set point and one active a set point (setpoint being level of water). Think I paid under $10 USD for a stainless steel one on Amazon. The plastic housing ones are less cost.

Ron
 

Thread Starter

Tom2459

Joined May 23, 2020
16
You've stated a good point! One that i think i've sillyly overlooked, that being that float switches could now be uses like this..will have a looksey but i think this would be the cheapest, simplist form of switch for the project thanks again.
 

Reloadron

Joined Jan 15, 2015
7,515
I have a sump in my basement and all I care about is water in/water out. Water reaches a level and a level switch turns on pump and sump drains. I added a second pump just in case. When water level exceeds first pump level by a few inches then pump two comes on. All I care about is the level of the water so all I need is a few simple switches. :) That's all I need on that system.

Ron
 

Thread Starter

Tom2459

Joined May 23, 2020
16
My trouble came because firstly i tried to over complicate it but that i needed the water level of a container to be filled very specifically, ie no trigger activated when above or below this point. (and no trying to cheat the game lol)
This escape room project is quite interesting! Im learning a lot as i go..
 
Top