wake up sleeping Arduino when water detected

Hello,
I'd like to build a water sensing Arduino. The ATMEGA328P-PU would be sleeping to conserve battery, and wakes up when the probes detect water. To further conserve energy, no current should flow from 3.3V to GND when the probes are not in water. Also, that's another constraint - I only have 3.3V power.

I found this diagram online:

His recommended parts list:

I would take out the LED and the top resistor. Can I replace the BC548 transistor with a 2N3904? Will it work with only 3.3V?

I'm not sure where to land the ATMEGA's interrupt wire on the circuit - should it go below the transistor? So I would see 3.3V when the transistor switches?...not sure.

Yes, a 2N3904 will work. You will need a single resistor in place of the 220 ohm/LED combination, and any value about 10K ohms or greater should be fine. The output is at the collector of the transistor and will be high if no water, low if water is present.

Edit: the function of the circuit depends on there being dissolved salts in the water. Very pure water, including rain water, is a poor conductor.

Oh, I see. A resistor on collector (above the transistor) to drop most of the voltage. And you land the Arduino interrupt wire below the resistor but above the transistor. When current flows, the part of the wire below the resistor sees almost ground voltage.

A potential concern is that your reference electrode is connected to the supply voltage. It would be better if it was grounded - and the circuit tuned "upside down" by using PNP transistors instead.

This has been discussed in another thread recently in regard to electrolytic effects "poisoning" the electrodes if you permit the current to flow continuously. The advice there is to make infrequent checks and disable the resistors which connect to the electrodes at all other times.

In your case, it may be the best (for many reasons) to have your Arduino sleep and wake only at the intervals you determine appropriate to make the measurements. Now if you are going to use LEDs as indicators, they can be controlled by outputs on the Arduino but of course, whilever the LEDs are lit, they are going to be consuming power.

check the power consumption of the mega in sleep mode.

Paul, thanks for the pointer and for the link.

This water sensor is really only going to be in water if the house if flooded. I'm hoping that's not very frequent...if it happens, I got problems!

If I'm reading the additional information right, I shouldn't have to worry about the poisoning of the electrodes right? They'll be dry (I hope) most of the time. My Arduino might get flooded, in which case I'll have to replace it anyways.

They'll be dry

If they are dry there will be no problem.

My Arduino might get flooded

Just keep it higher than the electrodes :wink:

Make sure you test the system on a regular basis so you know it will work when needed.

jremington:
Yes, a 2N3904 will work. You will need a single resistor in place of the 220 ohm/LED combination, and any value about 10K ohms or greater should be fine. The output is at the collector of the transistor and will be high if no water, low if water is present.

Edit: the function of the circuit depends on there being dissolved salts in the water. Very pure water, including rain water, is a poor conductor.

I've been trying this. Is the gate resistor (the 220k) value important? If I change the collector side resistor to 10k, do I have to change the 220k resistor? I wonder if that's a typo, if it's not 220 ohms instead? I kind of remember the current from gate to emitter controls collector-emitter current, right?

My experimenting has been inconsistent. Sometimes I get 0V when conducting (no water, the two wires directly touching), sometimes I don't.

EricExperiment:
I've been trying this. Is the gate resistor (the 220k) value important? If I change the collector side resistor to 10k, do I have to change the 220k resistor?

Actually, it is the other way around! The 220k resistor was far too high to allow a BC548 or 2N3904 to conduct much current to light a LED with the 220 ohm series resistor (it would be the transistor limiting the LED current, not the 220 ohm resistor) but would be just fine with a 10k collector resistor requiring a gain of only 22 to fully switch on the transistor.

jremington:
Yes, a 2N3904 will work. You will need a single resistor in place of the 220 ohm/LED combination, and any value about 10K ohms or greater should be fine. The output is at the collector of the transistor and will be high if no water, low if water is present.

Edit: the function of the circuit depends on there being dissolved salts in the water. Very pure water, including rain water, is a poor conductor.

Poorer, but adequate for a few microamps. De-ionized water is never found in the
environment, only in bottles of de-ionized water in practice!

MarkT:
Poorer, but adequate for a few microamps. De-ionised water is never found in the
environment, only in bottles of de-ionised water in practice!

Acid rain - is not a myth!

Paul__B:
Actually, it is the other way around! The 220k resistor was far too high to allow a BC548 or 2N3904 to conduct much current to light a LED with the 220 ohm series resistor (it would be the transistor limiting the LED current, not the 220 ohm resistor) but would be just fine with a 10k collector resistor requiring a gain of only 22 to fully switch on the transistor.

Humm...I tried it again, it works great now. Tried with tap water and works like it should.

Thanks!

The fact the electrodes will corrode put's me off...

How about an ultrasonic (distance) sensor to keep a very close eye without submersing anything?

Or a float that trips a switch?