Picture of Reverse Engineering an Electric Fence Charger
Reverse engineering something can be a great form of both entertainment and education.  I’ve often purchased items just for the satisfaction of disassembling them to determine how they function and how they are designed.  Along the way you can learn a great deal, improving your own design and debugging skills.

The unit that will be investigated and described herein is what is called an electric fence charger.  It is the unit that generates the high voltage used to drive an electric fence for containing pets or livestock.

Personally, I find anything that generates high voltage is inherently interesting.  This applies to all high voltage items in general, be they Tesla coils, stun guns, automobile ignition systems, or whatever.  Hopefully you will find this investigation interesting and educational.

Of couse, since this also means that a safety disclaimer is in order:

The device described here is powered by 120 VAC.  Excercise caution when working with 120 VAC, as contact with it can be lethal!  Unplug any 120 VAC device from power when investigating it!

The output side of this device is used to drive an electric fence, and  can generate kilovolt pulses causing pain when contacted!

Exercise extreme caution when working with any high voltage device or 120 VAC powered device! Experiment at your own risk!
Remove these adsRemove these ads by Signing Up

Step 1: An Overview of Fence Chargers

Picture of An Overview of Fence Chargers
Fence chargers come in a variety of forms.  The type you need in practice will depend on how long the fence is, what kind of animals it needs to contain, and whether or not it has to operate with weeds or other foliage contacting it.  Some are designed for battery powered operation in remote areas, and may include solar charging capability.  Others are designed to be powered by 120 V AC. 

The particular fence charger examined here is an ACC2 Fence charger manufactured by Zareba.  This is a lower priced unit, which sells for about $25 at a local store. This charger is intended for shorter lengths of fence, smaller short haired animals, and for operation only in relatively weed free areas.  This charger operates from 120 VAC.

So, here you have a low cost, off the shelf unit that generates a high voltage meant to deter an animal.  What’s not to enjoy?

Step 2: Opening up the Unit

Picture of Opening up the Unit
Time to Repeat the Safety Disclaimer:




The unit is housed in a black plastic case as can be seen in the picture.  A cord for connection to a 120VAC wall outlet protrudes from the bottom of the case.  The front of the case has two thumbscrews for attaching to the fence.  One of the thumbscrews is used to connect to a wire to a metal rod driven into the ground. The other terminal connects to the fence wire itself.

When I opened up this unit, what I found was a small circuit board with relatively few components.  The circuit board can be extracted from the case be unscrewing the thumbscrews all the way. 

The pictures show the exterior of the unit and how the PCB mounts within the case.

Some of the components have their designators marked on the PCB in white.  In creating the schematic, I have used these designators when they are present, and assigned others when none we present on the PCB.

The board is covered in what is called conformal coat, which in this case is like a fairly thick varnish.  This can add protection from moisture and condensation.  It can make probing the circuit much more challenging, as your multi meter and oscilloscope probes generally won’t penetrate the coating and contact the circuit.  I found it necessary to scratch away this coating to make good connections when probing.

Step 3: Creating a Schematic for a Product

Picture of Creating a Schematic for a Product








Step 4: Detailed Description of Circuit Operation

Picture of Detailed Description of Circuit Operation
The fence charger unit produces a very short high voltage pulse on the output terminals approximately once every 1.3 seconds.

Like many high voltage devices, this unit operates by quickly pulsing the input to a high turns ratio transformer.
In this particular device, energy is first stored in a capacitor, which is later quickly discharged through the primary of the transformer, generating a brief high voltage pulse on the secondary of the transformer.

I’ve broken the circuit into different sections based on their function.  Each is described in detail in the steps that follow.  Within each section is a schematic with the relevant components highlighted.  Refer to the schematic when reading through each section.  If the text in these schematics is unreadable as displayed, click the little "i" in the left corner, and then select either "original" or "large".

The pictures here show the top and bottom of the PCB.

Step 5: Energy Storage and Primary circuit

Picture of Energy Storage and Primary circuit
The capacitor C3 is used to store the energy to be later discharged through the transformer.  C3 is charged through R4.  Diode D2 rectifies the input AC waveform, so the cap is only charged by every other half cycle of the sine wave. 

