I am adding a sub panel in an unattached building. My sub panel has the connection for the 2 hot wires coming from the source panel (a 40 amp double breaker) In addition it has one neutral/ground bar which has a green screw head for the ground and a row of places to connect neutrals. I am seeing advice on sites like yours to not connect the ground wire on the same bar as the neutral. So with only one bar I am not sure what to do with my ground wires. Do I need to install a second ground bar? I have the ground wire coming from the house that is well grounded through the house 200 amp service as well as a buried ground rods outside of the outbuilding. Do I use both and if so do I connect them both to the same ground bar?
The neutral and ground MUST NOT be bonded at a sub-panel. They should only be bonded at the main service panel. If you bond them anywhere other than the main service, the neutral return current now has multiple paths, including though your ground wire.
You should be able to buy a second bar for the sub-panel if it really is meant to be used as a sub-panel. The neutral bar will need to be isolated (it should have plastic insulator separating it from the case). The ground bar should be bonded to the case.
The ground wire from the house must be connected to the sub-panel ground. Since it is a detached building the ground rods are also required by code and should be tied to the sub-panel ground. The ground to the service is the most important because it will provide the low resistance path back to the service in case of a fault.
The advice by Tim does not sound correct. For as long as I've been performing electrical service if you create a subpanel feed from your main service panel, the subpanel is supplied by 4 wires, two hot, one neutral and the other a ground. An insulated neutral must also be separate from the ground bar at the subpanel and if installed in a separate building must have it's own ground electrode with a solid #6 copper wire attached from electrode to the ground bar. The main service panel ground bar must be bonded and the subpanel unbonded.
Rule 10-208 allows for two options. Under first option, the neutral conductor running from the main service to a building supplied from this main service would function as a bonding conductor. In this case, no separate bonding conductor (between the main service and the service in any building supplied by the main single service) would be required, and the service in each building supplied from the main single service would have to be grounded in accordance with Rule 10-204(1)(b).Under the second option, each new service in the building supplied from the main single service would be considered as part of distribution system. In this case, no connection to ground would be made at each such building, as the only connection to ground would be allowed at the main single service. The neutral conductor which runs to each such building supplied from the single service, would be isolated from the service enclosure (it would be used only to carry a load current in a 2-wire circuit or an unbalanced current in a multi-wire circuit), and a separate bonding conductor would have to run from the main single service to each building supplied from this single service to bond the service equipment in each such building.
Changes to the Electrical Code now REQUIRE all unattached buildings with sub panels, to have the Neutral Bar Grounded with #6 wire to the panel box then to a grounding rod in the earth. (Rule 10-208)
You CANNOT use the ground included in say #10/3 wire as your sub panel ground anymore.
You are to treat the sub panel just as a service that is coming in from the meter, the only conductors that should be entering your sub panel now are your 2 Hot Feeds, and your Neutral. (no ground from the main panel.)
Now the confusing part, Rule 10-208 (b) states that you can ground any metal non current carrying components (outlet boxes) through a separate conductor back to the main panel if the building does not house livestock. However, since you must now have a bonded neutral in sub panels, this is more of a pain to attempt since you have a separate grounding circut right there already.