Adding additional MIDI DINs (I/O)

midi

#1

hi,

any ideas on how to add more MIDI DIN ins/out to Axoloti?

I can see there is an additional RX/TX not the back connections... so presumably this could add one more in and out? (need a +5v out for din) ... but Id really want more.

presumably for more, we could turn to the digital I/O pins, and link to some kind of UART to create a serial link?
is this viable? or very complex?

does anyone know of any example circuits, perhaps produced for another board (ardiuno etc)

ideal scenario, would perhaps be putting 4 - 8 (!) IO din on a separate expansion board with the dins + any other required electronics. (uarts), circuits I've seen so far, seem within my (limited) build abilities, just Ive no idea on how to design such a thing :slight_smile:

what sparked this idea was a review on sonicstate of the Sipario. see here, which is basically an intelligent midi router

... and I thought, thats cool, but I could do that easily with Axoloti... and actually better in some ways due to having both usb midi device and host. BUT as pointed out, lack of midi din is an issue...
(the Sipario has 2x i/o, but really something like 4x io would be ideal for an intelligent midi mangler)

of course, what I like about axoloti, is it can go much further, not just mapping midi, but also sequencing, and also 'midi effects'... downside (aside from the midi din i/o) is UI, but Ive ideas for that :slight_smile:

note: yeah, I could to this with multiple axoloti boards, but seems a little excessive for this use.

funny, Ive a few axoloti boards, but just keep finding so many uses for them... and nice to be able to have them have 'dedicated' (but programmable) functions littered around my studio.

anyway, any thoughts on more midi din i/o?
thanks
Mark


Communicating with several Sensel Morphs
#2

