I have connected to my Arduino Uno outputs relay module. Relay module has 16 relays (5VDC) which are controlled by transoptors pins (HIGH from Arduino = specific relay is off).

Link to relay module (lang: polish): https://botland.com.pl/pl/przekazniki/6940-modul-przekaznikow-16-kanalow-z-optoizolacja-styki-7a240vac-cewka-5v.html?search_query=modul+przekazniko&results=75 (SRD-05VDC-SL-C relays).

Arduino is supplied by +5V pin and GND pins with external power supply MDR-5-10. Relay module is supplied with the same power supply.

I control Arduino from PC using serial communication over USB (I send a command eg. 1;1;1;1;1;1;, then 6 outputs goes to HIGH). And now there is a problem. When I disconnect relay module control pins from Arduino outputs everything works fine. But when it is connected, I get serial com. error "device not found" (after some switches: sometimes it works for about 20 output switches, sometimes for 1 output switch) and I have to open serial communication again. Probably error appears only when I'm switching outputs.

I think the problem is because my external power supply +5V drops for a while when switching and then Arduino switches to +5V from USB (which doesn't drop), which has not enough power and then error occurs.

Am I right? Any suggestions to fix the problem?

EDIT #1: Thank you for help. Answers:

@Jot, after disconnecting +5V Arduino pin, but with connected relay module, I get serial error immediately with first relay switch. If i dosconnect both +5V pin and relay module control pin, my application works fine. My wires: external power supply - Arduino: 0,5 mm2; Arduino - relay module control pins: 23 AWG (~0,25 mm2); external power supply - relay module +5V and GND: 1,5 mm2. It flows through relays: 24VDC <30W or 230VAC ~20mA.

@CrossRoads, no I use A0-A4 and Q3-Q12 (for relay module: Q3-Q7, Q9-Q11, Q13).

@Duncan C: Currently, I use only 9 relays, other control pins are disconnected and off. Here - http://botland.com.pl/index.php?controller=attachment&id_attachment=244 (power consumption per relay - 0,36W 5VDC) - you can see relay datasheet. Relays are isolated from Arduino with opto-isolators (signal HIGH from Arduino = relay is off). I never switch them all at once. In specific function I never use more then 5 relays together.

@Majenko, thank you, I'll give it a try in Tuesday!

Further informations:

  1. Probably problems occur more often when I connect wires to relays pins (I use them all as NO: 7x 30W 24VDC - coils, 2x 230VAC ~20mA - contactor).
  2. Serial communication error can occur during both reading or writing to serial.
  • 1
    2A output should be more than enough. You can try adding a large electrolytic capacitor across the 5V and GND pins on the Arduino though to see if that helps. – Majenko Feb 15 at 16:34
  • The arduino uno does not switch between the power supplies. Everything stays connected. Only when the barrel jack or the vin pin is used, then the usb power is switched off at about 7.5v. What happens if you disconnect the relay module and keep the gnd connected (arduino gnd to relay module gnd to external power gnd)? How thin are the wires that you use from the external power supply and between the arduino and the relay module? – Jot Feb 15 at 17:57
  • Do you have D0, D1 connected to the relay module? If so, try using two other pins instead. – CrossRoads Feb 15 at 17:59
  • I can't make much sense of the Polish language specs on that relay module. What's the max current the relay module will draw? 16 relays are likely to use a WHOLE LOT of current if you activate them all at once. I thought I remembered each relay in mine as drawing about .2 amps, so 16 relays would be 3.2 amps. – Duncan C Feb 15 at 19:23

I have a similar rig using a 4-channel optically isolated relay, but I use different power supplies for the Arduino and for the relay. (It works perfectly.) My guess is that the relays are causing the voltage on your arduino to droop when they switch on. I suggest using separate power supplies.

As @Majenko suggests, you might try adding a filtering cap (capacitor) between +5V and ground very near the Arduino. The cap should slow the drop in voltage to the Arduino long enough for the power supply to recover, but separate power supplies is the surest fix.

Your Answer

