

PREN PCB
This repository contains the control software for the PREN Puzzle Robot (Lucerne University of Applied Sciences and Arts).
- Size
- 125.1 × 87.8 mm
- Copper layers
- 2
- Thickness
- 1.6 mm
- Parts
- 66
- Nets
- 97
- Pads
- 291
- Tracks, vias
- 500, 299
- Pours
- 1
- Routed
- Yes
- KiCad
- KiCad 9.0 (file 20241229)
- Created
- 25 Oct 2025
- Updated
- 3 Jul 2026
Overview
PREN PCB is an open-source printed circuit board by janvogelTAET, from the janvogelTAET/PREN repository on GitHub. It is a 2-layer board of 125.1 × 87.8 mm with 66 parts on 97 nets, routed with 500 tracks and 299 vias.
It is built around the EEU-FR1J101B, MS 2 and NVMFS5C460NLWFAFT1G. Its parts include 27 connectors, 16 capacitors, 8 diodes, 7 resistors and 5 ICs. It belongs with the robots and motor control boards of this library.
Main components
3README
README.mdPREN Puzzle Robot - TinyK22 Controller
This repository contains the control software for the PREN Puzzle Robot (Lucerne University of Applied Sciences and Arts). The system is based on an NXP Kinetis TinyK22 (MK22FN512VLH12) and controls 3 stepper motors, one servo, and a vacuum pump to sort puzzle pieces.
The system utilizes a Dual-UART architecture and a specialized Homing System for precision and automatic field calibration.
🔌 Hardware & Pin Mapping
The system utilizes both header rows (J4 and J3) of the TinyK22 as the primary header's GPIOs are fully utilized.
Pin Assignment Table
| Function | TinyK22 Pin | Header & Pin | Type | Description |
|---|---|---|---|---|
| LED Power | PTA4 | J3-10 | Output | Green LED (Power and signaling) |
| Vacuum Pump | PTA5 | J3-11 | Output | MOSFET Driver Control (Pump Motor) |
| Motor Enable | PTB3 | J4-18 | Output | Stepper Enable (Active-Low) |
| Debug RX | PTB16 | USB / Internal | UART0 | Console RX (Via OpenSDA chip) |
| Debug TX | PTB17 | USB / Internal | UART0 | Console TX (Via OpenSDA chip) |
| START_BUTTON | PTB18 | J4-1 | Input | Start (NC, pulled to GND) |
| E-Stop | PTB19 | J4-2 | Input | Emergency Stop (NC, pulled to GND) |
| Motor X Step | PTC8 | J4-3 | Output | X-Axis Pulse |
| Motor X Dir | PTC9 | J4-4 | Output | X-Axis Direction |
| Motor Y Step | PTC10 | J4-5 | Output | Y-Axis Pulse |
| Motor Y Dir | PTC11 | J4-6 | Output | Y-Axis Direction |
| Servo PWM | PTD0 | J4-7 | FTM PWM | Gripper Z-Axis (Up/Down) |
| Limit X Home (X_0) | PTD1 | J4-8 | Input | Reference Switch X (Origin) |
| Data RX | PTD2 | J4-9 | UART2 | From Raspberry Pi TX |
| Data TX | PTD3 | J4-10 | UART2 | To Raspberry Pi RX |
| Motor Rot Step | PTD4 | J4-11 | Output | Rotation Axis Pulse |
| Motor Rot Dir | PTD5 | J4-12 | Output | Rotation Axis Direction |
| Limit Y Home (Y_0) | PTD6 | J4-13 | Input | Reference Switch Y (Origin) |
| LED Status | PTD7 | J4-14 | Output | Status LED (Red/Blinking) |
| Vacuum Valve | PTE0 | J4-15 | Output | Vacuum Control (Suction/Release) |
| LED Finish | PTE1 | J4-16 | Output | Green LED (Sequence Complete) |
| GND | GND | J4-0 | Power | Common Ground |
| 3.3V | VDD | J4-20 | Power | Logic Voltage for TMC2209 |
TMC2209 Driver Wiring
A TMC2209 driver is used for each motor (X, Y, Rotation).
- EN (Enable): Connected to TinyK22
PTB3pin (Active-Low). Allows de-energizing motors in idle states. - VIO (Logic): Connected to TinyK22 3.3V.
- GND: Connected to TinyK22 GND.
- VM (Motor Power): Supplied via 24V.
📡 Dual-UART Communication
The system strictly separates machine communication from human diagnostics.
1. Data Channel (Raspberry Pi)
- Interface: UART 2
- Pins: J4 Pin 9 (RX) & Pin 10 (TX)
- Baudrate: 115200, 8N1
- Protocol: Pipe-separated ASCII commands (
move|x=..,pick,place, etc.).
2. Console Channel (Debugging)
- Interface: UART 0
- Pins: PTB16 / PTB17 (Hardwired to Micro-USB Port via OpenSDA).
- Baudrate: 115200, 8N1
- Function:
PRINTFoutput for real-time diagnostics. Can be monitored via PC terminal (e.g., PuTTY, HTerm).
🚀 Software Architecture
The firmware follows industrial standards with strict separation between Hardware Abstraction (HAL) and logic layers:
robot_config.h(Central Control): All physical parameters (mm/s, angles, timings) are defined here. The C-Preprocessor converts these into timer delays using Fixed-Point Arithmetic (Q1000), ensuring high precision without resource-intensive floating-point operations.motion.c(High-Performance Kinematics): Implements the David Austin Trajectory for smooth acceleration ramps. It uses the PIT Timer (Interrupts) for asynchronous, non-blocking step generation.robot_ctrl.c(Non-Blocking State Machine): Manages the overall workflow (Homing -> Idle -> Pick/Place). The CPU utilizes theWFI(Wait For Interrupt) instruction to maximize efficiency while waiting for hardware events.periphery.c(HAL): Encapsulates pin logic and implements 3ms Software Debouncing for all mechanical switches to eliminate vibration-induced false triggers.
Safety & Calibration Concept
- E-Stop: A hardware-monitored state immediately halts all timer ramps and releases the vacuum.
- Homing Switches (X_0, Y_0): Used to establish a precise machine origin.
- Reset Behavior: Upon receiving a "reset" command, the robot moves back to coordinates (0,0,0) before de-energizing motors and entering the "Wait for Start" state.
🛠️ Commands (Raspberry Pi -> TinyK22)
| Command | Example Format | Description |
|---|---|---|
reset | reset | Returns to (0,0,0), disables motors, and waits for start. |
move | move|x=50|y=43|rot=180 | Moves to absolute coordinates (Units: µm / Degrees). |
pick | pick | Lowers servo -> Vacuum ON -> Raises servo. |
place | place | Lowers servo -> Vacuum OFF -> Raises servo. |
finish | finish | Sequence complete. Activates green Finish LED. |
Author: Jan (PREN Team)
Hardware: TinyK22 (NXP MK22FN512VLH12)
Date: 2026
Parts
66| Qty | Value | Footprint | References |
|---|---|---|---|
| 7 | 1n | passive:C_0805 | C2, C4, C5, C6, C8, C10, C12 |
| 6 | Schutz | aprog:SOD2512X116N | D2, D4, D5, D6, D7, D8 |
| 5 | 4.7 | passive:R_0805 | R3, R4, R5, R6, R8 |
| 3 | 100n | passive:C_0805 | C9, C11, C13 |
| 3 | EEU-FR1J101B | passive:ELKO | C14, C15, C16 |
| 3 | M1B, M1A, M2A, M2B | connector:TE_282837-4 | J11, J18, J25 |
| 3 | ~ | aprog:MODULE_TMC2209_SILENTSTEPSTICK | U3, U4, U6 |
| 1 | 10k | passive:R_0805 | R2 |
| 1 | 10u | passive:C_0805 | C3 |
| 1 | 1k | passive:R_0805 | R1 |
| 1 | 22u | passive:C_0805 | C7 |
| 1 | 24V | connector:TE_282837-4 | J13 |
| 1 | 2u2 | passive:C_0805 | C1 |
| 1 | 3.3V | connector:TE_282837-4 | J22 |
| 1 | 5V | connector:TE_282837-4 | J9 |
| 1 | Buck Converter | aprog:CONV_TSR_1-2450E | PS2 |
| 1 | E-Stop | connector:TE_282837-2 | J6 |
| 1 | GND | connector:TE_282837-4 | J21 |
| 1 | GPIO's Raspi | connector:TE_282837-4 | J23 |
| 1 | Input | connector:TE_282837-2 | J3 |
| 1 | LED Finish | connector:TE_282837-2 | J2 |
| 1 | LED Status | connector:TE_282837-2 | J10 |
| 1 | LIMIT_X | connector:TE_282837-2 | J8 |
| 1 | LIMIT_Y | connector:TE_282837-2 | J14 |
| 1 | MS1 | Connector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_Vertical | J26 |
| 1 | MS2 | Connector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_Vertical | J27 |
| 1 | NCV68061 | aprog:TSOT-23_S6 | U2 |
| 1 | NVMFS5C460NLWFAFT1G | aprog:TRANS_NTMFS5C628NLT1G | Q2 |
| 1 | PTA4, PTA5, PTA12, PTA13 | connector:TE_282837-4 | J17 |
| 1 | PTB18 | connector:TE_282837-2 | J20 |
| 1 | Pin 1,2,38,39 | connector:TE_282837-4 | J15 |
| 1 | Pin 3-6 | connector:TE_282837-4 | J16 |
| 1 | Raspi | aprog:PinHeader_2x20_Raspi | J1 |
| 1 | SPRD | Connector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_Vertical | J4 |
| 1 | Schutzdiode | aprog:D_SOT-23_ANK | D3 |
| 1 | Servo Z-Achse | connector:TE_282837-3 | J12 |
| 1 | Shottky protect diode | aprog:SOD2512X116N | D1 |
| 1 | TinyK22 | aprog:tinyK22 | U1 |
| 1 | VBAT | connector:TE_282837-2 | J19 |
| 1 | Vakum FET | package:SC70 | Q1 |
| 1 | Vakumventil | connector:TE_282837-2 | J7 |
| 1 | X_Home | connector:TE_282837-2 | J24 |
| 1 | Y_Home | connector:TE_282837-2 | J5 |
Similar boards
- 2 layers123.5 × 112.1 mm

