Christmas Tree Sensor

Greg Abbas

My family loves getting a big noble fir Christmas tree every year, and we try to give it plenty of water to keep it green for as long as possible. I found it inconvenient to crawl under the tree and pour a pitcher full of water into the tree stand, so I attached a funnel to a clear rubber hose. Now I just pour water into the funnel, and the hose carries it into the stand at the bottom.

But that raises a new problem: how do I know when to stop pouring? I don’t want to overflow the bowl, but I can’t tell what the water level is just from looking at the funnel.

It occurred to me that this could be the opportunity to build a ridiculously over-engineered solution. So I made an electronic “baton” that can be immersed in water to measure how deep the water is. Here’s what the baton looks like:

I put the baton in the bowl of the tree stand, and it feels the water level and reports it over Wifi. Here’s the baton, sitting in the tree stand:

To see what the baton is saying about how much water the tree has, I use an app on my iPhone. Now, I can hold the pitcher in one hand and my phone in my other hand, and I stop pouring just before the water reaches the top! When there’s plenty of water, the blue background reaches the top of the tree. When it’s low, it goes down to the bottom of the tree.

Of course, this contraption has another benefit. The communication from baton to phone works over the internet, so I can check on the status of my tree from anywhere in the world. (I don’t know how I ever lived without that.)

How It Works

Inside the device is an eTape Liquid Level Sensor from Adafruit, that can sense when it’s in water and changes its resistance depending on how much of it is submerged. The enclosure is a PVC pipe with openings on each end, so the water flows inside to get measured.

The level sensor is connected to a small ESP8266-based microcontroller, which is basically a wifi interface that you can program. Mine connects to a server and uploads (via UDP) a new measurement every second, and the server makes that data available to the app running on an iPhone.

On the software side, probably the most interesting detail is that I used MicroPython on the ESP8266. The board came with Lua so I tried that but couldn’t bring myself to like it very much. I thought about flashing Arduino-compatible firmware onto it, but that’s not my favorite development environment either. Luckily, some intrepid souls ported a version of Python to the ESP8266 and it works great. I was a supporter of their Kickstarter, so I figured this was a great opportunity to get a return on my investment.

The server basically just listens for UDP messages from the baton and TCP connections from the iOS client. It then copies data from one to the other, plus a little bit of filtering to smooth out noisy measurements.

Good times (to be a nerd). Merry Christmas, everyone.

Questions or comments? Email me at .

2017 December 10