Measuring voltage on electric fance

Hello there,

I am working on my final assignment for my degree and would like to measure the voltage on an electric fence. I know it has a high voltage — approximately 9kV down to 0V — but I’m not sure how to safely read that using my ESP32 microcontroller. I've been looking into various sensors and current transformers (CTs), but since I don’t have much experience in electrical engineering, I would really appreciate your feedback or any ideas that could help me successfully complete this task.

Congratulations, what degree will that be?

Will you measure the voltage directly at the output of the High voltage supply?
Which ESP32 will you be using?

This probe has 1000:1 attenuation so a 10Kv input will provide 10V out so you still need to decrease the voltage for an ESP32.

I highly recomment that the ESP32 be battery powered or powered by an isolated supply with high voltage isolation or powered by a battery powered laptop.

Could be higher or lower, depending on what animals it's rated for.

My recommendation would be a 1Mohm 2000:1 voltage divider with a 5V zener across the input for additional safety. However, I don't remember what the Arduino analog input impedance is so the output impedance of the divider might affect the accuracy.

You sure you don't want to do a simpler project?

Here you can find one implementation quite well documented

Degree of Computer and Information Science

yes i'll be measuring directly at the output.
I am using ESP32 wroom 32 and it will be powered by its own battery yes.

The electric fence is designed for use with cows, and I checked that it can reach up to 9kV.
I chose this project because it's something I can actually use at home, rather than just being thrown away after I graduate.

You need to be aware that the 9kV isn't present all the time.

The voltage is in narrow pulses, typically one per second.

Measurement will be much easier when the fence charger is connected to a very long wire fence as that acts as a capacitor to store the charge for a bit longer. The charger may also have something to discharge the fence wire. That is the click you hear!

I don't have much hands-on experience with high voltages but I can give you some basics...

Do you know Ohm's Law? It defines the relationship between voltage. resistance, and current. Resistance is "the resistance to current flow". Current = Voltage / Resistance.

The importance here is that the current is limited (I don't know to what...) so that you don't kill a cow or a person. :wink: The result is that the resistance is (relatively) low, like a soaking-wet person touching the fence, the voltage will drop.

If the resistance of your measurement setup is too low, the voltage will drop. And if the fence is battery powered the battery will drain faster if the measurement setup is connected continuously.

I won't attempt to estimate the needed resistance but it will be in megohms.

A voltage divider can be made from two resistors. BUT with these high voltages you might get arcing across the "top" resistor which "sees" most of the voltage. The solution would be to replace that top resistor with more than one resistor in series, with a bit of wire-length between them. The voltage will also be divided among those resistors and an arc is less likely over the longer distance.

And even though we have a voltage divider, "unexpected things" can happen when dealing with voltages higher than 3.3 or 5V so I recommend an Over-voltage Protection Circuit for the microcontroller.

A high voltage probe like the one shown will use a resistor in the range of 600 megohms. That resistor is about 8 inches long so the high voltage does not arc or creep across it to cause inaccurate readings.

High voltage resistors are a common part and much safer than making your own.
Leo..

9 kV sounds like the typical encounter when you enter a server room. :upside_down_face:

Hello,
i am working on project where i want to detect if electric fence has impulse of 5kV or more (otherwise fence is unstable and it needs checkup). I was thinking that i could try and wire up a voltage divider to a simple electric fence tester (built with serial of resistors and some kind of led that can withstand high voltage). Maybe i would wire it up on tester where it outputs only 5kV and detect with microcontroller if there is that kind of pulse or not. Would that be possible? Would i need some kind of sensor? Would microcontroller detect electric pulse? How to wire it so it wont fry other components of the device?
I am using ESP32 Wroom32 microcontroller

I have merged your forum topics due to them having too much overlap on the same subject matter @eightbitmatija.

In the future, please only create one topic for each distinct subject matter and be careful not to cause them to converge into parallel discussions.

The reason is that generating multiple forum topics on the same subject matter can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.

Thanks in advance for your cooperation.

Was the previous suggestions not satisfactory?

You already was advised to use high voltage resistors by @Wawa . But this setup is tricky as @DVDdoug explained even though we have a voltage divider, "unexpected things" can happen when dealing with voltages higher than 3.3 or 5V

I would research using an ignition coil, that way the pulse will be transformed down to more reasonable voltages. Some data needs to be collected and calculated to get somewhat decent readings.

The previous owner left an electric fence volt meter. I use it to verify that the wire is not shorted, somewhere.

The meter consists of 7 neon bulbs attached to a series of resistors as a voltage divider. All neon bulbs fire up to the point of the highest voltage. Easy to see in the daylight and never needs external power! Sealed in a plastic box with a place to hook the fence wire and a wire with a ground probe.

And it would be easy to use an Arduino with photodiode or phototransistors to monitor the neon lights. Great isolation, too.

I think that the device that @JohnLincoln pointed out is just what you want. It looks like it only has two high voltage resistors in it. They look to be 80Megohms each.