About
It's a rite of passage. Every electronics hobbyist must make their own bench power supply.
The power supply is of course based on a linear voltage regulator (the venerable LM317) with analog voltage control. Voltage and current are measured and displayed on an OLED display.
It boasts the following features:
- 1.25V - 18V output limited on the low end by the LM317, and on the high end by the input.
- 0 - 2.5A output limited by the LM317.
- Short-circuit safe courtesy of the LM317.
- Accurate analog voltage control with a 10-turn potentiometer.
- Fast-updating (~100Hz) digital display with voltage, current, power.
- Accurate voltage display: 10mV below 5V, otherwise 20mV.
- Accurate current display: 1mA below 240mA, otherwise ~5mA.
- Temperature-controlled fan which only kicks in for heavy loads.
Design
The core of the power supply is the LM317 linear regulator U4, whose output voltage is adjustable through potentiometer R23. R31 provides a minimum load, and R32-R41 form the 0.1Ω current shunt.
The voltage is buffered through U5C, and then clamped to VCC and fed to the 10-bit ADC for fine voltage measurement. It's also scaled down using a 5:1 voltage divider (R14,15,48) and fed to the ADC. This provides a coarser full-range voltage measurement.
Similarly, U5A and U5D measure and amplify the voltage across the current shunt, at two different gains. These are also connected to the ADC, and they provide an accurate low-range current sense, as well as a full-range coarser sense. The MCU displays the fine-grain current/voltage when within range, and uses the coarser full-range measurement otherwise.
The rest of the circuit consists of status LEDs, fan control, a temperature sensor, connectors, and several voltage rails (including -3V obtained with a ring-oscillator-driven charge pump).
The MCU is an Atmega328P (embodied here in an Arduino Pro clone), programmed in plain C. It measured voltage and current, and shows them on the display. It uses a moving window average to ensure the fast-updating display has some stability. It also measures the temperature and controls the fan.
The Result
The populated board is housed in a plastic box, together with the LM317 on a hefty heat sink with fan, and a 21V laptop power brick. The box has strategically placed holes to encourage some airflow.