The goal of this little post is to share an idea to build your own robust mud water detector using readily available inexpensive electronics components. Although unintentional, the sensor component in this design concept is the AZDM01 water turbidity sensor, a photoelectric turbidity sensor with analog signal output, manufactured by ASAIR.
The AZDM01 sensor can be powered by a regulated 5VDC power source (25mA typical). It uses infrared light source with wavelength of 940nm. The light emitted by the source will pass through the target liquid and received by the light detector in the senor. The light intensity is measured by the light detector and converted to analog signal to represent the turbidity of target liquid. This waterproof sensor can be used for turbidity detection of low viscosity and low corrosive liquids, such as washing water in washing machine, dishwasher, coffee machine, water in rivers and lakes.
The connection interface of AZDM01 is a XHB2.54mm 3P socket with buckle, which include 3 pins as shown in the below figure (definition of pins is also shown there).
Below you can see its internal parts (photographed by me).
According to ASAIR datasheet, AZDM01 gives a typical analog output close to 3.8VDC in clear water. Note at this point that the turbidity of clear water is less than 1NTU.
The simple concept of the muddy water detector presented here is based on a quite popular single-supply dual-operational amplifier LM358. The LM358 IC consists of two independent, high gain, internally frequency compensated operational amplifiers which were designed specifically to operate over a wide range of voltages.
Although there are several reasons not to use an operational amplifier as a comparator, it’s configured in this simple application as a comparator as it fits for the intended task. Note that comparators are often used to differentiate between two conditions in a system. Along with dedicated comparators, it’s possible to setup operational amplifiers to operate as comparators.
Now see the simplistic schematic of the muddy water detector (v1):
As you can see, one part of the LM358 (IC1A) is configured as an inverting comparator. In this setup the output (Pin 1) of the LM358 goes high when the input voltage (Pin 2) is lower than the threshold voltage (Pin 3), and goes low when the input voltage is higher than the threshold voltage. The resistor divider formed by R3 and R4 sets the threshold voltage close to ½ Vcc (~2.5V).
As pointed above, the AZDM01 turbidity sensor renders about 3.8VDC when immersed in clear water, but drops-off that output voltage when it detects muddy water. Therefore, the “muddy water alert indicator” (LED1) will instantly wake up in such a situation to announce a dirty water sample.
The given circuit idea was tested with a 2.7KΩ load resistor (R2 but in some cases you may need to reduce its value to ensure that the detection system works properly. You may try resistance values from 4.7KΩ to 1.5KΩ but don’t try to go below that range.
Moreover, you must consider all key op-amp characteristics to ensure expected circuit performance. It should be noted that the LM358 op-amp features a push-pull output but it’s not a rail-to-rail op-amp. So, its output voltage swings might not be equal to the power supply rails.
Returning to the quick breadboard test performed on my workbench, a small opaque object simulated muddy water (see below). Anyway, it worked as expected, hooray!
Finally, you can use the unused/second op-amp of the LM358 IC as a buffer/voltage follower to interface this circuit with a microcontroller. A microcontroller’s ADC input may have some resistance to ground, and it acts as a parallel resistor to the turbidity sensor’s output. But by using the aforementioned buffer/voltage follower circuitry, the ADC input circuit of the microcontroller can be easily separated from the analog output circuit of the sensor. Try it!