Connect the ground wire to the green screw on the opposite side of the switch. The switch comes first in the new part of the circuit and new 2 wire cable is run to it from the outlet.
Light Switch Wiring Electrical 101
How to install a new light switch box. Screw on the switch plate and turn on the power. Strip the ends of the wires at the switch box. Wiring a new switch and light from an outlet in this diagram power is taken from an existing wall outlet for a new switch and light fixture. Figure 3 old work electrical box. All of the connections in the switch box can be made prior to turning any power off. Loop the black wires clockwise around the screws and tighten the screws.
Push the new wired switch back into the electrical box and screw it in place. Wrap a little more than 12 inch of the stripped wire clockwise around the terminal screws and tighten with a screwdriver. Connect the ground wires with a 6 in long pigtail wire leading to the switch. Place switch in the wall box. Covering all bare wires and terminals with electrical tape ensures safety. From the switch new 2 wire cable is run to the new light location.
In the tutorial how to install an electrical box in an existing wall we provide detailed photo rich how to instructions on easily installing the old work electrical box. Connect the black wire to the brass screw and the neutral wire to the silver screw. Gently bend the wires and push the switch into the wall box. Run a 142 ground cable from the switch box to the electrical box where the light fixture is located. Screw a wire cap onto the pair of white wires and connect the twisted together. Connect each of the black wires to one of the brass switch terminals and tighten the terminal with a screwdriver.
Connect the neutral white wires with a wire connector. If the existing switch has a green ground wire attach the wire to the green screw terminal on the new switch or to the electrical box. Wrap the body of the switch with electrical tape. Included in the tutorial are tips for making the box installation go much smoother and faster so you will be up and running quicker. Installing an old work electrical box.