Introduction: Awesomely Cute Christmas Tree Water Level Indicator

And lo! A Playmobil shepherd boy watched the water level in our Christmas tree stand by night. When there is enough water, his lantern glows green. When there is too little, his lantern turns red. But wait. Your mind has gone elsewhere. You're thinking of it now, the water monitor you would make for your own tree, with your own ideas. Perhaps it involves glowing glass ornaments, or some rare Lego pieces, or maybe the star on top of the tree, or some more Playmobil. Whatever you may be imagining, I hope that with the following instructions you find it a fun and simple Arduino project.

Before you begin, if you haven't already done so, you need to get an Arduino and complete the blinky LED tutorial. This will give you a quick overview of programming the Arduino, uploading programs from your computer to it, and listening for its output back to your computer. With that done, you should be able to complete the present project with any Arduino model you like. If you have never used an Arduino before, get an Uno and be happy.

For the most basic liquid level monitoring, you will need:

So few pieces! But that's without something cute holding lights on your tree. For full cuteness, add the following extra bits:

  • Two 1k ohm resistors
  • Two LEDs, one red and one green
  • Soldering equipment (or strong-fingered wire twisting)
  • Something interesting to mount the LEDs in (I'm using a lantern held by a Playmobil guy. Guy has a vest to stay warm.)

[Curious about the colored stripes on the resistors? They're a pretty neat encoding of resistance and error tolerance. Write numbers with colors!]

In this tutorial, we will

  • See how the eTape works, hooking it up to the Arduino
  • Make an on-board low-water warning light
  • Move our warning lights off-board and into something visible and interesting

Step 1: Sensing Water Level With the ETape

In this step, we're going to figure out how the eTape liquid level sensor works, and how we can use it with our Arduino.

First off, you may notice that my Arduino looks nothing like yours. Ne timeas. Arduini come in all shapes and sizes. The one depicted here happens to be a Boarduino from Adafruit, which I like because it's small, includes a power jack, and works nicely with breadboards. But never mind. All that matters is that we are using the same pins, namely 5V, gnd (there may be several on your Arduino; all are ok), A0, D12, and D13.

The eTape sensor is a big electrical resistor, meaning it limits the amount of current and voltage that can pass through it. It's much like the dimmers you might have on the lights in your house. The tape is sensitive to the pressure of the water around it. The less pressure it is under, the more it resists. With this knowledge, we can tell how deep is the water around it, according to its electrical resistance. This tape can measure changes to fractions of an inch of water, so as you may imagine, it is very, very sensitive to pressure. If you bend it or touch it, you will drastically change its resistance value. Keep that in mind as you proceed, always letting the eTape hang freely in water without touching anything.

  1. Connect one of the middle pins of the eTape to ground. Use female-female jumpers to connect to the eTape and to the two wires you will connect to the breadboard. (I have looped the jumpers over the top of my fancy clothespin in the picture above and taped them to the back of it in order to reduce strain on the eTape.)
  2. Connect the other middle pin to a 560 ohm resistor.
  3. Connect the same end of this resistor to pin A0.
  4. Connect the other end of the resistor to the 5V source on the Arduino.

It doesn't matter which of the two middle pins on the eTape you connect to which point on the board. It also doesn't matter if you don't use red and green wire, but it couldn't hurt to keep up the old xmas atmos.

Now upload this first sketch to the Arduino:

Open the serial console (Tools → Serial Monitor). You should see it printing some numbers that are greater than 0 and less that 1023. These represent the current resistance of the eTape.

What's happening is that the A0 pin (analog input number 0) on the Arduino is mapping the resistance of the eTape onto a scale of 0 to 1023. 0 means no resistance, and 1023 means total resistance. The greater the resistance in the eTape, the greater this number will be. If you fill the eTape's container with more water, the readings will decrease along with its diminishing resistance. Pouring water in and out of this thing and watching the numbers change is so cool I could do it all day.

If you are feeling sad right now because your values are pegged at either 0 or 1023, ask yourself:

  • Have I connected the eTape into the wrong end of that resistor? (The wrong end in this case is the one with the 5V line connected to it.)
  • Is my wiring correct? (Check pin A0, 5V, gnd.)
  • Are the headers are really attached firmly to the top of the eTape?

Once you are getting different readings with different water levels, we'll move on to make an alarm indicator for when the water level falls too low.

Step 2: Making a Low-water Alert

In this step, we're going to make the Arduino tell us when the water around the eTape has fallen below a certain level.

In my case, I just want to know when my Christmas tree needs a drink. With my tree stand, if the water level falls below three inches, the tree is thirsty. So all I need to know is the number the Arduino reports for three inches of water.

For the most basic visual alarm, you've probably got everything you need built into the Arduino already. This is because there is typically an LED on the board that will be illuminated when pin 13 is set to HIGH. So if the water dips below a certain level, we'll make that LED glow. In the picture above, there's a red LED. It's glowing because the water level fell below three inches.

Download or copy the following sketch:

Modify the sketch, setting CRUCIAL_LEVEL to a value right for your tree stand.

Now if the resistance of the eTape exceeds the CRUCIAL_LEVEL (i.e., the water dips below a certain level), the on-board LED will glow.

Cool! If this is all you want, you're done! You can stop reading. With just a few wires, you now have an Arduino that will warn you when your tree needs water. But maybe you can't see the Arduino from across the room. Or more importantly, maybe you want to make it more interesting. If so, let's keep going!

Step 3: Making Low- and High-water Alerts

In this step, we're going to convey the level of the water by illuminating LEDs that are not on the Arduino board. Separating these indicating lights from the Arduino itself prepares us to move them wherever we want.

For this step, you will need:

  • Two 1k ohm resistors
  • Two LEDs, of differing colors

Upload the following sketch to your Arduino:

You can let that sketch run while you wire everything up. It's kind of fun that way.

For each LED, you are going to connect one of the Arduino's pins to one end of a 1k resistor, the other end of the resistor to the positive lead of the LED, and then the negative lead of the LED to ground.

[The purpose of the 1k resistor is to prevent the LED from burning up (literally). If you haven't burned up an LED, you ought to. It's a pretty good way to learn about resistance (of the lack thereof). Go outside and bridge the terminals of a 9V batter with an LED you can afford to say goodbye to. Poof. Yay! Resistors matter! Now smell the destroyed LED; it may be useful to know this smell someday on some different project.]

The positive side of the LED is the one with the longer leg. If your LED's legs are the same length, look into the plastic bulb; the negative side is the one with more stuff on top of it.

  1. Connect digital pin 12 to one end of a 1k resistor.
  2. Connect the other end of this resistor to the positive end of your green LED.
  3. Connect the negative end of the green LED to ground.
  4. Connect digital pin 13 to one end of the other 1k resistor.
  5. Connect the other end of this resistor to the positive end of your red LED.
  6. Connect the negative end of the red LED to ground.

In the end, if everything is hooked up correctly, the red LED will glow (along with the LED on the Arduino board) when the water level is low. The green LED will glow when there is enough water.

We've separated the indicators from the Arduino board itself. So now we can move those indicators wherever we want.

Step 4: Putting It All Together

Now it's your turn. You decide how this should look.

At this point, we can put the sensor in the tree's water, and put the red and green LEDs up in the tree somewhere. It doesn't really matter where the Arduino ends up. In my case, I just put it near the tree so I could power it by a 9V adapter plugged into the strands of lights that were already running up the tree. You'll be cutting new lengths of wire for everything.

When you place the sensor in the tree's water basin, be careful to find a spot where it can hang free without being touched by stray branches or twigs. This would be a good place to confirm, using the first sketch, that the resistance readings are what you expect. Clip the top of the resistor on some stray twig or something.

In my case, I put the two LEDs into this Playmobil guy's lantern. I clipped one of the LED's negative leads shorter and soldered it to the negative lead of the other LED (since they both share the same ground). Then I used three female-female jumpers to connect the three LED wires to three 22 gauge wires that I ran down the tree to the Arduino, connecting the red and green LEDs as they were. I used hot-melt glue to affix the jumpers to the back of the lantern.

I'm looking forward to seeing what you choose to do. Please post pictures and let me know! I'm @drainmice on Twitter.

Happy holidays!