It seems that more and more people are putting up fake Christmas trees, these days. Well, not so at the Hammersmark home. We used to go cut down our own, but, this year, we bought it from the Boy Scout lot nearby. We got a beautiful 7′ Nordmann, managed to squeeze a couple of hours of tree-trimming into our ridiculously busy holiday schedule, and now I get the job of keeping it from burning our house to the ground.
I have a simple system that I’ve used for several years to keep me from having to get down on my hands and knees with a pint glass full of water. It’s a length of 3/4″ plastic tube duck taped to a funnel. The funnel is connected to a heavy duty twist tie, which I use to hang it from the tree like the biggest, ugliest ornament ever. I route the tube to the tree stand, then I pour water (slowly) into the funnel and trust that it’s both making its way into the tree stand and not overflowing the basin. I have, in the past, been mistaken.
Enter: as-yet-unused garden automation supplies. Last year, I bought a six-pack of cheap moisture sensors from eBay. I also picked up (from Sparkfun) a couple of 12v 3/4″ electric valves, a handful of Arduino Pro Minis, some N-power MOSFETs and some relays. I never did get around to automating the garden, so I still have all of this stuff sitting around the workshop. I decided to put some of it to use (and learn how it works) by building a water level sensor for my Christmas tree stand.
The sensor is brilliantly simple. It comes in two parts: the sensor strip and a small driver board. The driver board offers 4 pins back to the microcontroller: Vcc, ground, digital signal, and analog signal. The digital signal just runs a comparison on the analog value, controllable by a variable resistor mounted on the board. The analog signal just gives you a voltage somewhere between 1/3 Vcc and Vcc. Though it is intended to go into moist soil, it is perfectly happy reading a half full glass of water.
I had a few empty plastic Christmas ornaments that I picked up thinking I might stick some Neopixels in them. One of them was big enough to hold a Pro Mini, so I soldered 5 LEDs to 5 digital pins, soldered 1k resistors to the negative leads of the LEDs, soldered these all together and then connected this to ground. I wired in the sensor board and a power supply, ran all the wires out the top of the ornament, and my water level sensor was ready to go!
I looped the sensor strip’s cable over part of the tree stand and just let it dangle in the water. When I first installed it, the tree hadn’t had any new water since the previous day, but the level wasn’t anywhere near the base of the trunk. I adjusted the height of the sensor until this lit up 3 of my 5 LEDs. After pouring in a pint of water, the sensor lit up all 5 of my LEDs. Success!
Next step: Use this to trigger a system that automatically waters the tree from a reservoir. Now I just need another one to monitor the level in THAT…
UPDATE: I am sad to report that immersion in my tree-water (or, perhaps, in any water) causes the moisture sensor to quickly deteriorate. This project worked perfectly when I first installed it. By the following morning, it would only ever read 2 or 3 LEDs full. I pulled the sensor out this evening to discover this mess right here:
After cleaning up the corroded probe, I found I could get more-or-less 3 reliable signals: dry, some water, and fully immersed. I reworked the code a little bit to cope with only 3 signal levels and am, for the time being, back in business.