Controlling focus on nikon d5300

I am trying to control the focus on my nikon d5300 with an arduino. I am new to arduino and electronics so I am running into some issues. I attached the schematic. I based this off of this tutorial: . However, when I plug everything in the camera focuses and then locks up. If I manually remove the power supplied through pin 5 then it unlocks. I feels like it is ignoring the low state of the pin. Anybody have an ideas that could help me out. I really appreciate it.

I managed to get it working by connecting the GND of the arduino to the emitter. I am still confused though why I need the GND of the camera and the arduino plugged into the emitter.