Error with Op-Amp

I am trying to implement an op-amp so that when 3.3V signal is sent from an Arduino it sends a 12V signal output from the op-amp. However, with this configuration the LED connected to the output pin turns on regardless of whether a 3.3V signal is sent or not. Attached is a link to its data sheet and a circuit drawing:

You didn't show the pin numbers on your op-amp so I have no idea how it's wired...

An op-amp comparator needs a reference, which in this case would be about half of the 3.3V, created by a Voltage Divider made with two equal-value resistors.

When the input voltage is above the threshold the "infinite differential gain" slams the output as high as it can go (about the same as the op-amp's positive power supply). When it's below the threshold the output gets slammed as low as it can go (about 0V if the op-amp doesn't have a negative power supply.)

The circuit diagram you posted doesn't make any sense. Where is the 12V signal supposed to go, and what should it do?

The word "valve" suggests you are trying to control a valve, which this circuit will do (substitute "valve coil" for "M").

So in the data sheet it says:-

Large Output Voltage Swing: 0V to VCC -1.5V

That means you can never get to the VCC voltage only to within 1.5V of the VCC.

Also note that you should only connect the output to source 20mA with an output voltage of no more than 2V.

Likewise you should only let it sink current of 5mA with an output voltage no more that 2V.

This means you can't get enough current from from the op-amps to drive anything much.

You should start by reading this

The diagram you have provided isnt useful, you should redraw it following the examples in that link.

You cant use seperate gounds with an op amp like that.

The circuit provided by @jremington is more appropriate to your requirements.

Here is an updated sketch of the wiring. I'm not quite sure how to draw a diagram in the format of the link provided. The valve is for hoses. It needs 12V to open the valve.

I tried looking at the diagram with the MOSFET chip but I'm not sure how the signal from the Arduino is implemented. Just to reiterate, I need a 12V signal sent from a DC jack to the valve if the Arduino is providing a given voltage.

An op amp is totally inappropriate for directly controlling a valve, motor, etc., and the circuit won't work as shown.

MOSFET chip but I'm not sure how the signal from the Arduino is implemented.

To turn the valve on, use the command digitalWrite(pin_number, HIGH); with any digital output.

Example Arduino code:

void setup() {
pinMode(8, OUTPUT);  //use Arduino pin 8 to control the valve.
digitalWrite(8, HIGH); //valve on
delay(2000); //wait two seconds
digitalWrite(8,LOW); //valve off
}
void loop() {}

You can buy MOSFET modules with the circuit on the web, but DO NOT buy ones advertised as IRF520. Make sure it is advertised as logic level.

I misread your diagram. If I understand correctly "dig out" is the digital pin. Where in the diagram is the 12V source? Is "motor power" the valve? Why aren't IRF520's sufficient?

Is the 12V power source. Sideways "M" would be the valve coil.

IRF520, IRF540, etc. are not logic level, and cannot be switched fully on by an Arduino.

This is a logic level MOSFET switch module designed for motors, valves, solenoids, etc.

Hi, @mfusco

Tom.... :smiley: :+1: :coffee: :australia:

Because they need 10V to fully turn them on. If you look at the data sheet it will give you a a number in ohms, or even milli ohms, for the minimum resistance a fully turned on FET will have. This is called the Rds (resistance between the drain and source). If you look at that figure it will always have the conditions under which this was measured.

On a logic level FET this will always be with a voltage of 3V to, more likely, 4.5V as the minimum gate voltage.

So in short, it it is not a logic level FET like an IRF5020 you can't turn it on hard enough to be useful in a 5V logic system. Often the part will have an L in the part number, like the IRLB8721.