I've never done it but couldn't the circuit be as simple as a 555 threshold trigger, a large capacitor, and a digital pin?