I am using pin D11 and Puck.capSense() feature to detect water leakage. The wire on D11 has a bigger capacitance if put into water.
When the wire is "dry" everything is fine, but when I try into water, capSense() takes a lot more time to return (about 1 second) and returns value 20000200. If I remove the wire from the water and dry it out, capSense() remains in a state that takes 1 second to return, with value 20000200.
After that if I run Puck.selfTest()it returns Capsense resistor disconnected? (pullup) a few times but after a while it seems to put the function back into a normal mode. This process is repeatable.
Capsense resistor disconnected? (pullup)
I slightly misunderstood the root cause. Given that my probe is made out of 2 pads, one for D11, the other one for GND, putting it into water doesn't increase the capacitance but instead lower the impedance. I suspect that the latter is low enough to prevent the capSense timer to reach the compare threshold, thus generating a timeout on the function nrf_utils_cap_sense().
Now I will try 2 things:
Well it appears that method 1. works well.
Puck.capSense()returns around 8000 when the probe is in the air, and between 17000 and 23000 into water.
To conclude, Puck.capSense() works well and the problem came from probe itself
Glad you got it sorted! As you noted, the capacitance test expects the thing you're measuring not to have any resistance to GND, and when that happened the function gets stuck waiting for the voltage to rise (since there's only a 1MOhm pullup resistor I think)
If you do want to use resistance I believe I've had some luck with plant moisture by adding a pullup to an ADC pin and then measuring the voltage
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem