I have a nodemcu connected to a shift register(https://www.amazon.de/gp/product/B07CHBYR7Z) to control an 8 channel relay board (https://www.amazon.de/Elegoo-Relaismodul-Optokoppler-Arduino-Raspberry/dp/B01M61VVGV). The realy board is connected to various pumps. The setup itself works quite well normally. However after some switching cycles or when I manually bridge the relay to activate a pump the shift register suddenly either doesnt react at all. Switches on everything or is off by one. I read that it might be possible that I have flow back from the relay coil so I added the diode over the gnd and vcc pin of the relay board. However that didnt help either. Can anybody tell me what I am doing wrong? I hope the schematic is legible.

enter image description here

  • Can you explain what you are doing when you say "manually bridge the relay"? Also, what are you switching through the relays? 110 volts AC from mains? Or are you switching lower voltage? And, if lower voltage, are you using the same power supply / source as that which powers the Arduino? Lastly, are the Arduino and this control board located close (within inches) of each other?
    – st2000
    Oct 13, 2018 at 12:37
  • With manually briding i mean connecting the two "output" pins from the relay with a cable to activate the pump without switching the relay for testing purposes. I am switching a 220v light bulb as well as 5 pumps which are 12v and connected to a different power supply but to the same multi plug. The distance from the arduino to the relay is ~15cm. The arduino and the relay board are on the same power supply (the relay board is connected to Vcc from the arduino)
    – ACB
    Oct 13, 2018 at 12:40
  • Do you have the required bypass caps on the shift register?
    – Majenko
    Oct 13, 2018 at 12:50
  • No. Where would I need to put those?
    – ACB
    Oct 13, 2018 at 13:04
  • 1
    Item 2 in my answer: "as near as possible to each integrated circuit". Oh, I see, it is commonly understood that these should go across the power pins of each integrated circuit.
    – st2000
    Oct 13, 2018 at 13:10

1 Answer 1


If this is a noise issue, there are a number of mitigating actions to consider. Also, consider that most if not all noise mitigating approaches are generic and may not apply to all situations.

  1. It is almost always easier to mitigate noise at the source. Filtering the power & shielding are two approaches.
  2. When laying out digital integrated circuits, it is common to include bypass or decoupling capacitors as near as possible to each integrated circuit. If unfamiliar with these, these capacitors go across the power pins of the integrated circuit.
  3. If an electrically noisy environment is anticipated, making all communication leads and cables as short as possible prevents the likely hood of unexpected results.
  4. If cables need to be long different communications methods such as balanced line or differential signalling should be considered.
  5. Bring all power grounds to a single point. This mitigates current loops which can cause unexpected power voltage fluctuations.
  6. Consider the power requirements and generally use a power supply that is rated for double to have a margin of safety.
  7. Avoid running cables containing high power or switched power near or in parallel to cables containing low voltage logic.

For this particular application / design:

  1. Likely the reversed bias diode on the relay power supply lines is not needed. There appears to be optical isolators on the relay board which should prevent the inductance of the relays from feeding back.
  2. Verify you are creating the correct signal to the 74HC595 chip. Use the timing diagrams on page 8 of this ti.com 74HC595 specification sheet as a guide.
  3. Consider the gauge of the power cables. Thinner wires over longer runs will drop the voltage proportional to the current demand. If all 8 relays are active, the current demand may be as much as an Amp.
  • Thank you I will try those. The signals should be correct as I am using the arduino library for the shift register and as I said it is normally working. Only it sometimes stops and I need to turn off power to fix that.
    – ACB
    Oct 13, 2018 at 13:12

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.