I am designing a circuit that will sense an electric fence shock generator.

In my first prototype, it worked very well, except in the time the shock generator creates a spark, when it produces a lot of interference in my sense circuit. It seems to me that the wires that connect my circuit with the generator are carrying a lot of noise inside my PCB and I am looking for advices for how to reduce it. More details about my circuit below:



simulate this circuit – Schematic created using CircuitLab

Real picture:

Real picture of the circuit in the moment of the spark

The PCB has two pairs of wire connections: The power supply, a 12V sourced by the shock generator circuit and the wires that came from the electric fence, with are connected to an optocoupler.

The signal generated by the optocoupler is processed by a digital circuit, which is experiencing a lot of false clocks and triggering in the moment a spark is generated in the fence.

I tried to start an investigation about what was happening and I almost concluded that the noise has been carried by the wires, because I put a scope probe with both terminals shorted together in the nearby of the wires and I found this: Signal in the scope, when probe's terminals were shorted together

I have repeated this test far away from the wires, but I did not obtained this results.

The image below is the noise in a track which work as a clock in the digital block:

enter image description here

As the image above indicates, the circuit has a lot of false clock that are may causing the erros I have mentioned. However, I feel I can not trust 100% in my scope in such high frequency. As a counter test, I tried to watch the voltage in the supply pins of the microcontroller of the shock generator (this part is working very well) and I obtained the following image:

enter image description here

If this was the real voltage across the supply pins of the microcontroller, I think it would burn in less than one second, as its maximum voltage was 5.5V and it has spikes grater than 8V (maximum values not shown in the scope snapshot).

Anyway, it seems to me that I can trust that I have a lot of noise inside my PCB, but not generating so much voltage as it is showed in the images above.

Finally, the questions:

  1. Am I right to think that the noise is propagating via wires and not via the air?
  2. If yes, how could I workaround it and decouple it in a proper manner? --> In the second version of the prototype, I am planning to use ferrite bead in the PCB entrances; RC low pass filters in some sensitive tracks (dont care about slowing down the signals); isolate the High Voltage block in one corner of the PCB and put a guard ring around it; What is your opinion about it?

Information that can be helpful: Voltage rating of the shock generator: 10kV; Distance between High Voltage block and digital block: 3cm;

EDIT Waveform of the HV pulse generated in the fence (the maximum amplitude is around 10kV);

enter image description here

This pulse happens once in a second. But this was captured in the case when the spark does not happen. I don't have the waveform of this case, but I believe that the dV/dt will be much greater in this case.

  • 6
    \$\begingroup\$ FWIW, that construction is about as poor as possible for EMC. And sparks are one of the worst possible interference sources. Both conducted and radiated coupling are likely with that design. \$\endgroup\$
    – The Photon
    Commented May 19, 2017 at 16:39
  • \$\begingroup\$ I little more information would help. What exactly does the "Electric fence" connection do? How is the high voltage applied... continuous.. on demand... what? \$\endgroup\$
    – Trevor_G
    Commented May 19, 2017 at 16:39
  • 1
    \$\begingroup\$ I agree with @ThePhoton, it's likely both and you are wide open to ambient noise in general, fences make great antennas and lightning storms is a real issue. \$\endgroup\$
    – Trevor_G
    Commented May 19, 2017 at 16:41
  • 1
    \$\begingroup\$ Is your resistor rated to withstand 10 kV? Is your opto rated to withstand 10 kV? Are the tracking surfaces of your PCB rated to withstand 10 kV? Are your copper clearances rated to withstand 10 kV? It doesn't look so. \$\endgroup\$
    – Andy aka
    Commented May 19, 2017 at 17:38
  • 1
    \$\begingroup\$ LOL! Unless your resistors are HV rated, they will fail to short/lower resistance if you leave it running. Please don't play with HV unless you know what you are doing. The fence generator will limit the current so no one will get killed this time. \$\endgroup\$
    – winny
    Commented May 19, 2017 at 18:18

2 Answers 2


There are a few things you need to learn;

1) how to probe down to minimum rise time of scope , especially near radiated pulse noise.

2) what does EMC mean?

3) How is Common Mode (CM) interference avoided with balanced wire pair?

4) What is a Balun or CM choke?

5) Different types of Baluns as diverse as capacitors for different frequency ranges and currents.

  • Where are they used?
    • All Laptop charger DC cables 10k~10MHz range
    • All VGA cables 1~150MHz BW
    • Some electret mic cables
    • some power cords

What is the simple diagram? enter image description here

What is the real diagram?


simulate this circuit – Schematic created using CircuitLab

So depending on materials of iron or ferrite core and number of turns from 1 to N and ferrite mix from insulative LF to MF to conductive ferrite for RF with more metal particles.

  • the model values will change.
  • Often a CM choke or CM ferrite bead just says 100 Ohms meaning lossy in band of interest.
  • an ethernet Balun does same job as a YAGI Balun in "fundamental" theory, but for different f , and Zo so they look completely different

5) Learn how to search for pre-existing answers on web and in this forum ( locate the search window and experiement with different keywords, tags and user names like user:me in search finds ...yourself or by exact username user:joeblow or number user:17574 (that is I)

6) Understand that short arcs have spectrum all the way up the antenna length that fits in that length and then all the harmonics of this

  • so lets just say way beyond a GHz for now for a short arc from fence to target.

