LM317 adjustable supply
An LM317 on a 12 V adapter with 240 ohms and a 2 k pot: Vout = 1.25 V x (1 + R2/R1), from 1.25 V up to the dropout, with an LED on the output. There is no microcontroller in it: the simulator solves the 6 parts as a circuit, so it runs the moment you press Run, and nothing needs compiling.
Teaching? Assign it to your class in one click.
Beginner Runs in your browser. Free, and no account needed.
The parts retail for about $8.20. On Mokxi they're free.
How it works
There is no microcontroller in this one, so nothing is compiled: the simulator solves the circuit itself. The file in the editor is the notes that come with it.
// An LM317 adjustable supply.
//
// There is no microcontroller here. Press Run and the simulator solves the
// circuit; turn the knob and watch the number under the LM317.
//
// WHAT IT IS. A 12 V wall adapter into the LM317's IN. The LM317 holds its
// OUT 1.25 V above its ADJ leg, and that is all it does. R1, 240 ohms from
// OUT to ADJ, has those 1.25 V across it, so 5.2 mA through it. The same
// current goes on through R2, the potentiometer from ADJ to ground, and lifts
// ADJ off ground by R2 times 5.2 mA. So:
//
// Vout = 1.25 V x (1 + R2 / R1) + 50 uA x R2
//
// The 50 uA is the current that comes out of the ADJ leg itself, the small
// second term on the datasheet.
//
// THE KNOB. At mid travel R2 is 1 k: 1.25 x (1 + 1000/240) + 0.05 = 6.51 V,
// and the readout says 6.52 V, well inside the spread of the reference (TI
// gives 1.2 to 1.3 V). All the way down, R2 is nothing and the output is the
// 1.25 V reference. All the way up, R2 is 2 k and the formula wants
// 11.77 V, but the LM317 needs about two volts across itself: from 12 V in it
// gives about 10.5 V, and the rest is the dropout.
//
// WHY 240 OHMS. The LM317 has no ground leg, so its own operating current,
// a few milliamps, leaves by OUT. R1 has to take it. Change R1 to 10 k and
// take the LED off: the output climbs toward the input, because nothing is
// there to carry that current.
//
// THINGS TO TRY. Swap the adapter for 9 V in its properties and the top of the
// knob comes down by about 3 V. Or put a 47 ohm resistor on the output at
// 10 V and think about the heat: (12 - 10) V x 210 mA is 0.4 W in the
// regulator, and at 5 V out the same resistor costs it (12 - 5) V x 106 mA,
// 0.74 W. A linear regulator burns what it does not pass on.
Parts list
7 parts, plus the jumper wires. They retail for about $8.20; on Mokxi they're free.
- 1 × Half breadboard
- 1 × DC jack and adapter
- 1 × LM317 regulator
- 1 × Resistor, 240 Ω
- 1 × Potentiometer
- 1 × Resistor, 470 Ω
- 1 × LED, red
How it is wired
5 connections, pin by pin, read from the circuit itself. Each line is one set of pins joined together, by a jumper wire or a breadboard strip.
- DC jack and adapter pin V+; LM317 regulator pin IN
- Ground: DC jack and adapter pin V-; Potentiometer pin 1; LED, red pin C
- LM317 regulator pin ADJ; Resistor, 240 Ω pin 2; Potentiometer pin 2
- LM317 regulator pin OUT; Resistor, 240 Ω pin 1; Resistor, 470 Ω pin 1
- Resistor, 470 Ω pin 2; LED, red pin A
Change it and keep it
Open it in the editor, change the circuit or the code, and keep your version in a free account.