-
• #2
How are you driving the relay? Does it have its own transistor?
If you're driving it direct then I could imagine that the voltage spike from the relay coil could definitely affect surrounding pins (I imagine it would be out of spec for the chip).
The other problem could be that while the pins are 5v tolerant as inputs, they only produce a 3.3v output voltage - so if you're powering the relay off 5v, and you output
digitalWrite(A5,1)
, the pin's being connected to 3.3v - which is actually raising the voltage of the 3.3v line via the relay!To fix that you could try setting the output type if A5 to
opendrain
? It depends if your relay turns on when you output 0 (most do) or 1. -
• #3
Hi Gordon
Thanks for your answer. I tested it with two different types of relayboards:Sacha
-
• #4
I'd be pretty sure its what I'd said then - I've had issues with that in the past.
Either setting
opendrain
or writing with:if (on) digitalWrite(A5,0); else digitalRead(A5)
will probably fix it
Hi Gordon
SetWatch:
pinMode(A6, "input_pulldown");
setWatch(function(e) { do something }
Relay:
When i switch the relay width "digitalWrite(A5,1)" on, relay will be triggered as expected.
Sometimes the A6 setWatch is triggered in the same moment as the relay is triggered. Not allways, it is reproduceable out of 25 on/off switches of the relay.
I was not able to reproduce it when i have the setWatch on A1.
I was also not able to reproduce it then i powered the EspruinoWifi by USB.
Is this becuase A5 and A6 are neighbors ?
Thanks
Sacha