====== Communications Protocols ====== This section of the wiki is devoted to methods of getting data from sensor interfaces to host computers. ===== RS232 serial ===== Serial data is generally buffered by the operating system in order to provide the highest possible data transfer rates. This usually adds to latency and jitter. However, RS232 often provides the simplest means to connect an inexpensive microcontroller to a host computer. A [[http://sodoityourself.com/max232-serial-level-converter/|simple circuit]] can be used to convert from a microcontroller's TTL voltage levels to the RS232 standard. * Connector: DB9 or DB25 * Max Transfer Rate: 115,200 bps [[http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html|The RS232 Standard]] ===== USB-CDC serial ===== Serial data is generally buffered by the operating system in order to provide the highest possible data transfer rates. This usually adds to latency and jitter. * Connector: USB * [[http://en.wikipedia.org/wiki/USB_communications_device_class|USB communications device class]] on wikipedia * [[http://www.usb.org/developers/devclass_docs/usbcdc11.pdf|Universal Serial Bus Class Definitions for Communication Devices]] ===== USB HID ===== USB HID data is generally given high priority in operating system kernels since its designed around human response times. * Connector: USB * Max Transfer Rate: 64 kbps ===== IEEE1284 Parallel Port ===== * Connector: DB25, Centronics, or mini-Centronics * [[http://www.doc.ic.ac.uk/~ih/doc/par/|Interfacing the IBM-PC Parallel Printer Port]] * [[http://www.fapo.com/ieee1284.htm|IEEE 1284 Info]] ===== MIDI (Musical Instrument Digital Interface) ===== MIDI is an asynchronous serial communication protocol which is almost universally used in commercial digital instruments. MIDI has a lower resolution and data transfer rate than many newer data protocols, which makes it less-than-ideal for transferring large amounts of continuous data, but due to its ubiquity it can be useful for interfacing with a lot of existing music hardware. MIDI can easily implemented using the UART output capability of most microcontrollers. Most MIDI messages consist of three bytes, where the first byte specifies the type of message and the channel number, and the last two bytes are parameters relating to the type of message sent (key number, controller number, velocity, etc). For a full list, see the link below. * Connector: DIN-5 circular connector * Max Transfer Rate: 31.25 kbps * Data Resolution: 7 bits (14 bits for pitch bend) * [[http://www.midi.org/techspecs/electrispec.php|MIDI Electrical Specifications]] * [[http://www.midi.org/techspecs/midimessages.php|MIDI Message Table]] ===== Arduino and MAXMSP interface ===== Some good option for test, debug and also for some control can be find on [[http://www.arduino.cc/playground/|Arduino Playground webpage]]. As of March, 2011, under the following configuration: Mac OS X system + Arduino duemilanove board + Arduino 018 software + MAXMSP 5.1.7 two options worked really fine: * [[http://www.arduino.cc/playground/interfacing/MAXMSP|Arduino2Max(nov2010)]] * [[http://www.maxuino.org/|Maxuino(Firmata)(april2010)]] ===== Open Sound Control ===== Open Sound Control (OSC) is a communication protocol optimized for modern network technology. An OSC message consists of an address, followed by one or two more arguments. The addresses consist of a hierarchical, URL-style name that begin with a forward-slash (“/”) character. The transmission units of this protocol are called packets and they will always possess a size with a multiple of 4. Compared to MIDI, OSC has the advantage of being able to process “Bundles” of messages that can occur simultaneously. * Connectors: UDP/IP and Ethernet * Bandwidth: 10 megabits/sec * [[https://web.archive.org/web/20030914224904/http://cnmat.berkeley.edu/OSC/OSC-spec.html|OSC specifications]] ===== Inter-Integrated Circuit(I2C) ===== Inter-Integrated Circuit Protocol is a communication protocol that allows multiple peripheral devices to be controlled by one or more controller devices. It requires two lines a serial data line (SDA) and serial clock line (SCL) which each device connected on the bus requiring a unique address. Messages are split into two frames. The address frame indicates the peripheral where the data is being sent to and 8 bit data frames which contain the data being transmitted. {{::introduction-to-i2c-message-frame-and-bit-2-1024x258.png?direct&400|}}((https://www.circuitbasics.com/basics-of-the-i2c-communication-protocol/)) * Connectors: 2 wires (SDA,SCL) * Transfer Speeds: 100kbits/s(Standard Mode), 400kb/s(Fast mode),1Mb/s(Fast-mode plus),3.4Mb/s(High-speed mode) * Max Number of peripheral Devices: 1008 * [[https://web.archive.org/web/20210426060837/https://www.nxp.com/docs/en/user-guide/UM10204.pdf|I2C protocol rev.6]]