Skip to the content
4 layers307 × 46.1 mmStm32pe midi, the printed circuit board in 3D

a midi controller using the mpe protocol to create more expressive music

Size
307 × 46.1 mm
Copper layers
4
Thickness
1.6 mm
Parts
136
Nets
193
Pads
648
Tracks, vias
5,069, 369
Pours
9
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
6 Jun 2025
Updated
6 Aug 2025

Overview

Stm32pe midi is an open-source printed circuit board by udu3324, from the udu3324/stm32pe-midi repository on GitHub, published under the GPL-3.0 licence. It is a 4-layer board of 307 × 46.1 mm with 136 parts on 193 nets, routed with 5,069 tracks and 369 vias.

It is built around the TLC5940PWP, TCA9548APW and TPD2EUSB30DRT, with the SS14 and USB4105-GF-A among its other parts. Its parts include 41 capacitors, 31 ICs, 30 diodes, 26 resistors and 5 connectors. It belongs with the audio and music boards and the STM32 boards of this library.

Main components

5

README

README.md

stm32pe-midi controller

image

An expressive midi controller based on the stm32 ecosystem. It uses the MPE midi protocol to pass through signals that act as gestures/effects including velocity/note to any music DAW. (like ableton)

  • Uses the powerful STM32H7
  • Uses USB-C OTG to connect to a device
  • Has per key PWM leds for indication
  • Low profile/one sided pcb design
  • Small key footprint for compactness
  • Two octaves + extra key before an octave

See it in action here!

Why I Made It

This controller will be able to make music more accessible by being more affordable to the typical person. Most MPE midi controllers on the market cost between $500 USD to $2000. I also made this project to touch the stm32 ecosystem and learn how to integrate and use it. This midi keyboard could also make my workflow nicer for making music in Ableton.

image

Design

To reduce the cost of production, I decided to design a compliant mechanism (flexure) that would be only one part. It would reduce the labor and cost by a lot. This is because most keyboards/pianos have between 10 to 100 which I have reduced to a minimum of 2. A hall effect sensor is used to measure the position and rotation of a magnet embedded in each key.

image

Problems

There were many problems while prototyping and laying out things. I had bare knowledge of how flexures worked and had to create as many prototypes as needed until the right movement was made. I also didn't know that the size of the board would be a big constraint that was completely ignored.

I highly recommend to look over these issues before building another stm32pe device!!! A lot of tolerances for the 3d prints are based on my 3d-printer. Make sure to print segments before making the entire thing to test for fit between the pcb, magnet, and everything.

Problems during fabrication

  • TMAG5273 has a fixed i2c address which only differs by buying different models (B1, C1, D1) or by running extra interrupt traces
  • M screw spacers broke off when screwing into plastic
  • Too high of a tolerance between the board and 3d printed parts, had to cut off bottom two aligners on all keys
  • Connection (led mux) from main-board to other board was made through really tiny & painful to solder wires

Here's a list of problems after fabrication + firmware

  • The Black key flexure design suffers too much with plastic deformation permanently, as well as temporarily
  • ^ This issue also causes a permanent distance change with less distance to measure and use
  • TMAG5273 library has no calibration feature and the measured angle is offset when brought closer
  • Keys are a bit too slippery and need a dimple to grip the finger
  • Flexures on both key types are a little on the firm side, takes a little time to get used to
  • Last white key (b) is impractical as header wires are blocking its roll to pitch change up
  • The power on led is a bit too bright, not changeable
  • The base/case of the stm32h7 is kinda slippery
  • PLA flexures can get deformed under heat in a car which can leave a permanent loss of height on keys or mess more with the already high tolerance to allow press fitting

These issues do not make the stm32pe midi keyboard worthless or horrible to use, but are just little tiny problems that could be polished in the future.

Firmware

Thank you to all the open source libraries above to make this project possible. I don't think I would have the expertise to implement all my ics this well.

The firmware for the stm32pe midi controller is written in c/cpp on stm32cubeide and flashed with stm32cubeprogrammer. Amazing platform. Outdated UI (lol). To be as transparent as possible, some of the firmware was written/assisted with AI. About 20% of it was written mostly with AI, while the rest + logic that ties everything together was me. mpe.c, 80% of helper.c, 60% of tlc5940.c, and 5% of main.c with some fixes to TMAG5273.c was assisted with AI. I do understand what the firmware does. Depending on your perspective on AI, it shouldn't really matter as I know what I'm doing.

All of the code is stored in firmware/stm32pe_midi/Core/Src or /Core/Inc. Src/main.c contains some user preferences that can be set through variables.

