reading voltage of an N channel mosfet

the general project is an EDM machine, from an arduino perspective I need to be able make a pulse and read the voltage between the two electrodes(to adjust spark gap). I have the pulse system down but the reading of the voltage is giving me a real hard time. In my current iteration, I am getting “inverted” voltage readings…when the mosfet is on, I get adc vals around 200 (low I guess), when mosfet is off, I get adc vals of 1023. If you are thinking I messed up a register or am doing something wrong in software, I did too…so I put a multi meter on the voltage divider and it shows the same (1.2v when mosfet is on, 5.2v when off).

some additional tidbits:
-all grounds are common

-i have been testing with a small load on the mosfet(fan), if I measure the voltage when ON, I get 11.6, off ~=0v…but if I remove that load, that voltage ranges from [6.6 ->11.6]. I am not SURE this is dysfunctional behavior, but that range being exactly 5v makes me dubious.

-I know the 3205 is not logical level, that’s why its being driven by an NPN to get proper gate voltage…I know this is not ideal for fast switching, but its what I have & it does seem to work.

i have attach a diagram, note the electrodes are not pictured, but connect to +VpulseSupply and the drain of the mosfet.

any guidance would be greatly appreciated. thanks.

couple other tests runs:

when voltage divider is connected to +5V & ground adc=109 (reasonable number based on my divider ratio) +12 & gnd, adc=266 +12(transformer) & gnd , adc = 267

then when measuring the mosfet(fed by above 12v transformer ps), the adc vals (and readings @ divider) start inverting.

all those values are consistent with the math, so it seems my divider circuit is working properly ...I am thinking it may have to do with where my probe lines connect in the circuit?

also when I send the mosfet LOW, I get 5.22v @ the bridge input pin...thats the full Vcc/Vin. by my math, it should take 44V to get that, and no such voltage exist in the system...perhaps it has something to do with the NPN that is driven high to turn MOSFET off....now that I wrote that all out, I am almost certain that what it is, somehow the base of that NPN is bleeding into the circuit ....how to fix?

mtraven: the general project is an EDM machine, from an arduino perspective I need to be able make a pulse and read the voltage between the two electrodes(to adjust spark gap). I have the pulse system down but the reading of the voltage is giving me a real hard time. In my current iteration, I am getting "inverted" voltage readings....when the mosfet is on, I get adc vals around 200 (low I guess), when mosfet is off, I get adc vals of 1023. If you are thinking I messed up a register or am doing something wrong in software, I did too...so I put a multi meter on the voltage divider and it shows the same (1.2v when mosfet is on, 5.2v when off).

Yes that is exactly what I'd expect. MOSFET on, low output voltage.

Explain exactly what you want to achieve, and what voltages will be involved in the machine (measuring high voltages may have other challenges).

BTW that 10k pull up on the MOSFET gate is shockingly high. Try 680 ohms for faster pulses, or use a MOSFET driver chip instead of the NPN stage.

MarkT: Yes that is exactly what I'd expect. MOSFET on, low output voltage.

could you explain that? seems simple but I am not getting it.

MarkT: Explain exactly what you want to achieve, and what voltages will be involved in the machine (measuring high voltages may have other challenges).

the mosfet needs to pulse a spark across a gap (submerged in a dielectric). pulse is 30-100 microseconds long, with a duty cycle 2-10x that. voltage is relatively low (playing with 12v now, max would be 24). The voltage measurement is used to adjust the position of the electrode (spark gap)...basically if that voltage is above a threshold the electrode is lowered, if its too low, raise electrode.

MarkT: BTW that 10k pull up on the MOSFET gate is shockingly high. Try 680 ohms for faster pulses, or use a MOSFET driver chip instead of the NPN stage.

that was a pull down on a different circuit that just kinda got shifted over, ill try some lower vals.

and I am just scrapping parts together, if I am gonna go with different hardware, id go with a logic level mosfet. But I am curious what a driver chip would have in it? wouldn't it just be and amp like my NPN?

I'm puzzled...

What's an EDM machine?

Where does the 12v transformer come into this?

Where is the adc connected? If connected to the junction of the 2M2 and the 220k it will see +12 , or whatever your 12v pulse supply provides whenever the mosfet is off - ie +5 on the drive to the BJT.

Please complete your drawing .

Allan

allanhurst:
I’m puzzled…

What’s an EDM machine?

Where does the 12v transformer come into this?

Where is the adc connected? If connected to the junction of the 2M2 and the 220k it will see +12 , or whatever your 12v pulse supply provides whenever the mosfet is off - ie +5 on the drive to the BJT.

Please complete your drawing .

Allan

