Located the home's main breaker box and turn off the circuit breaker that controls the light switch. If you are in doubt, turn off the main breaker.
Remove the cover for the light switch by removing the screws. Use the screwdriver to turn the screws counterclockwise.
Remove the two screws securing the light switch to the wall.
Touch a non-contact voltmeter, available from most hardware stores, to the plastic covering the wires. If a light turns on, there is electrical current in the wire and you need to turn off the right circuit breaker in the breaker box.
Wrap masking tape around the wires extending out of the wall, noting to which end of the light switch they were attached. Remove wire nuts from the wires and untwist the ends. If there are no wire nuts, loosen the screws holding the wires to the light switch.
Strip a quarter inch of the plastic from the motion sensor switch. Put wire nuts around the red and yellow wires as these are used only for three-way switches.
Attach the black wire of the switch to the hot wire coming from the wall. Attach the red wire to the black wire coming from the wall. Connect the green wire to the bare copper wire coming from the wall. Make all connections using wire nuts.
Turn on the power and test the motion sensor. Turn off the power again and wrap the wire nuts with electrical tape to keep out any water that may get into the box. Push the light sensor into the box and tighten down the screws.