Introduction: Christmas Tree Water Alarm
This is a simple example project that can be used if you have a real tree for Christmas and need to make sure that it stays watered. Growing up, I remember we'd have to reach under the tree and wiggle your finger in the tree stand to see if there was any water. In the age of technology, there must be a better way! This simple project will read the water level using an analog water level sensor, a passive buzzer and an Arduino based MCU. Everything needed for this project (and other Christmas themed ones I am working on) can be done using this single kit.
- (1) ELEGOO Mega 2560 Project The Most Complete Ultimate Starter Kit w/Tutorial Compatible with Arduino IDE - Amazon, non-affiliate
- MEGA 2560 Controller
- Water Level Detection Sensor
- Passive Buzzer
- jumper wire
Step 1: Connections
As I mentioned, this is a pretty simple project to work with and modify. The water level sensor is only a three wire device and the buzzer is only two connections and can be powered directly by the Arduino PWM pins. Since this is such a simple project, I am not going to do a schematic of the connections but just pin-to-pin list. This starter kit does come with a CD that provides nice schematics and images for each of the components. There are also some example code pieces to assist with using the different items.
For this project, the connections are as follows...
Water Level (+) - Arduino (5V)
Water Level (-) - Arduino (GND)
Water Level (S) - Arduino (A0)
Buzzer (-) - Arduino (GND)
Buzzer (+) - Arduino (11)
Step 2: Sample Code
The code for this program is pretty simple, less than 30 lines. It just reads the value of the water level sensor, compares that to the preset value that I decide is enough water and then either beeps to alert you or it doesn't. The way I have it setup, it may end up like a smoke alarm with a dying battery, giving a short beep every so often. Once the water is filled enough it will beep five time to alert you that sufficient water has been added. These 'filled' beeps only happen once after it has been filled.
The program will also output the analog value to the serial port for debug when you are trying to find out how full your stand is. This could be scaled to a percent value, volume of water, etc. Whatever you'd want to fulfill your needs!
This code can be easily modified to change the water level value, how the buzzer announces the issues to you, etc. I am using the 'tone' function from Arduino that allows you to put in a frequency and time for a buzzer to sound. It makes it very simple to use a buzzer directly with a PWM pin.
I have uploaded the code here as well for you to use, modify, tear apart, copy, etc.
Step 3: Expansion
This example has many applications after Christmas is over. This could be used in other plant settings that sit in water such as hydroponics. You could also modify this to use on a fish aquarium to make sure that the water level doesn't get too low.
Although this is only a 5V system, you should always be careful using electronics around water and not fully submerge any electronics. If you don't feel comfortable with electricity being around water, then seek assistance.
Another improvement for this project would be to have some sort of clip or enclosure to put the water level sensor in so that you can better adjust it. There are two mounting holes and a nice groove cut into the PCB that would be pretty easy to mount into a 3D printed bracket or enclosure. I'm currently fighting issues with my printer so I haven't been able to print anything in a while.
The Elegoo kit that I am using also came with a 9V battery and connector so that you could make this device fully battery powered so you don't have to keep it tethered to a power outlet.
You could also shrink the size of this project down pretty easily using a Mini style controller and mounting all of this to a small circuit board. I used the Mega because it is what I have available.
I hope that this Instructable has given you some idea of something that you can do with these sensors. I will have some other Christmas related projects this month as well. Feel free to reach out with any questions!