MOV1 is a metal oxide varistor, which most likely was included for protection from high voltage transients.  It is rated for a breakdown around 300 volts.  It will conduct when the voltage across it exceeds the breakdown rating, clamping the voltage of any transient spikes to a level that is safe for the product.  The breakdown voltage is well in excess of the 168 Volt peak voltage of the 120 VRMS AC waveform, so it really doesn’t have any effect during normal circuit operation.

Note that there is no transformer used to isolate power to the unit!  The 120 VAC wires solder directly to the PCB!  The black wire is the HOT connection to your household 120 volt AC power, and it can be very dangerous or even fatal to contact it!  Normally, an AC powered  product that needs some low voltage DC for circuit operation will have a step down transformer followed by a rectifier, but not here!  This is another good point at which to repeat the safety disclaimer:




Step 6: Logic Power Supply Circuit

Picture of Logic Power Supply Circuit
This product includes some logic circuitry used to control the timing of the output pulses, which will be discussed in a later step.  The logic circuits need a stable, regulated, DC supply voltage to operate properly. 

Diode D2 recifies the 120V input . Because only a single diode is used, power is only delivered on one half cycle of the AC input.  Capacitor C2 is a filter capacitor for the power supply to the ICs. It filters out the ripple from the half wave recified input voltage.

The voltage is regulated to about 15 volts by Zener diode D1.  R1 is a large value, 680k, and is most likely used to discharge C2 when the unit is unpowered.

Step 7: Transformer

Picture of Transformer
The transformer is the part that steps up the voltage of the pulse from the primary side to the secondary side. The secondary side is where the fence is connected.  According to the manufacturers specs, the output voltage pulse is about 2300 volts.

The transformer is the large grey part visible on the top side of the PCB. The transformer used in this unit is most likely a custom part.  It is totally encapsulated, so its internal construction is unknown, but we can make some assumptions about it.  It has a primary DC resistance of less than 2 ohms, and the secondary DC resistance of about 270 ohms.  This is consistent with what one would expect, as the   transformer most likely has a primary with a small number of turns of heavy gauge wire and a secondary of many turns of smaller wire.

The measured inductance of the primary is 545uH, while that of the secondary is about 3.44H.  If the internal construction of the transformer is such that the primary and secondary coils are sharing the same amount of flux, (which is true if both coils are wound around the same high permeability core, without any magnetic shunts) then we can make an approximate calculation of the turns ratio. This can be done based on the fact that the inductance of such an inductor is proportional to the square of the number of turns.  The ratio of the secondary to primary inductances is about 6300, and so the turns ratio should be about the square root of that, giving an approximation of 79:1 for the secondary to primary turns ratio.

Step 8: Timing Circuit and Output Transistor

Picture of Timing Circuit and Output Transistor
Storage Cap and Clock.gif
Clock and first counter output.gif
The high voltage output pulses occur about once every 1.3 seconds.  The circuit timing is produced by a binary ripple counter as it counts clock pulses. 

The clock pulses for the counter are derived from the power line 60Hz waveform.  The positive half of the input sine wave produces the logic high portion of the clock pulse.  The current into the clock input pin is limited by R4 and R3. Those two resistors have a combined resistance of about 50k ohms, which would limit the current into the clock pin to only about 3mA, even at the 170 volt peak of the AC waveform.  

During the negative portion of the cycle, the input protection diodes which are internal to the counter IC clamp the input voltage on the clock input to one diode drop below ground. This is a low enough voltage to prevent damage to the part, and the IC then sees the negative portion of the cycle as a logic low.

Once the counter has counted to 64 pulses, the counter output Q6 on pin 3, the most significant bit, will go high.  This is the signal that is used to initiate the discharge of the storage capacitor through the primary winding of the transformer. Counter output Q6 is used to pulse the gate of transistor Q1 to turn in on briefly, which completes the path from energy storage capacitor C3 through the transformer primary to ground, to produce the output pulse on the secondary.

I could not read a part number off of this transistor.  There are G, D, and S markings in white on the PCB, identifying the part as a FET.  They way it is used in this circuit (with the source connected to "ground") indicates that it is an N Channel FET.

