# Basic Op Amp Question

I am trying to use a LA6500 to increase the current output from my MCP4725 that I am controlling with a raspberry pi. I have Pin1 attached to the output of my DAC pins 2&3 are connected to my pi's gnd, pin 4 it connected to a small fan and pin 5 is connected to a 5v pin on my pi. With this setup I was expecting the OP-Amp to output the same voltage but with more current availble but it only outputs a steady 5 v output. What am I doing wrong?

simulate this circuit – Schematic created using CircuitLab

EDIT 1
I've changed the wiring to be a follow voltage but now I can't get it to go to zero, it will go to ta high point and a midpoint but not to a zero point. Any help is appreciated sorry if this is too basic. EDIT 2 Just wanted to say Thank You to everyone for helping me. It has been several years since I have last had to work with any OPAMPS and I am trying to reteach myself some of the stuff I have forgotten since college. This has been an informative experience.

• A schematic would make it much easier to understand your question. Oct 31 '19 at 20:03
• I went ahead and added a schematic, because the guy sounds like a newbie who could use the help (but -- Michael -- do take a look at the schematic editor). Oct 31 '19 at 20:10
• @TimWescott I think he's trying to use his DAC as a variable voltage supply to power his fan. He knows that his DAC doesn't have enough current to drive the fan so he is trying to buffer it with an op-amp, but as we both know, that won't work so well. Oct 31 '19 at 20:21
• I thought this might be an XY Problem, which is why I asked what you're really doing. You probably want to use a PWM output. Depending on the current requirements of the fan, you can probably PWM the base of a BJT or the gate of a FET and have things work very nicely -- but you probably want to start a new question. It looks like the Raspberry Pi supports PWM, but please don't use the chip that article recommends -- it's dreadful. Oct 31 '19 at 20:33
• If you have the electronics chops, get onto DigiKey or Mouser and search for a rail-rail, 5V power op-amp that can supply 200mA. "Rail-rail" is key here -- that's why you're having trouble with the LA6500 even in the voltage follower configuration. Oct 31 '19 at 21:15

You should not connect pin 2 to GND but connect pin 4 to pin 2 in order to build a voltage follower.

• I have it in this configuration now and it will vary the voltage but it won't go to zero. What should I do? Oct 31 '19 at 20:37
• @MichaelH. You mean, you measured the positive input terminal and it is 0V, but the output is not? Oct 31 '19 at 20:51
• The Output was full open while the input was 0.00085V. Oct 31 '19 at 21:30
• I'm not sure what "full open" means. 5V i guess? Please use voltage readings instead. Anyway, a voltage follower should... follow the voltage. So, the voltage at the output should follow/ be equal to the voltage at the input. At the rails (0V and Vcc) it may deviate when the opamp is not rail-to-rail (which is the case here) (So, at 0V input the ouput may not go lower than e.g. 1V) Oct 31 '19 at 21:47
• 10V, I have a buck converter upping the 5V to a 12V for the power supply on the opamp. Oct 31 '19 at 22:10

It sounds like you want your Raspberry Pi to be able to control/provide a variable voltage supply for a 5V fan. I'll give you credit that you realized your RPI's pins don't have enough current to power the fan even though they have enough voltage.

This next part is to educate you about the approach you are trying to do take even though it won't work (or won't work well).

Op-amps are made to have as close to "infinite gain" as possible. In practice this means their gain is very large and not a specific gain of 1, or 2, or 100. They are then intended to be used with negative feedback which means some kind of connection from the output back to the inverting input (-IN). This causes the op-amp to keep itself under control and produce an overall gain based on the value of the components in the negative feedback loop.

We do this because it is difficult to construct transistors with specific gains. However, it is easy to construct transistors with very large, but unspecific gains.

You wanted a gain of 1 and no inverting of your signal so you need a voltage follower which is below. Note the negative feedback:

simulate this circuit – Schematic created using CircuitLab

However, this won't work very well for your circuit because though op-amps can probably supply more current than your RPI, it won't be enough for a fan, and if it is it won't be efficient.

Op-amps work similar to linear regulators where the extra voltage at the power pins which isn't required on the output is burned off as heat. The larger the output current, and the larger the difference between input and output voltage, the more heat is produced. Not good if you have a relatively "huge" load like fan.

