Hey guys! I am VERY new to using arduino’s and this is my first project but I think I have done pretty well for myself. I started out with this guide here but I wanted to add a few features, and change a few things. Basically it is a capacitive sensor in the water and when the capacitance drops below normal a relay will blink the lights once every 10 seconds and if below a fair level will blink the lights on the tree to say “Water, Water, Water” in morse code!!! Awesome!
FYI: tldr warning. You can skip down to the bold text if you don’t want to read this all
Firstly I made my sensor a little bit different. I used copper tape used for snail deterrent on a piece of clear plastic (just the DIY laminate stuff without anything inside it). I made two strips of tape about 1/4" wide about 1/4" apart. I soldered a lead to each and then just attached to the leads. Then I covered this all with packing tape as if it was just in the water the capacitance wouldn’t change. This should also allow me to make new sensors cheaply and quickly if needed.
Secondly, I have NO idea what I am doing when it comes to electrical diagrams (my father-in-law helped do most of the design and implementation) so when I went to the local electronics store and handed the guy the diagram at the post and asked for the components I just bought what he gave me. I guess he sold me the wrong/different relay. I’m pretty sure he warned me it was wrong but said I shouldn’t have any problems. With the original code the lights would be off when there was water, and blink on and off when it was low. I was able to switch the code out and make it work the way I want. I figured out this is what he was probably talking about.
Thirdly, I have frustrating pets that love to drink what my wife and I have named “tree tea”. I have to cover up the bowl at the bottom of the tree to keep them from drinking from it. I bought a plastic oil pan that I plan on cutting a hole in and flipping upside down on the bowl and strapping it down. This makes it difficult for me to add water, and determine what the level the water is at. I bought a small length of black tubing at the hardware store and a funnel. The tubing is ran along the trunk of the tree. I can pull it out when needed and funnel water down it into the bowl.
Since I can’t see what the level is at without taking all of this apart I tried to add logic to have the lights blink back at me in morse code. Naturally I chose for it to blink “thanks” back at me once it reaches my desired level.
This is where my problem is. I created a value called count. Every time the loop starts it increases this value by 1. Once the count reaches 30 it resets. What I am trying to do is determine if water is being added, to check if the desired “full” value has been met. This is difficult, not only because I am most definitely not a programmer, but because the capacitance is CONSTANTLY changing… It varies slightly each time the loop goes around. What I ended up trying is to record the capacitance in loop 1 as olevel. Then I compare the current capacitance, level, to olevel. If level is LARGER than olevel by more than 75 (this may be my problem here, value may need to go up or down) then check to see if the water level has reached full. If filling, but not full I have it output to serial “filling but not full” and keep checking. I know that when the water goes from normal, to fair I get the blink every 10 seconds, and when it goes from fair to low I get the morse “water” sequence. The problem is I sometimes get “thanks” even though I’m not filling the bowl. For simplicity I added a few boolean’s for “blink if full” and “output to serial” because I got sick of commenting lines out during testing. Right now I have both set to off but I am hoping to get the code working so I don’t flood my living room floor!
Any input would be helpful, I may just need to adjust the difference in capacitance in which I determine its being filled vs the normal variances. My other thought is that I my “count” is either too far apart or too close together. Thirdly, and in my opinion the most likely, is my code is just wrong.
I have my sketch attached, as well as some of the serial outputs during a time when it was over my “full” value, I was not filling with water and it was just sitting there outputting to serial.
Thanks guys, sorry for such a long and boring post!
Blinky_Tree_arduino.ino (4.01 KB)
Blinky_Tree_arduino.java (2.46 KB)
output.log (23.1 KB)