c
//midi
int start_octave = 4; //midi code shift
int mt_send_black = 40; //midi on threshold
int mt_send_white = 30; //midi on threshold

//mpe
int16_t pitch_mpe_st = 682; //mpe semitone pitch range (682 = 4st, 341 = 2st)
float angle_mpe_padding = 15; //mpe pitch
float angle_mpe_realistic_max = 25; //mpe pitch

float aftertouch_mpe_white_padding = 9; //mpe aftertouch
float aftertouch_mpe_black_padding = 15; //mpe aftertouch

//octave
uint32_t octave_change_mode_time_threshold = 200; //diff change between mode/octive
uint32_t octave_led_flash = 500; //ms between led flash during mode

//led
int startup_cutoff_wait = 100; //led cutoff + cutoff for initial sensor readings saving

//mode
uint32_t octave_mode_hold_down = 1500; //octave mode keys milliseconds to hold down & change
uint32_t mpe_mode_hold_down = 3000; //~ same above but for mpe mode keys

//debug
bool disable_comport = false; //silences comport to possibly make processing faster?

Wiring

image image image

BOM

This is an approximate bill of materials that is a little flexible. It would be around $333.27, ±5 dollars in case of shipping or extra taxes/fees. Thank you Hack Club - Highway for funding this.

PartCostCountSupplierNoteLink
PLA Filament (white)$16.991AmazonI have a 3d printer and would like to print most of the parts.https://www.amazon.com/dp/B07PGZNM34
PLA Filament (black)$16.991Amazon~ (for the black keys)https://www.amazon.com/dp/B07PGY2JP1
UV Plastic Glue$14.151AmazonThis is for the underside of the keys to stop scraping.https://www.amazon.com/dp/B00QU5M4VW
Header 10 Pins$0.782DigiKey(does not include shipping/taxes)68000-110HLF
Header 5 Pins$0.631DigiKey~68000-105HLF
PCB Fabrication + Assembly$151.092JLCPCB*no coupons applied yet
PCB Shipping$33.52n/a~
Customs duties & taxes$83.10n/a~
Sales Tax$15.24n/a~
TOTAL$333.27

I forgot to add two more parts to the bom. They have been covered out of pocket which is fine

PartCostCountSupplierNoteLink
5mm Cube Magnets$16.9945AmazonI could not find any listings with lower quantitieshttps://www.amazon.com/dp/B0CW9GVTX2
M3 5mm Screws¥2.1450TaobaoPretty cheap! (30 cents usd)https://detail.tmall.com/item.htm?id=722759297726
Female 10pin Headers$5.621MouserThis is for the main board. The part itself costs $0.63 without taxes/shipping.https://www.mouser.com/ProductDetail/710-61301011821
JLCPCB Two Design Fee$38.99n/aJLCPCB😭 i did not think about this while designing, i tried negotiating and doing everything
TMAG5273-B1/C1/D1$23.2818Mouseri stg the datasheet said the sensor's i2c addresses were reprogrammable.. but they didn't say i needed to hookup interrupts to them too... lesson learned :p
Total out of pocket$85.18
REAL TOTAL$418.45

Parts

