Voltage comparator

AnalogKid

Joined Aug 1, 2013
11,056
The pullup resistor R4 and the Q1 gate capacitance form an R-C circuit that determines how quickly Q1 turns off after the U1 output goes open-circuit. If you have a maximum turn-off time in mind, that sets the maximum value for R4. A 10 K resistor should be fine.

To protect the gate, consider a 20 V zener diode from gate to source, AND a resistor from the gate to the U1 output. As before this creates a voltage divider, but this time the added resistor is much smaller than R4. Its job is to limit the surge current into the U1 output stage when the output is low and Vcc spikes upward above 20 V. If Vcc spikes to 40 V, a 1 K resistor limits the surge current to 20 mA.

ak
 

Ian0

Joined Aug 7, 2020
9,847
What value of R4 (10k???) do you recommend when using LM393?
As low as you can. The LM393 can sink a minimum of 6mA, so 2k.

If this circuit controls the field windings for an alternator, then you have created a feedback loop. For most of the time, you will require a much lower voltage than 12V across the field windings, because the alternator is designed to give full voltage (14.4V) at idling speed, voltage is proportional to speed, so at 6000 rpm you will need only about 2V.
Either you need a linear circuit that will give you 2V output (and dissipate heat in the MOSFET) or you need to make the LM393 oscillate at a controlled frequency.
If you use the circuit as drawn, it will oscillate as fast as it can go, and blow up.
 

Thread Starter

Misieek

Joined Mar 17, 2021
34
Thank you for joining @Ian0 . So what can I do to make this circuit work as a field windings controller? I don't want to dissipate that huge amount of energy you mentioned in MOSFET. I would rather want to control the frequency or PWM with this LM393 to make the voltage oscillate at the set amount. Later I will redraw the schematic with your advices to keep you all updated about what we agreed upon.
Could you please suggest some changes? :/
 
Last edited:

Ian0

Joined Aug 7, 2020
9,847
As you now have a high-frequency square-wave at the output, you will need a better MOSFET driver than the output of the LM393, so add a MCP1402 to drive the MOSFET.
Then you need some hysteresis so add a resistor between pin 7 and pin 5. That will make a hysteretic regulator.
The frequency it oscillates at will depend on the inductance of the field windings, and the transfer function of field current to output voltage of the alternator. Probably easier to determine by trial and error than my calculation! Aim for something in the kHz region. Above 10kHz you will cause core losses in the alternator, especially as it will have relatively thick laminations.
Alternatively, you could probably design something around the good old UC3843.
You weren't far wrong with your original circuit, as this is what is used in my 1969 Humber Sceptre
http://www.industrial-electronics.com/images/emct_2e_5-23.jpg
I'm not sure what provides the hysteresis, probably just the really slow speed of power transistors in those days.
It oscillates at about 1kHz, which, of course, adds a 1kHz component to the output of the alternator which would bleed through into the radio, but my Sceptre doesn't have a radio, so I don't care.
I'm also not sure why the field windings appear to be switched to ground
The circuit comes from an interesting article:
http://www.industrial-electronics.com/emct_2e_5k.html
 

crutschow

Joined Mar 14, 2008
34,470
What value of R4 (10k???) do you recommend when using LM393?
For fastest MOSFET turn-off you could use a value to give the maximum LM393 sink current of 6mA or 15V / 6ma = 2.5k
I also want to secure the MOSFET gate, and also LM393 from voltage spikes, that are being created while cranking the car. How can I do that? Some varistor, or zener diode +20V?
You could add a small resistance (say 10Ω) in series with the power to the circuit (everything except the MOSFET source) with a large capacitor (several hundred μF) to ground.
You could also add an 18-20V Zener to be doubly safe.

You could also power the circuit from the ignition switch accessory output where it wouldn't see the starting spikes.
 
Last edited:

Thread Starter

Misieek

Joined Mar 17, 2021
34
As you now have a high-frequency square-wave at the output, you will need a better MOSFET driver than the output of the LM393, so add a MCP1402 to drive the MOSFET.
Unfortunately MCP1402 is not available now, but I searched the web and I found something even better in my opinion - TC4427A. I think it will be suitable for this project, but if not please correct me. I didn't really understand why do I need this driver, but I understood when I watched this video by GreatScott. Really helped me.

