Utah Reefs Homepage
  New Posts New Posts RSS Feed - Reliable water level sensor for < $20
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Reliable water level sensor for < $20

 Post Reply Post Reply
Author
Carlsson View Drop Down
Guest
Guest
Avatar

Joined: February 16 2013
Location: Logan
Status: Offline
Points: 172
Post Options Post Options   Thanks (0) Thanks(0)   Quote Carlsson Quote  Post ReplyReply Direct Link To This Post Topic: Reliable water level sensor for < $20
    Posted: October 19 2013 at 3:49pm
I've had some bad experiences with the floating switches for my DIY ATO. They've failed twice in the "ON" position. Luckily, I only have 5 gallon RO/DI water reservoir connected to my DIY ATO and in the 160 gallon circulating volume system it did not cause too big of a salinity change.
 
The problem is that in my set-up the switches have to be quite close to my Eheim 1262 return pump and the strong magnetic field produced by the motor permanently magnetizes the switch reeds and they remain permanently closed ("ON" position) after about a week. Even after moving things around and creating ~9 in distance between the pump's motor and the switches, they have failed again.
 
I then tried a different route: no moving parts (floats), no magnetic switches. I have just finished a prototype of an Arduino based ultrasonic water level sensor. It uses a small microprocessor controller (Arduino Uno - $15 on EBay) and an ultrasonic distance measuring device (HC-SR04 - $3 on Ebay) to read the distance between the device and water in the sump. I have written a short code to run the Arduino which allows to specify the desired distance between the HC-SR04 and the water in the sump (and thus specify the water level). It checks the water level every 30 min (that can be changed) and sends a 5V signal to a relay ($5 on EBay) to turn on the ATO pump. I use a small 12V DC pump, but the relay would have no problems running even a giant 110V pump. Once the pump is on, the device checks the water level every 0.5 seconds and shuts off the pump when the desired level is reached. It then goes to sleep for 30 min.
 
 
 
 The relay board is red, Arduino is the blue board. They both will go into a small project box to make things look cleaner.
 
 
 
 
 


Edited by Carlsson - October 20 2013 at 10:09am
Back to Top
laynframe View Drop Down
Guest
Guest
Avatar

Joined: May 17 2009
Location: north ogden
Status: Offline
Points: 1062
Post Options Post Options   Thanks (0) Thanks(0)   Quote laynframe Quote  Post ReplyReply Direct Link To This Post Posted: October 19 2013 at 7:16pm
Will it have a problem with clear liquid? I do my own ato too but do mine different than you have. This is pretty cool
The time we enjoy wasting isn't wasted time!!!!
Back to Top
Fatman View Drop Down
Guest
Guest
Avatar

Joined: December 23 2011
Location: South Weber, UT
Status: Offline
Points: 1694
Post Options Post Options   Thanks (0) Thanks(0)   Quote Fatman Quote  Post ReplyReply Direct Link To This Post Posted: October 19 2013 at 11:10pm
.

Edited by Fatman - November 11 2013 at 7:00am
Back to Top
Carlsson View Drop Down
Guest
Guest
Avatar

Joined: February 16 2013
Location: Logan
Status: Offline
Points: 172
Post Options Post Options   Thanks (0) Thanks(0)   Quote Carlsson Quote  Post ReplyReply Direct Link To This Post Posted: October 20 2013 at 10:25am
Here is the code. I'm sure there are many better ways of coding this, but I am a total newbie to this and my only previous programming experience had been Basic and LOGO in late 1980's Big smile 
 
