Skip to the content
2 layers125.1 × 87.8 mmPREN PCB, the printed circuit board in 3D

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

3

README

README.md

PREN 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

FunctionTinyK22 PinHeader & PinTypeDescription
LED PowerPTA4J3-10OutputGreen LED (Power and signaling)
Vacuum PumpPTA5J3-11OutputMOSFET Driver Control (Pump Motor)
Motor EnablePTB3J4-18OutputStepper Enable (Active-Low)
Debug RXPTB16USB / InternalUART0Console RX (Via OpenSDA chip)
Debug TXPTB17USB / InternalUART0Console TX (Via OpenSDA chip)
START_BUTTONPTB18J4-1InputStart (NC, pulled to GND)
E-StopPTB19J4-2InputEmergency Stop (NC, pulled to GND)
Motor X StepPTC8J4-3OutputX-Axis Pulse
Motor X DirPTC9J4-4OutputX-Axis Direction
Motor Y StepPTC10J4-5OutputY-Axis Pulse
Motor Y DirPTC11J4-6OutputY-Axis Direction
Servo PWMPTD0J4-7FTM PWMGripper Z-Axis (Up/Down)
Limit X Home (X_0)PTD1J4-8InputReference Switch X (Origin)
Data RXPTD2J4-9UART2From Raspberry Pi TX
Data TXPTD3J4-10UART2To Raspberry Pi RX
Motor Rot StepPTD4J4-11OutputRotation Axis Pulse
Motor Rot DirPTD5J4-12OutputRotation Axis Direction
Limit Y Home (Y_0)PTD6J4-13InputReference Switch Y (Origin)
LED StatusPTD7J4-14OutputStatus LED (Red/Blinking)
Vacuum ValvePTE0J4-15OutputVacuum Control (Suction/Release)
LED FinishPTE1J4-16OutputGreen LED (Sequence Complete)
GNDGNDJ4-0PowerCommon Ground
3.3VVDDJ4-20PowerLogic Voltage for TMC2209

TMC2209 Driver Wiring

A TMC2209 driver is used for each motor (X, Y, Rotation).

  • EN (Enable): Connected to TinyK22 PTB3 pin (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: PRINTF output 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 the WFI (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

  1. E-Stop: A hardware-monitored state immediately halts all timer ramps and releases the vacuum.
  2. Homing Switches (X_0, Y_0): Used to establish a precise machine origin.
  3. 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)

CommandExample FormatDescription
resetresetReturns to (0,0,0), disables motors, and waits for start.
movemove|x=50|y=43|rot=180Moves to absolute coordinates (Units: µm / Degrees).
pickpickLowers servo -> Vacuum ON -> Raises servo.
placeplaceLowers servo -> Vacuum OFF -> Raises servo.
finishfinishSequence complete. Activates green Finish LED.

Author: Jan (PREN Team)
Hardware: TinyK22 (NXP MK22FN512VLH12)
Date: 2026

Parts

66
QtyValueFootprintReferences
71npassive:C_0805C2, C4, C5, C6, C8, C10, C12
6Schutzaprog:SOD2512X116ND2, D4, D5, D6, D7, D8
54.7passive:R_0805R3, R4, R5, R6, R8
3100npassive:C_0805C9, C11, C13
3EEU-FR1J101Bpassive:ELKOC14, C15, C16
3M1B, M1A, M2A, M2Bconnector:TE_282837-4J11, J18, J25
3~aprog:MODULE_TMC2209_SILENTSTEPSTICKU3, U4, U6
110kpassive:R_0805R2
110upassive:C_0805C3
11kpassive:R_0805R1
122upassive:C_0805C7
124Vconnector:TE_282837-4J13
12u2passive:C_0805C1
13.3Vconnector:TE_282837-4J22
15Vconnector:TE_282837-4J9
1Buck Converteraprog:CONV_TSR_1-2450EPS2
1E-Stopconnector:TE_282837-2J6
1GNDconnector:TE_282837-4J21
1GPIO's Raspiconnector:TE_282837-4J23
1Inputconnector:TE_282837-2J3
1LED Finishconnector:TE_282837-2J2
1LED Statusconnector:TE_282837-2J10
1LIMIT_Xconnector:TE_282837-2J8
1LIMIT_Yconnector:TE_282837-2J14
1MS1Connector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_VerticalJ26
1MS2Connector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_VerticalJ27
1NCV68061aprog:TSOT-23_S6U2
1NVMFS5C460NLWFAFT1Gaprog:TRANS_NTMFS5C628NLT1GQ2
1PTA4, PTA5, PTA12, PTA13connector:TE_282837-4J17
1PTB18connector:TE_282837-2J20
1Pin 1,2,38,39connector:TE_282837-4J15
1Pin 3-6connector:TE_282837-4J16
1Raspiaprog:PinHeader_2x20_RaspiJ1
1SPRDConnector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_VerticalJ4
1Schutzdiodeaprog:D_SOT-23_ANKD3
1Servo Z-Achseconnector:TE_282837-3J12
1Shottky protect diodeaprog:SOD2512X116ND1
1TinyK22aprog:tinyK22U1
1VBATconnector:TE_282837-2J19
1Vakum FETpackage:SC70Q1
1Vakumventilconnector:TE_282837-2J7
1X_Homeconnector:TE_282837-2J24
1Y_Homeconnector:TE_282837-2J5

Similar boards

  • 2 layers123.5 × 112.1 mmJX8P PSU, the printed circuit board in 3D

    JX8P PSU

    calphool/JX8P_PSU

    Replacement power supply for Roland JX8P

    32 partsMIT
  • 4 layers187.9 × 60.2 mmMotionModuleSTM32F103R8, the printed circuit board in 3D

    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 mmSTMPS, the printed circuit board in 3D

    STMPS

    tetious/STMPS

    A 3d printer board based around the STM32F411.

    119 parts4
  • 2 layers69.6 × 80.5 mmProtoBoard, the printed circuit board in 3D

    ProtoBoard

    dustinreynolds/STM32Hardware

    Repository for Kicad board development and support libraries

    158 parts2
  • 4 layers100 × 70.5 mmSmart Irrigation SystemV2, the printed circuit board in 3D

    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 mmMC Circuit v2, the printed circuit board in 3D

    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 mmCarte Mere PAMI 2025, the printed circuit board in 3D

    Carte Mere PAMI 2025

    goldobot/ELEC

    fichier source des cartes électroniques

    116 parts1
  • 2 layers94 × 94 mmMotorboard, the printed circuit board in 3D

    Motorboard

    icl-rocketry/payload_gimbal

    the ReAL payload

    72 parts1MIT

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.