I have the following problem: I would like to use 14relays controlled by an arduino mega. For that I use 12V relays (2x4ch on one board and the rest 6 are 1ch single relays). The problem is that when I trigger one relay switching there are several other relays that are switching as well! It is not a software bug it must be electronics-related.
There are also several relays where the green LED goes on when switching another relay but the light is weaker and switch does not go to ON state whreas other switches are going to ON state (but they should not).
Could you help me out what am I doing wrong here?
Thanks in advance!
Sounds like a lack of power. What is supplying power for the relay coils? What is the power supply rated voltage? What is the power supply rated current?
Do the relays all have drivers with flyback diodes?
Please post a schematic.
Please post your well formatted testing code in code block.
I am using 60W 12V adapter - this has to be more than enough to supply 14relays.
I have bought the relays as pre-assembled onto a board with the needed electronics and there are no schematics attached (provider claims these are relays with optocoupler).
As for my wiring: I simply wire 12V+ and 12V- to all the relays one-by-one and a third wire goes to various pins on the arduino and the other ends to the relays input. This is it, I do no use flyback diodes (I am a programmer but I lack electronics knowledge unfortunately). Should I add them to the wiring?
Well, reading further about common ground I am not sure that would be a good idea. This would bypass the isolation of the relay, right?
And is it totally safe? Wouldn’t it cause harm to the arduino?
It depends on the application and environment, neither of which you detailed. It is customary to provide that, and also schematics for hardware questions.