String Synthesizer

Series: alt.ctrl activities; builds on Bell ringing

Pull strings instead of pressing keys: a row of long-lever microswitches, each worked by its own string.

Drawing: eight black microswitches stand spaced along two rods near the edge of a table, with dabs of hot glue where the rods poke out at the ends of the row. Each switch's flat metal lever reaches well past the table edge, and a coloured string of a different length hangs from each lever tip, fixed with a dab of hot glue. A side view shows a pulled string pressing a lever onto the switch's button.
The idea: switches locked on two rods with hot glue at a table edge, and a string hot-glued to each lever's metal leaf. An illustration, not to scale.

Materials

ItemAmazonMouser
Micro limit switches with long hinge lever, SPDT (1 NO, 1 NC), V-153-1C25, pack of 12B0G4MK5WM1653-V-153-1C25
String
Hot glue sticks
Two rods that fit the holes through the switches
Hookup wire
A microcontroller (MCU) with digital inputs

Tools

  • Hot glue gun
  • Soldering iron
  • Other tools not yet listed.

Skills

  • Soldering
  • Other skills not yet listed.

Instructions

  1. Align the switches in a row on two rods through their holes, and attach the row to a horizontal surface so that the levers overhang its edge.
  2. Lock the switches on the rods with a dab of hot glue where each rod pokes out of the switches at the ends of the row.
  3. Attach a string to each lever: lay the end of the string on the tip of the lever's metal leaf and fix it with a dab of hot glue. Tell the strings apart by length or colour, and possibly by shortening the levers themselves.
  4. Solder wires to each switch's terminals, and wire the switches to an MCU's digital inputs.

Variations

  • Tie extra strings to several levers together to play chords.

Related resources

Coding Prompt Build Block

A prompt to give a coding assistant, to start the code for this activity. Copy the box, answer its questions about your board and pins, and test what comes back on the bench before you rely on it.

I am building "String Synthesizer", the activity at https://adrianfreed.com/string-synthesizer.html.

Write a program for a microcontroller that plays notes from a row of microswitches, each pulled by its own string. Wire each switch's common terminal to ground and its normally open terminal to its own digital input, with the input's built-in pull-up on, so that a pulled string reads low.

Debounce every switch. When a string is pulled, start its note; when it is let go, stop it. Keep the notes in one table, one for each switch. One string can be tied to several levers to play a chord, so let several notes sound at once.

Send the notes as MIDI over USB, or make the sound on the microcontroller itself.

Libraries to explore:

Before writing anything, ask me what I am using: the board and its pins, or the software (such as Max, Pd or Python), and check its documentation for what this needs. Put the pin numbers, ranges and other settings in one block at the top, each with a comment. Say which of the libraries above you use, and why. Start with a test that shows the raw readings, so that I can check the wiring and the ranges before the rest.

This activity by Adrian Freed is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0): you may share and adapt it with attribution, for non-commercial purposes such as personal projects and teaching, and you must share adaptations under the same licence. Product names and links belong to their suppliers.

Design strategies: