Introduction: Cigar Box MIDI Controller
Here's a DIY MIDI controller that can be used with Max/MSP, Ableton Live, and just about any other music software or hardware that offers MIDI I/O.
The project uses the MIDI CPU, which can be used as a MIDI "brain" for DIY projects.
This zip file includes the parts list (Open Office .ods), design drawings (Corel Draw .cdr & .png) and MIDI SysEx files (.txt and binary .syx) used in the project.
Step 1: Select a Cigar Box
Considering the following characteristics:
- Overall shape . An ideal box has low height relative to the width and depth.
- Build quality . Choose a box that is sturdy and looks nice.
- Panel thickness. This can be important. Many panel-mount controls and connectors are designed for metal panels, which are relatively thin. A thick wood panel can make it difficult to mount the controls. Try to find a panel thickness of less than 6mm (1/4 inch).
Step 2: Select the Control Hardware
Mouser and other online electronics distributors have a “parametric search” feature that is a powerful tool for parts selection. Parametric search allows the DIY-er to find specific “flavors” of component without knowing the exact keywords beforehand. To take advantage of this, start by selecting a very broad category of part, and then narrowing down the list of results by eliminating parts that are not useful.
For example: to find pushbutton switches for this project, start by clicking the “products” link at Mouser. Then click the “Switches ” link under the “Electromechanical” section. The switches page shows the basic categories of switch that are offered by Mouser. Click the “Pushbutton Switches ” link. Within this category, there are almost 16,000 matches–far too many to browse. Use the parametric search to pare down the options.
For most projects, the first parameter to select is the “Mounting Style”. This project requires panel-mount switches. PCB-mount (also known as thru-hole) and SMD (surface mount) parts won’t work very well for this project. In the Mounting Style menu, select all of the options that relate to panel mounting. This includes the options beginning with the word “Panel”, plus other options like “Snap In”. Snap-in parts can work very well in DIY projects. Ctrl-click to select multiple menu items.
It’s also a good time to select the “Stocked” check box. Non-stocked parts require long lead times and large purchase quantities which make them impractical for DIY projects.
Click the “Apply Filters” button. There are now only about 2000 stocked panel-mount pushbutton switches in the listing. Selecting only momentary action switches and sorting by price leads to the selection for this project: 103-1211-EV .
Step 3: Design the Panel Cutouts
Create a Corel Draw document for each cigar box panel to be cut. Other programs, such as Illustrator and Inkscape, can also be used. Measure the cigar box to obtain the outside dimensions. Draw the side panel thickness and any other features of the box which could interfere with component mounting.
Download the datasheet for each component used in the project. The datasheet includes a mechanical drawing of the part, and in most cases, a recommendation for the size of the panel cutout. Use the information from the datasheet to draw the cutouts.
The top panel of the cigar box has 8 potentiometers, 24 buttons, a power switch and an activity indicator LED:
Step 4: Cut the Cigar Box With the Laser Cutter
The laser used for this project was the Epilog Mini at Columbus Idea Foundry .
Contact your local hackerspace–if it is like CIF , it offers a training program and provides laser access at an hourly rate. If no laser is available locally, use a service like Ponoko or Big Blue Saw to order a panel that can be attached to the cigar box.
Using Corel Draw, “print” to the laser cutter. The result is a perfectly cut box, ready to accept the control components.
Step 5: Create the MIDI CPU Wiring Diagrams
Plan the control & connector wiring with one or more MIDI CPU wiring diagrams.
The top panel of the cigar box has 8 potentiometers that will be used for analog input to the MIDI CPU. The pots will be connected to control terminals 16-23. (The MIDI CPU hardware user manual includes information about which control terminals can be used for analog inputs.)
The pushbutton switches on the cigar box are arranged in groups of 12, 8, and 4. The groups of 12 and 8 switches will be wired in a matrix configuration, using control terminals 0-10. (The MIDI CPU support forum has information about creating a switch matrix. ) The remaining 4 switches can each be connected to a dedicated control terminal.
Below is the control terminal wiring diagram.
The power connector has a built-in switch that can be used to automatically disconnect the battery when a DC power supply is connected. To take advantage of this feature, wire the MIDI CPU DC IN terminals.
Finally, wire the power indicator LED (integrated with the power rocker switch) and activity indicator LED.
Wiring diagrams for the MIDI connectors can be found in the MIDI CPU hardware user manual.
Step 6: Mount and Wire the Controls
If the panel cutout was designed correctly, all of the parts will fit perfectly into place. Use the wiring diagrams from the previous step to connect the controls and connectors to the MIDI CPU.
This step should be taken slowly. Make the wiring as orderly as possible to make troubleshooting easier. Route the wires close to the hinged part of the box so that the lid can be opened and closed without straining the connections.
If using ribbon cable or other stranded hook-up wire, tin the wires before inserting them into the MIDI CPU control terminals. This prevents weak connections and accidental short circuits.
Step 7: Configure the MIDI CPU
The cigar box will send MIDI note messages in response to button input, and MIDI CC messages in response to knob input. Max can map MIDI messages to arbitrary functions, so the exact note and CC numbers are not important.
Here is the control terminal configuration message. Lines beginning with “//” are comments.
// Control Terminal Config Message - Fixed Header
// This tells the MIDI CPU to interpret the message as control terminal configuration.
F0 00 01 5D 04 01
// Layer 0. There are 4 "layers" of configuration. This project only requires the first (0).
// What follow are configuration "chunks".
// Each chunk is 6 hex bytes: nn tt mm ch d0 d1
// nn = terminal number
// tt = transition
// mm = mode
// ch = channel
// d0 and d1 are mode-specific parameters
// Complete definitions can be found in the MIDI CPU firmware user manual.
// Switch Matrix Data Lines (CT 0-7)
// Mode 7Fh tells the MIDI CPU to accept logic input. (In this case, matrixed switch states.)
00 00 7F 00 00 00
00 01 7F 00 00 00
01 00 7F 00 00 00
01 01 7F 00 00 00
02 00 7F 00 00 00
02 01 7F 00 00 00
03 00 7F 00 00 00
03 01 7F 00 00 00
04 00 7F 00 00 00
04 01 7F 00 00 00
05 00 7F 00 00 00
05 01 7F 00 00 00
06 00 7F 00 00 00
06 01 7F 00 00 00
07 00 7F 00 00 00
07 01 7F 00 00 00
// Switch Matrix Select Lines (CT 8-11)
// Mode 2Ch takes switch data on CT 0-7 and generates notes.
// CT 8: Generate notes 52-59 (34h-3Bh).
// This is the row of 8 buttons in the center of the panel.
08 00 2C 00 34 00
// CT 9, 10: Generate notes 60-71 (3Ch-47h)
// These are the 12 buttons along the bottom of the panel.
09 00 2C 00 44 00
0A 00 2C 00 3C 00
// Direct Switch Input (CT 12-15)
// Mode 44h accepts logic input and generate MIDI notes.
// Generate note numbers 72-75 (48h-4Bh)
// Note On (velocity=7Fh) when button pressed (tt=00h)
// Note Off (velocity=00h) when button released (tt=01h)
0C 00 44 00 48 7F
0C 01 44 00 48 00
0D 00 44 00 49 7F
0D 01 44 00 49 00
0E 00 44 00 4A 7F
0E 01 44 00 4A 00
0F 00 44 00 4B 7F
0F 01 44 00 4B 00
// Analog Input (CT 16-23)
// Mode 04h generates CC messages.
10 00 04 00 00 03
11 00 04 00 01 04
12 00 04 00 02 06
13 00 04 00 03 06
14 00 04 00 04 08
15 00 04 00 05 08
16 00 04 00 06 09
17 00 04 00 07 0A
// Fixed Footer - This signals the end of the configuration message.
Step 8: Connect the MIDI Controller to Max/MSP
In this example, the cigar box is connected to an Edirol UM-2EX USB MIDI interface, which is connected to a Macbook running Max/MSP. (Note: Since the MIDI CPU sends standard MIDI messages, any MIDI software can be used, including Ableton Live, Reason, etc.)