I'm using a ESP8266 to activate a siren. The siren is activated thru a 5V relay, and the 5V relay is connected to a transistor, the transistor is connected to a pin of the ESP8266. The power supply of the ESP8266 failed and it hung, in this state the pin went high and the relay was triggered.
I was wondering if there is someway to trigger the relay with some kind of code, not just voltage, as a safety mechanism to avoid activation due malfunction. My first idea was replacing the transistor with a cheap microcontroller, like an ATmega 88p.
Is there a more robust way for doing this?