I am trying to build a piece or equipment that disconnects a product (printer/fridge) from the supply at the peak of the AC wave using a low latency relay. I am almost complete but I am stuck where I have millisecond pulses 5V-0V which are at the same frequency as the input - 50Hz and in line with the sinusoidal peaks. What I want to do now is switch a button which means that at the next pulse (AC peak), the pulse will enter a latch which sets the ouput at 5V DC, even though the pulse continues to go between 0V and 5V, or maybe sits at 0V after disconnection. This is required to keep the relay open, not switch the relay on/off. I am thinking about something with BJT's or opamp positve feedback but I think this is a bit dodgy - anyone have any ideas? Thanks