After failed attempt to combine a resistive wetness sensor with a multivibrator ( How to trigger multivibrator (or similar) from collector? ), I'd like ask a direct question.

What could be schematics for simple device, which has parallel wires in a textile with approx. resistance of 1MΩ when wet (and zero conductance when dry) as a sensor and some sound generator as a 8Ω speaker output? If possible, done with discrete transistors and other widely used cheap components (no ICs)?

Working voltage no higher than 5v DC.

I will still try answers to the above mentioned question, but I have a feeling, that the design I tried there is badly flawed.

  • 1
    \$\begingroup\$ Are cheap and common ICs off the table? There are many problems (this being one) where an IC solution will be cheaper and perform better than a discrete solution, while still being very cheap and easily sourced. \$\endgroup\$ – Phil Frost Jul 10 '13 at 14:32
  • \$\begingroup\$ Nowadays even small microcontrollers are part of very cheap toys (which is IMHO overkill). I am hoping for solution, which does not require even PCB, so maybe SMDs are ruled out. Please, judge yourself, taking into account usefulness of the answer for large audience of people. \$\endgroup\$ – Roman Susi Jul 10 '13 at 14:43
  • \$\begingroup\$ I understand what you mean about microcontrollers. You can always glue an IC upside-down on a board dead bug style and solder to the leads if you have a simple circuit. \$\endgroup\$ – Phil Frost Jul 11 '13 at 3:31

You are likely to have two problems with this sensor:

  1. it has a very high output impedance (\$1M\Omega\$) and so can not supply much current
  2. it will change very slowly as it transitions from "wet" to "dry", but you likely want your buzzer or or off, not something in between.

Consequently, you want to measure the resistance with a high input impedance. And, you want something with a whole ton of gain, and perhaps some hysteresis, to keep the buzzer definitely in an on or off state.

There is a device that is cheap and available that does both these things: the comparator. LM339 is a very common variety. Comparators can also be made from discrete components, although it's usually more expensive to do so.

The comparator has two inputs, compares them, and outputs high or low based on which is greater. By connecting your resistive sensor through another resistor, forming a voltage divider, and measuring the voltage in the middle with the comparator, you can distinguish between wet and dry:


simulate this circuit – Schematic created using CircuitLab

Adjust R2 so that at the threshold you wish to detect, the voltage between R1 and the sensor is the same as the voltage at R2's wiper. You can also change R1.

Since the LM339 has an open collector output, you can conveniently use it to switch power to your buzzer circuit, provided you don't exceed the \$16mA\$ of current specified in the datasheet. If you need more current, follow it with another transistor.

If you still find that the circuit doesn't transition cleanly between on and off, adding hysteresis between the comparator and the buzzer may be the solution. A Schmitt trigger is a common circuit that does just that. 74HC14 is a common variety, or it can be built with discrete components or even the other 3 comparators in the LM339 with examples easily found on the web.

| improve this answer | |
  • \$\begingroup\$ This looks good. Some questions: 1) what is "1/4" before LM339? 2) Wikipedia mentions non-inverting comparator ( en.wikipedia.org/wiki/… ) to implement Schmitt trigger, is it possibly suitable? 3) You mention buzzer circuit. Is it still just piezo buzzer or can I connect multivibrator at last? Thanks! \$\endgroup\$ – Roman Susi Jul 11 '13 at 3:22
  • \$\begingroup\$ @RomanSusi the "1/4" means you are using just a fourth of the IC (it has 4 comparators). The comparator-based Schmitt trigger would work fine. You can connect your multivibrator as long as you don't exceed the current specifications of the comparator; I don't know what current your multivibrator circuit requires so I can't say. If you use the comparator to drive an external transistor, you can handle a much larger current. \$\endgroup\$ – Phil Frost Jul 11 '13 at 3:26
  • \$\begingroup\$ Does it mean, that I can implement Schmitt trigger by using "2/4" of LM339 connected in non-inverting mode (as on the wikipedia page)? \$\endgroup\$ – Roman Susi Jul 11 '13 at 3:29
  • \$\begingroup\$ @RomanSusi it sure does. Probably that's what I should have suggested in the first place. You can even cascade them together for more gain, since you have 4. I'd build the circuit with just the comparator, and see if more gain or hysteresis is necessary. Buy several (they are cheap), and experiment. \$\endgroup\$ – Phil Frost Jul 11 '13 at 3:34
  • \$\begingroup\$ If the comparator has an open-collector output, how can it activate the external NPN transistor? \$\endgroup\$ – m.Alin Jul 11 '13 at 7:35

Here is a simple way to trigger a sound output whenever the moisture sensor's resistance drops to the 1 M range:


simulate this circuit – Schematic created using CircuitLab

  • When the sensor resistance is effectively infinite, the 2n7000 gate will be pulled low, hence it will not conduct.
  • As the sensor resistance drops towards the 1 M range, the voltage at the gate will be pulled higher, to the point where the MOSFET begins to conduct.
  • At this point, the piezo buzzer will begin to make a sound.

Continuous sound piezo buzzers are inexpensive, and need no additional circuitry: Once they have power, a tone sounds, and continues until power is removed (i.e. MOSFET stops conducting due to sensor drying up).

Such buzzers are available for as little as 50 cents, for instance on eBay, $2.90 for 6 units, with free international shipping.

| improve this answer | |
  • \$\begingroup\$ Thanks for interesting and simple solution. I have some doubts about buzzer loudness (too quiet), but its probably ok. \$\endgroup\$ – Roman Susi Jul 10 '13 at 15:32
  • \$\begingroup\$ @RomanSusi If it seems too quiet, simply use a larger battery voltage, e.g. 9 Volts or 6 AA cells. \$\endgroup\$ – Anindo Ghosh Jul 10 '13 at 16:32

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.