The graph shows oscilloscope waveforms of the charging of C3 (in yellow) and the “clock pulses” (in blue). Note how the capacitor C3 charges of about a 1.3 second span of time, but is then very rapidly discharged.

One interesting thing I found is that while one would expect that since the counter triggers after 64 clock cycles that it would take 64/60 or 1.07 seconds between output pulses. However, the repetition rate was observed to be about 1.3 seconds.  The reason for this somewhat longer time interval between output pulses is because until the capacitor C3 has charged to a high enough voltage, the pulses applied to the clock input will not of a high enough voltage to be recognized by the counter.

If you refer to the scope data graph, it shows how the voltage of the pulses on the clock input (in blue) increases as C3 charges.  The green trace on the graph is the least significant bit of the counter. That counter output is not connected in the circuit, but monitoring it with the scope shows the point at which the input clock pulses begin to be recognized.   Note that it does not start showing any output until after the first 12 pulses of the C3 charging cycle.  So, in actual use it takes about 76 cycles of the AC waveform between each output pulse.  As a result, the output pulses about once every 1.25 seconds.

Note that there is a capacitor, C4, in series with the gate of transistor Q1.  This is most likely used to prevent the transformer from being kept on too long.  This capacitor allows only a brief pulse to pass through to the gate of Q1, and blocks any DC.  If Q1 were turned on very long, it would see a continuous current, and either the transformer primary winding or Q1 may be damaged.  Q1 is a surprisingly small part, in a TO-92 package, and so it has a low power rating and would not withstand the current that would flow through it if it were turned on for any more than a brief pulse.

The output pulse is very brief, only tens of microseconds in length.  C3 is discharged from about 30 volts down to 0 volts in this process. 

Of course, I did have to touch the high voltage output to see how powerful it was.  It was painful, but was by no means capable of knocking me down. This is about what one would expect based on the intended application of the unit, which is designed for use with small livestock with short fur.

By no means do I encourage anyone to actually touch the high voltage output!  Exercise extreme caution when working with any high voltage device or 120 VAC powered device! Experiment at your own risk!

Step 9: Counter Reset Circuitry

Picture of Counter Reset Circuitry
Scaled Output Pulse.gif
The op amp is used as part of the circuit which produces the reset pulse for the counter IC.  The reset pulse makes the counter IC return to zero.  The counter then begins counting upward again until the next discharge.

The reset pulse is actually derived from the high voltage output on the secondary side of the transformer.  Capacitor C2, along with a small capacitance formed by PCB copper areas on opposite sides of the board from a capacitor voltage divider.  The reset pulse sets the counter back to zero, so the cycle can start again.  The op amp is configured as a unity gain buffer, and is used to buffer the signal from the voltage divider to the reset input of the counter.

The area of the PCB shape used to form the small capacitance for the divider looked to be about 2 square centimeters.  If the PCB is made from FR4, and is about 1/16 inch thick, then the capacitance will be somewhere around 3 to 6 pF.  C2 has a capacitance of 470pF, so the voltage divider ratio will be something on the order of 100 to 1.  The output waveform of the divider shows a peak of around 15 volts, so the output of the transformer may be on the order of 1500 volts.  The specs for the charger state an output voltage of 2300 volts.  My estimates of the capacitance my have significant error, as I make a number of assumptions and approximations here.

The scope plot shows the voltage across at the input to the op amp.  This is the shape of the pulse produced by the capacitive voltage divider. The high voltage output pulse delivered to the fence should have a shape very similar to this.

Step 10: Fault Indicator Circuit

Picture of Fault Indicator Circuit
The unit has a fault indicator which consists of a green LED.  The LED blinks once for each output pulse.  Under normal conditions it blinks about once every 1.3 seconds.  The LED turns on while C3 is charging, and the brightness increases until C3 is discharged. R2 limits the current through the LED.

If there is an excessive load on the output to the fence wire, such as from to contact with weeds or grass, the LED will blink at only about half the usual rate.  This is used to provide a fault indication to the user.

When there is an excessive load on the output wire, the output voltage will drop to the point where the reset pulse is not of a high enough voltage to reset the counter.  In this case, the counter will keep counting up until it rolls over, after a total of 128 clocks.  This is reflected in the LED output, which will then blink at only about one half the normal rate.  If the counter is not reset, then the Q6 output will remain high, even after it has counted to 64.  If the capacitor C4 in series with the gate of Q1 were not there, and the counter output were instead directly connected to the gate, then Q1 would be turned on until the counter overflowed back to zero.  It would then conduct for about 1 second, and it would most likely be destroyed.  So C4 is necessary to prevent that.

