Connecting 12v relay to arduino

Hey guys.
so i have a 12V relay that i want to use to switch on and off another DC circuit.

the thing is a cant seem to properly switch the relay.

i have an external 12V power supply.
here is how i'm connected:

PIN 0 on arduino to the relay IN (signal).
relay ground to ground shared with arduino and the power supply.
Relay's VCC to the 12V power supply.

when i connect i hear a tick sound of the relay switching state, but only once, and the switch does changes again according to pin 0.

if i'm not sharing the ground between the arduino and the power supply the relay just switches states really really fast...

i'm kinda new to this and don't have allot of knowledge on electronics so i hope some one can explain to me what i'm doing wrong.
thanks.

here is my code:

void setup() {
  // put your setup code here, to run once:
  pinMode(0, OUTPUT);

}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(0, HIGH);
  delay(1000);
  digitalWrite(0, LOW);
  delay(1000);
}

We need to know more about the relay. Can you post a link to where you got it? A photo of your wiring can be helpful, too. What Arduino board are you using?

Pin 0 is the hardware serial RX pin on Arduino compatible boards. It is OK to use pin 0 (or pin 1, TX) like you have unless you want to use the Serial port (which you will if you mess with Arduino very long). You can't use pin 0 or 1 for anything else if you use the Serial port.

post a link or picture of your relay.

when i connect i hear a tick sound of the relay switching state, but only once, and the switch does changes again according to pin 0.

this sounds like there is an issue with wiring and the jumpers on the relay.
it should only toggle when you set the pin high or low, not when you connect.

This is the relay:
https://www.gearbest.com/3d-printer-parts/pp_009192585077.html?wid=1433363