SOLVED: Relay does not work with external Power Supply

Hello together :slight_smile:

i have a problem to supply my Relay Modul with external power.

here is my setup:

the black cable from the right is connected to the electricity of the house (230V germany).
between I have a power supply to get from 230V to 5V. (TSP-05) this will go to the relay module.
the arduino gets power from the blue USB cable connected to my macbook.
it has configured pin 4 to trigger relay.

int relay = 4;

void setup() {
  pinMode(relay, OUTPUT);
}

void loop() {
  digitalWrite(relay, HIGH);
  delay(2000);
}

To debug this i tried two things:

supply the relay from the arduino. then the relay works as expexted

hang an LED to power adapter to proove that the adapter is working correctly

i am using a arduino ATmega328
can anyone help me please with this? :slight_smile:

here is the explanation what you have to change
https://forum.arduino.cc/index.php?topic=653831.0
best regards Stefan

Hey Stefan,

thank you for replying. This was very helpful for me, i very appreciate it :slight_smile:

i guess my problem was really a beginner thing, haha

so i connected both grounds and it works!

please change the title & add "SOLVED"

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.