I would like to know the difference between different types of Grounds like AGND, SGND, Battery Gnd, PGND. Are all the grounds not same? Cant we connect the device to any one of these grounds?
Though they all all contain "GND" they are not really mean the earth, we only have one earth, but can have many "GND"s. You can think GND as a common reference point of a local system.
From your "GND"s, the AGND, may represent the "analog ground", SGND may represent "signal ground", PGND may represent "power ground". For some reasons, such as safety, EMI, etc., we tend to split our system into many sub-systems. Every ground just is a reference point of the sub-systems.
If your device doesn't belong to a system, you can't connect your device to the ground of that system.
Ideally all grounds are the same. However, there may be reasons they aren't the same:
- Your ground has significant DC current flowing through it. From Ohm's law, we know \$V = IR\$, so there will be a slight voltage gradient across your "ground".
- Similarly, for high frequencies, ground has some non-zero inductance. An inductor at high frequency has significant impedance, leading to a potential difference at these high frequencies.
- Ground is a label for a reference point. Sometimes you don't want your reference point to be physically tied to the literal ground, or want isolated reference points (known as "galvanic isolation").
Usually high frequencies are on the digital side, where you are switching at a high rate (worse, these are square waves so there are higher harmonics). Analog circuits usually imply you care about the amplitude/other features of the waveform, and these high frequencies from digital circuits can easily corrupt your signal. Thus it's not uncommon to have a divider between analog and digital grounds. However, crucially both grounds are still tied together (preferably at a single point) so you have the same reference point. There are other things to consider here, but I'm omitting them for brevity.
For circuits with significant DC current and sensitive analog components, it's not uncommon to divide the power ground from your analog ground. Again, you would tie these together at a single point to have a common reference.
Galvanic isolation is used for various reasons. One of the big reasons is safety. For example, most power bricks are isolated supplies. If there is a failure on the primary side, as long as you don't exceed the isolation voltage limit your second side usually just loses power instead of being shorted to the primary side plugged into the wall. In this case, you physically have two separate reference points. Their potentials can float such that the voltage across the two grounds is not zero. Sometimes there is some effort made that this potential doesn't drift too far away.
No they aren't always the same. AGND (analog ground) for example is a reference point for your analog component. You can hook this up to another voltage then the ground of your battery. Same case with the SGND, which you will probably have with a differential signal. This is the reference point for the signal. I have never heard of PGND (protective ground?) so I can't really say alot about that, except that it is not always the same as the ground of your battery.