The PondMaster is a solar powered pond pump controlled by an Arduino based robot. Beyond turning the pump on when the sun shines, the robot is programmed to check temperature, water level, and power level to let it remain installed and operational throughout the year without outside interference, and it can report its status over bluetooth, with a more limited readout of what it is doing through LEDs.
The Build
This project had been on my to-do list for quite some time, but with other projects and limited funds, it kept getting pushed back. When I finally bought the parts, it was more than two months before I could begin building, since the pump, shipped from China via inexpensive shipping, never arrived and had to be reordered. When the parts were finally assembled, it took another month to determine that the relay used was faulty and to rework different aspects to suit what I wanted out of the circuit and programming – there was minimal written planning done. From then, it took several weeks to build the protective/mounting assembly around the solar panel and a couple more months devising a solution for measuring water level – I had initially tried infrared reflectance off of a float in the water, but when installed, they proved to give little useful information and couldn't be used.
Months after the start, partly due to various setbacks and partly because it was one of a handful of projects I had going, I brought the prototype up to the pond to be tested out. For a couple of weeks, there were overhauls in the coding to fix glitches and rework the flow of the main loop. The whole project ended up being very seat-of-my-pants in nature, with the circuit being reworked to accommodate changes and new requirements while the code evolved to fit sensor readings, better compensate for brown outs to keep the bluetooth module on, and all sorts of other fixes. When it was operating well, I set the post, hid the cables somewhat, and attached it to the top. There were still some software tweaks after putting it up, but nothing significant.
The Circuit
Short of drawing up a circuit diagram, which would obviously be handy but which would take a fair amount of work and trying to reconstruct what I actually made after all the revisions, I'll just outline the basics of the circuit – what connects to what and in what order. It's generally not all that complicated and is a collection of smaller circuits developed for other projects or for individual sensor readings and whatnot all compiled together. It's also likely that this can be done in a more efficient way or that parts are extraneous.
The solar panel has a built in diode and then plugs into the box. On the smaller power board, the large capacitor smooths out the power somewhat and connects to both a 5v regulator circuit and and a low power relay, used to switch on the pump. On the 5v side of the regulator, there's a very large (1.5 Farad) capacitor to make sure that fluctuations in power draw and input don't start restarting the microcontroller or corrupt memory. It's not a guaranteed solution, but it's good enough for this application. On the other side of the relay, the power is dumped out towards the pump jack – it is routed through the red toggle switch, which lets me select between off, on (direct connection to solar power), and auto, which is routed through the relay controlled by the microcontroller.
On the other board, the Arduino is directly connected to the five indicator lights, is connected through the serial pins to the bluetooth module, and of course power from the other board. There's the in-box DS18S20 temperature sensor connected to the declared oneWire pin, all three connected pins also run out to the temp sensor jack, which has another of the same sensor on the end of a long wire. When the software enumerates the oneWire devices, they always come up in the same order, so you can tell which is which quite easily. The capacitive level sensor, which is detailed here, connects directly to the Arduino as specified by the capacitiveSensor library – the supporting resistor and small capacitor to make the sensor are on the sensor, so there's no need for those parts in the box.
Then there's two Arduino pins connected to transistors – one to switch the relay, which may not be required, but was going to be a larger current drain so I figured I'd be safe – and one to reset the bluetooth module, which when activated, grounds the power pin of the module to force a reset.
The second level sensor jack was originally to accommodate a pair of optical sensors, but since switching to the capacitive sensor, it goes entirely unused, an unconnected jack plugged in to keep it from being a hole to the outside.
The Structure
Aside from a few circuit boards bolted in a waterproof box, putting the build together wasn't too complicated, but took a while to design and fabricate. Starting with the electronics, I opted for quarter inch stereo jacks for interconnects, decent quality jacketed three conductor cable, and as much water and oxidation resistant bits as possible, since it was going to be outside. The cable from the solar cell was already installed – silicone covered high gauge wire – but there is never a ton of power going through any one cable, so I have not opted for metal jacketed cables or conduit – though in farther installations or higher power ones, it would certainly be recommended, if not required.
The plumbing is just 1/2" CPVC cut and glued to fit the pond, then painted black. A holder was made out of spare tee joints to keep the water level probe in place, and zip ties keep everything somewhat organized and in place. The intake for the pump isn't glued, but is two 12" sections of CPVC coming out of a tee, each riddled with holes and covered in 3/4" filter floss. The idea was to spread out the intake as much as possible, so as not to suck anything in.
The mount and shield for the solar cell is the most complicated part, structurally. Even though the panel is mounted to an aluminum frame and covered in glass, I needed a sturdy way to attach it to the post and wanted to protect it from branches and whatnot, given the trees in the area. I built the shield out of a quarter inch sheet of acrylic, bent to fit with a heat gun, but I can't recommend doing it with a heat gun if you want to make one. To bend a full two foot sheet, you have to have the whole joint hot at once to bend it, which is extremely difficult to do with a point heat source like a heat gun. I built an aluminum frame to attach the shield to the panel, from L strips, flat strips, and stainless hardware, then eventually built several thicker pieces to connect it to the post securely. The panel has only four mounting holes, so the back frame tries to tie everything together with some redundancy to keep it from coming off.
On the top of the post, there's a pair of brackets designed for support post mounting on concrete slabs in home construction and the like, attached together like a hinge with a single large bolt. While using two short bolts, one on each side, would make for a firmer grip, a single bolt is simpler, and a piece of PVC acting like a spacer keeps the pressure on each side high, without bending the sides in, and keeps up enough friction to keep it from flopping around. This assembly screws into the top of the post and directly into the aluminum structure on the back of the solar panel. Originally, I wanted two degrees of freedom – a rotation and an angle adjustment – and I built it with just that, but to fit the parts I was finding, the rotation was going to be at the point where the mount attaches to the panel structure. The problem is, that rotating there is useless – because of the shape of the solar panel and the facing requirements, you don't actually get any benefit from being able to move in that direction, so I just added some extra bolts and kept that joint fixed. If I had made the rotation point directly on the top of the post, it would have been much more useful, but the hardware involved would have been more expensive and elaborate.
The Software
This was built in the Arduino IDE, version 1.0.5 and uses three common libraries: CapacitiveSensor, OneWire, and DallasTemperature (which comes with OneWire). The source code with some commenting is available for download here.
Essentially, the program checks solar voltage every quarter second and temperature and water level every five seconds, it compares them to set minimums and if everything is within the limits, the pump is turned on, but can only be restarted every 20 seconds. This is done to limit the uptime when the sun is bright enough to power the robot, but not steadily power the pump – letting it run too long will brown out the system, which makes the bluetooth module not restart under some circumstances. Checking every quarter second and having high enough minimums for starting the pump catches this before the power level for the bluetooth module drops too far. The Ardiuino actually runs properly down to just above 3V, and thus is almost totally protected when trying to get the bluetooth module its full 4.7V or so.
The bluetooth module used needs basically no input from the microcontroller, so the Arduino simply waits to hear "read" from it (it acts just like a serial port open to the connected device and doesn't say much of anything else, by default) and then sends a full report of basic statistics to the connected device. The device also has a set of lights to show a heartbeat, whether the pump is on, and what's wrong if the pump isn't on. There is also the normal power light on the Arduino, the status light on the bluetooth module, and a power indicator inside of the 5v regulator to show the status of the system without anything connected.
The installation
The setup, at the time of writing, has been in place for a little more than a month, though it's only been on the post for a few weeks. The installation area is pretty heavily shaded, and the trees still have all their leaves, so the pump run time is only a couple hours a day, but I knew this when I made it, and it should improve when the fall rolls around. Aside from needing to replace some horrible quality stereo connectors early on, it has held up quite well: no visible humidity in the box, no problems from dirt or heavy rain, no damage to the top, no leaves or other debris getting stuck, easy to take apart and reprogram, etc. It will be months before I can really tell how well it's doing, but so far, so good. I will update this section a ways down the line to report how it has held up after a couple of season changes in place.