I have been trying to get a relay to switch when one of the coil probe is underwater and the other probe connected to the positive of a 5V SMPS. The circuit is completed by the negative wire and the positive wire from the coil being underwater (water at room temperature), not touching, but have a potential difference between them.

These are the things I have tried:

  1. There is a minimal voltage drop of around 0.4V across the coil, considering that the resistance of the relay coil is 69 ohms and the water is much higher, the voltage divider rule maybe applied to find the resistance of the water or the output voltage. However, a LED turned on perfectly, I assume it is drawing more power than the relay.

I have tried adding salt to the water, but that doesn't make it switch either.

I have tried the same with three relays, none of them are switching. Furthermore, I have also tried keeping one probe on the metal container and the other one dipped in water. The voltage increases slightly, but not a considerable change.

Connected one end to the +ve of the SMPS and the other end inside water

The equivalent circuit of the above in terms of resistors in order to assess the voltage divider rule

  1. Using a MPS2222A transistor as a switch. This did not work either when dipped underwater.

The first transistor circuit I tried, the others are just slight deviations of the same

The following are the links of the data sheets of the relay and the transistor:

Transistor MPS2222A data sheet

Relay SC5-S-DC5V relay data sheet (data sheet contains only 6V and above, the coil resistance for this is around 69 Ohms)

The connections are right, the relay switches if the probes are directly touched. IF THE DESCRIPTION IS CONFUSING, ALWAYS RELY ON THE CIRCUIT DIAGRAM.

My question being, what may be some of the things that may go wrong and what other ideas can be tried?

  • 1
    \$\begingroup\$ Your words don't match your top schematic. Do you have a question? \$\endgroup\$
    – Andy aka
    Jan 11, 2022 at 14:09
  • \$\begingroup\$ You can try a Darlington pair, if the LED switched ON, you might just not have enough current through the coil to make the relay work. As long as you have enough voltage to switch the transistor pair ON, you should be OK in terms of current. \$\endgroup\$
    – Tim M
    Jan 11, 2022 at 14:13
  • \$\begingroup\$ A proper relay data sheet is required i.e. one which has full pin number information. You are using pins 1 and 2 yet, I suspect you need to use pins 2 and 5. \$\endgroup\$
    – Andy aka
    Jan 11, 2022 at 14:16
  • 1
    \$\begingroup\$ Have you tried adding a bit of salt to the water? \$\endgroup\$ Jan 11, 2022 at 14:42
  • 1
    \$\begingroup\$ An LED will light with much much less current than is required to operate a relay. \$\endgroup\$ Jan 11, 2022 at 16:24

1 Answer 1


A bit of an XY problem here.

My initial suggestion? Forget about using electronics. Instead, use a float switch. Then you avoid all the leakage and safety issues of using a resistance-based sensor, and you don't need a relay at all. Simple, cheap, reliable, and most of all, safe.

That said, the reason your single NPN circuit doesn't work is that it requires too much input current through the water to the base to activate the relay (for 20mA Ic to the relay, need an Ib of about 100-200uA.) The sensor pickup needs to have higher impedance.

Using a Darlington pair would work. But I think the simplest way is to use a FET with a 1M resistor between gate and source in place of the NPN. This has a much higher impedance than the single NPN, needing only about 1.7uA to activate the relay.

Here's how that would look (simulate it here):

enter image description here

Design notes:

  • the Zener across the FET gate and source protects the FET gate against ESD damage.
  • The diode across the relay coil catches back-EMF when the switch turns off, again to protect the FET.

But I'm still not entirely happy about this approach. Leakage current from the SMPS will make its way to a wet area. That's bad. Even without that, the sensor is subject to electrolysis and oxidation over time and will eventually fail. It also depends on the water resistivity, which (as you discovered) can vary widely depending on the ionic content.

Using a non-contact, fully insulated approach avoids all these problem. Which leads to a hacktastical idea: repurpose an aquarium water level sensor. Have a look here at some to choose from: https://www.bulkreefsupply.com/reefing/Water-Level-Sensor They have mechanical and optical types.

And, here's an optical one sold as an "Arduino" peripheral: https://www.dfrobot.com/product-1470.html It looks identical to one of the reef tank types that use a prism and LED / detector pair.

How does it work? Here's a paper describing how these prism optical sensors do their thing: https://www.coleparmer.ca/blog/2014/07/11/level-control-how-do-electro-optic-point-level-sensors-work/


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.