Pond water level monitor - please sanity check my circuit

Hi all,

I've an idea for a project in my garden. Every so often I discover the water level in my pond has dropped way more than it should have - usually because a waterfall jams and causes the water to overflow outside or a pipe comes loose and water gets pumped to the outside.. not good! I figured building something to monitor the water level would be fun. I'm a software developer so I'll hopefully have no issues with coding it but I've zero experience with creating my own circuits. I write apps that interface with custom built hardware over Bluetooth with my job but that's as close as I get :).

I've spent quite a few days reading into how to solve this and come to the conclusion I'm likely best mounting an Arduino with an ultrasonic sensor above the pond. Every ~30 minutes or so it can poll the rough water height and use wireless to send the data off to ThingSpeak/my own API somewhere which would then trigger alerts to email/text/push or whatever I choose if it gets below a certain value. Assuming it works I may look to expand it later to switch a 240V relay (UK mains) so I can turn the pump on/off when the water level gets too low.

I've come up with the following components I'll need and have spent far more time than I should have putting together a circuit; I tried to keep it neat!

I plan to power this from mains voltage rather than batteries but I figured I'd try and save energy where possible and make it more challenging so I've added two NPN transistors to let me cut the power to both the ultrasonic sensor/temperature sensor and wireless module individually. I read you should add a resistor to the gates so I have.

The ESP8266 uses 3.3V rather than the Arduino's 5V. The built-in 3.3V of the Arduino apparently can't provide enough current so I've used the 5V line with 3.3V regulator to bring the voltage down. Similarly, the TX pin of the Arduino needs to be shifted down to 3.3V for the ESP8266 so I came across a trick of using a voltage divider to do this. Voltage to ESP RX = 5V * (2KΩ/(2KΩ+1KΩ)) = 3.33V.

