• Hi guys,

    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.
    Any hint?

  • 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:

    1. removing the GND pin and see if the water detection is reliable,
    2. trying to measure the DC voltage on CAPSENSE_RXpin (CAPSENSE_TX put to logic HIGH), given the water impedance could be equal to or lower than the 1Meg resistor of the capSense feature.
  • 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

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

[SOLVED] Puck.js Puck.capSense() function seems to hang

Posted by Avatar for Jean-Philippe_Rey @Jean-Philippe_Rey

Actions