Saturday 2 August 2014

sensor - Electrical conductivity to determine reservoir water level to switch on/off pump


Did a survey of the commercial products available in the local market, which are broadly classified as 'Automatic Water Level Controller' or 'Automatic Pump Controllers', and found that all of them use a float-switches.


This got me wondering as to why the commercial products do not use 'electrical conductivity' of water as a test, to determine water level in the reservoir. If one uses something like 12VDC of periodic pulse to check for conduction via the electrodes at various levels, there should be no worry of electrical shock. So why don't the commercial systems use this, extremely inexpensive solution ? What is it that I might be missing ?



EDIT


To add a bit of context, what surprised me in my survey was that the price of spare float-switches was about 20% of the price of entire system (including 2 float switches). The cost of installation is about 2x the system price. And every time the float-switch is to be changed there's some labour cost as well (unless the unit is under an Annual Maintenance Contract, which cost 15-20% of the unit price). This is in a rather price sensitive market (India). Which is why the super simple "conductivity" test, seemed like a very cost-effective solution.



Answer



Well ... float switches are simple and reliable. Having said that, it is not quite as simple as detecting a DC voltage. Using DC, the electrodes would quickly be corroded (damage due to electrolysis).


The sensing circuit needs to use AC. There used to be a nice IC made by National that would do this, the LM1830N; but as far as I know it is has been obsolete for some time. The circuit is pretty simple to do yourself. Basically an oscillator is connected to a series resistor and capacitor which is connected to an electrode in the fluid. That electrode also connects to a comparator to sense the AC. A second electrode connects to GND (circuit common). When a fluid is present, the conduction between the electrodes causes the AC signal on the oscillator electrode to be attenuated. The resistor sets the sensitivity.


Here is a circuit I built a few years ago using a PIC12F683 :


schematic


simulate this circuit – Schematic created using CircuitLab


This circuit was for a dual-level fluid sensor that would turn on a valve when the fluid would drop below the FLUID_LO sensor, and turn off when the fluid reached the FLUID_HI sensor.


I'm afraid I'm not free to publish the source code, but I will describe the functionality:



SENSOR_CLK is a 50% duty-cycle square-wave output. The frequency is not critical. I used appx 8Khz.


The AN0 and AN1 inputs to the PIC12F683 are inputs to the A/D converter. The conversions are performed when SENSOR_CLK is high. If the voltage is sensed below 3.1V, the corresponding electrode is considered to be immersed in the fluid.


FLUID_HI and FLUID_LO are wires positioned such that they are immersed in the fluid when at the appropriate level. FLUID_COM may either be connected to a metal container holding the fluid, or be connected to a wire in the fluid and below the level of FLUID_LO.


When the wires are immersed in the fluid, the square-wave detected by AN0 and AN1 is attenuated and has a net DC component of about 2.5V. Resistors R1 and R2 may be changed to smaller values if a less sensitive circuit is desired. The 3.1V detection threshold (in firmware) may also be changed to adjust sensitivity, but it must be greater than 2.5V.


While I used the A/D converter in the microcontroller, other detection methods may be used. Some microcontrollers have built-in voltage comparators that may be used. It may also be possible to use general-purpose I/O to detect the immersion when SENSOR_CLK is low if the Vin high and low thresholds are well below 2.5V.


I chose to sense the voltages between the resistors and capacitors instead of the voltages on the electrodes because I felt that the internal clamping diode to VSS in the microcontroller might cause a net DC voltage on the electrodes.


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...