# LM317 intermittent current source

I need a 50 mA current source despite the load value (resistor LOAD), and I need the current flowing just when the microcontroller says so.

It works fine with LOAD = 0 ohm and IL = 50 mA, but when I enlarge LOAD the current decreases (LOAD = 330 ohm and IL = 11 mA / LOAD = 1,330 ohm and IL = 3 mA).

What am I missing in the design?

simulate this circuit – Schematic created using CircuitLab

• To start with, your FET is in upside down, and will always conduct via the body diode. – WhatRoughBeast May 22 '18 at 22:53
• Rmax=V / I ..... – Tony Stewart Sunnyskyguy EE75 May 22 '18 at 22:59

In the constant current mode, the maximum output voltage of the LM317 circuit is $V_{in} - 3\ {\rm V} - 1.25\ {\rm V}$. With 9 V input, that means you won't get more than about 4.75 V output.