---
title: "Sensors&Pumps"
date: 2025-01-27
draft: false
description: "a description"
tags: ["sensor"]
---
# Sensors
The board can address up to 16 sensors, with an A und B sensor per plant.
The A sensor is always used, the B sensor is optional and use is suggested for larger planters.

The sensor itself are just two spikes with a defined distance. They can be bought readymade or simply be done DIY with two long nails (use galvanized or non rusting ones)

The Sensor is switched via multiplexer chips to a 555 oscilator circuit that uses he the earths resistance for charging and discharging a small capacitor. The ESP simply counts how often the charge pulse was seen. 
While this sensor can be easily influenced since it runs in lower uA - mA range, due to the frequencys of several khz for normal moist plants, it is still very resistant, eg a 50hz failure signal from a nearbly power circuit would barely be registered.
Since the Sensor is changing polarity between charging and discharging, corrosion due to organic battery effects is minimized, also it prevents errors due having build a battery (You can easily charge a planter to several V if you do not change polarity).

# Pumps
The board contains 8 low side switched pump outputs. The pumps are running directly from the battery without further voltage conversion, so ensure that the can survive the full voltage range of the battery.
Each output can supply up to 3A continously.
The board will never switch more than one output concurrently, so there is no need to size the battery for higher maximum load.
An additinal extra out exists, that is switched, when any of the pump outputs is supposed to run.

This allows for multiple possible setups
## Layout Central Pump
One central pump is connected to the extra output, and multiple magnetic valves are used for the different plants
## Multi Gravity Feed Valves
Per plant a Valve that can close against pressure is used, no pump exists
## Multi Pump Setup
Multiple smaller cheaper pumps with no shared hoses, so that failures will only affect a single planter.

In any case I suggest to use a Water Filter on the Intake, as else you will get severe algae problems.

In my personal opinion small membrane pumps are a really good fit
* can be housed outside the tank 
* require less maintance/cleaning
* are able to pump smaller impurities without issues. 
* Can pull water 1-2meters
* Have higher output pressure -> Will blow out blockages in hoses
However
* are louder
* pump less volume per time and energy

{{< alert >}}
DO NOT DIRECTLY CONNECT TO WATER MAINS, YOU HAVE BEEN WARNED!

Software and Hardware may fail: It is your responsibility to ensure that a stuck valve or short circuit mosfet will not cause flooding and property destruction, for example by limiting the water tank to size that can drain.
{{< /alert >}}


# Todo
## Flow Sensor
There is a input for a flow sensor, currently it is not used as the software is missing. 
* Allow monitoring if pumps are actually moving water
* Allow to set limits for how much ml are allowed additinally to the current time limit per watering run



Currently it cannot be set how two sensor should be interpreted and they are only averaged. More complex functions would be nice here, eg. allowing a user settable interpolation (0.8*a+0.2*b)/2 and Min(a,b) as well as max(a,b) 

