0
\$\begingroup\$

I'm trying to build a voltage controlled DC current source. For this, I built this circuit: Holi

A little bit of context. The voltage supply is 5V. Current range must be from 0mA to 30mA or so. Load will be an LED but for now I'm just connecting the collector to Vcc and measuring current with an amp meter. The transistor I'm using is BC337 and the opamp is OP07 connected to 5V and 0V. Vset is a PWM filtered with an RC circuit. Rset is 100 ohms.

Now for the part that doesn't work. For voltages above 1V, 20% of Vcc, in the input Vset, the circuit behaves as expected. That is, I get a 10mA current at 1V and I get Vset/Rset current for every Vset until the transistor enters saturation around 30mA.

For voltages under that, the opamp does something I'd never seen before, it operates neither in linear nor saturation region. As I start lowering the voltage on Vset, both inputs separate, the inverting input lowers less and less until it gets stuck at around 500mV. So the final result is that I have 0V in the non inverting input, 500mV in the inverting input and thus 5mA through Rset. This is obviously not linear region because there is no virtual short circuit. However, the voltage on the base isn't Vcc, if it were Vbe would be huge and I'd get a bigger current. Instead, it gets stuck at around 1V.

How can the opamp do this? What sort of operation is this and how do I stop it?

\$\endgroup\$
  • \$\begingroup\$ Try an LM324 - there inputs and outputs extend to the lower rail. \$\endgroup\$ – Andy aka Dec 30 '15 at 14:17
  • \$\begingroup\$ Note that if your purpose is just a constant current, you can just omit the op amp from that circuit hooking your control voltage directly to the base and you will have the transistor acting as a constant current emitter follower. Subtract 0.7V when calculating current to take the vbe drop into account. \$\endgroup\$ – John Meacham Dec 31 '15 at 8:20
  • \$\begingroup\$ @JohnMeacham that was my first approach, but at low voltages the Vbe variations where enough that the current was not linear at all with the base voltage. \$\endgroup\$ – freejuices Dec 31 '15 at 18:26
3
\$\begingroup\$

Input voltage range.

Lets have a look at your opamp.

enter image description here

First notice that this table is for when you are using +/- 15V. Second, have a look at the input voltage range. Notice how it does not go up to the rails (+15V and -15V).

Now you say that when your input is 1V, everything is good, and the problem happens when you go below. This is because you are now outside the input voltage range and you must be within 1-2V of your supply. In your case, your supply is 5V. So what that means is that your input range must be between 1V and 4V (maybe even 2V and 3V. You'll have to measure it out, but seems like within 1V of the upper and lower rail will work.

When you start to do things that the datasheet says you shouldn't do, weird things can happen. The opamp will stop having predicted behavior and quite possibly, you'll get something called phase reversal. Instead of the opamp driving the output to one rail (as expected), it instead, will drive it to another. Fun times.

If you require your signal to go up to the rail, then what you need is a "rail to rail" or RRIO (rail to rail input output). These opamps can go have an input that goes up and down to the supply voltages AND output up and down to the supply voltages. The OP-07 does not.

enter image description here

As @Asmyldof pointed out in the comments, there are a lot of general purpose opamps that can do down to the lower rail such as the mentioned LM324

enter image description here

Notice that its input range extends down to 0V but it can only go as high as Vcc-1.5 (3.5V when using a 5V supply). This will address the below 1V problem you are having but you may not be able to reach your max current of 30mA.

If the Vbe of your transistor is 0.75V, and the max output voltage of the opamp is 3.5V, then the max current you can get is 27.5mA.

You can do one of the following with an opamp that at least extends to the lower rail

  1. Decrease your emitter resistor slightly such that it is at most 91 ohms
  2. Increase your supply voltage so that its at least 5.25V
  3. Swap your opamp with a RRIO.

Basically, the opamp you selected is not exactly the best for your application or voltage range.

\$\endgroup\$
  • \$\begingroup\$ Inclusion of the fact that there are quite a lot of general purpose op-amps that do reach the lower rail, such as the LM324 Andy comment-suggests above, would move this from great answer to awesome. Since RRIO only offers a fraction of diversity over lower-rail IO op-amps and the OP only needs up to 3V in / 3.8V out for the 30mA peak mentioned. \$\endgroup\$ – Asmyldof Dec 30 '15 at 14:34
  • \$\begingroup\$ @Asmyldof appreciate the feedback. Good points. \$\endgroup\$ – efox29 Dec 30 '15 at 15:11
  • \$\begingroup\$ Thanks for the great answer. I feel kinda dumb that I didn't realize that, I completely forgot about rail to rail. I'm so used to working with +-15V that I ignored it. Changing the supply is complicated because it's the 5V from the Arduino, and a step up regultaor seems overkill. I'm sure I have a rail to rail opamp lying around, I'll give it a go. Thanks again! \$\endgroup\$ – freejuices Dec 30 '15 at 15:25
  • \$\begingroup\$ Just to clarify for future readers, then the opamp is in saturation. It saturates at the lower voltage it can go, which is 100mV over GND because it's the closest it can get to the lower rail. Right? \$\endgroup\$ – freejuices Dec 30 '15 at 15:33
  • \$\begingroup\$ @freejuices If you don't need more than 3V Vset (30mA through 100 Ohm) you can also use an LM358. They are so general purpose almost everyone has a couple somewhere. They include the lower rail (GND) in their input range and output goes low enough to turn off the transistor, and though not strictly specified as such, from my experience the output will likely reach 4V as well in (near-) linear fashion with a 5V supply with below 1mA output current. \$\endgroup\$ – Asmyldof Dec 30 '15 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.