electrical discharge machining…its a method of using a controlled spark to slowly, but very precisely remove metal…also effective at cutting hardened metals otherwise machinable. In my case I am making very small holes (<0.5mm) in hardened steel.

the pictured +12v supply is the transformer based power supply needed to make the pulses. an additional atx power supply runs the ardunio & supplies gate voltage to the mosfet.

the only thing missing from the drawing is the electrodes, not sure how to put those into my fritzing diagram, but they connect to +12v transformer supply & the drain of that mosfet. the adc connected to A0 as shown

so is there a way to not allow that BJT voltage to bleed through the rest of the circuit?

Since the mosfet drain is connected to ground, when ON, the source is also connected to ground, so you would have "low output voltage when ON". Also, since the whole circuit is a bit hinkey with the resistors in series with the source, you would have minimal current anyhow (5uA).

Perhaps get those resistors in a parallel leg and actually connect a load to the drain. Just for testing, anything will do, like a led (and resistor). The divider would have to go on the switched side of things, so basically it has to go between the mosfet and load.

EDM- gotcha - what we Brits call spark erosion.

Normally done under a blanket of flowing electrolyte to take the eroded particles away.

I take it you're rectifying your 12v transformer?

I've never done this but so far as I understand you must supply a limited current - is there a series resistor?

Allan

ps many years ago I patented a method of making accurate holes down to 1 micron or less . Think it's still in use for making calibrated leaks for gas detectors....

tinman13kup: Since the mosfet drain is connected to ground, when ON, the source is also connected to ground, so you would have "low output voltage when ON". Also, since the whole circuit is a bit hinkey with the resistors in series with the source, you would have minimal current anyhow (5uA).

Perhaps get those resistors in a parallel leg and actually connect a load to the drain. Just for testing, anything will do, like a led (and resistor). The divider would have to go on the switched side of things, so basically it has to go between the mosfet and load.

the voltage divider IS connect in parallel to the electrodes.

I thought I had mentioned I have been using a fan as a test load.

mtraven:
could you explain that? seems simple but I am not getting it.

Its a low-side switch. A high side switch would be the opposite.

allanhurst:
EDM- gotcha - what we Brits call spark erosion.

Normally done under a blanket of flowing electrolyte to take the eroded particles away.

I take it you’re rectifying your 12v transformer?

I’ve never done this but so far as I understand you must supply a limited current - is there a series resistor?

Allan

ps many years ago I patented a method of making accurate holes down to 1 micron or less . Think it’s still in use for making calibrated leaks for gas detectors…

If I am honest, I like the term spark erosion better anyways.

are you sure you mean electrolyte and not dielectric?

my 12v transformer also has a 24v side and is rectified & smoothed with some bigass caps (also has inline breakers)

your method for small holes sounds interesting? I don’t need to be anywhere near 1 micron, 400 would be about where I need to be, would your method work for that? Would you be willing to share said method?

–I am not doing anything with current limiting, really just because I dont know how or what to limit it with…and I have seem these systems(not real nice ones) run without any current limiter. I have a bunch of 5-25w ceramic resistors, would one of those before the electrode do the trick? Do you have a recommendation for target current?

some general notes:
-I am more of a machinist than an electronics expert, so I am not set on this circuit. If someone wants to recommend something different, I am open to it…but I would like to do it will parts on hand, of which I have a lot. I have 30 or 40 atx power supplies that I have always wanted to pull chips from, might there be something in one of those that may make my spark better?

thank you.

MarkT: Its a low-side switch. A high side switch would be the opposite.

are you talking about it being an n channel vs p channel? does't really matter, its still a switch and when I put a voltage to the gate, the switch closes and should read high (and it does on a multi-meter) but when I connect my voltage divider to those same points, I get the inverted behavior I described.

why are you saying you expect a low voltage when the mosfet gate is high?

You are not understanding what the mosfet is doing. When there is 10V on the gate, source and drain are connected. If the source is connected to ground, then the drain is connected to ground. You will not get 12V on the drain while the mosfet is ON unless you have blown the mosfet.

Now, with the resistor divider, if there is ground attached to the bottom end (mosfet ON), current is moving through it, and you will see 1.2ishVDC at the center. With the mosfet OFF, that 12V potential extends all the way to the drain of the mosfet, also putting 12VDC to the Uno.

Perhaps update your drawing to what you have, use a SPST momentary switch for the electrodes. Show the load as a resistor.

OP...

You're right - the 'electrolyte' is something like paraffin ( kerosene for yanks).

As a very amateur machinist I did think about this.

My method would have a constant current supply ,and a very slow controllable feed mechanism whose speed depended on the average voltage across the gap. The bigger the volts, the faster the feed. Hence you'd get a constant gap as the hole was formed.

