A two-channel laboratory bench power supply, 0–36 V / 0–2 A per channel, fully isolated between channels. Each channel pairs a tracking switch-mode pre-regulator with a linear post-regulator, so it has the low output…
DualPreRegPowerSupply is an open-source printed circuit board by janni0609, from the janni0609/2-Channel-PreReg-Powersupply repository on GitHub. It is a 4-layer board of 99.6 × 100 mm with 379 parts on 215 nets, routed with 1,633 tracks and 481 vias.
It is built around the ATTINY1614-SSN, ADS1118IDGS and MCP48FVB22-E/UN, with the AP7383-33Y, LM2776DBV and LMV331TP among its other parts. Its parts include 123 capacitors, 99 resistors, 19 diodes, 18 ICs and 14 transistors. It belongs with the AVR (ATmega, ATtiny) boards of this library.
A two-channel laboratory bench power supply, 0–36 V / 0–2 A per channel, fully
isolated between channels. Each channel pairs a tracking switch-mode
pre-regulator with a linear post-regulator, so it has the low output noise of
a linear supply without the heat of dropping 36 V across a pass transistor.
Everything here is open: KiCad 10 schematics and layout for both boards, the
firmware for all three microcontrollers, and the design calculations (loop
stability, DC/DC dimensioning, ADC/DAC error budget) that back the component
values.
Status: built and working. Both PCBs are assembled and running. One known
footprint error, see Known issues.
2, independent, galvanically isolated from each other and from the control logic
Output voltage
0 … 36 V per channel
Output current
0 … 2 A per channel (setpoint = current limit, CV/CC)
Setpoint resolution
12-bit DAC ≈ 8.6 mV / 0.49 mA; front panel edits in 10 mV / 1 mA steps
Measurement resolution
16-bit ADC, ~1.9 mV / ~0.1 mA; displayed as 3 decimals (V) and 4 decimals (A)
Accuracy
±3–4 % uncalibrated (DAC band gap dominates). Measured after calibration, worst of both channels: setpoint ±17 mV / ±1.3 mA, readback ±2.8 mV / ±3.7 mA — see Measured accuracy
Protection
Per-channel over-temperature (settable, default 60 °C), system OTP on the heatsink, comms-loss shutdown, input fuses + TVS
Regulation
Analog CV and CC loops per channel; MCU sets the references, does not close the loop. CC is indicated by a panel LED driven straight from the loop
Display
256×64 SSD1322 OLED
Remote control
SCPI over Ethernet (raw TCP, port 5025) and USB CDC (front-panel USB-C)
Cooling
Temperature-controlled 4-wire PWM fan
Input
2 × 40 V DC (channels) + 12 V DC (logic) — see Power input
How it works
Power path (one channel)
text
40 V in ──▶ LT8612 tracking buck ──▶ Vpre = Vout + 2.2 V ──▶ TIP125 linear pass ──▶ OUT
▲ ▲
└────────── follows the output ────────────────┘
The buck converter does not produce a fixed rail — it tracks the output,
holding just 2.2 V of headroom across the linear stage. At full load that is
~200 mV across the 0.1 Ω shunt plus ~2 V across the TIP125 Darlington, i.e. a few
watts of dissipation instead of the ~70 W a plain 40 V linear supply would burn at
0 V out into 2 A.
The linear stage is a classic op-amp regulator built around a TIP125 PNP
Darlington driven by a TLV4387 quad op-amp:
Voltage loop — a 4-resistor difference amplifier across OUT+/OUT− scales the
output by 1/15 (0.06935) and compares it against Vset from the DAC.
Current loop — a 0.1 Ω shunt (PCS2512, 1 %, 0.4 W at 2 A) is amplified ×12.25
and compared against Iset. Whichever loop demands less current wins, giving
automatic CV → CC crossover. The crossover point itself is picked off as a
CC/CV signal that lights the front-panel CC lamp directly — no firmware in
the path, so the indicator is as fast as the loop it reports on.
Both loops are compensated deliberately, not guessed — see
Calc/Stability/ for the plant models, the chosen compensator
values, and the loop-gain / step-response plots.
Per-channel auxiliary rails come off the 40 V input: LMR51606 buck → 4.5 V,
AP7384-33Y → 3.3 V for the MCU and converters, and an LM2776 charge pump +
XC6901 negative LDO → −1.2 V so the op-amps can swing cleanly down to 0 V.
Each channel has its own ATtiny1614 living in that channel's isolated ground
domain. It drives the MCP48FVB22 dual DAC (the V and I references for the
analog loops), reads the ADS1118 16-bit ADC (output voltage and shunt current),
monitors an NTC, sequences the two enable lines, and stores its calibration in
EEPROM. Over-temperature shutdown happens in the channel MCU itself, so a hung
UART link can never leave an output enabled.
The RP2350 brain owns the user interface and all remote control. It never
touches the analog loops directly; it only sends setpoints and reads telemetry
over the two isolated 1 Mbps UART links.
Boards
hardware_main/ — main board (DualPreRegPowerSupply.kicad_pro)
Both power channels, both channel MCUs, the brain, and the digital supply on one
PCB. Hierarchical sheets:
Sheet
Contents
Ch1Power (×2 instances)
One complete channel — the sheet below is instantiated twice
├ Input
40 V input, fuse, TVS, common-mode choke
├ Power
Channel aux rails: 4.5 V, 3.3 V, −1.2 V
├ DCDCTracking
LT8612 tracking pre-regulator
├ Linear_PostReg
TIP125 pass element, V and I loops, shunt, sense amps
hardware_front/ — front panel (Front Panel.kicad_pro)
The user interface board: SSD1322 OLED header, rotary encoder with push button,
6 push buttons, 6 status LEDs (per channel: two green output-ON indicators, one
over each banana-jack pair, plus the red CC lamp), buzzer, and an MCP23008 I²C
expander that collects the buttons and drives the buzzer. The green indicators run
off the corresponding channel's isolated 3.3 V rail, so each half of the panel
stays in its own ground domain. Fabrication outputs in
hardware_front/production/.
Firmware
Both projects build with PlatformIO.
firmware/brain/main/ — RP2350 brain
Waveshare RP2350-Tiny (built against waveshare_rp2350_zero). Handles the OLED
UI, encoder and buttons, fan control, the UART links to both channels, and the
SCPI server on Ethernet + USB.
sh
cd firmware/brain/main
pio run # build
pio run -t upload # flash (UPF2 / USB bootloader)
RP2350 pin map (also documented at the top of platformio.ini):
Function
Pins
OLED SSD1322 (SPI1)
RES 9, SCK 10, MOSI 11, DC 12, CS 13
Rotary encoder (PIO quadrature)
A 14, B 15
W5500 Ethernet (SPI0)
CS 17, SCK 18, MOSI 19, MISO 20, RST 21, INT 22
MCP23008 expander (I²C1)
SDA 6, SCL 7, INT 8
Channel UARTs @ 1 Mbps
CH1: TX 0 / RX 1 · CH2: TX 4 / RX 5
Heatsink NTC / fan PWM
ADC3 (GPIO29) / GPIO26 (25 kHz)
firmware/brain/UI-test/ is the earlier UI-only
prototype the production firmware grew out of; it is kept for display work without
the power hardware attached.
firmware/channel/ — ATtiny1614 channel
megaTinyCore, 16 MHz internal oscillator, flashed over UPDI. Layered cooperative
super-loop with an explicit state machine
(INIT → SELFTEST → IDLE ↔ RUN → FAULT). See
firmware/channel/README.md for the module tree,
the state machine, and the calibration procedure.
sh
cd firmware/channel
pio run -t fuses # once: set OSCCFG to 16 MHz (required!)
pio run -t upload # flash over UPDI
The -t fuses step is not optional on a fresh part. The default fuse selects the
20 MHz oscillator base; with a 16 MHz build every timing (UART baud, delays,
telemetry period) comes out 25 % off.
Brain ↔ channel protocol
A small binary framing: [SOF 0xA5][LEN][CMD][payload][CRC8], defined in
firmware/channel/include/protocol.h (mirrored into the brain project). The
channel pushes a telemetry frame every 100 ms (V, I, P, temperature, state,
flags) and ACK/NACKs every command. If the brain goes quiet for 1 s while an
output is on, the channel turns that output off by itself.
Remote control (SCPI)
The instrument speaks an SCPI-1999 / IEEE-488.2 subset on two transports at
once — raw TCP port 5025 over Ethernet, and USB CDC — so it works with PyVISA,
NI-MAX, lxi, or a plain terminal.
Channel lists ((@1), (@1,2)) and stateful INST:NSEL selection are both
supported, along with the STATus register model, an error queue, and the
CALibration subsystem. The full command reference — including UART mappings and
known deviations — is in firmware/SCPI/commands.md.
Network settings (DHCP or static IP, netmask, gateway, hostname) are configured
from the front panel under Settings → Network, and only take effect on Apply,
so a half-typed IP never goes live.
Front panel
The main screen shows both channels side by side: measured voltage and current in
large digits, output power in the corner, and the active setpoints on the bottom
row. Six buttons (V · on · I per channel) select what the encoder edits and
toggle each output; the encoder push button moves the digit cursor — underlined on
screen — so any digit can be dialled directly instead of scrolling through the
whole range.
Below the buttons, each channel has two green output-ON LEDs flanking a red CC
lamp that lights whenever that channel leaves constant-voltage regulation, then the
output banana jacks. The USB-C port for SCPI-over-USB and firmware updates sits in
the middle of the panel; the mains switch is on the right. The enclosure is 3D
printed.
The Settings menu (encoder-driven, see
firmware/brain/UI-test/Settings.md)
covers per-channel diagnostics (temperature, DAC/ADC/comms health, operating
hours, stored calibration values, the manual 2-point calibration wizard), the
temperature and fan curve (start temp, max temp, minimum speed, system OTP),
the network configuration, and system items (firmware version, beeper, brain
runtime, remember-setpoints-on-restart).
Calibration
Every signal path — VSET, ISET, VMEAS, IMEAS, per channel — is a straight
line y = gain·x + offset fitted from two points and stored in the channel's
EEPROM. This is required, not optional: the MCP48FVB22 uses its internal
1.22 V band gap (Vref is not routed on the PCB), and that band gap is specified to
±3.3 %. Calibration removes it, along with the 1 % resistor and shunt tolerances,
leaving roughly ±0.05 % on voltage and ±0.1–0.2 % on current. Until a channel has
been calibrated it reports FLAG_CAL_INVALID.
Run it from the front panel (Settings → Channel n → Manual Cal V/I, with a
DMM on the output) or remotely via CAL:POIN / CAL:COMM. Full error budget and
where each term comes from:
Calc/DAC_ADC/DAC_ADC_Accuracy_Analysis.md.
Measured accuracy
Both channels were measured against a Siglent SDM3065X 6½-digit DMM on
2026-08-03/04, using Calc/evaluation/psu_accuracy.py — a
ramp of the full range in fine steps, comparing three numbers at every step:
source
exercises
setpoint
what was written with VOLT / CURR
DAC → VSET/ISET chain
readback
MEAS:VOLT? / MEAS:CURR?
sense amp → ADC → VMEAS/IMEAS chain
truth
SDM3065X
—
Voltage: 0 → 36 V in 500 mV steps, open circuit. Current: 0 → 2 A in 25 mA steps
into the DMM's own current input as the load, 2 V compliance. Figures are for the
instrument as it stands today, i.e. calibrated, and exclude the two endpoints
the channel physically cannot reach: the 0 V / 0 A setpoint (output floor, not an
accuracy error) and the clipped top of the current range (see
Known issues). psu_accuracy.py applies both exclusions itself,
so these numbers come straight out of its report; --keep-endpoints reports every
point instead.
Results
CH1 setpoint
CH1 readback
CH2 setpoint
CH2 readback
Voltage rms
8.8 mV
0.74 mV
5.1 mV
1.4 mV
worst
16.5 mV
2.1 mV
11.6 mV
2.8 mV
gain error
−0.0005 %
+0.0025 %
−0.0024 %
−0.0003 %
Current rms
0.30 mA
0.12 mA
0.52 mA
0.16 mA
worst
0.79 mA
0.39 mA
1.36 mA
0.51 mA
gain error
+0.012 %
+0.013 %
+0.035 %
+0.019 %
Both current columns were re-measured on 2026-08-04, after the measure-path
calibration bug was found and fixed and both channels' IMEAS re-calibrated.
The readback paths went from 0.78 mA rms / +0.135 % gain / −1.38 mA offset (CH1)
and 2.0 mA rms / +0.176 % gain (CH2) to the numbers above — an order of
magnitude, and the −1.4 mA offset that had been blamed on the shunt turned out to
be an artefact of the bad fit.
In short, worst of both channels: voltage setpoint ±17 mV (≈0.05 % FS), voltage
readback ±2.8 mV, current setpoint ±1.4 mA (≈0.07 % FS), current readback
±0.51 mA. Every voltage gain error is inside ±0.003 % and every current gain
error is now inside ±0.04 %, so the calibration is doing its job on every path.
The current readback is at ~5 ADC LSB worst case.
The voltage setpoint trace is the interesting one. Its error is not
calibration error — it is the 12-bit DAC. The sawtooth is the ±½ LSB rounding of
a requested millivolt onto the ~8.9 mV code grid, and the slow envelope on top is
the DAC's own INL (specified ±2 LSB). A 2-point calibration pins the two
endpoints and cannot bend to follow a bow between them, which is why
re-calibrating an already-calibrated channel here changes nothing. The readback
trace sits flat at the ADC's ~1.8 mV quantum. This is the hardware floor, not a
tuning problem — improving it needs an external DAC reference (the Vref pin is
not routed) or more DAC bits.
Current is the opposite case, and shows what calibration can do. Both of CH1's
current paths were a clean tilt beforehand — an error proportional to reading,
which is exactly the shape a 2-point fit removes. The setpoint went from +0.176 %
gain (−1.2 mA at 100 mA rising to +1.8 mA at 2 A) to +0.012 %, rms 0.89 →
0.30 mA; the readback went from +0.135 % gain with a −1.38 mA offset to
+0.013 %, rms 0.78 → 0.12 mA. Both traces are now flat inside ±0.8 mA across the
range, with the readback at ~4 ADC LSB. CH2 behaves the same way.
Rule of thumb from this: plot the error against reading before calibrating. A
tilt, or a constant offset, is gain/offset error and a 2-point fit removes it
exactly. A bow between the cal points is INL and it will not — which is why the
voltage setpoint above does not improve however often it is re-run. The report's
worst non-linearity row measures that bow; compare it against the quantisation
floor printed beneath it.
The supply is fed from three off-the-shelf Mean Well modules:
Input
Supply
Feeds
J101
Mean Well LRS-75-36, trimmed to 40 V
Channel 1
J601
Mean Well LRS-75-36, trimmed to 40 V
Channel 2
J901
Mean Well RS-15-12 (12 V)
Brain, OLED, Ethernet, fan
Each channel input has its own 3.5 A fuse, TVS clamp, and common-mode choke.
Because the two channel supplies are separate isolated modules and the UART links
are isolated with ISO6721 digital isolators, the two outputs are genuinely
floating and independent — they can be wired in series or referenced separately.
Outputs terminate in front-panel banana jacks (J201/J202 and J402/J403).
Repository layout
text
hardware_main/ KiCad 10 project — main board (power, MCUs, brain)
hardware_front/ KiCad 10 project — front panel (OLED, encoder, buttons)
firmware/
brain/main/ RP2350 production firmware (UI + comms + SCPI)
brain/UI-test/ Earlier UI-only prototype
channel/ ATtiny1614 channel firmware
SCPI/ SCPI command reference
requirements/ Original firmware requirements notes
Datasheets/ Datasheets for the main ICs
Calc/
Stability/ V and I loop compensation — notebooks + typeset report
DCDC Calc/ LMR51606 40 V → 4.5 V aux buck design
DAC_ADC/ Setpoint/measurement error budget
evaluation/ Bench accuracy measurement vs a reference DMM (+ raw results)
Design notes and calculations
Calc/Stability/stepbystep/ — Jupyter notebooks
deriving the voltage and current loop transfer functions (including the TIP125's
β(s) roll-off and the op-amp GBW corner), the chosen compensator values, load
sweeps, and step responses. The typeset summary is
Calc/Stability/stepbystep/report/loop_analysis.pdf.
AP7384-33Y footprint (channel 3.3 V LDO) — the footprint on the main board is
wrong; the part needs rework/adaptation to fit. Fix before ordering new boards.
The ADS1118 PGA is pinned to ±4.096 V rather than autoscaling. Each PGA range
has its own gain/offset error and input impedance, so a single 2-point cal line
cannot describe all of them — autoscaling made readings drift away from the
calibration points. Re-enabling it requires per-range calibration
(ADC_PGA_*_INDEX in firmware/channel/include/config.h).
Neither channel reaches its rated 2.000 A. The ISET DAC clips at ~1.99 A on
CH1 and ~1.95 A on CH2 (both setpoints above the ceiling return the identical
current, and the readback agrees). Full scale is 2.44 V ÷ 1.225 V/A = 1.99 A,
but DEFAULT_I_DIV in calibration.cpp assumes 1.2 → 2.033 A and
SETPOINT_I_MAX_MA is 2000; the channel spread on top is band-gap and shunt
tolerance. The top ~1–2 % of the current range is not reachable.
CALibration:DATA? returns NaN over SCPI: gain/offset cannot currently be read
back across the channel link. CAL:POINt/CAL:COMMit are also fire-and-forget
— the channel's NACK lands in lastNackCmd and the SCPI handler never looks at
it — so a rejected commit is invisible to the host. Between them these kept a
(now fixed) measure-path calibration bug hidden for far longer than it should
have been. Until they are addressed, re-drive the cal points and check the
readback residual (as psu_accuracy.py now does) rather than trusting
CAL:VALid?.
A setpoint written immediately after CAL:COMMit is occasionally dropped.
Seen 3/3 times as the first CURR after committing IMEAS in a full
calibration sequence, and 0/17 in isolated retries — so it is real but not yet
root-caused. Ruled out: the channel is not stalled by the EEPROM write (the
link never drops, OUTP? held over 3592 samples across a commit), and it is
not a frame-size overflow. Leave a settle after a commit, and verify setpoints
actually landed before measuring against them.
The hostname set in Settings → Network is stored and displayed, but the stock
Ethernet DHCP client does not advertise it to the DHCP server.
The CV/CC mode is shown on the panel by a hardware-driven LED, but the CC/CV
signal is not routed to a channel MCU pin, so the regulation mode cannot be
queried over SCPI (STAT:OPER has no constant-current bit).
Tools
KiCad 10 · PlatformIO (raspberrypi + atmelmegaavr platforms) · megaTinyCore ·
Arduino-Pico core · Python/Jupyter for the analysis notebooks.
A two-channel laboratory bench power supply, 0–36 V / 0–2 A per channel, fully isolated between channels. Each channel pairs a tracking switch-mode pre-regulator with a linear post-regulator, so it has the low output…
A programmable DC electronic load built on the Raspberry Pi Pico 2 (RP2350). It sinks a user-defined current from a DC source under test and measures voltage, current, power, capacity, and energy in real time on a…
This project is currently in a prototype stage. It features PCB project of basic reflow station utilizing 4 phase-controlled triacs steering with attached heaters.
Reference design of a two-face UHF early-warning phased-array radar: system sizing, MoM antenna simulation, seven KiCad PCB projects, Blender site model
Fully analog 2-wire 4-20 mA NTC thermistor temperature transmitter, built from multi-sourced parts — plus an instrumentation-theory tutorial. Default build: 20-40 C for chocolate temperature control.
Modular battery emulator for the development and functional testing of Battery Management Systems: the cell emulator
63 parts9
Questions
How big is the DualPreRegPowerSupply PCB?
It measures 99.6 × 100 mm and has 4 copper layers, 1.6 mm thick.
What parts does the DualPreRegPowerSupply use?
379 parts, built around the ATTINY1614-SSN, ADS1118IDGS, MCP48FVB22-E/UN and AP7383-33Y. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.
Where can I download the DualPreRegPowerSupply KiCad files?
From the janni0609/2-Channel-PreReg-Powersupply repository on GitHub, at the commit this page was made from: the board is hardware_main/DualPreRegPowerSupply.kicad_pcb and its schematic hardware_front/Front Panel.kicad_sch. PCBKit opens the board in the browser, with nothing to install.
Can I use the DualPreRegPowerSupply design in my own project?
Its repository states no licence, so its author keeps all rights: ask janni0609 before reusing the design.