Has anyone had issues with digital pins going high after/during device power shutdown? I have built a garage door opener using Blynk. It’s very simple. I simply have a Blynkapp button directly assigned to my D0 pin (that is initialized in setup as an output:
“PinMode(D0, output);”
The pin is tied to the signal pin of relay 1 on a 2 relay module I got from Sunfounder. It works perfectly with output of the relay attached to the “close button” terminals of my opener. However if I pull the USB pwr plug on my Photon somehow the relay closes momentarily and my door will activate (and close or open). I got this project from Make magazine and to avoid this problem (they mentioned it but I ignored cause it makes no sense) they tie 2 digital output pins to the 2 relay modules in series. Somehow this strange behavior does not occur in all pins/relays at the same time.
@Sklarm, is it possible to try using an Ax pin instead of a Dx pin to drive the relay? Pulling power on a device can lead to unexpected events while the regulator output decays but not sure why you get those results. Is the relay module powered from the Vin pin of the Photon?
Since we also don’t know what relay boards you are using exactly and how they are powered we can only guess.
One thing that comes to mind is the voltage induced into the relay coil by the collapsing magnetic field when swtiching off the relay.
This is the reason why relays should also have flyback diodes attached to protect the rest of the circuitry against that voltage spike.