136
QtyValueFootprintReferences
270.1μFCapacitor_SMD:C_0805_2012MetricC15, C16, C17, C18, C19, C20, C21, C22, C23, C24, C25, C26, C27, C28, C29, C30 +11
25LED_SmallLED_SMD:LED_1206_3216MetricD10, D11, D12, D13, D14, D15, D16, D17, D18, D19, D20, D21, D22, D23, D24, D25 +9
25TMAG5273EasyEDA:SOT-23-6_L2.9-W1.6-P0.95-LS2.8-BRU10, U11, U12, U13, U14, U15, U16, U17, U18, U19, U20, U21, U22, U23, U24, U25 +9
162.2kΩResistor_SMD:R_0805_2012MetricR8, R9, R10, R11, R12, R13, R14, R15, R16, R17, R18, R19, R20, R21, R22, R23
5100nFCapacitor_SMD:C_0805_2012MetricC4, C6, C7, C9, C12
4330ΩResistor_SMD:R_0805_2012MetricR5, R6, R7, R27
45.1kΩResistor_SMD:R_0805_2012MetricR1, R2, R24, R25
4LEDLED_SMD:LED_1206_3216MetricD3, D4, D5, D33
31μFCapacitor_SMD:C_0805_2012MetricC8, C13, C14
210kΩResistor_SMD:R_0805_2012MetricR3, R4
22.2μFCapacitor_SMD:C_0805_2012MetricC1, C2
24.7μFCapacitor_SMD:C_0805_2012MetricC3, C5
2SW_SPSTButton_Switch_THT:SW_PUSH_6mmSW1, SW2
2TLC5940PWPPackage_SO:HTSSOP-28-1EP_4.4x9.7mm_P0.65mm_EP3.4x9.5mm_Mask2.4x6.17mm_ThermalViasU30, U31
10.47μFCapacitor_SMD:C_0805_2012MetricC11
133μFCapacitor_SMD:C_0805_2012MetricC10
1Conn_01x05_PinConnector_PinHeader_2.54mm:PinHeader_1x05_P2.54mm_VerticalJ3
1Conn_01x05_Pin1_udu_lib:custom_padsJ6
1Conn_01x10_PinConnector_PinHeader_2.54mm:PinHeader_1x10_P2.54mm_VerticalJ4
1Conn_01x10_SocketConnector_PinHeader_2.54mm:PinHeader_1x10_P2.54mm_VerticalJ5
1LM3940IMPX-3.3/NOPBEasyEDA:SOT-223-4_L6.5-W3.5-P2.30-LS7.0-BRU2
1LOGO1_udu_lib:mainboard_drawingG***
1SS14Diode_SMD:D_SMAD1
1STM32H743VIHxPackage_BGA:TFBGA-100_8x8mm_Layout10x10_P0.8mmU1
1TCA9548APackage_DFN_QFN:Texas_RGE0024C_VQFN-24-1EP_4x4mm_P0.5mm_EP2.1x2.1mmU29
1TPD2EUSB30Package_TO_SOT_SMD:Texas_DRT-3U28
1USB4105Connector_USB:USB_C_Receptacle_GCT_USB4105-xx-A_16P_TopMnt_HorizontalJ1

Similar boards

  • 2 layers80 × 130 mmKuluckaMakinesi, the printed circuit board in 3D

    KuluckaMakinesi

    emrah1982/KuluckaMakinesi

    ESP32 tabanlı, 11 hayvan profili destekleyen çok evreli kuluçka kontrol sistemi. 3.2" TFT dokunmatik ekran, web arayüzü ve OTA güncelleme içerir.

    61 parts
  • 4 layers93.5 × 101 mmProjectAtlas, the printed circuit board in 3D

    ProjectAtlas

    BYU-Racing/SH_PCB

    Sensor Hub PCB Development

    131 parts
  • 4 layers130 × 90 mmRoute, the printed circuit board in 3D

    Route

    misko/prompt2device

    The separate vNext PCB skill and orchestrator package is available alongside the reference workflow below; existing projects keep their accepted toolchain until an explicit migration.

    83 parts3MIT
  • 4 layers40 × 40 mmDreamscape F722, the printed circuit board in 3D

    Dreamscape F722

    sneakylizard123-4/Dreamscape-F722

    Dreamscape F722 Flight Controller

    113 parts5
  • 4 layers50 × 75 mmOverkill nRF, the printed circuit board in 3D

    Overkill nRF

    sneakylizard123-4/Overkill-nRF

    A modular RF communication board designed for the Overkill system, built around the nRF24L01+ radio module instead of a bare RF IC + Amplifier.

    80 parts
  • 4 layers140 × 80 mm24V High Side Driver, the printed circuit board in 3D

    24V High Side Driver

    tracelabs-pcb/can-do12

    4-Layer IC-Gate-Driver for industrial application - Kicad, TPS274160, CANBUS

    147 parts
  • 4 layers239.5 × 239.5 mmBroadcast clock, the printed circuit board in 3D

    Broadcast clock

    espena/broadcast-clock

    Digital precision studio/broadcast masterclock with WiFi configuration, acts as local NTP server with accurate GPS time sync.

    440 parts28GPL-3.0
  • 2 layers64.8 × 109.2 mmDmx ledstrip dimmer-32ch, the printed circuit board in 3D

    Dmx ledstrip dimmer-32ch

    robinolejnik/dmx-ledstrip-dimmer-32ch

    Arduino Mini and TLC5940 based 32 channel 12V PWM dimmer with DMX512 and RDM support.

    105 parts14MIT

Questions

How big is the Stm32pe midi PCB?

It measures 307 × 46.1 mm and has 4 copper layers, 1.6 mm thick.

What parts does the Stm32pe midi use?

136 parts, built around the TLC5940PWP, TCA9548APW, TPD2EUSB30DRT and SS14. 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 Stm32pe midi KiCad files?

From the udu3324/stm32pe-midi repository on GitHub, at the commit this page was made from: the board is pcb/stm32pe_midi/stm32pe_midi.kicad_pcb and its schematic pcb/stm32pe_midi/audio.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Stm32pe midi design in my own project?

Its repository publishes it under the GPL-3.0 licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).