I'm linking to the topic above because it's great introduction. I have analog input that may be > 2.4 (max DAC voltage for ESP32), have implemented voltage divider to bring the input designed max within the acceptable bounds and now am looking to implement some sort of surge protection for the digital and analog pin inputs.
I'm planning to use some of the classic clamping diode schemas. I understand the principle of working, but I cannot figure out how the excess voltage gets routed away if I'm draining anything > 3.3v via the board's 3.3v pin? I'm concerned I would feed surge voltage into the board and zap it.
What's the practice for the GND/Vdd rails that handle the surge voltage for usb-powered board? How do they take away the excess voltage?
The resistor limits the current and creates a voltage divider with the chip. Without the resistor, yes you could end-up "powering the chip" through the diode and perhaps fry it. (470 Ohms seems a little low. I'd go with between 1K and 10K.)
Usually USB power is well-regulated so you shouldn't need any additional protection. You can use a Zener diode but in that case you should add a fuse so the fuse can blow before the diode (or the power supply). In this case a resistor would result in a voltage-drop during normal operation.
With the high-impedance analog input, there is no voltage drop since virtually no current flows through the resistor as long as the voltage remains below Vcc.
If you put 12V supply (say) with more than a trivial current sourcing ability on a 5.6V zener it would pass lots of current and melt rapidly. Then the rest of the circuit is no longer protected.
Polyfuses are often used today to give resetable over-current protection alongside other measures. The combination of a polyfuse before a zener clamp is a reasonably robust approach on a power input.
However signal input pins to a chip just need Schottky diodes to the rails plus some resistance in front to limit current enough that the diodes don't blow. As they are inputs no current needs to flow in normal operation so series resistance is generally fine. With enough resistance the Schottky protection might be unnecessary as the anti-static on-chip diodes may be able to cope.
A simple backup for protection is sometimes needed. It is even possible to use a thyristor with a zener. When the voltage gets too high, the zener triggers the thyristor which causes a shortcut that blows the fuse. Another example is a fuse soldered to a power distribution board, which is replaced completely when a problem occurs. Multimeters have input protection with fuses, just watch the EEVblog about multimeters. When you buy something cheap that runs on the main voltage, there can be a resistor of 10Ω or so, that acts as a fuse. Fuses are still everywhere.
This is called a crowbar circuit. It is used in very high current systems. The name "crowbar" comes from the subway workers who would lay a heavy metal crowbar across the electrified tracks to ensure that someone wouldn't inadvertently turn the power back on.
And its actually a rather flawed approach - this sort of crowbar circuit has been used in some audio amplifiers, resulting in the PCB being destroyed on a short-circuit as the high currents did indeed vaporize the fuse and the PCB traces simultaneously! And its also entirely possible to fuse the thyristor too as semiconductors make faster fuses than fuses! Better protection circuitry exists...
A steel crowbar across the rails sounds very unreliable to me - power comes back on, it simply heats up rapidly, melts and the workers get electrocuted (or the magnetic forces throw it up in the air...) - the sort of power to drive a train needs a stout copper busbar securely clamped to the rails to deal with.
I didn't say it was good science, just that this is how subway workers tested the rails before doing any work by dropping a crowbar across them. If the crowbar melts, the power isn't off.