High Voltage circuit interpretation - Arduino Electric Fence tester

Hello to everyone!

I don't want to open another topic about classic "electric fence tester" and relative solutions. I've jet test all of them but non satisfy my intentions.

I've disassembly a famous portable LCD tester for animal electric fence tester.
The idea is to replicate the high voltage circuit to use it in arduino or connect directly the "low tension" pin to arduino. Then arduino will do the simplier part: calculate the relative tension and send to webserver via REST request.

My difficulties are related to the comprehension of the circuit.
First of all the electric fence tension is from 0 to 11 kV. (not more is readable by this instrument)
The electrification of the fence depends on the various apparatus but generally is a low frequency (1 Hz) of DC/AC (I don't know but doesn't matter, there is a diode bridge in the instrument).
One pole on the fence, the other to the ground.
Here is some infos attached:



The PC is a 16F688 and here is it's scheme:

I thought that the high tension of the fence is at first stabilized with the diode bridge.
The two big resistor act as voltage divider. If I'm right the tension will be divided by 2.
Then I found "Q9" that has the "1P" text on it. May be this is a "NPN general purpouse amplifier" MMBT2222A?
After this component I don't know what happens...
The big transistor-like componente is a KY5050.

Is it correct to assume that on PIN 9 of the PIC there is a signal in low tension of the fence voltage? (with a simply tester I don't read a stable value of tension, in operation)
Is the C3 and R1 that make the work to maintain the tension for a longer time to be measured?

Thankyou to all!!!

I'm a mechanical designer, so sorry for my low electrics lacks...

It is advantageous to run a simulation: http://falstad.com/circuit/

The design file:

$ 1 0.000005 10.20027730826997 53 5 50 5e-11
v 160 352 160 64 0 1 40 12000 0 0 0.5
w 160 64 304 64 0
d 304 128 368 192 2 default
d 304 256 368 192 2 default
d 240 192 304 128 2 default
d 240 192 304 256 2 default
w 304 352 160 352 0
w 240 192 240 288 0
w 368 192 416 192 0
w 240 288 416 288 0
r 416 192 416 288 0 10000
x 463 248 500 251 4 20 load
r 304 128 304 64 0 120000
r 304 256 304 352 0 120000
o 0 64 0 4099 20480 0.1 0 2 0 3
o 10 64 0 4099 640 0.1 1 2 10 3

So, where I placed a 10K load and the Vd is 480V approx, you can replace the 10K with a voltage divider to properly scale for Arduino 0-5.

Thankyou for the info: I don't know this website :grinning:

Anyway the solution you propose doesn't works, is not easy as it seems, because without a proper capacitor and divider is not possible to read by arduino the tension value. The frequency is 1 Hz but is an impulse of a bit of milliseconds..

I was not proposing a complete solution, just giving you a new tool for your toolbox.

As stated, you must select an appropriate resistor divider values (where I showed 10K.) A small value capacitor for smoothing and a bit of math.
A Google search gives you the basic idea:
https://www.google.com/search?q=arduino+500V+meter+circuit

I would consider using the pulse to trigger an interrupt and set a boolean. In loop() if the boolean is set, use the Arduino A/D to read the voltage stored in the capacitor and reset the boolean.

Paul,

Nothing inappropriate with the interrupt, IMO, but I was thinking about a tight loop() where the analog was just displaying the max * scale factor and using a single digital input with a pushbutton to reset the display to 0 (zero.)

The simulation shows 480V peak, so the obvious scaling is 100, two order of magnitude.

As I told the Op, the 10K simply needs to be replaced with a couple of resistors such that the lower value had a Vd of 1.0 Volts when 500 Volts were across the combined resistance. A small capacitance would be all needed to stabilize the reading since the objective is peak measurement. Falstad can easily be used to design calculate the series resistor values... I simply am of the opinion Op should do that work using pen & paper or Falstad or soothsayer!

Ray

End result is the same if the loop code looks for a peak value.

Yep.

A variation of a fix high resistor and a pot can easily give the exact 5V for 500V input.

Just "as example"

495K & 5K

Thankyou all for all the reply and for the useful software!
But I need to say that the simulation as mentioned is not real. The peak is each second and has a duration of 1-2 ms. Not a wave. So the times to charge and discharge the capacitor are important.

The problem is not how to use high voltage. Is how to use high voltage in 1 ms!

Precedent solutions posted in this forum turned out that two or more resistors don't do the work.

and this is the reason because I wanted to understand how a professional instrument works.I think that the solution goes through amplifiers..and here there are two of them.

IMO an electrical fence has to provide some (but not too much) current. So the load is important for a fence tester. Eventually the energy can be measured with an RC load (R2/C3?).

In my state, Oregon, the voltage, current and timing are controlled by law.

I agree.

I think there is a generalized idea that a short pulse every second will somehow skew Ohm's Law when using a simple successive approximation A/D converter as is the common Arduino implementation.

What has not been discussed is that a long wire running parallel to the ground also has resistance; but more importantly it has a characteristic impedance.

The chart shows common characteristics for fencing:

As seen, the characteristic impedance is an order of magnitude greater than the resistance in some cases. This means that the fence itself is an energy distribution system with all 3 common electrical characteristics: resistance, capacitance, and inductance.

The fence proper does some filtering and smoothing of the energizer pulse.

The electric fence is also a huge RF transmitting antenna. I have a clock timer on mine to shut it off during certain hours. When my neighbor 1/2 mile away hooked his up to control his horses, I could hear it on 4 mHz. Someone way off to the West has a fence. I have never found it. But when I point my 144 mHz antenna that direction, I can hear it pulsing.

High voltage + large resistor = constant current source. The circuit (2 240k resistors + a diode bridge) will pass about 1000/240 ~ 4 mA per kV. No matter what. You must provide a way for this current or something breaks!

  1. You do not need voltage divider for this. It won't help at all. You need a shunt resistor. The simplest way would be 100 Ohm resistor giving 5 V for 50 mA (about 11 kV).
  2. To this you need some input protection. A series resistor (say another 100R) and a beefy Zener diode (if the input is more than 11 kV).
  3. Is the Arduino fast enough to catch this fast peak? I think measuring continuously and reporting maximum every 2 s or so should work.
  4. You can add some fanciness: pulse detector (that is what PIN9 in your schematic does I guess) so you only measure if a pulse is present and also measuring frequency and length of the pulses.

I admit I don't understand your schematic. Are you sure it is right?
You are missing one resistor - R18.
How did you determine pinout of the transistors? Maybe you have Base and Emitter swapped? The pinout on your schematic is very uncommon. Maybe those are not BJTs at all but something less common like a J-FET? Because the circuit as drawn makes no sense no matter how you swap the transistor pins.
(EDIT I was confused, it makes sense, PIN 9 measures voltage, PIN 11 presence/length of the pulse).
KY5050 is a linear regulator like LM7805 I think.

I think it's okay. Except R2 which might be a solenoid that forms a LC filter (and peak hold?) together with the capacitor. Q1 instead can be used to measure the duration of the pulse.


The input current I_in is input voltage V_in / 240 kOhm ~ 4 mA/kV.
The red arrows show how majority of this current flows. When Vbe of Q1 is more than about 0.6 V (600 uA through R11, about 150 V on the input of the device) Q1 starts conducting an pulls Pin 11 to 0V (circuit ground).
Voltage at point A (with respect to the circuit ground) is V_A = I_in * R3 + Vbe_Q1.
Q3 works as a voltage follower: voltage at Pin 9 is V_A - V_BE(Q3).
If we assume Vbe_Q1 ~ Vbe_Q3 voltage at Pin 9 is V_Pin9 = I_in * R3 + Vbe_Q1 - Vbe_Q3 ~ I_in * R3.
That is V_Pin9 = V_in * 90 / 240k. Or the other way around, V_in = V_Pin9 * 240k / 90 ~ V_Pin9 * 2700.

1 Like

Yes that looks good, I was also wondering how that circuit worked and it seems slightly more complicated that necessary. But I guess that a design criterion is also to deliver repeatable results.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.