Electromagnet waveform

Thread Starter

cmartinez

Joined Jan 17, 2007
8,768
is this coil really being fed this, or is it the result of arcing contacts ringing the coil?
That's exactly what I'm about to find out.
But I DID carefully make all possible measurements of the coil's resistance and inductance before we proceeded to design this thing... anyway, I expect there will be some discrepancies, since the coil energizes a plunger in the valve, so its inductance becomes a moving target... I just hope we're not too far off the mark
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,768
That's exactly what I'm about to find out.
But I DID carefully make all possible measurements of the coil's resistance and inductance before we proceeded to design this thing... anyway, I expect there will be some discrepancies, since the coil energizes a plunger in the valve, so its inductance becomes a moving target... I just hope we're not too far off the mark
Also the sim in the LTspice circuit that Ron so generously helped me design is as close as possible to the real thing that one could hope for.
 

ronv

Joined Nov 12, 2008
3,770
is this coil really being fed this, or is it the result of arcing contacts ringing the coil?
It's really pretty clever. It is just a very fast and consistent valve. The high current portion uses pwm to make sure the time to open is always the same regardless of supply voltage and coil temperature.
The flat part is to maintain enough current to make sure it stays open with a minimum of heating and the pulse at the end is like a zener clamp so it closes faster than just a clamp diode across the coil.
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,768
Ron,

Please take a look at these two circuits:

Untitled 01.png


The one on the left is not using a comparator, and the one on the right is using a comparator. And although in circuit two the initial pulses are not evenly distributed, the current peaks at close to 9A at the end of the startup phase. Almost exactly as is it is happening in reality.... but the current keeps building up afterwards during the plateau, and I'm a little concerned about that.

Now, on post #18 I showed the following graph:

x.jpg

It shows that current peaks at around 8.44A, but on the plateau it averages 3.375A

I know that I said I was (and I am) going to build the circuit without much further ado... but my question here is, what can I do to bring the current down to the 3.375A that I'd like to have in the plateau? Should I place a resistor between M2 and D6 ?

Also, I've noticed that there's an input (+HP) to the left of D2 in both circuits that is doing absolutely nothing in both circuits... is it ok if I remove it?
 

Attachments

ronv

Joined Nov 12, 2008
3,770
Ron,

Please take a look at these two circuits:

View attachment 83929


The one on the left is not using a comparator, and the one on the right is using a comparator. And although in circuit two the initial pulses are not evenly distributed, the current peaks at close to 9A at the end of the startup phase. Almost exactly as is it is happening in reality.... but the current keeps building up afterwards during the plateau, and I'm a little concerned about that.

Now, on post #18 I showed the following graph:

View attachment 83930

It shows that current peaks at around 8.44A, but on the plateau it averages 3.375A

I know that I said I was (and I am) going to build the circuit without much further ado... but my question here is, what can I do to bring the current down to the 3.375A that I'd like to have in the plateau? Should I place a resistor between M2 and D6 ?

Also, I've noticed that there's an input (+HP) to the left of D2 in both circuits that is doing absolutely nothing in both circuits... is it ok if I remove it?
+PWM was inverted, so I flipped it. I also changed the op amp to a comparator because it was kind of slow. Don't forget the 4.5 volt battery (+4.5v) needs to come from a port pin so you can only turn it on during high power.
The other PWM you are generating with the comparator in the micro. Right?
Yes, +HP is replaced with the comparator circuit.
 

Attachments

Thread Starter

cmartinez

Joined Jan 17, 2007
8,768
+PWM was inverted, so I flipped it. I also changed the op amp to a comparator because it was kind of slow. Don't forget the 4.5 volt battery (+4.5v) needs to come from a port pin so you can only turn it on during high power.
The other PWM you are generating with the comparator in the micro. Right?
Yes, +HP is replaced with the comparator circuit.
Thanks Ron, I'm already working a few adjustments on it... just one thing, there's a very ugly -75V spike at the end of the cycle being fed to the LM339 negative input... and according to the datasheet the chip would go up in smoke if that happens in the real world... Where do I place the zener?
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,768
Mea Culpa... I was measuring voltage referenced to the opposite side of the coil and not to ground, that's why there appeared to be a negative pulse. Sorry.

Anyway, take a look at this.

Untitled.png

