Or a comparator interrupt OR modify the power supply. You place a diode between the bridge and the capacitor, then send the bridge side on a interruptable pin.

Just another idea

How many different ways exist to skin a cat?