How horrendously wrong do this look? I'm mostly unsure of whether I've picked the correct resistor values or not and if it's going to go up in smoke the moment I power it on.

  • Arduino Uno R3
  • HC-SR04 (datasheet) - ultrasonic distance sensor [I'll probably use a waterproof variant]
  • ESP8266 (datasheet) - wireless module [I'll probably use the ESP07 varirant with an external antenna]
  • TMP36 (datasheet) - temperature sensor [I don't really need one, but why not]

Breadboard:

(click for larger image)

Schematic:

(click for larger image)

Thank you!

Think I would use a DS18B20 sensor as you can buy them prewired and sealed in a metal tube, cheap enough from Uk suppliers.

For the water level, would just use a simple float switch, but mount it within a larger diameter tube which serves as a wave / leaf / debris restricter, but put some net over the ends to stop snails etc going in.
Even these cheap ones can detect a change by just a mm or two, so for a pond you might want to have 2 of them, one for min and one for max levels.

Perhaps turn off the wifi module, though no idea how much power they actually use, but the temp sensors etc use very little power, what generally eats most power is the linear regulators, so use a modern digital buck type.

Electronics will be very unreliable if left outdoors, even if well covered. Moisture and condensation induced by temperature changes will rapidly destroy circuit boards and wiring.

I've had great luck with capacitive proximity sensors for yes/no water level, similar to this one:

http://www.ebay.com/itm/LJC18A3-B-Z-BX-3-wire-10mm-Capacitive-Proximity-Sensor-Switch-NPN-DC-NO-300mA-/121864216190?hash=item1c5fac5e7e:g:29YAAOSwFfhXjOeo

However, I used a much more expensive, industrial quality Pepperl & Fuchs sensor (recycled from equipment) and can't speak to the quality of a cheap Chinese version.

www.ebay.com/itm/Pepperl-Fuchs-Proximity-Sensor-CJ10-30GM-N/291395954242?_trksid=p2045573.c100642.m3226

The P&F sensors are very well sealed against the environment, very simple to use, and the leads can be brought in to an indicator inside the house. They can also directly switch a SSR relay to control a pump. No Arduino needed.

jremington:
Electronics will be very unreliable if left outdoors, even if well covered. Moisture and condensation induced by temperature changes will rapidly destroy circuit boards and wiring.

One reason I suggest the DS18B20 sensor and a simple magnetic float switch, both can operate at long distances, so allowing your control unit to be housed in a nearby shed, garage or greenhouse etc.

Your pcbs ( except regulator heat sinks etc) can also be sprayed with conformal coating to help against condenstation.

Hi all,

Thanks for the replies - Christmas got in the way of me replying. I hate hit-and-run threads!

ricky101:
Think I would use a DS18B20 sensor as you can buy them prewired and sealed in a metal tube, cheap enough from Uk suppliers.
1x DS18B20 Waterproof Digt Sensor Thermal Probe Temperature Thermometer Arduino | eBay

For the water level, would just use a simple float switch, but mount it within a larger diameter tube which serves as a wave / leaf / debris restricter, but put some net over the ends to stop snails etc going in.
Even these cheap ones can detect a change by just a mm or two, so for a pond you might want to have 2 of them, one for min and one for max levels.
Float Switch Tank Pool Water Level Liquid Sensor - High Quality Free Postage | eBay

Perhaps turn off the wifi module, though no idea how much power they actually use, but the temp sensors etc use very little power, what generally eats most power is the linear regulators, so use a modern digital buck type.

I should have clarified that I was just planning on monitoring the ambient outside temperature rather than the water. I never even thought about monitoring the water directly so I may as well do that as well, thanks.

A colleague of mine suggested using float switches so it's interesting you mentioned it. I guess to monitor varying depths rather than just "it's all ok" and "we have a problem" I'd need quite a few sensors which could prove a challenge to physically mount and cable.

According to ESP8266 power consumption it uses ~170mA transmitting, ~56mA recieving, ~15mA sleeping and 10uA in deep sleep. Given I plan to power it from the mains then obviously this isn't really a problem. To be quite honest I only wired in the transistors to make the project more complex, I probably won't even use it.

For deep sleep you tell the chip to sleep for x minutes and the chip's onboard RTC deals with waking it back up, however it looks like you can connect one of the Arduino's output pins to the CH_PD pin on the wifi module to cause a reset to wake it up early.

jremington:
Electronics will be very unreliable if left outdoors, even if well covered. Moisture and condensation induced by temperature changes will rapidly destroy circuit boards and wiring.

I've had great luck with capacitive proximity sensors for yes/no water level, similar to this one:

http://www.ebay.com/itm/LJC18A3-B-Z-BX-3-wire-10mm-Capacitive-Proximity-Sensor-Switch-NPN-DC-NO-300mA-/121864216190?hash=item1c5fac5e7e:g:29YAAOSwFfhXjOeo

However, I used a much more expensive, industrial quality Pepperl & Fuchs sensor (recycled from equipment) and can't speak to the quality of a cheap Chinese version.

www.ebay.com/itm/Pepperl-Fuchs-Proximity-Sensor-CJ10-30GM-N/291395954242?_trksid=p2045573.c100642.m3226

The P&F sensors are very well sealed against the environment, very simple to use, and the leads can be brought in to an indicator inside the house. They can also directly switch a SSR relay to control a pump. No Arduino needed.

I was planning on mounting it in a suitable IP67 container or similar, would that be OK? I wrote an app for a project at work where we put several solar powered Samsung Galaxy S2's inside waterproof cases and mounted them to a test rig in the English channel. We used them as a cheap way to record accelerometer/gyroscope/magnetometer data and send the data packets back to base over 3G. They were constantly being dunked underwater and survived :).

I'll have a look into those capacative sensors. I was looking at using one of these water proof ultrasonic sensors and running the probe outside a gland on the box.

Interesting you mention bringing the leads inside. I could just put the Arduino inside the garage; it's about 3 metres away from the pond. I'd just need to extend the length of those probe cables a little - I guess to 5m. I'm not sure how far they can be extended though.

ricky101:
One reason I suggest the DS18B20 sensor and a simple magnetic float switch, both can operate at long distances, so allowing your control unit to be housed in a nearby shed, garage or greenhouse etc.

Your pcbs ( except regulator heat sinks etc) can also be sprayed with conformal coating to help against condenstation.

I'll have to go ask one of my colleagues (electrical engineer) nicely as I'm sure he'll have some spray I can use, thanks :).

The DS18b20 is designed for long distances and can be bought pre wired, typcially 1 or 3 mtrs but some places do them in 5, 10 and 15mtrs.

Also they are designed to allow several sensors to be connected to the same cable, as they have individual adresses.

You do not need multiple float switches, you can do it with just one, so when it falls below the set level the top up pump / solendoid turns on.

If you want more than a couple of mm before the pump turns on then you will need 2 floats.

Both devices are used by folk with expensive marine reef fish tanks so have to stand up to moisture and salt.