Fish Worry Reducer (aka automatic pond filler)

Over time, my ponds lose water. Maybe raccoons drink it all or the fish party too much, but I need an easy way to fill it. Time to automate!

ponds

 

First Steps
There are really only two required pieces for this project: 1, A way to monitor the water level, and 2, A way to add water.

Adding the water can get tricky, but lucky for me the existing sprinkler system happens to run a water line right behind the waterfall of the pond. So I decided to add a sprinkler valve, with the output of the valve simply adding into the waterfall

Sprinkler Valve Details.

Sprinkler Valve Details.

That in itself could be enough to keep the fish happy – add a little timer and viola! – the pond keeps itself topped up. However, that can waste a lot of water. Thus the introduction of our fancy never-been-done-before (in my backyard) special water level detection and pond topping up solution.

 

The IOT2020 – Industrial strength Arduino

To automatically detect and fill, I chose to use the IOT2020. It’s an industrial Arduino-compatible platform which gives safe reliable control that’s super easy to program.

The IOT2020 Compared to an Arduino UNO.

The IOT2020 Compared to an Arduino UNO.

The nicest part of this platform is that coding and prototyping can be done on a basic Arduino Uno and then transferred seamlessly to the IOT2020. It also provides extra capabilities like built-in networking in case I choose to add web connectivity to the project later.

There are 2 little but important details to keep in mind for the IOT2020. The first is that it uses a 24 volt input which, if enabled, is transferred directly to the VIN pin of the Arduino headers. That’s enough to break most low-voltage circuits, so I recommend keeping the jumper set to disable/disconnect VIN.

The second detail is that the Arduino part of the IOT2020 can be set to use either 3.3 or 5 volt I/O. The parts I was using (especially the relay) requires 5 volts and it took me a moment to figure out why it wasn’t working! I recommend changing the jumper to set it to 5 volts for easy relay control.

The default I/O voltage is 3.3v

The default I/O voltage is 3.3v.

Switching the jumper (white arrow) changes the I/O voltage. The jumper just to the left of it disables VIN.

Switching the jumper (white arrow) changes the I/O voltage. The jumper just to the left of it disables VIN.

VIN jumper description from the IOT2020 manual.

VIN jumper description from the IOT2020 manual.

I/O voltage jumper description from the IOT2020 manual.

I/O voltage jumper description from the IOT2020 manual.

The Circuit Plan

The circuit really consists of 2 separate functional components (as mentioned above) – 1. the sensors, and 2. the top-up relay. The IOT2020 uses the sensors to figure out when to add water, and it uses the relay to turn on the sprinkler valve at the right time.

Sensors

The sensors are simply (very long) wires that are placed into the pond to detect when water needs to be added. I chose to use 2 sensor wires (plus at least one wire for ground) to detect low water and high water level. Using two sensors avoids frequent on/off cycles that are likely to occur with a single sensor in wavy conditions or even just when topping up. In my setup the low water sensor indicates when the water level is too low, and the high water sensor indicates when the pond is full enough. I found that having the sensors about 6″ apart in my pond requires only a few minutes of top-up time while not allowing the water level to get too low. That amount of water also takes a long time (days to weeks) to leave the pond.

The theory was that placing the sensor wire and ground into water would short them out like a regular switch, but while testing I found that this was not entirely true – even with a small 1/2″ gap, water (tap and pond) still has a fairly high resistance (just over 1 M-Ohm), which meant I couldn’t just use the internal pullup resistors. Using external higher-value pullup resistors solved that problem, but unfortunately also means adding a bit more complexity to the circuit. (I think mine are about 4 M-Ohm).

The resistance of tap water.

The resistance of tap water.

Water sensor up close - the wires are off the stick to avoid false readings from water sticking to the surface.

Water sensor up close – the wires are off the stick to avoid false readings from water sticking to the surface.

The source code for the probe testing is available on GitHub. I used 2 stranded pairs from an old Cat-5 cable (telephone wire would work too), wrapped around a bamboo chopstick. Of the pairs, the solid colours were connected to D5 and D6, and the white/dotted wires I connected to GND. For testing this I used an Arduino Uno because everything is more accessible on it – easier for prototyping.

Turning on the Water

Controlling a sprinkler valve is easy – simply connect the sprinkler’s regular power source through a relay that’s connected to the IOT2020. The sprinkler valve’s ground stays connected as before. In my case that meant all I had to do was run a wire from the +24VAC of the sprinkler controller to the relay, and then connecting the wire of the sprinkler valve to the other side of the relay. The ground of the valve stays connected through the regular sprinkler controller, which connects it to the other side of the 24VAC adapter.

Turning on a relay with Arduino is simple – it’s identical to turning on an LED. I used a small relay module for my initial testing.

