I’ve done that now!
First, a caveat: I’m talking exclusively about single-ended ADCs, i.e. those that can only accept unipolar positive voltages. These are by far the most common sort.
OK, you should largely forget most of the above, because the Hall effect device (from the thread where you first posted) provided an output that was centred at half-supply voltage.
That’s what we want with a normal wound current transformer, but you have to supply the bias voltage. The reason why that is needed is explained in Learn→Electricity Monitoring→CT Sensors→3. Interfacing with an Arduino→CT Sensors - Interfacing with an Arduino
Also not explained there but further down Learn→Electricity Monitoring→Current & Voltage→Advanced: Digital filters for offset removal→Digital filters for offset removal is how that offset we introduced is removed again.
The way an unplugged sensor is detected in the emonTx & emonPi is by using one of the “inner” contacts inside the socket, and grounding the input when there’s no plug present. (Note this detects the absence of a plug, not an open-circuit c.t.). But the action of inserting and removing the plug puts a half-voltage step onto the input, which appears as a large current.
If you want a short-circuit on the input (which you can’t detect in software), then you could arrange the switching contacts inside the socket to do that - but frankly, it will only help with your voltage-output c.t’s, because the on-board burden for the current-output c.t’s is close enough to a short circuit anyway. In the absence of a burden resistor, then it’s quite possible for the input to float off to some indeterminate voltage, and pick up any noise around. You could reduce the effect of that by adding a high value resistor across the c.t’s output - ‘high’ in this context being in relation to the internal burden of the c.t., which I think is about 68 Ω. It will affect calibration, so I wouldn’t go below 6.8 kΩ as that will decrease the reading by about 1%. (But you can recover that by calibration anyway.)
There’s nothing in emonLib to detect a short to ground - it’s done in the standard sketch and only at start-up - if you unplug or plug in the c.t. while it’s running, it shows a big spike of current. In emonLibCM, the test is done on every sample and it’s handled by the library, and there’s no provision to change it.