As used in carbon arc film projectors in cinemas years ago for feeding the anode carbon rod as it burned away..

I think this method is use for making eg dies for coin stamping.

My small hole idea relied upon deforming a malleable metal such as copper - not suitable for hard steel.

You can buy tungsten carbide drills down to about 300 micron - used for PCB manufacture. But very brittle.

Allan

tinman13kup:
You are not understanding what the mosfet is doing. When there is 10V on the gate, source and drain are connected. If the source is connected to ground, then the drain is connected to ground. You will not get 12V on the drain while the mosfet is ON unless you have blown the mosfet.

that drain connects to ground…completing the circuit to +12V. I do see 12v on a multimeter, but its not blown as I can turn in off & pwm it just fine…maybe the new drawing with change your view on this?

tinman13kup:
Now, with the resistor divider, if there is ground attached to the bottom end (mosfet ON), current is moving through it, and you will see 1.2ishVDC at the center. With the mosfet OFF, that 12V potential extends all the way to the drain of the mosfet, also putting 12VDC to the Uno.

i have seen that 1.2v you are talking about, i ive even worked with that spec from the datasheet. I have more to say/ask about this, but please look at the updated drawing and see if that changes your view at all.

tinman13kup:
Perhaps update your drawing to what you have, use a SPST momentary switch for the electrodes. Show the load as a resistor.

i think i did this as you asked, if its still unclear, just ask

allanhurst: OP...

My method would have a constant current supply ,and a very slow controllable feed mechanism whose speed depended on the average voltage across the gap. The bigger the volts, the faster the feed. Hence you'd get a constant gap as the hole was formed.

You can buy tungsten carbide drills down to about 300 micron - used for PCB manufacture. But very brittle.

Allan

yah I have looked at drills, one problem I run into is I would only try those drills on the lathe where everything is nicely aligned and my lathe just does spin fast enough for those tiny drills. I could also just buy the nozzles I need, but I saw an opportunity to learn about something new so I took it..

that setup sounds very much like mine. the(+) electrode is on a table with a 10-32 leadscrew and a microstepping stepper running 7680 steps/rev--so yah its slow as sin.

so my questions would be: 1) how would you measure that voltage across the gap (like I am with a voltage divider, or different method?)

2) how would you accomplish the constant current portion of that setup? (i have wanted to do this from the beginning but I don't know how.

,You circuit won't work.

I presume the 'right hand' switch is a connection, and the 'left hand ' one the gap.

To measure the average voltage across the gap:

1/ Connect one end of the 2M2 to the gap.

2/ Other end to the 220k , and to arduino analog in.

3/ 220k to this point, other end to ground.

4/ I'd add a capacitor eg 10uF between the gap and ground as well to smooth out the pwm and get a steady reading.

And even so this only tells you the PWM ratio of the drive ( which you know already) , nothing about the current flowing, which is the important thing.

I think my idea of a constant current feed and a variable speed drive is much better.

I'll hash out a circuit.

Allan

Ok. Do you understand what I'm saying about the divider when the mosfet is turned off? It really needs reconfigured, or better yet moved off that 12V supply. The noise from the arc will play havoc with any digital signal, and with R values that high it will be messy.

What is the goal of the divider circuit? Just indication?

Something like this.

R1 has to be 10W rating.

The mosfet should be heatsunk as it might dissipate 20 watts. IRF 540?

The pot adjusts between 0 and 1A => plenty. I’d start with 100mA.

The 24v psu MUST be completely isolated from ground - note that ground is on the electrode.

The arduino measures the gap volts - choose eg 2, and use it to drive the stepper to hold it near there.

As I remember a typical spark erosion system only uses a few volts - < 10 - so your +24 is probably well over the top and just adds dissipation. Try 12.

Allan

sper.pdf (22.9 KB)

allanhurst: ,You circuit won't work.

I presume the 'right hand' switch is a connection, and the 'left hand ' one the gap.

To measure the average voltage across the gap: 1/ Connect one end of the 2M2 to the gap. 2/ Other end to the 220k , and to arduino analog in. 3/ 220k to this point, other end to ground. 4/ I'd add a capacitor eg 10uF between the gap and ground as well to smooth out the pwm and get a steady reading. And even so this only tells you the PWM ratio of the drive ( which you know already) , nothing about the current flowing, which is the important thing.

I think my idea of a constant current feed and a variable speed drive is much better. I'll hash out a circuit.

neither of the switches is a switch, just a stand in for the electrodes.

well I am very confused....I read your description and that is how I have it setup, I even tried a filter cap as you suggested.

I am unclear how your idea differs, are you saying you would control the gap based on current? or still use voltage as a gap gauge and add a constant current method to the circuit?

I am excited to see what you sketch up, and very much appreciate your help!