- 4 layers187.9 × 60.2 mm

MotionModuleSTM32F103R8
griffotron/MotionModuleSTM32R8
PCB design and code for the STM32 powered Motion Module that controls 14 stepper motors
246 parts13MIT - 2 layers85.9 × 44.7 mm

- 2 layers69.6 × 80.5 mm

ProtoBoard
dustinreynolds/STM32Hardware
Repository for Kicad board development and support libraries
158 parts2 - 4 layers100 × 70.5 mm

Smart Irrigation SystemV2
Benedikt3141/Smart-Irrigation-System
A smart irrigation system for irrigation of up to 6 plants. It monitors the moisture, temperature, CO2 concentration, air quality ... and displays the data on a 2.4" TFT Display using an ESP32 DevKit C as processor.
147 parts1MIT - 2 layers93.2 × 50 mm

MC Circuit v2
bsbrl/Motorized-Commutator
This repository contains the necessary software, CAD, and PCB fabrication files, and instructions needed to setup a CV guided open-source active commutator for neural imaging.
33 parts1 - 2 layers100 × 77 mm

- 2 layers94 × 94 mm

Questions
How big is the PREN PCB PCB?
It measures 125.1 × 87.8 mm and has 2 copper layers, 1.6 mm thick.
What parts does the PREN PCB use?
66 parts, built around the EEU-FR1J101B, MS 2 and NVMFS5C460NLWFAFT1G. 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 PREN PCB KiCad files?
From the janvogelTAET/PREN repository on GitHub, at the commit this page was made from: the board is KiCad/projects/PREN_PCB/PREN_PCB.kicad_pcb and its schematic KiCad/projects/PREN_PCB/PREN_PCB.kicad_sch. PCBKit opens the board in the browser, with nothing to install.
Can I use the PREN PCB design in my own project?
Its repository states no licence, so its author keeps all rights: ask janvogelTAET before reusing the design.