Using an Arduino Uno with a Relay Module for easy prototyping.

Using an Arduino Uno with a Relay Module for easy prototyping.

Once that was working I decided to use a separate relay instead, to make it easier to fit within the IOT2020 enclosure as a shield. This required an extra transistor and resistor. Oomlout has a great tutorial on the details of controlling a relay with Arduino.

Putting it all together

Now that we can sense the water level and turn on the sprinkler valve, it’s time to bring it all together with some logic. The details are in the finished Arduino sketch on GitHub.

The quick explanation is that the IOT2020 turns the water on when the bottom (low water) sensor goes dry, and it turns the water off when the top (high water) sensor gets wet.

The completed prototype.

The completed prototype.

The first prototype used a small LED and button battery to emulate the sprinkler valve, and a jar of water to emulate the pond.

I also added some safety code to make sure the pond filler doesn’t stay on too long. In most cases that would indicate a severe failure of some sort. The safety is a basic counter/timer that checks to see how long the pond filler is on. If it’s on for longer than 15 minutes, it shuts off the valve and flashes the warning LED. I used the IOT2020’s “user” LED for that purpose, but you might want to add an external red LED to make it more noticeable. After tripping the warning, the filler won’t come on again until the controller is reset (human intervention required!)

The User LED on the IOT2020.

The User LED on the IOT2020.

The Circuit

The circuit

The circuit.

For prototyping I put the circuit onto a breadboard and then copied the circuit onto some cheap protoboard I had available. I learned a few lessons in that process – one, the cheap board I had was one-sided which made the installation of the header pins rather tricky. And it was low quality which meant the copper pads pulled off the board in several spots. It all works fine enough but for the future I’ll buy some 2-sided Arduino proto shields instead (I had one but planned to use it on another project).

The other lesson was in details – I soldered it up quickly late one night. Then I didn’t get back to it until 2 weeks later and (after many failures and much debugging time) found out I missed a power connection and missed 2 solder joints.

The finished shield (top).

The finished shield (top).

The finished shield (bottom), still missing a power wire. Can you spot the missing solder joints?

The finished shield (bottom), still missing a power wire. Can you spot the missing solder joints?

I purposely left the VIN pin off my shield, because I didn’t want the risk of shorting that to anything. I also did my initial testing of this shield on a cheap Arduino clone, just in case!

My shield installed on the IOT2020.

My shield installed on the IOT2020.

If you have access to custom PCB services, I recommend creating a high quality custom board instead – the Fritzing file in my GitHub project has all the details. I haven’t tested it, so you might want to double check my work first!

When you’re switching from using an Arduino UNO while prototyping to the IOT202 for production, remember to change the settings.

Settings for using IOT2020 with the Arduino IDE.

Settings for using IOT2020 with the Arduino IDE.

Installing the Finished System

The final step in all this is to connect everything up to the real thing: 1, Add the sensor stick to the pond, and 2, install the IOT2020 beside the sprinkler controller.

Spot the Water Sensor!

Spot the Water Sensor!

The IOT2020 installed beside my sprinkler system (home-built OpenSprinkler-Pi)

The IOT2020 installed beside my sprinkler system (home-built OpenSprinkler-Pi)

Happy Fish

In conclusion, the system works well and the fish are happy. I found the IOT2020 is very easy to use, and you can tell by the final picture that it looks a whole lot more professional than my storage-container sprinkler solution!

Happy Fish under the waterfall.

Happy Fish under the waterfall.

The same setup can also be used to sense and add water to things like coffee makers, hot tubs, and swimming pools. The same relay that I use for the sprinkler valve could also be used to switch a low-voltage pump, for example. (Don’t use it for higher voltage switching, as that is not safe for the average user/hobbyist).

An Afterthought…

Of course it’s always *after* completing a project when you realize how it could have been done better, easier, quicker, or cheaper.

In this case, I just realized that the project could be made to work just as reliably with a single low-water probe, leaving off the high-water probe. You would just need to time roughly how long it takes to fill up your pond from the low water mark (10 minutes in my case), and then simply leave the relay on for that amount of time after the low-water probe is triggered. The warning might then only come into play if the low-water probe is still showing low water after the pond filler has just finished a fill-up, or if it comes on more than once a day, for example.

 

Thank You

Thank You’s go to Hackster.io for sponsoring the contest I built this project for, Peter Oakes aka thebreadboard for hosting the competition, and RS Components for providing the IOT2020.

ps, This and other projects are also available on my blog: http://techblog.mulberryland.com/

 

For More Details

All of the Arduino source code and the hardware schematics are available in my GitHub repository for this project.

Leave a Reply

Your email address will not be published. Required fields are marked *