Arduino measuring high-voltage electric fence

I would like to know if someone has experience with measuring high voltages using an Arduino.

I know you can use resistors to lower the voltage, however.

I want to be able to measure the pulses of an electric fence used to prevent farm animals from escaping. These pulses are high-voltage and will not always be a similar voltage. I want to read these voltages, to scan for differences.

So, I wondered if someone has done something like that, and if the Arduino gets weird when it gets a voltage above 5V at a low amperage on its analog port.

--here some possible solutions for those wanting to know the answer-- -mostly based on comments and answers below-

• Using resistors as a voltage divider while keeping an eye on the maximum spark gap distance and capacitive coupling.
• using a transformer/coils to reduce the voltage.
• using a high voltage probe to measure it.
• using neon bulbs or other light sources to measure it.
• charging a capacitor and measuring discharge time with high resistance(only works for the total power)

-this list is meant as a summary of what is discussed further ideas and solutions are still welcome-

• Duh, that's typically a couple thousand volts. I fear a simple resistor won't do, since the voltage is high enough to cause severe interference or jump trough the air. And that would destroy your equipment quite spectacularly.
– PMF
Feb 3 '21 at 14:25
• I don't think that the high voltage is the problem. I grew up on a farm in Germany and There were many occations to experiment with el. fences, when I was a child ;-). The voltage is not high enough to "jump" over more than a fraction of a millimeter, and that only with a perfect ground. I would say the only thing that jumps is the farmer if, he touches the fence. Yes, I've tried it. Yes, I jumped. Feb 3 '21 at 15:12
• If you are fit in electronics, build a voltage devider with two high watt, low value resistors. Add a peak detektor to it and meassure the voltage with your arduino. Use a 5V Zehner diode to protect the Arduino pin from high voltage. Zehner diodes are slow, so you might want to use N shottkey diodes that add to about 5V. Feb 3 '21 at 15:13
• i think that you can buy a fence tester that contains a neon bulb ... use a photo sensor to detect the light from the lamp Feb 3 '21 at 16:05
• Typically you would use a long chain of resistors. The voltage across each one is then below the maximum rated voltage for that individual resistor (and any distances involved). However a transformer may be a better solution to give galvanic isolation.
– Majenko
Feb 3 '21 at 16:31

You are talking about measuring 2kV to 10kV pulses, with about 1J to 5J of energy per pulse.

The maximum current may be very low, but the voltages you want to measure are very high, and will very probably damage your Arduino without proper measures.

You will at least need a voltage divider to reduce the voltage the Arduino sees to 5V (or 3.3V for some Arduinos) to be able to make a measurement with the Arduino's ADC.

The voltages are high enough to bridge a fair distance with a spark; they could well bridge a physically small resistor or the distance between two connections on your breadboard or PCB.

To be honest, I think you shouldn't go anywhere near such voltages with an Arduino, unless you know exactly what you are doing when preparing the signal for an Arduino's ADC pin.

• Consider purchasing a high voltage probe for a VOM. They are very high in resistance, if you go low you will drain all the energy out of the fence. Nice part they are designed for this type of voltage, not a kludge device. This would go in series with a load resistor then measure the voltage across the load resistor which has one end grounded to the fence ground. International code limits the voltage to 10KV some countries it is lower.
– Gil
Feb 3 '21 at 17:29
• I think perhaps I might make a transformer like some have told in the comments, and then use a divider with extra isolation. some peak detection would be great however in a way where it would only pass through the highest differences. I was also when starting to think about this project thinking about designing my own computer for it or using analogue equipment, however, I thought that Arduino would be great to use because I can also easily perform all other kinds of instructions. Mar 4 '21 at 14:37
• @Gil I will try that, I have some laying around anyway so testing it would be great. I might also try making a custom one since that would make it more readable and less tape and wire. Mar 4 '21 at 14:41

When you say 'scan for differences', do you mean differences along the fence, or something else? Do you plan to use the Arduino as a portable voltmeter? If so, buying a HV probe for a standard voltmeter sounds a lot more practical.

However, if you plan to install multiple sensor points along the fence so that you can continually monitor pulse amplitudes along the fence, then that is a different kettle of fish, especially if you are thinking about outdoor use over a long fence length.

Can you elaborate a bit, please?

• I mean to use a system similar to an electric fence. but more compact and coil like to use the self-inductance to measure changes in nearby metallic or water like objects. since in versions where I manually feel for the differences in shock values it seems to respond really good to metals where a simple coil would give clearly feelable different shock intensity when I introduced small metal objects, at ranges my commercial metal detector can not even detect them. Mar 4 '21 at 14:33
• Note that the coil I use at the voltage and the maximum allowed charge and discharge time cycle is tuned to be rather safe even when put in massive cast iron. I would of course not recommend anyone to use its hands at a high voltage circuit, especially when not sure it is tuned properly to around half of the intentionally dangerous values. Mar 4 '21 at 14:57