I have one more question before ordering parts - do I need to change the LM358 to LM393 if I will utilize the TC4427A driver? In my opiniont it's not necessary and LM358 will work correct.
 

Ian0

Joined Aug 7, 2020
9,847
According to Microchip
https://www.microchip.com/wwwproducts/en/MCP1402
the MCP1402 is still in production, but it was just an example of many such products, all of which would be suitable.
I think I would change to the LM393. The LM358 is really slow, and would probably struggle to output a decent squarewave at any frequency above a few kHz. As the MCP1402 and TC4427 have schmitt triggers on the inputs, the LM358 wouldn't cause a problem, but the LM393 is a better solution, not necessarily the only solution.

Just a further thought - do you have access to both ends of the field coils?
If so, you would be better off connecting one end to V+ and switching the other end to V- with an N-channel MOSFET.

And whichever way you connect it, don't forget the flyback diode between MOSFET drain and the opposite power supply. It must be a fast (preferably schottky) diode rated for the full current of the field coil.
 

Thread Starter

Misieek

Joined Mar 17, 2021
34
MCP1402 is still in production
Yeah, I meant that it's not available in my electronics shop nearby, so I searched for replacement. Sorry for inconvenience.

Just a further thought - do you have access to both ends of the field coils?
If so, you would be better off connecting one end to V+ and switching the other end to V- with an N-channel MOSFET.
Yes, I have access to both terminals. However, I don't want to steer the coil with switching the ground, because the device will be placed in a car cabin, to let me change the voltage whenever I want to. Possible abrasion of the cable on its way to cabin would cause a short circuit to the ground via field coil.

I am currently drawing new schematic, and I will share with you when I finish.
 

Thread Starter

Misieek

Joined Mar 17, 2021
34
Got it guys!
1616287415321.png
Please check and correct any mistakes if they are present. I'm not sure about D1, because when the positive spike above 20V goes on, it makes short circuit between gate and source making the transistor turn off. I don't fully understand the purpose of it. I'm also not sure if R7 is necessary when using mosfet driver.

Next step is to add some components which will add soft-start feature. My idea is to connect OUT_A with the transistor (let's call it Q2) to the VCC, and keep the Q2 on, until soft-start capacitor becomes fully charged to make current flow through the Q2 gate and turn it off... My second idea (which I came up with while taking a shower a while ago) is to add a capacitor and resistor in paralel to pin 6 of LM393 and the ground.
 
Last edited:

Ian0

Joined Aug 7, 2020
9,847
Won't a large inductor on the output give it a soft start? (like the field coils of an alternator for example)
 

Thread Starter

Misieek

Joined Mar 17, 2021
34
Why do you think you need a soft start?
This circuit will be connected via relay, which is steered by fuel pump/original alterntor L pin (excitation). This means I want to make sure, that the alterntor won't offer additional resistance while cranking the motor. Charing should start about 3 seconds after the engine is working.
 

Ian0

Joined Aug 7, 2020
9,847
R3 should go the the output of the TL431, not to V+.
If you put the pot in series with R4 instead of R3, if the pot wiper loses contact, it will not overcharge the battery.

If you take a wire from the "starter" position of the keyswitch, though a diode and another resistor (say 4.7k) to pin 5 of the LM393, you will effectively disable the circuit whilst the starter is operating.
 

Thread Starter

Misieek

Joined Mar 17, 2021
34
Ok, so a little update. I was in a car, measured the voltage on fuel pump. When turning on the ignition, fuel pump is being turned on for 2s, to increase the fuel pressure level before starting the car. Then, the voltage is 0V, and it is again +12V when car is started. This is where I want to plug in my circuit.
1616339841049.png
I will do it via relay, since the current draw would be around 5A. I added C1 and R8 to prevent relay from turning one in this 2s time when fuel pressure is increased, but I'm not sure if this will really work.

I also connected IN_B of TC4427 to the ground.
 
Top