Act 02 idle.png

I've placed another comparator to regulate current through the coil during the plateau, and mixed it with the PWM from the MCU. Now the waveform looks almost exactly as the original.

My only concern now is the negative pulse at the end. In the original it lasts around 200 µs, while in the sim it's only about 50 µs.

What do you think?
 

Attachments

ronv

Joined Nov 12, 2008
3,770
Mea Culpa... I was measuring voltage referenced to the opposite side of the coil and not to ground, that's why there appeared to be a negative pulse. Sorry.

Anyway, take a look at this.

View attachment 83944

I think your comparator needs some hysteresis is all. I think I would use a 10k pot (less noise sensitive) and add like 27k from the output to the + input. Then just use +12 at the top of the pot.
I see you made the battery 5 volts. I didn't know what the high output was from your micro so I had used 4.5, but since it is cmos 5 might be closer. So you will need to make the resistor that charges the cap about 20k to get the current back down.
I don't think you need the diode on the output of the comparator now.

View attachment 83945

I've placed another comparator to regulate current through the coil during the plateau, and mixed it with the PWM from the MCU. Now the waveform looks almost exactly as the original.

My only concern now is the negative pulse at the end. In the original it lasts around 200 µs, while in the sim it's only about 50 µs.

What do you think?
 

ronv

Joined Nov 12, 2008
3,770
Well, that was pretty informative wasn't it? :rolleyes:
What I really wanted to say was: - trying to remember..........:(
I think you just need some hysteresis around the comparator. I would make the pot 10k (less noise sensitive) and add like a 27k from the output of the comparator to the (-) input. Then you can get rid of the mpu pin and tie the top of the pot to +12.
I don't think you need the diode in series with the output of the comparator.
I see you changed the 4.5 volts to 5 volts. Probably closer to the real mpu output pin, but the resistor that charges the cap will need to be larger now to get the current back down. Maybe 20K.
I'm going to try and click post reply now.
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,768
Well, that was pretty informative wasn't it? :rolleyes:
What I really wanted to say was: - trying to remember..........:(
I think you just need some hysteresis around the comparator. I would make the pot 10k (less noise sensitive) and add like a 27k from the output of the comparator to the (-) input. Then you can get rid of the mpu pin and tie the top of the pot to +12.
I don't think you need the diode in series with the output of the comparator.
I see you changed the 4.5 volts to 5 volts. Probably closer to the real mpu output pin, but the resistor that charges the cap will need to be larger now to get the current back down. Maybe 20K.
I'm going to try and click post reply now.
Thanks Ron, I'll implement all the changes you're suggesting and then get back to you.
One last question, is there a particular reason why you chose a Schottky diode for D12? Could I use a regular 1N4148 diode instead?
 

ronv

Joined Nov 12, 2008
3,770
It might work, but it would be better if it were a schottky since we are counting on it to turn off Q2 when HP is minus. A normal diode and the base emitter voltage are about the same, so it would be better to have the lower voltage drop of a schottky.
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,768
Just placed the 27K between the comparator's output and its (-) input, don't see much of a difference either at the coil's current or voltage... but that's ok, I'm keeping it 'cause you said it would be an improvement.
I've removed the diode that was placed at the comparator's output, but I'm keeping the MCU connected to the pot to make sure that I can replicate the voltage signal (and not just the current) as close as possible to the original.
Also, as per your suggestion, I've changed R20's value to 22K, which is more of a standard value than 20K and everything seems a-ok.
Finally, I've replaced the schottky with a 1N4148 and the only difference I see is that the current through the diode on the first 0.5 ms of the simulation is virtually zero, instead of the high-frequency (about 70 kHz) ±2 mA oscillations shown with the original schottky.
 

Attachments

Last edited:

ronv

Joined Nov 12, 2008
3,770
Sorry, My bad. The resistor should go from the output to the (+) of the comparator.

If you check the collector current when HP is (-) you will notice there is a little - 0.5ma indicating Q2 is still on just a little bit. It's probably ok, but if you have a little schottky it would be safer.
If your looking for bigger bumps further apart in the current you can make the 27k smaller.
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,768
Last question of the day, Ron. Why do you think the negative pulse at the end is so short? Is there a way to make it longer, or is it the coil's natural discharge behavior?
 
Top