water level sensor in boiler 120vac

5v pin turns HIGH durring button press. Signal is read by analog pin, which in turn is connected to Arduino gnd through 1M resistor (connection is ar base of boiler, outside the water. The base is also connected to ground earth through the 3 prong 120vac cord.

Can i do this? Is this not ok? I get a decent measurable change with water vs no water. Why do i get any signal at all?..wouldn’t just ground out to earth ground before reaching the sensor?

See attached picture

Conceptually it is a valid measurement. However

I suggest your ground the arduino the to boiler ground and have the input connected to the sense probe. Then the 1 meg to 5V. Be careful with the arduino power source, it will end up grounded to your building (via the 3rd wire in the AC cord). You only want ground in one location.

Having said that I suspect you will have a lot of AC noise on your signal due to the high impedance ( 1 meg).

I recommend:

Keep the arduino as close to the boiler as practical; to reduce the lenthe of the sensor wires and therefore the AC pickup

Add some filtering at the arduino, perhaps a 0.1 µF near the input.

Twist the sensor wires going to the arduino (if the layout allows this.

Good luck.

I would hate to think what will happen to arduino when/if the AC heater element develops a fault and hence leakage current flows via water to earth. Even if an RCD is fitted, I doubt if the Arduino will survive.

If this is more of a permanent setup as opposed to an experiment, I would suggest additional protection for the arduino inputs.

I agree with the above this is a situation where an opto-coupler (maybe driven by a logic gate) might be a good idea

Is the 5V wire in contact with the water?

Ok… let’s take this a strp further everyone…look at the full circuit diagram attached.

The EE we are working with said the water will become ‘live’ because the ground is not true ground to the mcu. It looks like the circuit is using a half wave bridge to a voltage regulator for the mcu - yes?

I want a pin in the water to sense water level. I thought connecting my input pin to boiler gnd and mcu ground through resistor made sense. You can see the mcu has 2 extra/open i/o pins , one for output and one for input. Am i right on this? I only read a couple volts through the water with my multimeter, no high voltage.

I’m looking to put this water sensor system on those 2 extra pins

OPs Diag;

Tom… :slight_smile:

The EE understands the circuit. You don’t.

One of my EE ‘s many years ago had a favorite quote. “Beware of software weenies wielding screwdrivers”.

If that device is going to be a consumer product, it needs to be 100% potted as it’s just waiting to kill someone if they can touch the microprocessor pins. All because someone is too cheap to spend a few bucks on an isolation transformer.

Haha…True. I never claimed to be fully understanding of the circuit or best practices. Of course a transformer was the first go-to solution for a safe circuit, but we don’t have space for it on the pcba.

I think I started this thread off on the wrong foot. I said ‘Arduino’ when it really is a finalized pcba. The PCBA is of course away from the user, internal to the machine.

Here is my thought on this though…The IC would send out a 3-5v signal through an I/O. The input is also an I/O connected to IC ground and outlet gnd through the base of the boiler. How does this make it not safe or not potentially unsafe? Is it because the IC could fail and potentially send high voltage through the water, or is this just a matter of practice / UL / ETL standards meaning you have to have the transformer for us to be ok with it?

Boiler tank itself must be earthed (I hope!), just connect the sense wire to ground at the mounting point with
two TVS diodes in parallel (redundancy). Add 100k series resistance too for current limiting.

Or a capacitive level sensor, which is isolated?

i've seen a few water-level measuring systems come through, and i am always a little surprised that the floaty attached to a variable resistance (pot) as it is done in fuel-tanks has not been among the systems used. It confuses me...

I did try the capacitance sensor idea. I could not get it to work well with the water. The sensitivity wasn’t there.

We are looking into a float and reed switch currently, but by design, the float doesn’t have much space inside the boiler… double wall insulation, not much space between the inner and outer sleeve.


Yes it is of course it is earthed 3 prong at the metal base. Good point on the diode clamping circuit with a resistor ( I did get as far with the series resistor). I will look into this.

I think the main concern (if there is one) would be large neg voltage swings since this is a half bridge dc system. I will consider this option with the TVS. Thank you.

Still worried about UL or ETL. This may not be accepted practice when dealing with wet environments but worth looking into.

I'm worried about the fuse in the Neutral wire.
When that blows the now non-functional circuit becomes live.

@Deva_Rishi FYI

Floats with variable resistors work fine in fuel because for the most part fuel is non conductive.

Once you get into water or fuels with a lot of alcohol the need to drive them with AC or some other approach becomes more of a issue.


IMHO, "bouncing" a commercial idea off the folks in a hobby forum is not a good idea. From the past most folks here are hesitant to "throw" ideas out there when further down the road there may** be legal consequences. Had I had known your device was planned for commercial product I would not have responded in the same manner. My first suggestion would be to get a typical boiler and perform some testing, including the effect of a damage heater.

** perhaps I am being too cautions but my guess is that no one here would like to have been involved with a product / idea where there were serious negative possibilities such as death or fire etc.

Perhaps it's just me.