I have an arduino connected to a 12v vehicle circuit. I want to supply the ground to some of the relays in the circuit. I was going to use the some of the digital input pins to provide the ground but understand they can only operate at max 5v?
Also, kind of by mistake, I connected the 12v Gnd direct to the input pin acting as ground on a Mega and it didn't seem to fry anything and the relay worked. Was i lucky, or can the input pin operate at 12v as a ground?
I think what you are talking about here is what is called "Low Side Switching". Using the Arduino to switch the ground connection on and off to switch the relay on and off.
The usual way of doing this is with an NPN BJT transistor or with an N-channel MOSFET.
You would control the base (BJT) or gate (MOSFET) with an output pin from the arduino (usually via a resistor to limit current draw) to turn the power on and off.
Make sure you use a resistor from Arduino pin to transistor base.
150 ohm, 180 ohm, should be enough to let transistor turn on good & strong without the arduino pin driving too much current.