unsigned long echo = 0;
int echoPin = 7;  // ultrasound pin listen
int trigPin = 8; // ultrasound pin ping
int pumpPin = 13; //pump pin
unsigned long ultrasoundValue = 0;
 
  void setup()
  {
    pinMode (pumpPin,OUTPUT);
    digitalWrite (pumpPin,LOW);
    pinMode (trigPin,OUTPUT);
    pinMode (echoPin, INPUT);
  }
 
  unsigned long currentMillis = millis ();
  long previousMillis = 0;    // sets previousMillis to 0
  long interval = 1800000;   // sets interval between water level checks at 30 minutes (1.800.000 miliseconds)
  long duration = 0;
  long distance = 0;  
 
 
 
  void loop ()
 
 
  {
  pingcheck:
  digitalWrite (trigPin, LOW); // clears the pingpin for signal
  delayMicroseconds(2); // for 2 miliseconds
  digitalWrite (trigPin, HIGH);
  delayMicroseconds(5); // signal on for 5 miliseconds
  digitalWrite (trigPin, LOW);  // signal off
duration = pulseIn (echoPin, HIGH);
distance = duration/58.2;
             
        if (distance > 23) // if the distance to the water is more than 23cm
            {
            digitalWrite (pumpPin, HIGH); // turns the pump ON
            delay(500); // runs the pump for 0.5 second
            goto pingcheck; // rechecks the water level
            }
           
        else
        {digitalWrite(pumpPin, LOW); // if the distance to the water is less than 23cm, go to timeout
        goto timeout;}
       
timeout:
  if (millis() - previousMillis > interval) // if more time than (interval) has passed from the last check, check water level again
    {previousMillis = millis (); // record time of the current water level check
    goto pingcheck;}
  else
  // continuously running code (temp probe)
  goto timeout;
  }
 
My next step is to add a 20x4 display and connect some temperature probes so I can use the Arduino as a thermometer, too. I'm also working on a function which will shut off the return pump, skimmer, and power heads for either 10 or 30 minutes depending on how long you hold a push button down (momentarily or 1 second) so I can feed my fish or corals without having to remember to turn everything on.
 
 
Here is the link for the 4-channel relay. It will handle 10 amp of 250V AC or 10 amp of 30V DC and you can wire them as either normally closed or normally open. I believe the guy also sells single and dual channel boards. If you don't like the clicking of mechanical relays, solid state relays are the way to go. They are a little bit more expensive, but totally silent.
 


Edited by Carlsson - October 20 2013 at 10:39am
Back to Top
Fatman View Drop Down
Guest
Guest
Avatar

Joined: December 23 2011
Location: South Weber, UT
Status: Offline
Points: 1694
Post Options Post Options   Thanks (0) Thanks(0)   Quote Fatman Quote  Post ReplyReply Direct Link To This Post Posted: October 20 2013 at 1:21pm
.

Edited by Fatman - November 11 2013 at 7:00am
Back to Top
Carlsson View Drop Down
Guest
Guest
Avatar

Joined: February 16 2013
Location: Logan
Status: Offline
Points: 172
Post Options Post Options   Thanks (0) Thanks(0)   Quote Carlsson Quote  Post ReplyReply Direct Link To This Post Posted: October 20 2013 at 3:33pm
You are welcome. I'll keep updating this post as I progress with the project. I have finished the code for the timed shutdown and successfully tested it w/ just LED connected. Now I have to buy a couple of outlets, mount them in a project box, and connect to the relay board. I'm still waiting for the temperature probes (coming from Hong-Kong). LCD arrived yesterday. It may all have to wait a few weeks as I have an annual examination coming up at work in the middle of November.
Back to Top
Carlsson View Drop Down
Guest
Guest
Avatar

Joined: February 16 2013
Location: Logan
Status: Offline
Points: 172
Post Options Post Options   Thanks (0) Thanks(0)   Quote Carlsson Quote  Post ReplyReply Direct Link To This Post Posted: August 17 2014 at 8:52pm


This is the final "look" of my project (Arduino Uno and a solid state relays inside). One of the relays also switches on the top-off pump based on the signal from the ultrasound water level probe. The return pump and circulating pumps are plugged in to the left outlet, the skimmer in the right one. Pushing the red button down momentarily stops all pumps and the skimmer for 10 minutes (enough to feed my fish). Pushing the button down for 3/4 of a second turns everything off for 1 hour (enough time to target feed my corals and let them "swallow"  the food so it wouldn't be blown all over the tank by the two powerful Jebao 40s and two Koralias 1050). There is a 30 second delay between starting the pumps and turning on the skimmer. This is to keep the skimmer from overflowing as the water level in the sump is about 5cm higher with the return pump off. The Jebao DC 12000 takes about 15 seconds to rev up to the preset speed and about 20 seconds to get the water level in the sump down to normal.


Edited by Carlsson - August 17 2014 at 9:31pm
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.03
Copyright ©2001-2018 Web Wiz Ltd.

This page was generated in 0.297 seconds.