16Channel-Relay-Module chitters when supply voltage is connected

Hello,

I have the following situation:

I have a project in which I have an Arduino Mega controlling a 16Channel-Relay-Module. I have an external 5VDC power supply powering the relays as well as a Raspberry Pi which in turn powers the Arduino through an USB-connection.

I have connected all the GNDs together (RPi, Arduino, relay, ext. power supply).

The relay module is something like this and is active low:

The idea is to use the relays to power 15 door openers. The openers also have limt switches which are also connected to the Arduino.

I then have the Raspberry Pi run a GUI I wrote through witch you can activate the door openers by sending a serial message to the Arduino. There are 15 differnt limit switches connected to the RPi for other purposes.

The problem is this:
When I power the Arduino through my computer everything works as intended.

But when I power the Arduino through the RPi USB connection as soon as the power is turned on, the relays switch on and off like crazy.

Here is an example how I control the relays (note, that the RPi isn´t sending anything to the Arduino as of now, so I didn´t include the code here):

int nb1 = 23;

void setup() {
  // put your setup code here, to run once:
  digitalWrite(nb1, HIGH);
  pinMode(nb1, OUTPUT);
  digitalWrite(nb1, HIGH);
  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  if (Serial.available() > 0){
    int com = Serial.read();
    if (com == '1'){
      digitalWrite(nb1, LOW);
      delay(100);
      digitalWrite(nb1, HIGH);
    }
  }
}

I also tried disabling the serial Connection (commenting out serial.begin and basically everything in the loop so only the setup remains) to make sure, that the RPi wasn´t sending anything on its own, but no luck.

This is my second thread I think, so please be gentle :wink:

Thank you for any help you might provide
konni941

Show us a good schematic of your circuit. Show us a good image of your ‘actual’ wiring. Give links to components. Posting images: Simple guide for inserting images in a post - Website and Forum - Arduino Forum

The schematic is something I cobbled together in a few minutes, so I hope its enough.
I can´t provide an image of the wiring since I´m not allowed to take pictures in a work environment (I am still an electrician apprentice) but I tested every connection and they are all arcording to the schematic.

Arduino:

Raspberry Pi 3B+:

Door openers:

Suggest you feed 5v power from the power supply directly to the Arduino.

Please show some closeups images of the actual relay card.

Also real wiring between the project components.

The data sheet shows 12v going to the blue terminal on the relay card so there we have confusion.

larryd:
Suggest you feed 5v power from the power supply directly to the Arduino.

I will try this tomorrow, thank you. Do you have an explanation as to why this would be an issue, so I can explain myself why this was a problem?

I don´t have a picture, but I have the link to the datasheet:

Kind regards
konni941

The PDF in the last post shows 5v input, if this is your card you are good to go.

The card from the sales site has a 12 to 5v converter mounted on the relay card.


When applying 5v to the Arduino via USB it is possible the Pi cannot power the load.


Also suggest you make a USB cable ‘without’ 5 volts connected as you will connect the Arduino directly to the 5v power supply.

Double check the relay coil voltage. Is it really 5V or is it actually 12 or 24V? It will be engraved on the relay housings.

I tried powering the Arduino with the external power source and it now works perfectly.
Thank you very much for your efforts :slight_smile:

Kind regards
konni941

That relay board has a voltage regulator to drop 12V to 5V. If you are putting 5V into the regulator input, you won't get 5V out. Also the relay board GND should not be connected to Arduino GND. The board should be powered by 12V.

JCA34F:
That relay board has a voltage regulator to drop 12V to 5V. If you are putting 5V into the regulator input, you won't get 5V out. Also the relay board GND should not be connected to Arduino GND. The board should be powered by 12V.

Thank you for your reply. The first link I posted was the wrong one. If you look at the data sheet, you will notice, that the one I use was converted to use with a 5V supply. But thank you for your reply :slight_smile:

Kind regards
konni941