Mains zero-detection software-only solution

I have been playing with my AtMega256 and have found a weird behaviour that could be used for zero-detection.

I am using a USB charger for powering Arduino.
When I read an analog input I am getting a nice sine wave at 50Hz.
However, this only happens under certain conditions:

  1. ALL analog inputs must be not connected, or connected to air (antenna?).
  2. Any other analog inputs must not be read while performing the detection.
  3. If the sampling is done too fast it soon degrades the signal (it goes towards zero). Sampling at 1ms the signal is quite robust.

I was wondering if this could be used for a software-only solution to zero-crossing detection.

What do you think? Are you able to replicate what I am seeing?

A "floating" pin has a high impedance and could easily pick up hum from a short piece of wire.
Not very reliable I would say. There is more floating around than mains hum.
You could detect zero voltage (or zero current when a motor is near).
Detecting if an analogue input returns 0 or >=1 might sort of work.