Intro
Summer is rapidly approaching here in Switzerland and with it also the problem of watering our plants as
Makers we want to measure the humidity to control it
Unfortunately, most humidity sensors destroy themselves after a short while we need a better solution
pretty youtubers here is the guy with the Swiss accent with a new episode and fresh ideas around sensors and
microcontrollers today we will test different moisture sensors and I will show you how they work and why most sensors
From China destroy themselves, and of course, we will find the solution to the problem
Plants need a defined humidity to prosper
This is why we want to control the watering of plants using our home automation system
The controller has to measure the moisture of the soil and to give commands to a pump or a solenoid
if you go to our usual purchasing platforms and enter moisture sensor or water sensor and
Arduino you get these proposals a two length sensor with a separate small controller PCB
It has two pins on the sensor PCP and four pins to connect it to a microcontroller
It provides a digital and a analog output the digital output can be adjusted by a trimmer
there are conducting tracks exposed on both legs of the sensor a
Small to length sensor with control logic on the same board. It only provides a analog output a
Sensor similar to number two, it connects every second copper path to emulate the two legs
Sometimes the legs are of solid metal and the price of the sensor is much higher, but the rest is the same
The last sensor looks different
It does not have any exposed copper path and more electronics at the top
It is more expensive than the cheap ones and it also provides an analog output
Let's start with number one. How does it work?
The sensor which is pictured like a resistor is connected to VCC
via a
510 kilo
ohm resistor
These two resistors form a voltage divider and the analog output signal is the voltage drop across the sensor
Let's check if this is true
First we use our own meter to check if the water has a resistance its resistance
Fluctuates a lot but it is not indefinite the more water between the legs the smaller the output voltage
The rest of the circuit on this Center PCB is a comparator which compares the measured value with a constant
Usually we do not use this digital output because we can do that much more elegant in software
The sensor is now connected to its PCB and to five volts
the analog output voltage is close to 5 volts as
Soon as the sensor touches the water it starts to conduct and the voltage drops considerably
The more we dive the sensor into the water the lower the resistance and the lower the output voltage
We all know that we do not water our plants like that
Most plants grow in moist soil, but still the principle is the same
The more water between the two legs the lower the voltage
efficient and
Straightforward as it seems we will later see that
This is not true. The next two sensors do not have a digital output and therefore to not need the op-amp
But they have a transistor abort if we look at the diagram we see that one leg of this
Sensors is connected to VCC
The 100. Ohm resistor is just a protection against a short circuit
The other leg of the sensor is connected to the base of the transistor
the other two pins of the transistor are connected to VCC and
Via a resistor to ground and also here the analog output is the voltage across the resistor
the purpose of the transistor is to amplify the base current by a factor of let's say 50 as before if
The moisture sensor sends is water
it reduces its resistance and a current can flow into the base a
Much stronger current flows through the collector and creates a 50 times higher current
the lower the resistance of the sensor the higher the base current the higher the collector current and
the higher the voltage
This is precisely what we see
The amplification of the transistor leads to a much smaller current flowing through the sensor
Which is good as we will see later on also this sensor works
But if you talk to people who used these sensors
They will tell you that after a while they stop to work and I show you why
Because we do not have a lot of time. I will accelerate the effect which happens in the soil
I connect the two legs to my power supply precisely as it is done in the sensors
The only difference I do not limit the current
Now I put the sensors in water
Also as intended if you have a close look you see strange things happen
bubbles in the glass and
The right leg starts to change its color. It loses the plating
After a few minutes the current stops
The right leg is interrupted because all copper was taken away
If you look at the sensor, it does not look healthy and if you watch the water
This is where your plants would live. It also does not look healthy
I am sure one of my viewers can enlighten us about the chemical reaction and how dangerous
this green stuff is
Fact is the sensor is dead the same happens again if you replace it
It's not a quality issue. It happens because of the water and the DC current to
Prevent this from happening. We could isolate the electrodes from the
If we do, so the sensor does not work at all. So this is not the solution
The only solution for me is to avoid these sensors
Let's continue with the last sensor
This one has no copper exposed to water and it's legs cannot be dissolved good
But how does it work?
when we try to isolate the sensor legs before
The sense it did not work at all
So let's check if this one works
Yes, it does. Cool
Also this sensor uses a chip
this time not an op-amp, but an
ne555 timer
The diagram looks like that the ne555 works in an a stable mode and creates a square wave
This square wave goes to one leg of the sensor. The other leg is connected to ground
What happens if we put the sensor into the water the two isolated legs form a capacitor?
Together with water its capacity changes if we look at the resistance formula of the capacitor
we see that it is reduced if the
Capacitance gets bigger. This is precisely the behavior. We are looking for very good
By the way, you see that its resistance is also reduced with an increasing frequency
This resistance is not a real resistance, but I will not bother you with complex numbers
The sensor anyway works if we do not understand these calculations
in the end a diode and a
Capacitor are used to smoothen the square wave and we get an analog value which changes with the humidity
Without contact to the water and this sensor also does not need a lot of parts you do not believe me
Look at this circuitry on my breadboard and here to my home made sensor
I know it is not good looking but this is not a channel about good looks and makeup
I just used an old PCP and
separated two areas with trailer
Now we have to isolate our sensor from the water
I do this with a simple plastic pack done and we need a square wave instead of an any
555 I use my wave form generator
Like that. I also can change the frequency on
channel, one of the oscilloscope you see the square wave and on channel two the output of the sensor and really if I
Eat my sensor into the water the output value changes now, you can believe me
Here you see the effect of frequency on the range of the sensor the biggest difference between null water and fully submerged
results with frequencies around 600 to 900 kilohertz
the frequency used by these sensors is about
570 kilohertz because in ne555
cannot do much more
We still have to solve a small issue
because the supplier of these capacitive sensors use a
standard PCB they leave the edges without protection and what too easily can enter here you
either put your sensor into a plastic bag or
Use some sort of protective lacquer like this one or that one
Summarized we learned the principles of moisture sensing
we know which sensors can be used over a more extended period and
We know how we have to enhance them to become even more stable. So the summer can start now
I hope this video was useful or at least interesting for you if true
Please consider supporting the channel to secure its future existence. You will find the links in the description
Thank you. Bye
You