I like the idea of connecting and controlling circuits from a touch screen device. It seems like a great combination of DIY technology and modern smartphone technology.
This post describes a basic setup that has been tested and working and is ideal for connecting an Android phone to Touch Daw to OTG Cable to MIDI interface to Teensy.
The MIDI interface is hacked to allow direct connections to data send / receive, 5V and ground, which are needed to power and communicate with the Teensy.
Using the Touch DAW application, MIDI data such as notes, pitch bend, continuous controllers can be used to send data to the Teensy. The Teensy can then be used to control a circuit of some sort.
In order to connect the smartphone to Teensy, you will need:
• An Android phone that can run Touchdaw and can act as a host USB device
• An OTG USB cable (i.e. male micro USB to female USB A)
• A class-compliant MIDI interface, even a cheap one should be fine
• A Teensy microcontroller
MIDI Interface Hacking
This is a cheap USB MIDI interface with one input to one output. It costs $6 with shipping. It is a class-compliant device. This means that the USB MIDI interface does not require any drivers when used with music software on a Windows or Mac computer i.e. it will show up as a MIDI device with an input and an output.
• Pin 1 of the MFM0860 is 5V
• Pin 4 of the MFM0860 is ground
• Pin 5 of the MFM0860 is RX (i.e. receive data from elsewhere)
• Pin 5 of the MFM0860 is TX (i.e. send data to elsewhere)
Connecting to Teensy
UART that is separate from the USB connection, which can come in handy. The UART is a serial connection that has an RX and a TX pin.
Digital pin 7 of the Teensy is RX and digital pin 8 of the Teensy is the TX pin. 5V and ground need to be connected to the Teensy. In this example, only the TX connection from the USB MIDI interface is connected to the RX connection of the UART on the Teensy.
Teensy CodingThe Teensy code is relatively straightforward, but keep in mind that:
• The code needs to facilitate the use of the Teensy UART to accept incoming data
• The code needs to facilitate MIDI protocol for incoming data
• The code needs to make use of received status bytes, as some Android apps may format data in that way
A skeleton code that contains blank function for: NoteOn, NoteOff, ContinuousController and PitchBend across all channels can be found here: http://www.little-scale.blogspot.com.au/2013/05/teensy-uart-midi-input-skeleton-code.html
Use With TouchDaw
Setup in TouchDaw is easy:
• Connect the Teensy to the MIDI Interface
• Connect the MIDI Interface to the OTG cable; Connect the OTG Cable.
• Launch TouchDaw on the Android
• Go to the Main Menu; Go to Setup; Go to MIDI Utilities
• Go to MIDI Connection, and choose USB > USB MIDI Interface