I'm working on a VLC+IR transmitter that runs from batteries. I decided to use an LM317 so that the discharging battery wouldn't really affect the current through the LEDs. (Disclaimer: I've never worked with this IC before in my life.) I use TINA for simulations and I found a spice model of the 317 somewhere on the internet.* Its output voltage dropped when connecting the LEDs, so I connected a unity-gain buffer op-amp between the two.

enter image description here

The transmitter has two "outputs": a white and an IR LED. They can work together or one-by-one. VG1 and VG2 are square waves with a frequency of 1 MHz. When I turn off SW-SPST2 or SW-SPST3, the other is working properly. However, when I try to operate them at the same time, one of them stops behaving normally. I checked the op-amps output voltage (VM3), and it keeps changing between 2 and 5 volts, approximately. I don't understand why, as the op-amp has a really low output impedance, thus the output voltage shouldn't be affected by the load.

enter image description here

So, my question is: First, what is the cause? Simply a simulation mistake? Second, I'm not really convinced that the LM317 model is correct, so, am I correct assuming, that its output voltage drops with a load?

Edit: Yes, I made a mistake by putting a 2k resistor to the LM317. I just wanted to produce a stable ~4 volts. Now, I replaced it with 540 Ohms, the nominal value for which the output is about 4.06V. The problems are still there, whether or not I use the op-amp. If I don't use it, the voltage drops after I connect the load. If I do use it, I still can't use both the LEDs at the same time.

  • \$\begingroup\$ "I decided to use an LM317 so that the discharging battery wouldn't really affect the current through the LEDs." Except it's not in a CCS configuration. \$\endgroup\$ – Ignacio Vazquez-Abrams Oct 15 '14 at 15:53
  • \$\begingroup\$ What does that mean? \$\endgroup\$ – hryghr Oct 15 '14 at 15:58
  • \$\begingroup\$ The LM317 can be used in constant-current mode by putting a resistor between OUT and ADJ, with no further connections to ADJ. See the datasheet for details. But the op amp disrupts this since it acts as a source itself. \$\endgroup\$ – Ignacio Vazquez-Abrams Oct 15 '14 at 16:01
  • \$\begingroup\$ Well, I don't really want constant output current, I just want to negate the effect of a discharging battery on the brightness of the light. \$\endgroup\$ – hryghr Oct 15 '14 at 16:03
  • \$\begingroup\$ Which is why you want constant current. Once voltage reaches a minimum it has no effect on LED brightness. \$\endgroup\$ – Ignacio Vazquez-Abrams Oct 15 '14 at 16:06

Resistors R1 and R2 set the output voltage of the LM317 to 11.7 volts. However, the input voltage is only 6 volts, so the LM317 can never get anywhere near regulating.

The LM317, and other three-terminal linear regulators can only reduce the input voltage, not increase it. In addition, they require a certain amount of headroom to operate correctly. I recall (without looking at a datasheet) that the LM317 requires the input voltage to be at least 2 volts above the output voltage in order to regulate.

  • 1
    \$\begingroup\$ Also, once you do get the LM317 into regulation, you'll find that it has much greater current capacity than the opamp. \$\endgroup\$ – Dave Tweed Oct 15 '14 at 16:40
  • \$\begingroup\$ Somehow I still get 4V at the output (DC analysis). The model must have an error, I'm gonna get rid of it. Could you please also answer the more theoretical questions? \$\endgroup\$ – hryghr Oct 15 '14 at 16:41
  • \$\begingroup\$ @hryghr: The model is fine, that's what "headroom" means. The problem is your circuit design. \$\endgroup\$ – Dave Tweed Oct 15 '14 at 16:43
  • \$\begingroup\$ I disconnected everything but the battery, the LM317 and R1, R2, C1, C2. Still, the output is 4.07V. \$\endgroup\$ – hryghr Oct 15 '14 at 16:46
  • \$\begingroup\$ @hryghr: ... Which is about 2V lower than the input voltage, exactly what you'd expect for this chip. \$\endgroup\$ – Dave Tweed Oct 15 '14 at 16:51

It appears that you are expecting the LM317 to produce an output voltage greater than the input voltage. If so, a rethink is needed - it's just a basic voltage regulator with no ability to boost the output voltage above the input.

If you want 11 volts (or thereabouts) from a 6 volt supply then use a boost regulator like this: -

enter image description here

This takes an input voltage of about 5V and produces 12 volt but could be adjusted to produce 11 volts by altering R3. Here's the data sheet and this will show you that the input voltage can encompass 6 volts.

  • \$\begingroup\$ Well, unfortunately the mistake I made at the very beginning (and me being unclear about the wanted voltage) lead you astray. I edited my question, please take a look if you have some time. \$\endgroup\$ – hryghr Oct 15 '14 at 19:36
  • \$\begingroup\$ @hryghr you can use the chip above as a buck boost regulator to produce a 4 volt output even when the input voltage drops down to 2.5 volts. The LM317 needs at least a power supply input that is 2.5 volts above the output to work correctly at a drive of 1.5 amps. This lowers to under 2 volts at low current loads and I also suspect that under load your battery voltage drops and the problem spirals. Go for a buck boost regulator if you want to get the most from your varying input voltage. \$\endgroup\$ – Andy aka Oct 15 '14 at 20:18
  • \$\begingroup\$ Thank you for your help! However, I'm still interested in what to do if, let's say, I only had an LM317 and wanted to preserve its output voltage from getting dropped by a load. \$\endgroup\$ – hryghr Oct 15 '14 at 20:25
  • \$\begingroup\$ How much are both LEDs taking current wise? \$\endgroup\$ – Andy aka Oct 15 '14 at 20:50
  • \$\begingroup\$ About 20 mA each (50% duty cycle square-like wave, 20 mA peak). The function AM2 is what I want to achieve for both. \$\endgroup\$ – hryghr Oct 15 '14 at 21:18

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.