Hi,
I have a project to help me detect water in the basement. I have both an Argon & Proton. Both are wired the same to D0 and a ground (a wire on each). When you put the 2 wires in water, they are supposed to send an alarm notification.
I recently added an Argon for the capability of using a 3.7V Lithium Ion battery backup if power goes off. I had the code running on a Proton with the USB. When I installed the code on the Argon and use USB, all works fine (although more sporadic than Proton). However, when I run the Argon on battery only (3.7V LI), it doesn’t work. You can touch the 2 wires together on battery power only and it sends the alarm. Stick the 2 wires in water on battery power, they don’t send the alarm.
I suspect it has something to do with the amount (extra) power output by the USB but I’m lost as to how I can fix this. I’m looking for some advice on how to make this work on battery power.
We can’t see your code, so I’d have to ask: Are you using pinMode(D0, INPUT_PULLUP)?
If you do, the conductivity of the water may be too little to trigger the input.
What happens when you put the wires into a glass of water and gradually add salt?
Clean water isn’t really that good of a conductor. You may need a stronger pull-up (lower resistance) to drive a higher current to actually produce a detectable voltage drop.
@ScruffR, You are absolutely spot on with the conductivity. I had just come to the same line of thinking this morning, so I added a bit of salt to the water in the cup, then tried it. It now consistently reads the presence of water. This is supposed to work in a sump pump so I may have to consider @shanevanj’s suggestions (can’t add salt to the sump pump pit).
@ScruffR, I’m not an electrical engineer, so would you add a resistor between the wire from the D0 and the water and if so, what size or how do I determine a good size?
For the Argon Vcc should come off the 3v3 pin to prevent damaging the input pin when no current flows. 4k7 would be a good value, but you could go down to 1k.
In your case the switch would be the presence/absence of water.
@ScruffR, Your diagram seems very clear but I admit, I’m not an engineer with the hardware. But, let me see if I understand correctly.
I’ve run a wire from the 3V3 pin on the Argon (with the 4.7K resistor) to a blank pin on the breadboard (to get some place to work with connecting wires). I jump wired the D0 pin to a blank pin to the right of the 3V3 wire on the breadboard. I hooked a wire next to the D0 wire and this runs to the switch. When I complete the circuit in the water, it doesn’t work. If I remove the 3V3 wire, it works. I even switched the 3V3 and D0 wires places and still doesn’t work. What am I messing up?
And, I used the sump pump water, so I’m getting a better conductivity as well, so it does work without the 3V3 now. I tried distilled water and it doesn’t work.