Measure on/off pulse of relay (with reversed polarity) with a MCU?
You can use a bidirectional input optocoupler such as H11AA1



Connect the input optodiodes to points A/B with a small resistor in series and drive the AVR pin from the output transistor.



Using this way you have to keep track of the pulses to know the current state.



Here is an alternative, an optocoupler connected to the output of the relay. The output signal will be low when the relay is on and high when it is off.