Mothballs Outside Your Trashcans
Scatter mothballs around on the ground near your trash cans, if you do not mind their presence in plain sight. This is more effective than placing them inside the trash cans, as it also acts as a preventative measure against raccoons getting inside. You may also sprinkle large bags of naphtha flakes around the trash cans to repel raccoons. This option may be less unsightly. Using mothballs outside of the trash cans is only recommended provided you are not bothered by the scent yourself. Keep the treated trash cans away from the general entrances of your home to minimize exposure to the scent if it bothers you.
Mothballs Inside Your Trashcans
Place an opened bag of mothballs at the bottom of your trash cans if you do not want the loose materials around your home. Feel free to scatter the mothballs throughout the bottom of the trash cans if you do not mind cleaning it up later. Large trash cans may require several bags of mothballs, as you will need enough mothballs to create an odor stronger than that of the trash to effectively deter raccoons. Otherwise, raccoons may not smell the mothballs until they are close enough to consider tipping over your trash cans, which is a popular raccoon tactic.
Tips and Warnings
Latch your trash cans closed. While raccoons are crafty animals, they will not be able to rummage through your trash if the lid is secure.
Do not confront or attempt to trap raccoons. Make loud noises from a safe distance by banging pots and pans. Raccoons are generally non-confrontational, but may attack if cornered or threatened.
Do not feed raccoons. Feeding raccoons makes them bold around humans, which encourages them to invade your space. This may exacerbate trash can attacks.