MidiTron MIDI to Real-World InterfaceSkip other details (including permanent urls, DOI, citation information)
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 3.0 License. Please contact email@example.com to use this work in a way not covered by the license. :
For more information, read Michigan Publishing's access and usage policy.
Page 00000001 MidiTron MIDI to Real-World Interface Eric Singer Eroktronix firstname.lastname@example.org Abstract MidiTron is a new MIDI to real-world interface designed to simplify the process of creating sensor- and robotics-based MIDI projects. It is easily user configurable and provides up to 20 terminals of digital and analog inputs and outputs in any combination. This paper describes its features, operation, advantages and applications. 1 Introduction MidiTron is a new MIDI-to-real world interface. Its purpose is to provide MIDI interfacing to switches, sensors inputs and voltage-controllable devices such as LEDs, motors, solenoids and relays. Several design features distinguish MidiTron from other real-world i/o solutions currently available: * It is highly and easily user-configurable. * Its small size (about 2" x 2.5") allows it easily to be embedded in MIDI projects such as sensor-based instruments and robotic and lighting control applications. * It takes advantage of MIDI's availability, standardization and reliability for interfacing and configuration. No special interface hardware (such as USB or serial) or drivers required. * It is configuration via MIDI sysex. No special software or Max objects required. 2 Hardware MidiTron has one MIDI In Port, one MIDI Out Port, twenty user-configurable i/o terminals and terminals providing power (5v) and ground (Figure 1). Each i/o terminal can be configured as a digital input, analog input (ADC), digital output or analog output (PWM). Up to ten channels of analog input and up to twenty of the other types of i/o are available, in any combination. MidiTron has a power LED, indicating power on, and a status LED which blinks when MIDI is received or sent. MidiTron can be powered by a 9v wall transformer or equally well from a 9v battery for embedded applications. 3 Configuration MidiTron provides twenty terminals of configurable i/o. Configuration is accomplished via sysex commands sent to the MIDI In Port. MidiTron can be configured using a supplied Max patch (running within Max or MaxPlay, or as a standalone application) (Figure 2) or from any device that can generate sysex commands in MidiTron's format (which is documented in the user's manual). MidiTron stores all configuration parameters in persistent ("flash") memory, retaining its configuration even when powered off and on. Thus, after configuration, it may be disconnected from a host computer and used henceforth with any MIDI equipment. Each terminal can be in one of five modes: Off, Digital Input, Analog Input, Digital Output or Analog Output. Analog inputs are available on terminals 1-10 and must be consecutive, starting from 1. Each mode has a set of configuration parameters specific to the context of the mode. Modes and configuration parameters are described in detail below. 3.1 Digital Input mode In this mode, the terminal will accept 5v to switch on and Ov to switch off. When the terminal is switched on, it will send its "On" MIDI command; when switched off, it will send its "Off' MIDI command. Available commands for this mode are Note Off, Note On, Poly Pressure, Control Change, Program Change, Channel Pressure and Pitch Bend. Digital Input mode is useful for reading switches and binary-state sensors, such as Hall Effect, PIR and capacitive touch sensors. 3.2 Analog Input mode In this mode, the terminal will accept a range from 0 to 5 volts, converting this voltage to a corresponding value using A/D conversion. It will send a MIDI message each time the converted value changes. Available commands for this mode are Poly Pressure, Control Change, Channel Pressure and Pitch Bend. Conversion is done with 10-bit resolution, then scaled according to user parameters. This allows the user to trim the input to map a smaller voltage range to full output range, as well as limiting the output to a particular range. Trimming the input range is useful for voltage-divider configurations of resistive sensors, which typically do not output a full voltage range from 0 to 5v from a 5v supply. Proceedings ICMC 2004
Page 00000002 When using Poly Pressure, Control Change or Channel Pressure messages, the converted data value can range from 0-127. When using Pitch Bend, it can range from 0-16383, scaled from 10 to 14 bits according to user parameters. Analog Input mode is useful for reading continuousvalue sensors. These include resistive sensors, such as forcesensing resistors, bend sensors, photocells and thermistors, and voltage-output sensors, such as accelerometers and capacitive sensors. For devices which output a pulse width modulated (PWM) signal, the signal can be converted to a voltage using a simple low-pass filter circuit. 3.3 Digital Output mode In this mode, the terminal will output Ov when switched off or 5v when switched on. The output can be switched using one of the following MIDI input messages: Note On, Poly Pressure, Control Change, Program Change, Channel Pressure or Pitch Bend. The output switches on when the MIDI message's data value becomes greater than or equal to the user-configured high threshold value and off when it becomes less than the user-configured low threshold value. Using two different threshold values allows for hysteresis when receiving input from a continuous controller, thus yielding a dead or safety zone between positive- and negative-going inputs. The polarity setting controls the output voltage mapped to on and off states. With positive polarity, the output switches high (5v) when the MIDI data value goes above the high threshold and low (Ov) when it goes below the low threshold. With negative polarity, the output switches low (Ov) when the MIDI data value goes above the high threshold, and high (5v) when it goes below the low threshold. Negative polarity is useful when driving LEDs or other devices in an "active low" circuit configuration. Digital Output mode is useful for driving lighting devices and electromechanical devices in non-continuous (on-off) mode. 3.4 Analog Output mode In this mode, the terminal will output a pulse width modulation (PWM) signal, with controllable pulse width ranging from 0-100%. PWM can be used to yield an effective voltage range of 0-5v and can be used to control the speed of motors and the level of LEDs and for many other analog output functions. The pulse width can be controlled using one of the following MIDI input messages: Poly Pressure, Control Change, Channel Pressure, Pitch Bend. The data value of the MIDI message, from 0-127, is translated into a pulse width from 0-100%. (For pitch bend, only the high data byte is used.) For example, a value of 64 yields a pulse width of 50%, or an effective averaged output voltage of 2.5v. Conversion from PWM to an actual analog voltage can be accomplished with a simple low-pass filter circuit. The global PWM resolution and period per step are usercontrollable. These parameters have a direct effect on the PWM frequency for all terminals in Analog Output mode. Resolution is set as a value from 2 to 7 bits. The number of available pulse width steps per cycle is 2 to the power of the number of bits. MidiTron's maximum PWM resolution is 7 bits, or 128 steps. Each decrease in 1 bit of resolution doubles the output frequency. For example, changing the resolution from 7 to 6 bits cuts the resolution in half, to 64 steps per cycle. The frequency will double, but the pulse width step size will be 1/64. The output pulse width will change for every two steps of change in input value. The period per step sets the period in units of 1/10 microseconds per step. For example, a value of 1000 will result in a period of 1000/10 (i.e. 100) microseconds per step. If, for example, the resolution is set to 6 bits (equal to 64 steps per cycle), this will result in a PWM period of 100 microseconds * 64 steps = 6400 microseconds per cycle. This corresponds to a PWM frequency of 1 / 6400 microseconds, or about 156 Hz. (The actual period will be slightly longer than the set value, due to some additional internal processing that takes place during each step.) MidiTron enforces a minimum period (and thus a maximum frequency) which is dependent on the number of terminals set to Analog Output (see Table 1). Analog Output mode is useful for level control of lighting devices and speed control of motors. PWM Min Freq @ Freq @ Freq @ Freq @ Freq @ Freq @ terms period 2 bits 3 bits 4 bits 5 bits 6 bits 7 bits 1 799 3,130 1,565 783 391 196 98 2 937 2,667 1,334 667 333 167 83 3 1076 2,323 1,162 581 290 145 73 4 1215 2,058 1,029 515 257 129 64 5 1353 1,847 924 462 231 115 58 6 1492 1,676 838 419 209 105 52 7 1631 1,533 767 383 192 96 48 8 1769 1,413 706 353 177 88 44 9 1908 1,310 655 328 164 82 41 10 2047 1,221 611 305 153 76 38 11 2185 1,144 572 286 143 71 36 12 2324 1,076 538 269 134 67 34 13 2463 1,015 508 254 127 63 32 14 2601 961 481 240 120 60 30 15 2740 912 456 228 114 57 29 16 2879 868 434 217 109 54 27 17 3017 829 414 207 104 52 26 18 3156 792 396 198 99 50 25 19 3295 759 379 190 95 47 24 20 3433 728 364 182 91 46 23 Table 1: PWM Maximum Frequencies Proceedings ICMC 2004
Page 00000003 4 Applications MidiTron supports applications in music, video and lighting control, robotics, data acquisition and other applications requiring real-world interfacing to computers or MIDI equipment. It is particularly well-suited for use in sensor-based controllers and MIDI instruments due to its embeddability, battery operatability and persistent configuration feature. Versatile output configurability makes it useful for interfacing to electromechanical devices such as motors, solenoids and relays, and lighting devices such as LEDs and electroluminescents. More information is available at http://eroktronics.com. References Igoe, Tom, Physical Computing. Available at http://fargo.itp.tsoa.nyu.edu/-tigoe/pcomp/index.shtml MidiTron User's Manual. Available at http://www.eroktronix.com. O'Sullivan, Dan, Physical Computing - A Hands On How To Guide for Artists. Available at http://fargo.itp.tsoa.nyu.edu/-dano/physical/ physical.html Proceedings ICMC 2004
Page 00000004 0 0T 0