I am using the EE2-12NUL relay and the LL4148 flyback diode. I am controlling the relay with a GPIO pin from an MCU connect to some mosfets. The coil current is 11.7mA for this relay. When not energized the relay should switch back to Pin 3 but I am running into the issue where when I pull the 12V power supply jack while Pin 4 is connected to Pin 5 (by writing a 1 to GPIO_WRITE), the relay output, Pin 4, stays with Pin 5 and does not switch back to Pin 3. This does not always happen, I get into this state about 1 out of every 5 times I try this.
When I put the 12V power supply jack back in after this has happened (Pin 4 is still connected to Pin 5), I measure Pin 1 of the relay and voltage is 0V (as expected since my GPIO_WRITE =0 at the start) but the output of the relay is still connected with Pin 5 so it seems like MCU has no control over it. The only way to get it back to pin 3 is to write a 1 then write a 0 from my MCU. If I just write a 0, it will not go back to original state. When I write a 1, I expect the relay not to click since it is already connected to Pin 5. But I still hear a click.
I read that flyback diodes alone may not always be sufficient, and to install a cap between the coil supply and ground to act as a back-up power source allowing the relay to toggle properly. I added a 10uF cap to Pin 1 and GND but then my relay seems to never switch back to it's original state of Pin 3 regardless of what I do.
I have attached the portion of my design and help would be much appreciated!