0
\$\begingroup\$

I designed a Raspberry Pi shield PCB.

There are 6 relays on the board and a ULN2003 relay driver to control these relays. The BCM pins to the relay driver are marked in yellow below.

enter image description here

enter image description here

enter image description here

When two relays are ON, adifferent relay, which should be in the OFF position, automatically also turns ON. It does this occasionally, not always.

Do the relays on the board create a magnetic field and cause jumping due to the proximity of the GPIO pins? Do I need to isolate the GPIO pins?

Does anyone have any other ideas on this subject?

\$\endgroup\$
6
  • \$\begingroup\$ What is D1 doing? \$\endgroup\$
    – Kartman
    Sep 2, 2021 at 10:49
  • \$\begingroup\$ I'd measure the coil supply with a scope and see what's going on there. \$\endgroup\$
    – Lundin
    Sep 2, 2021 at 11:36
  • \$\begingroup\$ D1 is in the datasheet. There is also something like this: The same scenario is repeated over and over when I work on relays. For example, for 4 pins; BCM17: Relay1 BCM18: Relay2 BCM24: Relay3 BCM27: Relay4 The scenario is as follows: After energizing the system, I trigger Relay1 and Relay4 and in this case Relay3 is also triggered. Then when I reset the system and trigger Relay1 and Relay4 again, Relay2 is triggered. There's definitely something I don't understand. I can't find the exact problem. \$\endgroup\$
    – Enes Orhan
    Sep 2, 2021 at 11:36
  • 1
    \$\begingroup\$ "D1 is in the datasheet" - Not in the one I'm looking at. The ULN2003 has protection diodes on the outputs so you don't have to add them, COM is the common terminal for them all to connect to your supply. \$\endgroup\$
    – Finbarr
    Sep 2, 2021 at 12:34
  • \$\begingroup\$ D1 is incorrect. Delete it. Connect the COM pin to the positive voltage supply for the relays. \$\endgroup\$
    – AnalogKid
    Dec 14, 2021 at 13:43

2 Answers 2

3
\$\begingroup\$

You did it right, the relay side circuitry.

Tie pin9 of ULN2003 to the +5V of the relay. Arrange the 5V and GND connection, in the way the relay side current does not pass the logic side.

Problem happened, hypothetically, when relays are driven, low voltage is coming through the ULN internal re-circulation/clamping diode then driving the inactive relay.

That may not completely fix the problem. And, the problem will amplify when the relay output is connected to loads. The main problem is the arrangement of the signal path and grounding.

\$\endgroup\$
5
  • \$\begingroup\$ I would appreciate it if you could look at the solution I added below and comment. \$\endgroup\$
    – Enes Orhan
    Sep 3, 2021 at 9:10
  • \$\begingroup\$ --1-- @EnesOrhan I forght where 5V came from, probably it was assumed to be the relay drive voltage. It is must, connect U3 pin 9 to the relay drive voltage rail, as close as possible to the relay side, along with a good bulk and decoupling cap. If possible, the rail can be further isolated with L-C or R-C from the source. ... Next, I cannot tell exactly what is wrong with the grounding scheme & power lane, but I doubt, while seeing how the problem was solved. However it is, \$\endgroup\$
    – jay
    Dec 6, 2021 at 16:04
  • \$\begingroup\$ --2-- However it is, since you are seeing very rare event, there is a way to hide it in the software side: Refresh the Raspi output (called output scan) in regular interval as often as it can (timer interrupt / a thread). \$\endgroup\$
    – jay
    Dec 6, 2021 at 16:04
  • \$\begingroup\$ Wait a moment.. I see it now, the relay coil circuity.. There are D2...D5, which may replace the U3 pin 9, though not sure until I see the whole setup. Meantime, R&C, L&C isolation still is a valid approach. BTW, EMI, in the form of magnetic coupling or RF, back to driver input isn't something happens before more serious problems, with very unresonable design. \$\endgroup\$
    – jay
    Dec 6, 2021 at 16:14
  • \$\begingroup\$ Can you take a look at the question here again? electronics.stackexchange.com/questions/599356/… \$\endgroup\$
    – Enes Orhan
    Dec 14, 2021 at 15:33
0
\$\begingroup\$

The problem was solved by adding resistors as done in the schematic I've attached below.

In this way, I think I transferred the excess load on the BCM pins, which we do not want to be active (ON), to GND via the resistor.

enter image description here

\$\endgroup\$
5
  • \$\begingroup\$ Good to hear that. I may need to withdraw my comment soon, "That may not completely fix the problem. And, the problem will amplify when the relay output is connected to loads." ULN2003 turn on voltage is as low as 2.4V (high enough), with 65uA current needed. That device is "unidirectional". No energy come over from the output to input. Whatever it is, connect pin 9 to the Relay coil Vcc side. \$\endgroup\$
    – jay
    Sep 3, 2021 at 13:20
  • \$\begingroup\$ The resistor provided the solution for now and as you said I connected the COM pin to Vcc. As far as I understand, when one pin is active, the other pins are active because the COM pin is connected to GND. If I disable the resistors again, will the problem still be solved? Or what would it cost me if the resistors were also switched on? \$\endgroup\$
    – Enes Orhan
    Sep 6, 2021 at 9:25
  • \$\begingroup\$ An engineer.. You would be curious, wouldn't you? :-) \$\endgroup\$
    – jay
    Sep 6, 2021 at 14:15
  • \$\begingroup\$ "The main problem is the arrangement of the signal path and grounding". What exactly do you mean by the arrangement of the signal path you are talking about here? Are you talking about the drawing of the signal paths on the PCB? The relays worked depending on the load, there was no problem. But rarely the problem shows up. \$\endgroup\$
    – Enes Orhan
    Sep 7, 2021 at 6:49
  • \$\begingroup\$ Probably over concerned, I was. I thought the pins you circle was any of the relay connection along with other signals. Sorry, if I have mistaken. \$\endgroup\$
    – jay
    Sep 7, 2021 at 13:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.