Tuesday 26 January 2016

pic - Water Sensing Circuit


I'm working on a circuit board driven by a PIC18F; one of the components on the board is a water sensor. This is pretty straightforward, there are two electrodes on a probe; when immersed in water, there's enough conductivity to complete the circuit, and it pulls a pin high on the PIC. Below is a sketch of the relevant portion of the circuit. The electrodes are CN4-1 and CN4-2, the board is powered by a 3.6 V battery.


As it stands, it works as intended, but I'm seeing some undesirable behavior. The system is highly sensitive to anything touching the second electrode, CN4-2; I'm assuming this introduces stray charge to the system, and I can get a false positive detection (even if nothing is touching CN4-1, so the circuit is not completed). In particular, there's an LED that signals the presence of water, triggered by this circuit. If CN4-2 is touched by a conductor (either water or something else, like a hand), the I/O pin gets pulled high enough to trigger the LED, but in some cases just having the LED lit is enough to pull some current from the battery, letting the signal to the I/O pin get pulled low enough that it turns off again, and we end up switch back and forth between states. Tying the ground of the board to an external ground helps reduce this, but doesn't always eliminate it.


Reducing the size of the resistor pulling the pin low reduces these false positives, but then makes it hard for the circuit to pull it high when there's a legitimate signal. Simultaneously reducing the size of the resistor that pulls it high can fix that, too, but then the total resistance of the circuit is low enough that when the circuit is connected across CN4, there's a significant current draw, which will shorten the battery life significantly.


I inherited the board design, so I won't be offended if you tell me that there's a completely different way to handle this that would be better. I'm ideally looking to have the system very responsive to a connection across CN4, minimal power draw whether CN4 is open or closed, and preventing a false positive signal when only a single electrode has some contact. If it can be done without requiring tying the system to an external ground, that would be convenient.


Water Sensor Circuit





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...