For a project with an MCU and a water pump I want to measure if there is still water in a container so the motor does not run dry.
I thought about buying a sensor but had an idea that could be made by myself.
I would put a cable each on ADC IO Pin x and Pin y of an Arudino MCU. The cables would be hold in a distance of about 1 cm to each other and fixed about 5cm upwards from the bottom of the container.
Before activating the motor, Pin x would be set "high" (3v3) and Pin y would measure its input.
As long as there is water in it, there should be a voltage input on Pin y, if the water is empty there should be no voltage, so the motor would not run.
My question would be:
Is it a good idea to short two cables in water like that?
Can it damage the MCU if the Output pin x would distribute too much amps? (Is it likely that this would happen?)
Would I need any resistors in this cirquit? For example a resistor on the output pin to protect it from delivering too much current? Or should the input pin pulled down to not have it floating like when you use buttons?
Many sensors are resistive and will pass a current in the water. If they are DC they will rapidly corrode and give problems. I prefer to use sealed capacitance sensors they do not have the aforementioned problems but do cost a little more.
1 Like
Unfortunately, most folks just leave those resistive types running all the time, rather than drive them momentarily through a transistor or something.
Now, these things are fun...
https://learn.sparkfun.com/tutorials/h2ohno
It would work fine.
But the anode (the electrode connected to +) will suffer from corrosion.
You can use special materials (platinum, Rethenium oxide coating) that will not corrode very fast. But these materials are expensive.
You can use alternating current (combined with low voltage to prevent hydrolysis).
You can reduce the time that the sensor is in use (shut it off when you do not measure).
If you have a steel vessel, you can use the vessel as cathode. For obvious reasons: do not use it as anode...
Other options that come to mind:
Pressure sensor
Floating ball switch
Well, the container would only contain water, the 5V pump (switched with a relay) and the sensor for checking if there is still water in the container.
Thanks, I will look into it
Can you tell me which one you mean?
The controller would be in sleep mode most of the time. It would only be powered every 6 hours, measure if water needs to be pumped. if yes: measure if there is still water in the container. if yes: do the pumping and then go back to sleep. So the cables to check for the waterlevel would be probably used every third day for less than a second.
This is a good point. I will put them much closer together than 1cm then! I only need to make sure there is a little gap between them to avoid a false positive measurment.
Would I need any resistors on one of the cables or can I just put the two cables directly to the input and output pins?
Put one electrode to analog input.
Add 100 nF capacitor from analog onput to ground.
Add a large resistor (1 Mohm) from analog input to VCC.
Put other electrode to ground.
Measure analog input reading with and without water.
Keep wires close together (or better: use shielded cable).
Resistivity of water is dependent on dissolved salts. Tap water will have sufficient dissolved salts.
The measured resistance is dependent on electrode surface and electrode distance. So the claim of @Delta_G is dependent on his specific setup. Commercial conductivity meters use around 1 cm2 and around 2 mm gap. Depending on dirt you might want a larger gap. A larger surface will reduce measured resistance.
Is the water meant as drinking water???
There are many to pick from, depending on your application and budget. Here is a picture of one:
Use your search engine and look for "arduino non contact capacitance sensor" I used duckduckgo and got a lot of hits.
1 Like
I meant to say that the measured value (in Mohm) is dependent on electrode surface and electrode distance.
Rmeas = Rspec * distance / surface
Check units:
MOHM = Mohm* cm * cm / cm^2
That is the question I answered. I did not follow the redefinations of your question.
This claim is simply wrong. Take two electrodes of 1 m^2 separated by 1 cm and check yourself...
All things considered I would likely just place a stainless steel float switch at the bottom of the tank and be done with it. A stainless steel float switch can be had for less than $10 USD. No problem with leads and corrosion and matters not what the conductivity of the water is.
Ron
No, you talk about resistance.
I think we can agree on that!
It is normal tap water, I dont know the actual conductivity. The only thing that is important will be that the measured value from the arduino will be different wether the container is empty or not.
You mean like this? Why do I need the resistor from input to vcc (pullup?)?
Yes
The container will hold only 400-500ml of water, so that could be a little big for the project I think
Not like that. Like this:
A0------------------+
|
|
|
Vcc -------[ ]----+-----your electrode
|
===
|
Gnd----------------+-----your other electrode
You could use a digital output instead of Vcc to reduce the time your electrode is active.
One electrode will eventually dissolve. And someone will ingest it... chromium and nikkel are not really good for your health.
I do not know if it is legal to use this way of measurement with drinking water.
I know it works fine with sewage water...
Yes, that pretty much eliminates a float switch, even a small float switch.
I was envisioning a tank. A pair of probs and just keep them clean. I would use stainless steel for the probes.
Ron
If contamination of drinking water is an issue then going with a capacitive sensor is a viable solution. So this is potable water (drinking water for human consumption) correct?
Ron