September 2019 Update

New! We're moving to the new forum, eventually it will replace this blog. Please join us there.

View the Most Recent Feature Sheet by clicking HERE!

Tuesday, August 27, 2019

Water Sensor Washout!

Posted: 1:45am

Some time ago I picked up 10 of these Water Sensors from an online retailer in China.



I only paid $0.35 Canadian each for them in October last year (2018) and now they are $0.52 each, plus $1.19 shipping...

Tonight I pulled them out, thinking they might be useful for keeping track of the water level in the jug used by the automatic clone mister.  With something monitoring the water level, I pretty well don't even need to pay any attention to the clones until they root.

They are simple analog sensors, give them 5v and read the S pin with an analog pin on your arduino. 

I hooked one up, configured it in the system, which was made much easier because of the modification allowing me to define a set of "calculation id's" that tell the system which calculation to use when converting the raw numbers to something useful.  I just had to add a new sensor type, and tell it which calculation to use, then add a sensor and tell it what type it is (water sensor) and which module/port it's connected to, and assign it to a plot, which in this case is a virtual plot (not assigned to a specific plant)

First off, it read pretty well the same value no matter how much water it sat in. Because I only enable power to the sensors when actually reading them, to prevent corrosion from electrolysis, the power comes on and I read the sensor 100 times and take an average, then turn off the power again. That's done using another digital pin to switch a transistor.  This switching behavior is configurable, so I went and configured it to stay powered up all the time.  That didn't work very well, I'm doing this on the new firmware for the sensor modules, and the power didn't get switched on at all!  So, off to find and fix the bug..

Found it, fixed it, and now the sensor stays powered all the time. I'm thankful this sensor has a power led on it, I was able to know that it wasn't receiving power, I didn't have to get my multimeter out.

I played with it for about an hour, trying different depths, even calibrating it like the soil moisture sensors...  The end result?  First off, it will only measure about 1.5 inches depth, anything higher, and the electronics on the board are under water. If you mount it near the top of the container, then it will read empty after 1.5" is gone, so the size makes it useless for my application.

I couldn't get stable readings from the sensor at all, it really had no bearing on the depth, either reading 0, or around 640 when the water was at the top, but anything in between from a couple mm to 1.25" always read around 620.

So the range is too small (1.5") and the readings seem meaningless other than it's wet, or it's not wet. They say it is for measuring the level, but I think it's moree for just detecting the presence of water.

As for why I power off my sensors (that are in moist conditions) have a look at the corrosion on the water sensor on the right. It has only had power applied to it for maybe 20 minutes total, can you imagine running it 24/7? The one on the left is unused.



In this next picture, the corroded one is on the left... but I probably didn't have to tell you that did I? :)



While I'm not going to be using these for this task, it did give me an idea for a new feature to add to the code.  Now, either a sensor is always powered, or when it is time to read it, the power is turned on, wait half a second, then read it 100 times, take the average, and shut it off.  I'm going to make the initial wait time configurable, so with a sensor like this, I can say 1 second or 5 seconds or whatever it takes for the sensor to become stable once it is powered up. It will be a simple addition, just a little time consuming so I'll put it on my todo list, as it's not something I need now anyways.


As for measuring the water depth, simply hang two wires in the container, add a voltage divider, and you have something like a soil moisture sensor. I imagine some experimentation is in order, but it should work. The container for my mister is too small to use the ultrasonic sensor like I do on the Automatic Watering reservoir. Perhaps the mister could draw its water from there once it is installed, that would solve a few problems :)



No comments:

Post a Comment

Any comments deemed off topic or offensive will be removed