Why connect arduino GND and power supply 0V?


I am building my first project with arduino using a 24V relay to switch a lamp. To activate this relay, I use a transistor and external power supply.

The problem is:
I asked help from a friend who works with electronics and he told me that I need to connect the GND pin from arduino to the 0V on the power supply. I did not understand his explanation about why I need to do that.
Could someone, please help me to understand?

I don’t know if it is needed, but the scheme of what I am trying to build is attached to this post.

Thank you


Read this

In your circuit you must have a common ground.
You could use an opto isolator ( google it) then you would not need the common ground.


Thank you guys.


Think of it this way:

The arduino drives the base-emitter circuit.

The relay current flows through the collector-emitter circuit.

The emitter is clearly a common point.

Circuit is a loop (obviously). Connecting a single wire (no ground) from Arduino
to transistor would be using the transistor as an antenna, not a circuit!!

If you used an opto-isolator instead of transistor there are 4 wires and the
two 'ports' to the device are isolated. With a 3-terminal device 2 ports must
share one terminal.