Once you have your well pump up and running, it’s important to ground the entire system to prevent damage in the event of a lightning strike and to disperse static electricity from the air. This is especially important in lightning- prone areas, and a dedicated grounding rod should be installed near the solar panels and controller. If the well casing is metal (and if local code allows), it can be used for an earth ground instead of a dedicated grounding rod.
Connect the solar panel frames (using the mounting holes or grounding holes), controller enclosure, and any mounting poles and solar panel supports to the grounding rod using adequately sized grounding wire; 6 gauge solid copper is most common. Most customers choose to run the grounding wire into a ring/eye terminal end, fastened to one of the back screws of the controller’s enclosure. Do not connect the sensors, well pump connections, or solar panel returns (-) to earth ground. Ideally, use a multimeter to confirm proper grounding of the various components.
The solar panels and controller, if within 20’ of each other, should ideally be grounded to the same grounding rod.
In the event of a lightning strike, check the system for damage, that the ground wires are still intact, and re-check the metallic components for proper grounding.
As sometimes asked, NEC makes exemptions for ground fault protection. “The NEC lists two exceptions to this general prescription. The first exception to the general GFPD requirement is for ground- or pole-mounted PV arrays that are isolated from any buildings and limited to one or two parallel source circuits. This exception might apply to a small water pumping system, for example.” http://solarprofessional.com/articles/operations-maintenance/pv-system-ground-faults#.WwBeahZlCEc Plus UL says this requirement is for grid tied systems.