Step 11: Surprising Things about this Circuit Design

Picture of Surprising Things about this Circuit Design
Well, that is about it for my analysis.  I feel that I have done a fairly thorough investigation of this unit and how it works.  If you feel I have missed something or gotten something wrong, or if you have any comments or questions, please post them here. 

To conclude, I want to identify the more interesting and surprising things I found during this project:

1)There is no transformer to provide a stepped down and isolated voltage for generating the DC power.  The excess voltage is dropped across a resistor and regulated using a Zener diode.  So, if you ever work on a circuit like this, keep in mind that the dangers “HOT” lead of the 120 VAC input is present on the PCB!

2)The use of the high voltage output to provide feedback to the digital logic for counter reset was kind of a strange thing that I did not expect.  The capacitive voltage divider is used to scale down the ~2300 Volt output pulse to a level safe for input to an op amp used for a buffer. 

One thing about the reset circuit that I cannot explain is why the areas of the PCB that form the smaller capacitor of the voltage divider have such an irregular shape.  I would have expected them to have a somewhat rectangular or circular shape, but instead they are a kind of crescent shape.  I don’t know if there is any significance to the actual shape.  It would make sense that a shape would be chosen which did not have sharp corners, to prevent corona from the high voltage, but other than that I have no theory as to why the shape is what it is.  I feel that the reset circuit and what I call the capacitve voltage divider are one area where I may not fully understand the intent of the design. If you have any theories, please comment!

3)The small size of the transistor used to connect the storage capacitor across the high voltage transformer primary was another surprising aspect of the design. I would have expected a larger part, in say a TO-220 package.  The output pulse is so brief, that the transistor can apparently handle the power dissipation.

Overall, the design and operation of this unit has many peculiar and ingenious attributes.  It was definitely a worthwhile learning experience to totally wring out the design of this product. 

Alternate Uses???
There is a great deal of interest in high voltage devices for displays such as Tesla coils and jacobs ladders. Unfortunately, this device won't be of much use for those purposes.  The 2300 volt output is not suffiecient to jump much of an air gap, and so it won't make for a very impressive display. 

One possible use for the device would be as the ignition source for a potato gun.  If the output were to be applied to closely spaced electrodes, it will produce a short, brief arc.  I have not tried to use this device for such a purpose, so this is speculation on my part.

In order to use this charger from DC, the best approach would be to use a small DC to AC inverter along with a 12 volt battery.  Otherwise, you would have to create a new timing circuit, as the existing one uses the AC waveform for clock pulses.

If you have any suggestions for possible alternate uses for this device, please comment!

alemail1231 year ago
excellent post and education, I thank you
That was most interesting, thanks! I am as well intrigued by the capacitive divider on the high voltage side, something to remember. But no, i am ignorant of the crescent shape reasons...

Another use of the circuit might be a power supply for Geiger tube circuit? You would run the input at a lower AC voltage, and rectify and regulate the secondary voltage to what is needed ( in this case, I am thinking of the 900Vdc or so tubes), and since they require very little current, Bob's your uncle. You might be able to control the dc voltage on the secondary by pre-loading the pulse counter on the primary as well, if this particular counter accept such operation.
jukees2 years ago
LargeMouthBass (author)  jukees2 years ago

if you dumped that huge voltage through a coil of wire you could probably make a coil/rail gun.
deaks3 years ago

LargeMouthBass (author)  deaks3 years ago
Sharp_Tack3 years ago
Well done. Interesting design uncovered.
TABULLO3 years ago
Ever tried to reverse engineer one of those inversors that activate the laptop backlight? Good instructable, souds ike you have fun doing it and that's great.
Fantastic post! I've had an accoutn on the site for a couple of years and have never commented. This was a wonderful, extremely well explained instructable. I've tried what you've done here with dollar store electronics for fun but this is well beyond any level of detail I've applied to reverse engineering those items.
Very good stuff, I am inspired.