I found a cheap moisture sensor on Ebay that only came with the schematic attached. The moisture can be read with an analog or digital signal. However, I am wondering how the opamp creates a digital signal, and how to read this signal from a microcontroller. The schematic is this:

moisture sensor

  • 1
    \$\begingroup\$ Have you read the datasheet yet? \$\endgroup\$ Jun 11 '16 at 16:49
  • \$\begingroup\$ there was no datasheet - just this circuit \$\endgroup\$
    – poseid
    Jun 11 '16 at 17:28

From the schematic, the LM393 is acting as a comparator. It compares the voltage from VR1 (which can be considered the reference voltage) to the output of the voltage divider formed by the 510K resistor and the moisture sensor. Thus the output of the LM393 is either a low voltage (when the reference voltage is higher than the moisture sensor divider) or a high voltage (when the reference voltage is lower than the moisture sensor divider). The LED on the output indicates which of these two outputs exists. Since the output is either a high voltage (near VCC) or a low voltage (near ground), it is a digital signal and could be read by a microcontroller.


The moisture can be read with an analog or digital signal.

Moisture as a measurement can only be read from AO as a voltage representing the voltage divider consisting of the moisture sensor and the 510K series resistor. The digital output is an on/off output providing only under/over set moisture level, f.ex. to control a watering system or an alarm.

  • \$\begingroup\$ You could improve this a bit, Tom. There is no "analog output" from the sensor. There is from the divider formed by the sensor and the 510k resistor. \$\endgroup\$
    – Transistor
    Jun 11 '16 at 17:13
  • \$\begingroup\$ @transistor Thanks for your suugestion, my vocabulary needs improvement. But its hard to improve the answer without saying what Barry already said. \$\endgroup\$ Jun 11 '16 at 17:23
  • \$\begingroup\$ Quoting the text solves it. d:^) \$\endgroup\$
    – Transistor
    Jun 11 '16 at 17:45
  • \$\begingroup\$ @transistor I'll keep that in mind ;) \$\endgroup\$ Jun 11 '16 at 17:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.