the midibox has a 2 in-2 out midi card that can be chained to get 4 in-4 out. since it has a similar processor (it's based on the same f4 discovery board as the axolotl development stage) it's probably worth checking out

http://www.ucapps.de/mbhp_midi_io.html


#3

thanks for that... very interesting.

I had a quick look at the input connector, which connects to the J11E on the midibox, to check connections etc.
and from reading the schematics (which I'm not experienced at, so probably wrong!) , this goes directly to 4 pairs of uart connections on the discovery board.

whereas on axoloti we only have 1 pair, I'm guessing 1 other goes to the onboard din pair... and the other 2 are used for something else? (or not exposed?)

so unfortunately I'm guessing this wont quite work for axoloti,without some additional circuitry/uarts?


#4

Wouldn't the extra midi io solution described here be what you're looking for?


#5

If necessary, something like an arduino mega2560 would give you access to 4 hardware uarts and a midi library. 1 could plug into the existing midi i/o on the axoloti, the other 3 left to do whatever you want with.


#6

hmm, interesting... nice that you don't have to worry about connecting the uarts, so just some seems like simple circuit then for the midi din.
I found an midi input here : http://www.notesandvolts.com/2015/02/midi-and-arduino-build-midi-input.html
is the optocoupler just required to protect the input against high voltage.

does the output need one, as the voltage is presumably from the arduino, and the other device will have an optocoupler? (not found an output circuit yet) ... so is that simply TX -> TX , GND ->GND , +5v->220ohm resistor->+5v

also if I have 4 input/output , that share the same +5v/GND on the arduino, do I have to do anything extra?
or do I just connect them all identically?
(can i optimise, eg.. all the 5v, come into the same 220ohm resistor, or do i need separate ones?)

also I'm wondering, perhaps I can use an SPI interface between axoloti and arduino mega2560, that would keep my axoloti's midi din and usb free for use.

sorry, all dumb questions, total newbie to circuit design :slight_smile:


#7

The optocoupler is only on the input, it is to isolate the circuits to avoid ground loops


#8

I'm not an expert either but as far as I know, the opto-isolators are generally there for a belt and braces safety approach, imho it would seem sensible in an open environment like we're using, who knows how far a wrong voltage could reach?

You could use SPI but you could also use usb-host as some of the arduino boards support usb-midi, although I'm not sure if this is out of the box yet or by additions to the arduino IDE. I know for my mega2560 usb-midi support I had to use a moco-lufa firmware on the bootloader chip which can make things slightly more complicated for uploading new firmwares, it's nothing that can't be solved with an appropriate switch/button.

As for voltages and tying muliple pins to +v/gnd, I am not sure but the cost of components would be pennies/cents if you can't share them.


#9

you should use a resistor to every contact, don't be cheap :smiley:

as @Reggie says you can use the usb port and you can flash the usb-chip to act as usbmidi device, (you ned a programmer like a usbasp or just another arduino acting as a programmer to flash the chip) and then connect it to the usbhost jack, that is absolutely the simplest way to connect it if you don't use that for anything else, BUT the arduino USB still uses the serial port so you only get 3 ports left on the mega


#10

@mnskll that's what we needed, an expert :wink: If you want usb-midi + 3 uarts and no messing around, a teensy 3.2 will do the job very well, without needing an extra programmer, teensyduino is also an excellent collection of libraries addons that compliment the arduino IDE, with midi (normal and usb) libs and a raft of others.

I'm trying to remember if I needed an extra programmer for the mega2560, I'm pretty sure I didn't, I just needed to do a vulcan death grip on the ISP pins to flip it into dfu mode and program via usb.


#11

One extra DIN MIDI in/out pair is easy, via uart on GPIO. For midi input, I strongly recommend not skipping an optocoupler, and 6N137 rather than 6N138. There is no optocoupler on MIDI output, the input is supposed to have it.
Use separate 220 ohm resistors for each output, and two per output like here https://www.arduino.cc/en/Tutorial/Midi
Some sources suggest using a single 220 ohm resistor between TX and the midi out socket, I don't recommend that.

(Many) more extra outputs could also be created with just Axoloti with a "software uart", driven by a high priority timer interrupt at 31.25kHz, scanning out start, stop and data bits in firmware to regular gpio pins. This adds a lot of context switching to firmware, which is not really nice, and time spent in the interrupt service routine should be minimized.
In a similar way, inputs could be done in a "software-uart", but need to sample the input at at least triple speed, align to the start bit etc, way more fiddly than output.


#12

yeah, I'm trying to avoid usb, as the arduino only has 1 usb port, and the axoloti only has one usb host port...
so if I use this for comms, then Ive no USB hosting ability, which Id like to keep :slight_smile:

@johannes that actually was kind of what I was wondering initially... i was assuming to dedicate an axoloti to the task, so the achieved performance, would lead to how many ports it could support.
a very naive questions... if you did this as a software uart , and put an optocoupler on both ports, could you have each port then configurable as input or output?
(I'm assuming we use the digital io ports on the axo board, and I think this are bi-directional )


#13

All of the arduino/teensy boards support midi via serial, so you're not stuck with using usb-midi if you don't need it, in that respect you just pick the arduino with the right number of uarts to give you the midi IO you need :slight_smile:


#14

@thetechnobear I don't think it will work, but I'm really not sure here.

You can't send anything out through the optocoupler, it's one-way, and as far as I understand midi is communicating byis sinking the +5v signal, so the connection is normally high when nothing is being sent. when no midi cable is connected the input is null meaning the optocoupler is giving 0V sinking the signal on the input pin. If you want the same pin to work as an midi output, it is already low from the optocoupler, so you can't use the pin for communication. if you set it to high it will probably create a shortcut.

Please correct me if I'm wrong, I am just guessing here..


#15

Making a bidirectional midi port?
A regular optocoupler only works one way. Adding output functionality to a DIN midi port, without destroying the properties of the (opto)isolated input requires an isolated output too, but a MIDI output needs a bit of power, so then needs an isolated power supply. Something like ADuM5241 provides bidirectional data isolation and isolated power in a single chip, but I don't care enough for bidirectional midi ports to do the design work..


#16

thanks guys... as i said was naive hope, nothing more...
theres enough IO on axoloti for dedicated midi in and out... and now Ive learnt a little more about optocouplers , thanks :slight_smile:


#17

Axo UART -> Teensy UART then logically split based on channel to more MIDI-Outs hanging off the teensy.

Of course, this needs some code (not much) and your using the Teensy as a splitter. Which essentially is the same thing as building a MidiThru. The benefit is the channel from Axo to Teensy is UART so shouldn't need any of the extra's (opto etc)


#18

never looked at the Teensy world...

so a Teensy 3, appears to have 3 uarts, so if you use one for communicating with axoloti, thats means only 2 additional midi ports.
I guess like connecting to an arduino and option would be to use, so you then get 3 more midi ports.

I like the uart idea, as it seems simpler to code (though im sure there are tricky bits still)...
but what are the maximum data rates? if your servicing say 2 extra midi din, then between axo and teensy/arduino, you need to be at 2*31k so ~62k, for 3, is going to be ~94k, is this reliable over serial?


#19

atmega 168 chips @ 16mhz can handle upto 1Mbps over uart, I think you're good to go on this one. The teensy 3.2 is a 96Mhz cortex chip...


#20

i have a mega2560 connected via rx/rx3 (arduino) and PA2/3( axoloti) running midi.
I used the extra midi I/o object in Paul's Comunity patch folder.