DIY electric fencing is a tricky business and if you get it wrong, you end up going to jail when you kill or injure a neighborhood tyke. Buy one if you want to go that way, they are not very expensive and they are proven safe.
An alternative is to sprinkle cayenne pepper all around the areas you want to protect. It
has no effect on birds and reptiles, but mammals get it on their paws when they walk around and things like badgers and raccoons who eat with their paws get irritated by the
capsicum and eventually learn to stay away. Badgers are also usually chasing moles, gophers or voles in your garden. The cayenne will drive them away too and the badgers will stop badgering you!
__________________
** All I every really wanted to be, was... A LUMBERJACK!.**