Skip to content

setbe/midic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Khekhowich MIDI Controller (midic)

Firmware for a Raspberry Pi Pico–class board that shows up as a USB MIDI device and sends MIDI CC messages from three analog potentiometers.

This project uses the Raspberry Pi Pico SDK + TinyUSB (device stack).


What it does

  • Enumerates as a USB MIDI controller
  • Reads 3 ADC inputs and converts them to 7-bit CC values (0–127)
  • Sends Control Change messages (channel 1 by default)
  • Uses the on-board LED as a simple status/activity indicator

Hardware

Supported boards

Any RP2040/RP2350 board supported by the Pico SDK + TinyUSB should work (for example: Pico, Pico W, Pico 2, etc.).

Potentiometers (ADC)

This firmware reads three pots on:

Pot GPIO ADC channel Default CC
1 26 ADC0 CC1 (Mod Wheel)
2 27 ADC1 CC74
3 28 ADC2 CC71

Make sure your pot wiring matches your board’s ADC pinout and reference voltage requirements.


USB identity

The USB descriptors currently report:

  • Manufacturer: Khekhowich
  • Product: Khekhowich MIDI Controller

(See usb_descriptors.c if you want to change the strings, VID/PID, etc.)


Build prerequisites

You’ll need:

  • Raspberry Pi Pico SDK set up locally
  • A working ARM GCC toolchain (as required by the Pico SDK)
  • CMake (3.20+) and a generator (Ninja recommended)

Environment variable used by this repo:

  • PICO_SDK_PATH -> path to your pico-sdk checkout

Build (recommended)

Option A: CMake Presets (Windows example)

This repo includes CMakePresets.json. If your SDK is at C:/pico-sdk, you can build with presets:

cmake --preset pico2-release
cmake --build --preset pico2-build-release

Artifacts will be placed in the build/ directory (including a .uf2).

Option B: Standard CMake (macOS/Linux/Windows)

export PICO_SDK_PATH=/path/to/pico-sdk
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build

Flashing

After a successful build, you’ll get a .uf2 file in build/ (exact name depends on your target).

  1. Hold BOOTSEL button on Pico 2.
  2. Plug the board in over USB and then release the button.
  3. Copy the .uf2 file to the mounted USB drive
  4. The board reboots and should appear as a USB MIDI device

Customization

Change which CCs are sent

Edit the CC mapping in main.c:

static const uint8_t POT_CC[3] = { 1, 74, 71 };

Tuning smoothing / responsiveness

Also in main.c:

  • EMA_SHIFT controls smoothing (higher = smoother/slower)
  • CC_STEP adds hysteresis (reduces jitter)
  • SEND_PERIOD_MS rate-limits per knob

Troubleshooting

If the device does not enumerate:

  • Confirm you built for the correct board/target
  • Verify TinyUSB is enabled and your Pico SDK setup is correct

If values jitter:

  • Increase EMA_SHIFT and/or CC_STEP
  • Check pot wiring and grounding

If MIDI messages don’t show up:

  • Confirm your DAW/app is listening to the correct MIDI input
  • Try a generic MIDI monitor utility to verify CC output

Project layout

  • main.c - application logic (ADC -> MIDI CC)
  • tusb_config.h - TinyUSB configuration (derived from upstream)
  • usb_descriptors.c - USB device/config/string descriptors (derived from upstream)
  • CMakeLists.txt, CMakePresets.json - build configuration

License

This repository is licensed under the MIT License (see LICENSE).

Third-party code notices

This repo includes files derived from TinyUSB / Pico SDK examples, which are also MIT-licensed:

  • tusb_config.h - Copyright (c) 2019 Ha Thach (tinyusb.org)
  • usb_descriptors.c - Copyright (c) 2019 Ha Thach (tinyusb.org)

Their original license headers are preserved in those files, as required by the MIT License.

Credits

  • TinyUSB by Ha Thach and contributors
  • Raspberry Pi Pico SDK

About

Raspberry Pi Pico 2 MIDI controller

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors