⚠ Under heavy construction

As of July 11, 2026, Sorter V2 is not yet in a position to be built.

The documentation that exists is incomplete. Any given page may be accurate, inaccurate, present only as an example, or badly out of date. We do not yet recommend that anyone attempt to build Sorter.

For the most live updates on our progress, join our Discord.

Design and research: Variants, Concepts

Push-button power manager

Explanation

A proposal to start the machine with one button and shut it down cleanly, by switching a Mean Well HRPG-150-24 supply through its remote-control input, with the Orange Pi shutting itself down before the 24 V goes away.

Author Jan-Henning Grell (Soran82)

Concept, not built, not simulated, not tested. The component values are calculated, the part numbers are suggestions, and the firmware was only syntax-checked against a stub. Nothing on the build pages changes because of this page. Mains wiring must only be done by a qualified electrician.

This page summarises a concept proposal, draft 0.1 of 2026-10-21. It was written from the Sorter V2 documentation and KiCad files and from the Mean Well HRPG-150 datasheet (2017-07-14), and the author prepared it with the help of an AI assistant. The full document, including the part-by-part schematics and all the source code (the ATtiny firmware and the Orange Pi scripts), is the concept PDF. The Sorter V2 pages it was read from are themselves marked as drafts that were not checked against a built machine, so every project detail in it should be confirmed against the KiCad files and the firmware.

1. Summary

  • Goal: start the machine with one button and shut it down cleanly. The Orange Pi has to finish its shutdown before the 24 V supply is switched off.
  • Approach: a small power manager (an ATtiny214) runs from the always-on 5 V auxiliary output of the HRPG-150-24 and drives the supply's remote-control input.
  • Fail-safe: the HRPG remote input is "open = on, shorted = off", so the concept uses a normally-closed photo-MOS relay. If the power manager is dead or unpowered, the supply stays off.
  • Isolation: the auxiliary ground (AUXG) is isolated from the 24 V output, so the power manager talks to the Orange Pi through two optocouplers.
  • Status light: a plain RGB LED (common anode, no data protocol) on its own cable, separate from the button.
  • Servo flaps: no per-layer adapter boards. The servos plug into the 3-pin ports of a PCA9685 servo-driver module, which gives up to 16 layers per module.
  • Automatic shutdown (optional): an Orange Pi service switches the whole machine off when no new piece has been sorted for a configurable time, using the backend's existing shutdown endpoint and the same path as the button.

2. What it re-uses and what it adds

Provided by the Sorter V2 project (re-used)Added by this concept
The "basically board v1.3" control board: Raspberry Pi Pico, five TMC2209 stepper drivers, 5 V, 12 V and 6.5 V (ServoV) rails, four LED ports, two switch inputsA power manager at the HRPG-150-24 auxiliary output (button, remote on/off, shutdown handshake)
A PCA9685 servo driver (16 channels, I2C 0x40) with MG995 servos on 6.5 VDirect servo connection to the module ports (no layer adapter boards, no ribbon cables)
The 24 V to 5 V USB-C converter for the Orange Pi, the USB hub and the three PSU jacksAn RGB status LED and a button as a separate control panel
An Orange Pi 5 (8 GB) with SorterOSTwo small systemd services and a GPIO configuration on the Orange Pi, plus an optional automatic-shutdown service

Out of scope: the mechanical design, the sorter software, the mains-side wiring inside the PSU box, and a PCB layout. The author suggests that, if the idea turns out to be of interest, the power manager could be built into the distribution board. That is a change to the board design and is not proposed here.

3. System architecture

Power paths

  • Mains goes through the PSU box (fused IEC inlet with switch) into the HRPG-150-24 (24 V, 6.5 A, 156 W).
  • The 24 V output feeds three loads through separate leads: the control board, the USB hub and the 24 V to 5 V USB-C converter for the Orange Pi.
  • The auxiliary output (5 V, at most 0.3 A) stays live while the supply is switched off. It powers the power manager and the status LED.
  • On the control board, 24 V is converted to 5 V, 12 V and 6.5 V (ServoV). ServoV feeds the PCA9685 module and the servos.

Control and signal paths

