I'm trying to power a 12VDC pump with 6-10V through a p-mosfet.
i use a summer to get the levels (0-5) from the Arduino, amplify it by 2.4, then use a follower to "equalize" the voltage on the power circuit to the amplified output. At least this is my intention.
I'm finding that when it's all connected, i always have 12 volts on the power circuit, regardless of input.
what i expected to see what that the non-inverting input of the opamp would read 'actual' voltage, and inverting input would read 'set' voltage, then the output would change the output to 'equalize' the non-inverting output to the inverting one.
That second op-amp is configured improperly if it's as shown.
The input should be to the non-inverting input and the output should be connected to the inverting input (that's negative feedback) for a "buffer"(X1). If you want an inverting buffer (X -1), it's a different situation (not a matter of pin swapping.)
Is the O-5V from the Arduino from analogWrite or digitalWrite?
odimachkie:
Sorry, i am not familiar with X1 or X-1...
Oh, me...
"times 1", multiplied by 1
"times negative one", multiplied by negative one (-X1 ?)
odimachkie:
So, I cannot merely switch the pins? I must say, I have tried that. it didn't work.
Anyway, an op-amp is the wrong way to go.
You just need to switch the Gate bias between +12 and Gnd.
I would do that with a transistor.
For instance,
with the circuit furthest to the right, the common emitter amp.
With the LED omitted, so it's just R2 between "9V" (that could be 12V, too) and the Collector, you have just what you need.
Connect the Gate to the junction of R2 and Q1's collector.
When Digital output is Low, the transistor is Off, the FET Gate is High and the FET is Off.
When Digital output is High, the transistor is On, the FET Gate is Low and the FET is On.
Probably go with a higher value of R2 (5K to 10K), and a low value resistor (100?) connecting the Gate to the R2-to-Collector junction.
Incorrect, the p-channel MOSFET is also inverting so the polarity of the second
op-amp is right, its just that you cannot drive a power MOSFET gate direct from
most opamps! They are many nF of capacitive load and you'll get instability.
You need to get a bit cleverer for this kind of circuit, as the impedance and gain
of the MOSFET vary a lot - a secondary negative feedback network is needed from
opamp output to its -ve input to give high frequency stability, then a resistor between
opamp and MOSFET gate limits the current to what the opamp can handle without
saturating. Instability may still be an issue.
The circuit is basically that of an LDO regulator and these are tricky to get
stable. Here an NPN darlington to boost the opamp in emitter-follower mode
would be the easiest option.
JohnLincoln:
When you add an extra inverting stage that is within the feedback loop it effectively changes the inverting input to a non-inverting input, and the non-inverting input becomes inverting. The feedback needs to go to the "new" inverting input, (formerly the non-inverting input).
No, No, No - a thousand times, No.
Anyway, as I made clear in Reply No 3, there are two op-amps too many.
One transistor between the Arduino output and the FET's Gate will suffice.
If the gate goes low, the output of the PMOSFET goes high. Thereby inverting. So for a buffer, that is the correct output.
I'm concerned that if things were wrong in the MOSFET, the output of the second Op Amp should be acting as if it had no feedback, not following the input. Are you sure you measured that on pin 7, and not on pin 6?
As pointed out, there are simpler ways to do this not involving Op Amps, using PWM. It seems to me that all you are doing with the 5 outputs into a summer circuit could be done as a single pin PWM feeding a transistor and PMOSFET directly, without all the extra stuff.
BTW, referencing your schematic, you really don't need D1. The diode across the motor will handle the inductive spike, and the diode integral to the MOSFET should handle any voltage generated by a turning motor, if somehow it generates something higher than 12V.