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.
- 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
| 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 |
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.
- PlatformIO installed in VS Code
- Arduino core for ATtiny (included in PlatformIO)
- Clone this repository
- Open the project in VS Code with PlatformIO extension
- Connect your Digispark USB to your computer
- Run
pio run --target uploador 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.
This project uses the DigisparkMIDI library, which is automatically included via PlatformIO.
- Touch the ribbon at any position to play a MIDI note
- Slide along the ribbon to change notes
- Release the ribbon to stop playing
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.
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 thresholdIf notes don't map correctly to your ribbon:
- Comment out the
updateNote(raw)line temporarily - Add
Serial.println(raw);to see the raw ADC values - Adjust
MIN_RAWandMAX_RAWto match your ribbon's actual range - Uncomment
updateNote(raw)and upload
For improved playability and rhythmic accuracy, this controller works excellently with the MIDI Quantize Max4Live device in Ableton Live:
This device quantizes your input notes to the grid, making your ribbon controller much more precise for melodic playing.
- Increase the
HYSTERESISvalue - Ensure you're using a 200KΩ or higher pull resistor
- Check that all connections are secure
- Verify the Digispark is properly uploaded
- Check that the correct COM port is selected
- Try a different USB cable
- Adjust
MIN_RAWandMAX_RAWvalues - Ensure the pull resistor is properly connected
This project is open source. Feel free to modify and distribute as you wish.