SignalFrom toLevel or mediumNotes
RC+ / RC-Power manager to HRPGCN100 pins 6 and 5, dry contact (photo-MOS)open = supply on, closed = off
REQ_NPower manager to Orange Pioptocoupler U5, 3.3 V on the Pi sidea 500 ms low pulse means "shut down now"
PWROFFOrange Pi to power manageroptocoupler U4high for at least 500 ms means "the Pi is about to halt"
USBOrange Pi to USB hub to PicoUSBthe project's normal communication (steppers, servos, lamps)
I2CPico to PCA9685 module3.3 V to 5 V through the PCA9306servo angles, with the 50 Hz PWM generated by the module
PWM_0 to PWM_15PCA9685 to servo ports5 V PWM, 220 ohm per outputone port per layer
Overall schematic of the proposal. On the left the mains input feeds the HRPG-150-24, whose 24 V output runs to the converter for the Orange Pi, the USB hub and the control board. Below the supply, a boxed power manager holds the ATtiny214, a normally-closed relay on the remote-control pins, two optocouplers to the Orange Pi, and the button and RGB LED. On the right, the control board's Pico drives a PCA9685 servo module with up to sixteen servo ports, plus the stepper drivers and LED ports.
Overall schematic. Red is 24 V, orange is the 5 V auxiliary output, purple is ServoV, green is the 3.3 V standby rail, black grounds are the 24 V side and blue grounds are the isolated auxiliary ground. Drawn from the concept proposal, not from a build. Drawing: Jan-Henning Grell (Soran82). Full-size image.

4. What the HRPG-150 datasheet says

The signal connector is CN100 (mating housing HRS DF11-6DS). The pins used are:

CN100 pinSignalFrom the datasheet
1-SRemote sense negative, not used
2+SRemote sense positive, not used
3AUXGAuxiliary ground, isolated from the output terminals (+V and -V)
4AUX4.75 to 5.25 V, at most 0.3 A, not controlled by remote on/off
5RC-Remote control ground
6RC+4 to 10 V or open = power on; 0 to 0.8 V or short = power off

Other values used: output 21.6 to 28.8 V adjustable (24 V nominal), 6.5 A and 156 W, overload protection at 105 to 135 % with constant-current limiting and automatic recovery, inrush typically 35 A at 115 V and 70 A at 230 V, setup time about 3 s. The datasheet also says "The 5V standby must be connected with a minimum load of 0.03 A."

Datasheet factDesign consequence
RC open = on, short = offA normal (normally-open) relay would switch the supply on as soon as mains is applied. U2 is a normally-closed photo-MOS relay (1-Form-B). Unpowered, the contact is closed and the supply stays off.
AUX minimum load 30 mAResistor R14 (150 ohm, 0.25 W) draws about 30 mA from the 4.6 V rail. The regulator, ATtiny, LED and U2 add to this and stay below 0.3 A.
AUXG isolated from -VThe standby ground is not tied to the 24 V ground, so the Orange Pi interface uses two optocouplers (U4 and U5).
Output adjustable to 28.8 VThe 24 V to 5 V converter accepts up to 32 V, so the adjustment range is uncritical.
Constant-current limiting at 105 to 135 %An overload does not trip a fuse. The total load has to be kept clearly below 6.5 A (section 8).

5. The power manager

Circuit blocks

BlockPartsFunction
SupplyD2 (SS14), U1 (MCP1700-3302), C3 and C4 (1 uF), C5 (100 nF)3.3 V logic rail from the auxiliary output, so the ATtiny runs whenever mains is present
Remote switchU2 photo-MOS 1-Form-B (for example G3VM-61B1 or AQY412), R4 220 ohmshorts RC+ and RC- while its LED is off (supply off); the ATtiny lights the LED to open the contact (supply on)
ControllerU3 ATtiny214 (SOIC-14), UPDI header J2state machine, debouncing, LED control
Pi interfaceU4 and U5 (PC817), R7, R9, R12, R13isolated handshake: REQ_N to the Pi, PWROFF from the Pi
Minimum loadR14 150 ohm / 0.25 Wsatisfies the 30 mA minimum load on the auxiliary output
Control panelSW1 push button, LED2 RGB LED (common anode), D4 (SS14), R3, R10, R11, R2, D3, C6button input with ESD protection, status output, LED supply from the auxiliary output

Sequence

StateEventAction
Offshort button pressU2's LED turns on, the remote input opens, the supply starts (about 3 s setup), state on
Onshort button pressREQ_N goes low for 500 ms; the Orange Pi runs systemctl poweroff
OnPWROFF high for at least 500 msstate "shutdown", latched even if the line drops again
Shutdownafter 25 sU2's LED turns off, the remote input is shorted, the supply is off
Onbutton held for 8 semergency off immediately (for a hung Pi); the LED shows red for 1.5 s
Onsorting finished (optional watchdog, section 7)the Pi shuts itself down, PWROFF follows, and the supply is switched off 25 s later

A Pi reboot does not set PWROFF, so the supply stays on. After a mains failure the system stays off until the button is pressed (a constant, AUTO_START, can change this). The 25 s delay covers the file-system sync and the kernel halt after the shutdown service has signalled PWROFF.

Failure behaviour

SituationResult
Power manager unpowered or deadU2's contact is closed, so the supply stays off
Mains returns after a failurethe supply stays off until the button is pressed
Orange Pi hangshold the button for 8 s (emergency off); there is no clean shutdown, so file-system recovery may be needed
Cable to the control panel cutthe button reads open (no press) and the LED is dark; the machine can still be shut down from the Pi
PWROFF glitch on the Pi pin during bootignored unless the signal stays high for 500 ms

Control panel: button and RGB LED

The push button has no LED. Status is shown by an external RGB LED with a common anode on its own 4-wire cable (+4.6 V, red, green, blue). Button and LED connectors are separate so that either part can be replaced independently.

The LED is supplied with about 4.6 V (the auxiliary output through a Schottky diode) and not 3.3 V, because green and blue LEDs have about 3 V forward voltage, which leaves almost no current from a 3.3 V pin. With the anode at 4.6 V each colour carries about 5 mA. The ATtiny pins switch the cathodes: pin low = colour on, pin high (3.3 V) = off, because only about 1.3 V then remains across the LED and its resistor. The three LED pins must never be left high-impedance, because a floating cathode would rise towards 4.6 V and feed the 3.3 V rail through the ATtiny's protection diode. The firmware writes high first and then makes the pins outputs.

LEDMeaning
dark, short green blink every 3 ssupply off, power manager waiting
bluestarting, the first 45 s after power-on (the Orange Pi booting; the time is an assumption)
greenrunning
yellow (red and green) fast blinkingshutdown requested, the Pi is shutting down
red slow blinkingthe Pi has signalled PWROFF, the supply switches off in 25 s
red for 1.5 semergency off

6. The Orange Pi side

Two small systemd units run next to the Sorter software. The full source is in Appendix B of the concept PDF.

  • powerctl-req.service waits for a falling edge on REQ_N (with gpiomon) and runs systemctl poweroff.
  • powerctl-off.service runs only on poweroff or halt (not on reboot), before poweroff.target, and sets PWROFF high for 2 s with gpioset.
  • /etc/default/powerctl holds the GPIO chip and line numbers, which depend on the pins chosen on the header (check with gpioinfo).

The scripts use the libgpiod 1.x command-line syntax, so with libgpiod 2.x the options have to be adapted. The Orange Pi GPIOs are 3.3 V and not 5 V tolerant.

7. Automatic shutdown when sorting has finished

The power manager does not need to know about the end of a sorting job. Any Linux shutdown of the Orange Pi ends in the same path as the button: the shutdown service signals PWROFF, and the supply is switched off 25 s later. The machine can therefore switch itself off after sorting if software on the Pi starts a normal shutdown.

The Sorter V2 backend already provides POST /api/system/shutdown, which powers the whole machine down. What it does not provide is a "finished" signal, so the optional powerctl-auto watchdog defines "finished" as "no new pieces for a while":

  • It polls GET /api/system/status and GET /api/pieces/overview on the loopback interface every 30 s.
  • It arms itself only after at least one piece has been distributed since it started, so a machine that was just switched on and is still idle is never shut down.
  • If the piece counters stay unchanged for IDLE_MIN minutes (default 20), the hardware state is ready and no hardware error is active, a grace period of GRACE_S seconds (default 60) starts. Any new piece, state change or error during the grace period cancels it.
  • After the grace period it calls the shutdown endpoint once.
  • If the backend is unreachable, the idle timer restarts, so a crashed or restarting backend never causes a shutdown.

The feature is off by default (AUTO_SHUTDOWN=0) and starts in a dry-run mode (DRY_RUN=1) that only logs what it would do. A paused machine cannot be told apart from a finished one over the REST API, so IDLE_MIN has to be generous. The watchdog logic was tested against a fake backend (five scenarios) and not against a real Sorter V2 backend. A proper "run finished" event in SorterOS would be a better trigger than inferring the end from silence.

8. Servo flaps

The Sorter V2 design connects one MG995 servo per layer. The signals come from a PCA9685 chip or module (16 outputs, 50 Hz PWM, I2C address 0x40); in the project, ten outputs are routed on a ribbon cable to passive per-layer adapter boards. This concept drops the layer boards and plugs the servos directly into the module's 3-pin ports (brown GND, red V+, orange PWM).

  • Capacity: 16 ports per module, so up to 16 layers instead of 10. A second module (for example at address 0x41) would allow 20 layers in hardware, but the project firmware only addresses 0x40, so a firmware change would be needed.
  • ServoV rail: the rail is rated 1.5 A (6.5 V, from the 12 V rail). A stalled MG995 draws about 1.2 A, so two stalled servos overload it. The project firmware releases a servo after at most 3.5 s.
  • Cable length: the servo lead is 300 mm. Higher layers need extension leads (3-core, 22 AWG or thicker). The 100 uF capacitor of the adapter board is missing at the servo, so add 100 to 220 uF across V+ and GND at the plug for long leads.

9. Open points

#Open pointPriorityNext action
1Total power budget not verified. A rough upper bound from the project's own ratings is about 120 to 130 W: Orange Pi branch up to 25 W, hub and cameras about 5 to 10 W (assumption), three lamps about 28 W, fan 1 W, four NEMA 17 steppers up to about 40 W at full holding current, the NEMA 23 about 5 W at the driver limit, servo rail up to about 10 W, plus converter losses.HighMeasure the real 24 V current in all machine states (homing, sorting, lamps at full brightness) before relying on a 156 W supply.
2Servo rail 1.5 A. Several simultaneously stalled servos overload it.HighLimit concurrent moves in software, or size a stronger 6.5 V converter on the control board.
3U2 part selection. The HRPG datasheet does not give the open-circuit voltage or short-circuit current of the RC pins.HighMeasure RC+ and RC- on the actual supply, and check the relay's LED current and voltage ratings.
4Supply protection. The project's board fuses are 10 A, but the HRPG delivers only 6.5 A and relies on current limiting from 105 %.MediumAdd a 6 to 8 A fuse in the 24 V feed, or accept the limiting behaviour after the measurement in point 1.
5Pin numbers and firmware. The ATtiny214 pin numbers were not checked against the datasheet, and the firmware was only syntax-checked against a stub.MediumVerify the pinout, compile with megaTinyCore, and test on a bench setup with an LED and a dummy load.
6Project documentation status. Several project pages are labelled as AI-generated first drafts.MediumConfirm details against the KiCad files, the firmware and the published v1.3 board schematic.
7More than 16 layers. Needs a second PCA9685 module and a firmware change.LowDecide whether 16 layers are sufficient.
8No PCB layout.LowCreate it after the points above are closed, and keep the board low voltage only.
9Definition of "finished". The backend has no finished state, so the watchdog infers it from missing pieces and cannot tell a pause from the end of a job.MediumKeep IDLE_MIN generous, start with DRY_RUN=1, confirm the port and endpoints on the real machine, and consider a real run-finished event in SorterOS.

The concept describes the Orange Pi's GPIO header as a 40-pin header. The plain Orange Pi 5 has a 26-pin header and the Orange Pi 5 Pro has a 40-pin one, so which two pins are free and what they are called depends on the board in the machine.

10. Suggested next steps

  1. Measure the 24 V load of a running machine, then decide on the supply and the fuse (points 1 and 4).
  2. Bench-test the power manager with the real HRPG-150-24: measure RC+ and RC-, the auxiliary-output load, and the start and stop sequence with a dummy load.
  3. Compile and flash the firmware, and check the LED colours and timing.
  4. Install the Orange Pi services, set the GPIO lines, and test the button shutdown and the PWROFF path end to end.
  5. Test the optional automatic shutdown with DRY_RUN=1 on a real machine, then enable it.
  6. Test the servo ports with the longest planned leads and the added capacitors.

Sources

  • The concept PDF (19 pages, with the full schematics and source code).
  • The Sorter V2 repository: the Power distribution, servo and Pico pages, the board's KiCad files, and the backend files server/routers/system.py (shutdown endpoint) and server/routers/pieces.py (pieces overview).
  • The Mean Well HRPG-150 series datasheet (HRPG-150-SPEC, 2017-07-14).