# A simple electric fence idea

#### wingnut

Aug 9, 2012
259
Hello all

I was wondering if one could make a simple electric fence to keep out animals by using AC from the mains (220V 50 Hz) and simply adding a resistor and a capacitor in series, as shown in the attached circuit. Where the switch is I would have two wires along the fence and the animal would close the circuit.

I was wondering if just having a capacitor to limit the power, but allowing 220V through to the fence would do the job. It looks OK to me, but one does not know what one does not know.

#### Attachments

• Screenshot 2022-07-16 at 18.49.10.png
37.9 KB · Views: 13

Moderator
Nov 8, 2019
2,642

#### crutschow

May 7, 2021
467
That's a little too simple.
A fencer powered directly from the un-isolated 220Vac is inherently dangerous and not allowed.

Also the electrical power should be periodically interrupted (typically about once per second) to allow the person/animal to escape the fence.

Below is the LTspice simulation of a fairly simple and relatively safe line-powered electric fencer.
It is a capacitor discharge type which uses a dual output (waste-spark) ignition coil to generate an isolated HV pulse output.
These coils can likely be found at an auto salvage yard or purchased new.
(Do not use a standard single-output coil as they provide no secondary isolation from the mains.)

Capacitor C2 is charged with DC from the main's voltage through current limiting capacitor C1 (peak limit of about 100mA) and rectifiers D1 and D2.
When C2's voltage (green trace) reaches about 80V (after about a second), Zener D4 conducts, causing Q1 to turn on and fire SCR U1.
This rapidly discharges C2 through the coil primary, generating a near 8kV pulse (no load) at the output (yellow trace).

The spark energy is over a Joule, which should be enough to discourage most animals.

(Unless you are in the competition for a Darwin award, please observe all the below safety precautions)--

The unit must always be powered from a GFCI outlet to help protect against accidental electrocution. (A GFCI plug for the fencer, such as used on some hair dryers, would be the safest.)

Note that all the electronics are connected to the mains, so make sure the circuit is well isolated from any metal chassis and no part of the circuit (except the coil output) is connected to earth ground.

And use great care when working on the live circuit (use only one hand anywhere near it).
Connecting a line-powered oscilloscope to it, for example, will likely result is some spritzen sparken and blown parts.

Last edited:

#### CircutScoper

Mar 29, 2022
290
That's a little too simple.
A fencer powered directly from the un-isolated 220Vac is inherently dangerous and not allowed.

Also the electrical power should be periodically interrupted (typically about once per second) to allow the person/animal to escape the fence.

Below is the LTspice simulation of a fairly simple and relatively safe line-powered electric fencer.
It is a capacitor discharge type which uses a dual output (waste-spark) ignition coil to generate an isolated HV pulse output.
These coils can likely be found at an auto salvage yard or purchased new.
(Do not use a standard single-output coil as they provide no secondary isolation from the mains.)

Capacitor C2 is charged with DC from the main's voltage through current limiting capacitor C1 (peak limit of about 100mA) and rectifiers D1 and D2.
When C2's voltage (green trace) reaches about 80V (after about a second), Zener D4 conducts, causing Q1 to turn on and fire SCR U1.
This rapidly discharges C2 through the coil primary, generating a near 8kV pulse (no load) at the output (yellow trace).

The spark energy is over a Joule, which should be enough to discourage most animals.

(Unless you are in the competition for a Darwin award, please observe all the below safety precautions)--

The unit must always be powered from a GFCI outlet to help protect against accidental electrocution. (A GFCI plug for the fencer, such as used on some hair dryers, would be the safest.)

Note that all the electronics are connected to the mains, so make sure the circuit is well isolated from any metal chassis and no part of the circuit (except the coil output) is connected to earth ground.

And use great care when working on the live circuit (use only one hand anywhere near it).
Connecting a line-powered oscilloscope to it, for example, will likely result is some spritzen sparken and blown parts.

View attachment 55633

Looks like a good circuit, but one modification might be a useful safety measure. The C1, D1, D2 voltage doubler has the ability to charge C2 to ~680V if L1 should fail open-circuit or the SCR circuit otherwise quit.

The resulting possibility of grossly over voltaging C2 and provoking a 90J explosion suggests an independent voltage limiter (e.g. a 1N5378B 100V zener in parallel with C2) might be worthwhile.

#### Minder

Apr 24, 2015
3,275
You can obtain the automotive ignition coil from a local wrecker, the modern ones are isolated versions, also known as waste spark type..

#### CircutScoper

Mar 29, 2022
290
...a dual output (waste-spark) ignition coil...

View attachment 55633

Just as a random-factoid thing: "Waste-spark" coils aren't really designed to waste sparks, but rather so that each coil can serve two engine cylinders operating one crankshaft rotation out of phase, thus halving the number of coils required. They came into fashion when distributors fell out.

#### Minder

Apr 24, 2015
3,275
Both spark plugs fire. but one of the cyl is on the exhaust stroke, hence 'Waste' spark.
I just built a successful E.Fence. using one such coil, works like a charm.

#### crutschow

May 7, 2021
467
The C1, D1, D2 voltage doubler has the ability to charge C2 to ~680V if L1 should fail open-circuit or the SCR circuit otherwise quit.
The Q1, D4 combination will actually limit the voltage to below 90V if the SCR fails open (I view the chance of the primary of the auto coil failing open rather remote.)

But an added Zener to protect the circuit is probably a good idea.

#### wingnut

Aug 9, 2012
259
Thank you all so much for the good advice and for all your effort. When I build it, if there are further questions I will get back to you. One again, thank you so much.

#### hevans1944

##### Hop - AC8NS
Jun 21, 2012
4,739
I think @crutschow has presented a pretty good DIY "fencer" circuit, but for safety reasons I would use a transformer to isolate the circuit from mains power.

Perhaps two filament transformers wired "back-to-back" would serve this purpose, rather than an expensive "purpose-built" isolation transformer. Or perhaps a control transformer (used in instrument panels) with two 24 volt secondary windings and a 240 volt primary. These are often made in symmetrical forms with two primary windings and two secondary windings. Back in the day, you could find power transformers in every discarded defunct television. You can still find used transformers inside discarded microwave ovens, but you will need to remove the high-voltage secondary winding (usually with a hack-saw) and wind your own lower-voltage replacement secondary to get approximately a 1:1 ratio between the primary and the secondary.

#### Minder

Apr 24, 2015
3,275
Using the waste-spark type of coil assures isolation, the secondary is rated at 30Kv.
I used a mains step down transformer for the 12v -15v DC, so virtually dual isolation from the mains.
Two consecutive pulses, every second.

#### crutschow

May 7, 2021
467
for safety reasons I would use a transformer to isolate the circuit from mains power.
Only for the person that is building and testing it, if they feel uncomfortable working on a main's circuit.
As Minder noted, the waste-spark dual output coil will provide isolation from the mains to the output.

#### hevans1944

##### Hop - AC8NS
Jun 21, 2012
4,739
Only for the person that is building and testing it, if they feel uncomfortable working on a main's circuit.
As Minder noted, the waste-spark dual output coil will provide isolation from the mains to the output.
You and @Minder are both correct of course. But I, or the DIYer who builds this, SHOULD "feel uncomfortable working on a main's circuit." The Government uses a mains circuit to execute criminals, albeit a bit more thoroughly than the average DIYer hell-bent on winning a Darwin Competition.

It's hard to believe that early in the 20th century, induction coils were used to deliberately administer shocks through both hands and the upper body, as a show of manly strength. You inserted a penny in a slot in the machine, then gripped firmly two vertical metal handles and tried to rotate one handle. Doing so, slowly removed a soft-iron cylinder surrounding the induction coil and "shorting out" its magnetic field. As the iron cylinder moved off the coil, the intensity of the voltage applied between the two handles increased to almost unbearable levels, but the longer you could hold on and twist the handle that controlled the movement of the cylinder, the "better" man you were. I remember seeing one of these machines in a popular skating rink that I visited from time to time, hoping to impress a local female classmate by learning how to skate. I knew from reading The Boy Electrician, by Alfred P. Morgan, how these infernal devices worked, so I avoided the older crowd lined up to "prove" how strong they and the machine were. Never did see any pretty young girl try to "prove" how strong she was with this machine. Which was one of my first Life Lessons on the differences between men and women.

#### CircutScoper

Mar 29, 2022
290
You and @Minder are both correct of course. But I, or the DIYer who builds this, SHOULD "feel uncomfortable working on a main's circuit." The Government uses a mains circuit to execute criminals, albeit a bit more thoroughly than the average DIYer hell-bent on winning a Darwin Competition.

It's hard to believe that early in the 20th century, induction coils were used to deliberately administer shocks through both hands and the upper body, as a show of manly strength. You inserted a penny in a slot in the machine, then gripped firmly two vertical metal handles and tried to rotate one handle. Doing so, slowly removed a soft-iron cylinder surrounding the induction coil and "shorting out" its magnetic field. As the iron cylinder moved off the coil, the intensity of the voltage applied between the two handles increased to almost unbearable levels, but the longer you could hold on and twist the handle that controlled the movement of the cylinder, the "better" man you were. I remember seeing one of these machines in a popular skating rink that I visited from time to time, hoping to impress a local female classmate by learning how to skate. I knew from reading The Boy Electrician, by Alfred P. Morgan, how these infernal devices worked, so I avoided the older crowd lined up to "prove" how strong they and the machine were. Never did see any pretty young girl try to "prove" how strong she was with this machine. Which was one of my first Life Lessons on the differences between men and women.

Speaking of "shorting out," I wonder how many manly "Boy Electrician" readers contrived to conceal a length of stout copper wire spanning the distance from the palm of one hand, through the sleeves and back of their jacket, to the palm of the other?

Imagine how impressed the crowd would have been, seeing the cloud of smoke billowing above the "infernal" inductor.

#### hevans1944

##### Hop - AC8NS
Jun 21, 2012
4,739
Speaking of "shorting out," I wonder how many manly "Boy Electrician" readers contrived to conceal a length of stout copper wire spanning the distance from the palm of one hand, through the sleeves and back of their jacket, to the palm of the other?

Imagine how impressed the crowd would have been, seeing the cloud of smoke billowing above the "infernal" inductor.
Ha! Ha! I never thought about doing that! But I doubt there would have been any smoke... those early induction coils could barely generate enough spark to keep a Ford engine running. I took one to school once, hidden inside a shoe box with a 6 volt screw-terminal lantern battery and a concealed push-button switch. They were called "Ford Coils" back in the late 1950s and were delivered via mail-order in a nicely-crafted wooden box with two high-voltage button electrodes on top of the box and an adjustable interrupter contact on the end. You had to supply your own capacitor if you didn't want the contacts to wear out too quickly from arcing. I could "electrify" a whole row of theater-style chairs, where I was forced to attend a "music appreciation" class because there was no real classroom available. Fun times in that school, but I never got caught!

#### CircutScoper

Mar 29, 2022
290
Ha! Ha! I never thought about doing that! But I doubt there would have been any smoke... those early induction coils could barely generate enough spark to keep a Ford engine running. I took one to school once, hidden inside a shoe box with a 6 volt screw-terminal lantern battery and a concealed push-button switch. They were called "Ford Coils" back in the late 1950s and were delivered via mail-order in a nicely-crafted wooden box with two high-voltage button electrodes on top of the box and an adjustable interrupter contact on the end. You had to supply your own capacitor if you didn't want the contacts to wear out too quickly from arcing. I could "electrify" a whole row of theater-style chairs, where I was forced to attend a "music appreciation" class because there was no real classroom available. Fun times in that school, but I never got caught!

Long decades ago, a CalTech pal and I got into an (only moderately drunken) argument about how train crossing signals detected the presence of an oncoming train. He maintained it involved sensing weight while I voted for a simpler method based on electrical conductivity between the rails.

So off we went (I forget how much  was on the line) to a nearby crossing on Colorado Blvd. with a length of 10AWG in hand.

I won.

Tied up traffic for quite a while as I remember before we got bored and headed off to other "adventures."

Also didn't get caught. Or run over.

#### crutschow

May 7, 2021
467
Since there is a possibility of overvoltage being generated on capacitor C2 if there is a component or wiring error, I recommend the following when you do your first "smoke test":

Connect a battery powered multimeter set to the 100-200V DC range and connect it across C2 with clips so you don't need to be touching anything.
Apply AC power to the circuit and watch the meter voltage.
It should get to about 80V in 1 second and then drop to zero as the spark is generated.

If it goes over 90V, quickly unplug the circuit.
Wait for the voltage to drop to a safe voltage, and then troubleshoot for the circuit error.

#### CircutScoper

Mar 29, 2022
290
Since there is a possibility of overvoltage being generated on capacitor C2 if there is a component or wiring error, I recommend the following when you do your first "smoke test"

A practice I adopted in days of yore was to do every first smoke test of any line-powered gadget with AC supplied from a Variac (or similar) autotransformer slooooowly dialed up from zero while checking supply voltages and copiously and continuously sniffing.

Saved a lot of rework. And smoke. And flames. And terror.

Last edited:

#### CircutScoper

Mar 29, 2022
290
...
Wait for the voltage to drop to a safe voltage, and then troubleshoot for the circuit error.

Good idea! And be sure to leave the multimeter connected while you're waiting.

That way, loaded by the meter input resistance, C2 should take "only" a couple of hours to bleed down (I.e, RC ~ 10M x 470uF = 4700 seconds).

Otherwise, it could take weeks.

Last edited:

#### CircutScoper

Mar 29, 2022
290
If it goes over 90V, quickly unplug the circuit..

"Quickly unplug" is right! With only ~1/10th second between 80V and 90V, seems a pretty good reaction time would be needed to use this method!

Replies
1
Views
703
G
Replies
7
Views
1K
ehsjr
E
Replies
16
Views
299
Replies
3
Views
447
Replies
2
Views
597