Search This Blog

Friday, December 21, 2018

STM8 Timer - Irrigation

Projects / Misc 8-bit uC projects

Water level sensor

The TPP223 (.pdf) touch sensor I bought finally arrived.  As usual, the LED is just too bright.  I change the series resistor (bottom in black) to a 2K (0603).  A small value capacitor (0-50pF) can be added to the empty footprint at the top right corner to reduce the sensitivity of the sensor.

The default output is push-pull, active high, non-toggled.
There are two solder bridge jumpers: A, B to set the following options.
A: (AHLB) pin 4 - Active low
B: (TOG) pin 6 - Toggle


For testing, I used a small piece of double side tape to stick it to the side of a plastic container and slowly filling it with water.  The LED lights up for a minute or so.


I think this could be useful for determining if water level reaches the high water mark.

I cut up a plastic bottle into two halves and fitted the top end with a short PVC jacket from a stranded CAT5 patch cord.  I used lots of hot glue to seal the joint. The top end works like a funnel. I drill a hole on the bottom half for the exit.


I tried to make a gentle L bend without crushing the PVC jacket.


I am trying to avoid using regular tapes as they tends to dry up and crack under sun light. I cut up 3 strip of paper about 2" wide x 11" long.  I applied a generous amount of white glue and use it to wrap it around the plastic bottle to hold it together.  This forms a paper mache shell to hold the two halves together.


I soldered in a 22pF capacitor to the empty pads on the touch sensor board.  This lowers the sensitivity a bit. I soldered a short piece of wire (~1cm) to the corner pad of the touch sensor to a small copper foil.  The bottom part of the copper foil is used to set the high water mark.


The output of the board drives a 2N7002 MOSFET which converts it to an Open Drain output.  This will be wired in parallel to the light sensor.  The on resistance of the MOSFET is about 10 ohms.

I have to make my trip much sooner. I have given away two of the plants as I can always grow more.  Only been running it for a few days on the remaining one and it seems to be okay.

Things I have learnt so far:
  • The pump I used is a centrifugal pump which requires that the pump to filled with water.
  • The pump produces a lot of electrical noise generated by the DC motor during commutation to reset the microcontroller.  I have included ceramic cap near the output connector on my PCB, but that wasn't good enough.  I had to add a 0.047uF cap at the pump side end of the long cable. I added another one to the other end of the cable for good measure.
  • The water drains out of the container very quickly making it hard to measured..  There are ways to stop the drainage.  Right now I set the timer for a fixed time instead of relying on water level detection
  • There was water leaking out of the seams in the pump, so I touched it up with super glue. That fixed the issue.
  • Water from the container relies on gravity.  Some water droplet ends up sticking to the small diameter silicon tubing.  It amounts to less than a couple of cc.  Try to keep he slope of the tubing uniform to minimize the water retained. I might try using a slightly larger diameter tubing. It probably not going matter too much as they'll get pushed out next time.