Opamp Misbehaving in Constant Current Source Circuit

I'm planning to build a current regulator for a power supply and I'm prototyping a number of different regulator circuits. First up, the op amp and transistor circuit shown below.

I felt I understood the principle well enough: negative feedback resulting in the opamp regulating the transistor in order to equalize its inputs to some given reference voltage. So, I pulled out whatever bits and bobs I had in the box and put the circuit together. I was aiming for a current limit of about 100mA and I wanted to keep the voltage drop across Rsense low. I had some low ohmic resistors from another project, so I used a .010 ohm resistor as the sense. Calculating the reference voltage to achieve 100mA gave me 1mV (100mA x .01R). The voltage divider shown on the left in the schematic below produces 1mV at the non-inverting pin. So far, so good... but then... many, many hours later and a lot of contemplation and confusion, I still don't understand it.

As you can see from the schematic below, the notes are the actual measurements taken using a dvm.

The opamp inputs are refusing to equalize. What's more, the opamp seems to be driving the transistor hard into saturation, the current almost completely owing to the 22 ohm (7W) load resistance. It's almost like the opamp is using positive feedback, rather than negative feedback. But, why so? The inverting pin is clearly reading 3mV. I'm stumped! Any help greatly appreciated.

The first thing that I notice from the datasheet is that the opamp has 3 mV input offset voltage, which is clearly biasing your circuit.

Try to use larger signals, since you have enough output voltage headroom. (100 mA * 22 Ω = 2.2 V). I'd start by using something in the order of 0.1 V as input signal, then maybe reduce it until you get too much error due to the offset.

• Good stuff, offset voltage, eh?? Here's me thinking opamps were straightforward! But, what you're saying makes sense, since I was concluding (having eliminated other possibilities) that the low input voltages were causing the opamp trouble. Actually, I put in the 22ohm load after my 5k pot started burning up. The load will eventually be whatever circuit is being prototyped (resistance unknown). I was hoping to keep as much of the voltage as possible, but losing a bit more is no big deal. Commented Dec 7, 2014 at 19:56
• @user50500 I'm not sure why exactly the 5k pot was heating up, and how that was related to the load. I would expect the transistor to heat up if it has to drop most of the 5 V while drawing 100 mA (500 mW). Commented Dec 7, 2014 at 20:49
• Actually, you could be right and I was thinking the same thing this morning. Since the opamp wasn't behaving as expected (and even if it was) when I shorted the load using the pot I gave it as much current as it was screaming for owing to the opamp pushing hard on the base pin. Even if it came out of saturation because of a disappearing Rl it would still have a very high Ic - thus the smoke! The worst part is I threw that transistor back in the pile! Better go find it. Commented Dec 8, 2014 at 11:31
• Thanks Clabacchio, increasing the voltage on the inputs worked a treat (just got around to testing it again). I'm using a 1ohm sense at the moment, but I'll try a .1ohm sense shortly and one of these guys: TLC2272CP op amp which seem to have a lower Vio. Commented Dec 9, 2014 at 23:01

Assuming your schematic is really how you've hooked it up, I'd hazard a guess that all your problems (except the pot burning up) are caused by the fact that you have the power and ground reversed. +5 goes to pin 8 and ground to pin 4, not the other way around.

Once you fix this, the question of offsets may or may not become relevant, but replacing Rsense with a 0.1 ohm resistor is a good idea. As it stands, though, at least half the time your circuit with the 0.01 will be able to compensate for offsets if you make a few changes. Your 10 ohm resistor is too small. Assuming you want to keep the 0.01 ohms, I'd recommend putting a 50 ohm resistor in parallel with the pot, and then running the wiper tor the op amp without the 10 ohm unit there at all. This will allow you to adjust for positive offsets.

I'd also suggest putting a 0.1 uF cap on the + input, just on general principles.

The pot burning up is a big red flag. You are doing something very, very wrong.

• Cheers beast, actually I created that component in TinyCAD and I must have got the pins mixed up. It was wired correctly on the breadboard. Commented Dec 8, 2014 at 11:43
• Whoops, hit return by accident. So, by removing the 10R and taking Vref from the wiper I can get a Vref from 0 - 480mV (if I've got my sums right). I'm not sure I understand the 50R in parallel apart from dividing the current. Why would I need to do that? Commented Dec 8, 2014 at 11:47
• By the way, you're right about that red flag. I'll need to replace the BC337 with power transistor or a FET to handle the power under short circuit conditions (which is the purpose of this circuit in the first place). Commented Dec 8, 2014 at 11:50
• A 50 ohm resistor in series with a 47k resistor and a voltage of 5 volts, will give a voltage of about 5 mV. If you put 5k pot across this 50 ohm resistor, the voltage will not (approximately) change. So now the voltage at the wiper of the pot can be varied from 0 to 5 mV, and unlike your present setup the variation will be linear. The 5 mV range should be enough to overcome any positive op amp offsets. Commented Dec 8, 2014 at 19:30
• Thanks for your comments beast. I implemented your Vref voltage divider arrangement and it worked very well. Unfortunately I had to accept clabacchio's answer because he was there first and it was pretty spot on. Commented Dec 9, 2014 at 23:03