7) understand the spectrum of the noise interference ( and stray impedance to problem area)

  • Lets look at your clean 10k Pulse and assume the rise time is say 1us with 50us pulse duration then a sine wave roughly 350us , So we have almost 500MHz rise time 50KHz 1/2 pulse duration then 1 sine wave of about 3Khz
    • as you said this causes no problem
    • so that means the energy of interference is way beyond 500MHz but maybe only say some xx nanoseconds rise time.

Now which kind of Ferrite CM choke can you get?

I forgot some OP's may not want to actually learn just want a crystal ball solution.

Things to do:

  • make sure all sensor electronic circuits are far away from the HV generator and twisted pair wires going to the fence at right angles to the sensor STP wire pair shielded . Keep at least 10m away from the generator and wire pair to fence.

    • STP shielded twisted pair balances much of the spectral E field ingress and isolation distance reduces the H field current coupling
    • generator and sensor wire pair at right angles reduces the antenna coupling of EMI pulses between 2 wire pairs.
    • use a current loop around the generator feed wire with a few turns to detect high current pulse as your air gapped current sensor into coax or STP sensor wires.
    • terminate the wires with matched impedance such as 120~220 Ohms or STP or 75 Ohms for video coax,
    • use a CLC balun or CM choke rated for RF as your signal conditioner input. This raises the CM impedance and the shunt cap attenuates it slightly.
    • What you want is a 1us risetime pulse and not a 1ns Rise time pulse that spews noise voltage into sub-picofarad stray capacitance.
    • terminate it with the matched impedance
    • add more current sense wire turns or use a Rogowski coil if you are really keen but not necessary.
  • I have used these techniques successfully over 40 years in many applications

  • My 1st experience in late 70's was measuring the power of 100kA fusion arc welding of Zirc-steel tween two 4"Diameter tube
  • My most recent experience was measuring pulse power of a 20kV pulse inside transformer oil like a HIPOT test before the onset of corona in a 5MVA power transformer.

The pulse measures only 2 watts or 10V into 50 Ohms from a 20kV/mm dielectric test using a small 1 turn loop to coax.

enter image description here

(not I, but a keen builder of HV multipliers.

This is a small partial discharge pulse measured using the above method on 50 Ohm coax terminated by 50 Ohms, similar to a small fence discharge or a Hipot bug zap. I used an old LeCroy scope to capture the image. The 1ns rise time is limited only by the scope.

enter image description here

  • \$\begingroup\$ Forgive my Spectral Density analysis of pulses. I've done this so many times I have the transform in my head. \$\endgroup\$ Commented May 19, 2017 at 22:15
  • \$\begingroup\$ Hi @Tony, thanks for your massive reply. I think it is a good introduction for me in this subject. I have a few question about it: Can you explain me better how did you measured the 20kV inside the transformer? I am not sure if a got the method. How did you reduced to just 10V? And following this subject, you ask me to terminate my input path with a matched impedance, like 75/120~220 Ohm. However, I have a 10kV pulse. So, it is not possible in the topology I have for now, as the input wire pair are directly connected to the fence. \$\endgroup\$ Commented May 22, 2017 at 18:29
  • \$\begingroup\$ I noted that you told me to make a loop around the fence wire. However, it does not have a big current in the normal operation. Just in the case of something touching the fence, it generates the spark. However, normal operation won't allow me to sense it pulse by using just a loop around it. But I will take a look on that \$\endgroup\$ Commented May 22, 2017 at 18:32
  • \$\begingroup\$ use coax terminated with R for squarish pulse otherwise detect high Z ringing voltage with Shottkey diode and buffer with peak follower. and NB read my links. \$\endgroup\$ Commented May 23, 2017 at 17:49

That PCB is single layer. Using thru-hold components and a double-sided PCB, I bet you can implement solid-one-side-GNDplane.

Your first waveforms show ringing in 100MHz (10 nanosecond) region. That could be scope-probe. On the other hand, at 100MHz, a plane should produce 8.6dB * sqrt(100MHz / 4MHz) = 8.6dB * 5 = 43dB attenuation of magnetic-field injected interferers.

  • \$\begingroup\$ Ground plane is a start, but you still have to deal with the fact the circuit is intended to be connected to a large ungrounded metal structure. \$\endgroup\$
    – The Photon
    Commented May 19, 2017 at 19:07
  • \$\begingroup\$ Hey guys and @ThePhoton, the 1st waveform is a shorted 10:1 probe probably rated for 200MHz. The long ground wire loop and cable capacitance results in this 100Mhz ringing into 10 MOhm load. Good signal, bad noise. It should look like my waveform. \$\endgroup\$ Commented May 19, 2017 at 23:23
  • \$\begingroup\$ Hello @analogsystemsrf. Thanks for your reply also. About the ground plane: If I made the solid-one-side GND plane, I should make a clearance between it and the High Voltage side of my PCB. How this solid plane will help reducing the commom mode interference in the system? It will be intended for providing the shortest return paths for the signals or it acts like a massive guard ringing/shielding for the noise that came from the outside? I would be glad if you could explain me about it, especially the background of the formula you used. External links are welcome if you want! :) \$\endgroup\$ Commented May 22, 2017 at 18:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.