Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KeyRibbon - Softpot MIDI Controller for Digispark USB

A compact MIDI keyboard controller built with a Digispark USB (ATtiny85) and a softpotentiometer ribbon. Maps analog ribbon position to MIDI notes across 3 octaves with hysteresis to prevent note jumping.

Features

  • 3 Octave Range: Maps ribbon position to MIDI notes (C2 to C5 by default)
  • Scale Modes: Toggle between chromatic, major scale, and minor scale modes
  • Hysteresis: Prevents note jumping and bouncing
  • Touch Detection: Automatically detects when ribbon is not being touched
  • LED Feedback: Onboard LED indicates active note and mode changes

Hardware

Required Components

Component Description Link
Digispark USB ATtiny85-based USB development board hobbyelectronica.nl
Softpot Ribbon 500mm flexible potentiometer Reichelt Elektronik
Pull Resistor 200KΩ or higher (for improved linearity) Any electronics supplier

Wiring Diagram

Connect the softpotentiometer as follows:

Digispark USB        Softpot Ribbon
-----------          --------------
P0 (GND)     ------  GND (black wire)
P2 (A0)      ------  Wiper (red wire)
P3 (VCC)     ------  Pull Resistor (200KΩ+) ------  Signal (green wire)

Important: Use a high-value pull resistor (200KΩ or above) for improved linearity across the ribbon's travel range.

For detailed hookup instructions, see the SparkFun Softpot Hookup Guide.

Software

Prerequisites

  • PlatformIO installed in VS Code
  • Arduino core for ATtiny (included in PlatformIO)

Installation

  1. Clone this repository
  2. Open the project in VS Code with PlatformIO extension
  3. Connect your Digispark USB to your computer
  4. Run pio run --target upload or click the upload button in PlatformIO

Note: Digispark requires a special upload process. After the first upload, you may need to put the Digispark into bootloader mode by toggling the reset pin.

Dependencies

This project uses the DigisparkMIDI library, which is automatically included via PlatformIO.

Usage

Basic Operation

  1. Touch the ribbon at any position to play a MIDI note
  2. Slide along the ribbon to change notes
  3. Release the ribbon to stop playing

Scale Mode Toggle

Hold the bottom of the ribbon for 2 seconds to cycle through scale modes:

  • Chromatic (No Scale): All 12 semitones available (default)
  • Major Scale: Only major scale notes (W-W-H-W-W-W-H pattern)
  • Minor Scale: Only natural minor scale notes (W-H-W-W-H-W-W pattern)

The LED will blink twice to confirm a mode change.

Configuration

Edit the following constants in src/main.cpp to customize behavior:

const int SENSOR_PIN = 1;          // P2 on Digispark (analog input)
const int MIN_RAW = 10;            // Minimum usable analog value
const int MAX_RAW = 1010;          // Maximum usable analog value
const int START_NOTE = 36;         // C2 (MIDI note number)
const int NUM_NOTES = 36;          // 3 octaves = 36 notes
const int VELOCITY = 100;          // Fixed velocity (0-127)
const int MIDI_CHANNEL = 1;        // MIDI channel 1
const int HYSTERESIS = 20;         // Hysteresis threshold

Calibration

If notes don't map correctly to your ribbon:

  1. Comment out the updateNote(raw) line temporarily
  2. Add Serial.println(raw); to see the raw ADC values
  3. Adjust MIN_RAW and MAX_RAW to match your ribbon's actual range
  4. Uncomment updateNote(raw) and upload

Recommended Software

For improved playability and rhythmic accuracy, this controller works excellently with the MIDI Quantize Max4Live device in Ableton Live:

MIDI Quantize on MaxForLive

This device quantizes your input notes to the grid, making your ribbon controller much more precise for melodic playing.

Troubleshooting

Notes jump or stutter

  • Increase the HYSTERESIS value
  • Ensure you're using a 200KΩ or higher pull resistor
  • Check that all connections are secure

No MIDI output

  • Verify the Digispark is properly uploaded
  • Check that the correct COM port is selected
  • Try a different USB cable

Ribbon not responding at edges

  • Adjust MIN_RAW and MAX_RAW values
  • Ensure the pull resistor is properly connected

License

This project is open source. Feel free to modify and distribute as you wish.

Credits

About

KeyRibbon - Softpot MIDI Controller for Digispark USB

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages