A welding assembly is provided for welding a fastener to an object such as a
vehicle
body panel. The assembly includes a weld gun having first and second electrodes
movable relative to one another between an open position and a closed position.
The first electrode includes a housing assembly. A pin is received in the housing
assembly and is movable when in said closed position between a desired nut position,
and upside down nut position, and a no nut position. An optical sensor has a terminal
end space from the pin for direction light thereon. The terminal end of the sensor
received reflected light from the pin. A sensor control system processes the reflected
light into a signal corresponding to one of the desired nut, upside down nut, and
no nut positions.