This approach is more for applications require very precise outputs which are usually, but not always low current. Something like a large speaker which requires a precise voltage is a different story and takes a lot of effort to get a precise, pristine, high power signal. Fans (and motors) care a lot less about how pristine their power is. Which means the best balance between efficiency and simplicity is probably some kind of simple switching method (similar to that used for brushed motors).

Op-amps and linear regulators kind of work like variable switches that are always halfways on to control the voltage output. That's basically burning power in a resistance. It's not efficient.

What's more efficient is a switch that is fully on (very low resistance and high current) or off (high resistance but no current). So what you can do is use a transistor to switch the power to your fan on and off very rapidly (via PWM) through an inductor and capacitor to smooth out the square wave into something that more resembles DC.

This is the simplest way but has some caveats:

simulate this circuit

The caveat is that your fan is not reference to ground. This is okay as long as your fan doesn't have any control signals (which will to be referenced to the fan's negative supply pin, but the RPI's signals aren't referenced to the fan's negative supply pin. They're referenced to ground, and your fan's negative supply pin isn't connected to ground.

If such fan control signals do exist do, then you have to move the transistor to the "high-side" (i.e. somewhere on the positive supply leg of the fan) but this means it's not so simple to switch the transistor since the voltage that controls the transistor is the voltage between the gate and source pin. This means that the source pins is most conveniently connected to GND since your RPI is sending signals relative to GND. If you put the transistor somewhere else, then the source pin is no longer at GND but your RPI's signals still are so more circuitry is required to "float" the signal up to the transistor. Or you have to use a PMOS transistor which doesn't the same issues, but has other issues. A PMOS is probably the simplest way though.

simulate this circuit

The inductor smooths the current and the capacitor smooths the voltage so the fan sees an "average" rather than a full blast of the supply voltage every time the switch closes.

The diode is so the inductor's kick (flyback) doesn't blow the switch or anything else when you shut the switch off. When current flows through inductors, they store energy in their magnetic field. When you reduce the current (especially when you reduce it quickly like switching it off) it will start using the energy in it's magnetic field to act like a source and keep the current flowing through it in the same direction. It will produce any voltage necessary with its energy to push that current through the inductor. If there's a difficult path in the way, it means a very high voltage will be required which damages other components. If you give it an easy path like with the flyback diode the voltage will be smaller since less voltage is required to push the current around the inductor.

The 1K resistors are to give the transistors a default OFF state if the RPI isn't driving the line

You will need transistors that turn on at the RPI's pin voltages. This is NOT $$\V_{gsth}\$$ on the datasheet. $$\V_{gsth}\$$ is when the MOSFET just barely starts to turn on and is for analog applications. Yours is a switching application so you care about the Vgs voltage used to obtain the MOSFET's rated on resistance ($$\R_{dsON}\$$).

If you PWM switch too fast you will need to put a gate driver between your RPI and the MOSFET gate pin since there is a capacitance there that needs to be charged and discharged fast enough. But I will not talk about that right now.

You've made two mistakes so far:

First, an operational amplifier has lots and lots of voltage gain. When you're studying them in school, you start by assuming that they have infinite voltage gain, and for the most part you can pretend that's the case for real-world designs. So you've grounded the inverting input and put a positive voltage on the non-inverting input. Multiply that positive difference by infinity, and the amplifier will try to put out as much voltage as it can. I'm actually surprised you're getting 5V out of it (more on that in a bit).

Second, real operational amplifiers can't pull their outputs all the way to the power rails. If you look at the datasheet for the LA6500, it calls out an output voltage swing of $$\\pm\$$12V when you power it from plus and minus 15V supplies and try to drive a 33$$\\Omega\$$ resistor to ground. That means that when you're pulling 450mA from it, it drops three volts. It just isn't going to work on a 5V supply.

This is the circuit you would need to build to just follow the DAC voltage -- but I'm purposely leaving off the supply lines and the amplifier part number, because you have some more work to do to get there from here.

simulate this circuit – Schematic created using CircuitLab

The inverting input shouldn't be connected to ground...you have no feedback. Connect the inverting input to the op amp's output instead.