I was working with a magneto-resistive float level sensor that has a 0 - 5V output, and it’s powered by 12VDC. Since the ADCs are all 0 - 3.3V, I put a voltage divider with equal resistors to make 0 - 2.5V. When I tested the sensor, and at maximum height it was closer to 6V, so I wanted the extra safety margin and didn’t adjust the resistors to make exactly 5V → 3.3V.
When I redesigned the controller board, I added input protection: A D1213A TVS, which is a combination of a Zener diode and two regular diodes to make a rail-to-rail voltage limiter. I’ve been putting these SOT23 devices on a lot of circuits as they are cheap but provide extra protection. The circuit looks like this:
As it turns out, this was fortuitous because I had a bad ground connection. I hadn’t tested this scenario, but the sensor produces 10V in that case. Even with the voltage divider it was 5V, which could have permanently damaged the ADC.
But with the D1213, there was no damage, the ADC just read the maximum value (4095) which is what tipped me off to something being wrong, since the level should never be that high. (I measured the voltage with a DMM and it really was 3.3V.)
There’s a voltage divider in this circuit so there’s effectively a series resistor to the source. If there was a direct 3.3V input I would have added added a 100Ω series resistor. This is to make sure the 3.3V rail-to-rail wins over the input. Without it, the external voltage could end up increasing the voltage of 3V3 until the Zener fully kicks in.