Operational Amplifier and N-channel mosfet

Thread Starter

mike69

Joined Dec 22, 2012
83
Hello,

I have a few questions regarding the attached schematic:
1. I just draw the attached schematic and I am wondering if the value of the gate resistor (R4 = 100 ohms) is OK for this circuit ?
2. The inrush current of the mosfet can damage LM358 ?
3. What will happen if I change the 100 ohms resistor (R4) with a 1.5 Kohms resistor ? The circuit will work the same ?
4. Will be the hysterezis modified by the 1.5 Kohms (R4) resistor ?

night_activated_switch_mike69.png
 

Attachments

wayneh

Joined Sep 9, 2010
16,102
1. I just draw the attached schematic and I am wondering if the value of the gate resistor (R4 = 100 ohms) is OK for this circuit ?
Short answer, Yes. A more detailed answer depends on the switching frequency.
2. The inrush current of the mosfet can damage LM358 ?
No, the LM358 can survive a continuous short to ground. For this reason you might even consider removing the resistor altogether.
3. What will happen if I change the 100 ohms resistor (R4) with a 1.5 Kohms resistor ? The circuit will work the same ?
Yup, more or less. Again, it depends on frequency. With a larger gate resistance, the MOSFET will spend more time switching from one state to the other. A little heat will need to be dissipated at each switch. At high frequency, this could add up to a significant amount of heat. You might consider using a genuine comparator instead of an op-amp, to speed up switching.
4. Will be the hysterezis modified by the 1.5 Kohms (R4) resistor ?
Only during the switching intervals where the voltages are not steady state.

This circuit wouldn't be too hard to enter into an LTspice simulation. Then you could play around to your heart's content.
 

Thread Starter

mike69

Joined Dec 22, 2012
83
I think that I was not sufficiently clear in my first messaje.
The circuit will be powered using a 12V/2A SMPS. The load will consume about 1A.
When I said "mosfet inrush current" (point 2.) I was talking about the inrush current of the gate (generated by the capacitance of the mosfet). Was that clear ?
1. The inrush current of the mosfet gate will not damage LM358 ?
2. Can I use direct connection between the LM358 and the gate of the mosfet ?
 

danadak

Joined Mar 10, 2018
3,577
The reason to leave in gate drive resistor -

https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&ved=2ahUKEwj6rb--rdjaAhXLxYMKHcqFAsgQFjABegQIARAv&url=https://www.infineon.com/dgdl/Infineon-EiceDRIVER-Gate+resistor+for+power+devices-AN-v01_00-EN.pdf?fileId=5546d462518ffd8501523ee694b74f18&usg=AOvVaw2dlijHodjLI1xRAOI8ndRf

Also, schematic, U1B, its output is not connected to anything, other than
Inv input to make it a follower ? Seems like you are trying to create a
psuedo ground for something.

Regards, Dana.
 
Last edited:

ScottWang

Joined Aug 23, 2012
6,827
The better is in series a 470Ω with RV1(10K) and R5 change to 47K + VR250K.
The frequency of CDS control circuit may be not so high, so the R4 could increase to 1K to try and that is to avoid when any reason causes the Vgs shorted.
 

wayneh

Joined Sep 9, 2010
16,102
I think that I was not sufficiently clear in my first messaje.
The circuit will be powered using a 12V/2A SMPS. The load will consume about 1A.
When I said "mosfet inrush current" (point 2.) I was talking about the inrush current of the gate (generated by the capacitance of the mosfet). Was that clear ?
Yes.
1. The inrush current of the mosfet gate will not damage LM358 ?
No.
2. Can I use direct connection between the LM358 and the gate of the mosfet ?
I think so, yes. However, see the document linked by @danadak in #5. There are other reasons to use the gate resistor than just limiting the current. Will those reasons matter in your circuit? I doubt it, but the higher your operating frequency, the more concerned I would be about careful choice of that resistor.
 

danadak

Joined Mar 10, 2018
3,577
L:M358 is about maxed out on phase margin at 50 pF. The MOSFET
gate is multiples of that. So DO NOT connect the LM358 directly
into the MOSFET, unless you want to build an oscillator.

