mike wrote... >I am trying to use a LM339 comparator to tell me when two probes are shorted by water. I have one probe connected to Vs and the other going into the +input of the comparator. The -input is connected to a pot between the supply and gnd, which should let me set the threshold at which it decides the probes are shorted. I have a 1M pulldown on the input pin, and a 3.3K pullup resistor on the output. > >This seems to be working fine, but there is some sort of oscillation on the output that is puzzling me... essentially, when the probes are open, it sits at zero, but when they are shorted, it sits at about 3.1V with a few mV of wiggle. I thought the pullup would eliminate this, but apparently not. > >I've posted the schematic here: >http://www.moosecraft.org/comparator.html > Most comparator circuits will oscillate at high frequency when their inputs are near the switching threshold. The usual technique for killing these oscillations is to inject a small amount of positive feedback into the circuit to establish some hysteresis. Try inserting a 1K ohm resistor in between your 1 Meg resistor and ground, and connect a 330K resistor between the 1K/1M junction and the comparator's output. Also, you should check the specs on the LM339 comparator, to make sure you're operating it within its rated supply voltage range. I haven't used those in a long time so I may be wrong here, but it seems to me they might not work on that low a supply voltage. Hope this helps... Dave D. -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu