I'm pretty new to raspberry pi, and have fairly entry-level circuitry knowledge. For this project, I'm using a raspberry pi zero w. I'm putting this question in this stack exchange because I'm hoping that there's a programming solution with minimal circuit modifications.
I'm modifying a digital alarm clock so that while the alarm goes off, it triggers the pi to perform some task. I think the easiest way to do this is to just snip off the piezo buzzer so that the current that was sent there when the alarm sounds is redirected to the pi instead.
This way, I don't have to alter other parts of the clock. Ideally, I would be able to read it through a GPIO pin the same way I would a button press. I need the on state to be continuous, because the task starts when the alarm sounds and ends when the alarm is silenced.
There are two related things I'm not sure how to handle.
The buzzer input is AC. (I don't have an oscilloscope--I'm just using a multimeter.)
The voltage sent to the buzzer ramps up over about a minute. As I said, I'm hoping to treat this input like a button, so I just want it interpret it as on/off.
With my limited knowledge, it seems one straightforward solution might be to get a small AC relay. Depending on the specs, I wouldn't have to worry about the ramping-up voltage, and I'd have my button-like input without having to create any sort of rectifier, etc.
The ideal solution would be to take the input as-is (or with a resistor*) and solve the problem in python. But I don't know whether that's possible.
I'm open to solutions with more involved circuits, but I'd prefer to keep the circuit as simple as possible on this otherwise pretty simple project.
Thanks for the help!
* I'm not worried if the ramping up causes the pi to be triggered slightly after the alarm technically starts. I just don't want the high end of the voltage (~12V) to damage the pi. So I think I'll need to add resistance to the circuit, but there may be a better way.