In the datasheet you will see V follower pulse response with a 50 pF
load, clearly showing poor phase margin. Note in your case you are
G = 10 so its more tolerant to C load, but no specs in datasheet for
that.

Also note that RC formed by that Rgate and Mosfet C also add phase
shift, reduce switching time, so there is a tradeoff. If you want to do it
right do the analysis, then bench verify phase margin with -

https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&ved=2ahUKEwjhyqL96djaAhUkxoMKHXetA_UQFjABegQIABAx&url=http://www.ti.com/lit/an/snva364a/snva364a.pdf&usg=AOvVaw1STkMWwZiHSAwoQMpJ4djS

https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=2ahUKEwiuit3T6tjaAhXH5IMKHR0CDzMQFjAAegQIABAq&url=http://www.ti.com/lit/an/slva381b/slva381b.pdf&usg=AOvVaw21rJeQqWp_B5sZBAwQWFlW

This is most likely due to the phase shift thru its output PNP driver,
PNPs of old crappy when it comes to BW in circuits.

Regards, Dana.
 
Last edited:

Thread Starter

mike69

Joined Dec 22, 2012
83
I built the circuit from the following schematic:
night_switch_shcematic.PNG
Everything looked OK, but when I put the scope on pin 2, there appears an oscillation (I don't know what is it, but I suppose it is a oscillation).
The first image is from pin 2 of LM358 (the probe between GND and pin 2), and the second image is from the terminals of LDR.
pin2 to gnd.png
ldr.png
On the pin 6 and 7 is only noise, about 2-3mV. On pin 1 is the same with pin 6 and 7.
DS0262.png

The oscillation appears in both cases, if the LDR is at light or the LDR is at dark.
I tried to remove the two 10 nF capacitors but it behaves the same.
I tried with another LDR and it behaves the same.

It is normal or my circuit does not work correctly ?
 
Last edited:

wayneh

Joined Sep 9, 2010
16,102
I suppose your AC power is 50Hz? It looks like power line noise, maybe from nearby fluorescent lighting? Maybe you can power this all with a battery, away from AC noise?
 

AnalogKid

Joined Aug 1, 2013
8,108
There still is no decoupling directly across the opamp. Leave C1 where it is to filter noise at the input to GND.

C2 is injecting power supply noise *into* your sensor input. Move C2 so it is directly across the LM358 power and "GND" pins. Make the leads as short as possible.

Increase both C1 and C2 to 100 nF.

Where are you located? 100 Hz could be radiated powerline pickup, or (more likely) powerline hum on the power supply output. The full-wave rectified look is a clue, and 35 mV is well within many 12 V power supply specs. Increasing C1 and moving C2 should decrease this.

No hum on the output means the hysteresis is working.

ak
 

AnalogKid

Joined Aug 1, 2013
8,108
L:M358 is about maxed out on phase margin at 50 pF. The MOSFET gate is multiples of that. So DO NOT connect the LM358 directly into the MOSFET, unless you want to build an oscillator.
Disagree in this application. As a linear amplifier with forward gain greater than ten and no frequency rolloff in the feedback network - maybe. But that is not what this circuit is.

Operating as a comparator with hysteresis, I've had a 358 drive all kinds of loads, including large timing capacitors, with zero problems.

ak
 

ebp

Joined Feb 8, 2018
2,332
With your oscilloscope probe ground lead connected exactly where it was for the waveforms at #10, probe pin 4 ("ground") of the LM358 with scope set as for the third waveform at #10. You may be surprised.

C1 would normally be used but C2 would not. C1 filters the input signal. If C4 and C5 do their jobs perfectly, C1 and C2 are in parallel for AC (since the supply and ground are short-circuited for AC), but the reality is that C2 will typically just inject high frequency noise that may be on the 12 volt supply into the signal. You could make C1 very much larger (to tens of microfarads) to slow response to brief changes in the light on the LDR - unless you specifically want fast response. With 10 nF the corner frequency of the filter is going to be at least 1.6 kHz, depending on the setting of RV1 and the resistance of the LDR.
 

danadak

Joined Mar 10, 2018
3,577
You might consider using a 2 conductor cable with outside shied to connected to
ground to eliminate the 50 Hz pickup. Or at in the very least make it a twisted
pair from sensor to OpAmp.

Regards, Dana.
 
Top