tttapa / Control-Surface

Arduino library for creating MIDI controllers and other MIDI devices.
GNU General Public License v3.0
1.27k stars 140 forks source link

Possibility of communication between modules #17

Closed masydoblig closed 3 years ago

masydoblig commented 5 years ago

Hi Pete

Is there a possibility of getting the Arduino boards to communicate with each other so that each module is on the buss with one master module passing the Midi information to/from the PC via usb. Either over I2C or similar using the spare TX RX ports

If the message is a channel 2 message it only gets recognized by the #2 module

The modules can be programmed exactly the same except for the midi channel number All of the slaves would only need to be powered by a 9v supply.and connected on the bus.

With this approach there is the possibility of having a modular up to 48 ch mixing console with with (EQ and Dynamics modules) setup using only 3 usb ports (and only 3 generic midi controllers).

i.e.

Fader module 1 : (mega 1 sends and receives midi data to/from Master) CCPotentiometer potentiometer(A0, {MIDI_CC::Channel_Volume, CHANNEL_1});

Fader Module 2 : (mega 2 sends and receives midi data to/from Master) CCPotentiometer potentiometer(A0, {MIDI_CC::Channel_Volume, CHANNEL_2});

Master Module: (Mega 16) Passes all information to PC CCPotentiometer potentiometer(A0, {MIDI_CC::Channel_Volume, CHANNEL_16});

I am about to start the design of the EQ Module and Master Modules All will have their own controller(Mega) and custom pcb All Face panels will be laser cut 8 fader assembly img2

tttapa commented 5 years ago

I've thought about this, but I haven't implemented it yet (and I can't test it at the moment).

I²C seems an easy solution:

There are a couple of caveats, however:

masydoblig commented 5 years ago

Could the sysex be disabled from being sent on the I2C bus and only recognized by the master? If required.

As you have said before the mega uses TX0 and RX0 for the communication so So could the midi transfer bus be on TX2 RX2? To avoid the interrupt issues? And would that then mean it could be in a midi serial protocol.

I'm sure this is a shit load of work to get it working but it would make your system absolutely powerful as hell and completely modular there could be 1 to 32 modules (16 faders 16 eq) on a single usb as there is dfinately enough midi assignments avaliable

.

tttapa commented 5 years ago

So could the midi transfer bus be on TX2 RX2? To avoid the interrupt issues? And would that then mean it could be in a midi serial protocol.

That's not possible, because only one slave can send data on the UART, you would need some kind of external bus access control, which is even more complicated, and should also use interrupts for reliability.
I²C is better suited because it handles the bus management for you.
You can perfectly send serial MIDI over I²C, that's not the issue here.

I'm sure this is a shit load of work to get it working but it would make your system absolutely powerful as hell and completely modular there could be 1 to 32 modules (16 faders 16 eq) on a single usb as there is dfinately enough midi assignments avaliable

I'm afraid I don't have the time right now. I have to focus on my studies, and adding this feature would take up too much time. It's not just writing code, you need architectural design, hardware testing, unit tests, refactoring, documentation, examples, etc.
It's too much work for the limited time I have available.

I'm thinking it might be easier to just use the ExtIO functions with "dumb" IO expanders instead of extra Arduinos.

masydoblig commented 5 years ago

I have been meaning to ask what are you studying?

Get Outlook for Androidhttps://aka.ms/ghei36


From: tttapa notifications@github.com Sent: Sunday, February 24, 2019 11:36:12 PM To: tttapa/Control-Surface Cc: masydoblig; Author Subject: Re: [tttapa/Control-Surface] Possibility of communication between modules (#17)

So could the midi transfer bus be on TX2 RX2? To avoid the interrupt issues? And would that then mean it could be in a midi serial protocol.

That's not possible, because only one slave can send data on the UART, you would need some kind of external bus access control, which is even more complicated, and should also use interrupts for reliability. I²C is better suited because it handles the bus management for you. You can perfectly send serial MIDI over I²C, that's not the issue here.

I'm sure this is a shit load of work to get it working but it would make your system absolutely powerful as hell and completely modular there could be 1 to 32 modules (16 faders 16 eq) on a single usb as there is dfinately enough midi assignments avaliable

I'm afraid I don't have the time right now. I have to focus on my studies, and adding this feature would take up too much time. It's not just writing code, you need architectural design, hardware testing, unit tests, refactoring, documentation, examples, etc. It's too much work for the limited time I have available.

I'm thinking it might be easier to just use the ExtIO functions with "dumb" IO expanders instead of extra Arduinos.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/tttapa/Control-Surface/issues/17#issuecomment-466770295, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AlaaoWHsyCjrkNShL0YRK5Gjw3irP-B9ks5vQoc8gaJpZM4bOYkN.

tttapa commented 5 years ago

I'm in my third year of Electrical Engineering and Computer Science.

masydoblig commented 5 years ago

That explains the awesomeness at control surface programming.

Get Outlook for Androidhttps://aka.ms/ghei36


From: tttapa notifications@github.com Sent: Monday, February 25, 2019 7:07:56 PM To: tttapa/Control-Surface Cc: masydoblig; Author Subject: Re: [tttapa/Control-Surface] Possibility of communication between modules (#17)

I'm in my third year of Electrical Engineering and Computer Science.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/tttapa/Control-Surface/issues/17#issuecomment-466910021, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AlaaoeTosN4OKcPuMoYeMx2NCVHZJ_LLks5vQ5ncgaJpZM4bOYkN.

masydoblig commented 5 years ago

Hi Pete

when you get time would you be able to help me with some code using the I2c i have no idea how to do it (i am going to have a look on the weekend)

i would like to have 2 buttons on the master module that when pressed send out a message to the slaves and the slaves will send a note on off to the pc (to change the vst track up or down in cubase as i can program this in the daw) if this is possible

that way i can set up the fader modules i have with their own usb port and when they get the signal from the master they can all shift to their nex designated track at the same time in cubase ie fader 1 would go to fader 17 (if i had 16 fader modules built)

Cheers Sam

tttapa commented 5 years ago

Is there a specific reason you're not using the ExtIO classes for buttons and LEDs? I think that would be much easier.

I²C is pretty straightforward, the master sends a message to a slave on a specific address, and the slave can reply to that message. The Arduino site has some working examples.
The next problem is coming up with some kind of protocol to tell the slave what to do. Then you'll also need a parser for that protocol.
My repository with motor fader code I linked to earlier contains an example of this (to set the parameters of the fader controller).

masydoblig commented 5 years ago

I am using the ext io functions for the push buttons and the LEDs on each module.

but with 16 faders each having 10 buttons (cubase specific) and a rotary encoder for each fader i would run out of pins quite quickly even with the ext io. not to mention the eq module would have 16 rotary encoders and buttons or the implementation of the motor faders .

Within cubase if i plug in one usb controller i can assign it to a generic remote image I currently have 2 fader modules plugged in on 2 generic controllers

Then in the editor for each generic controller i can create and delete custom vst banks which i can make anything i want it to be i.e in a 16 fader module set up fader 1 module has 5 vst banks VST 1 Channel 1 VST 2 Channel 17 VST 3 Channel 33 VST 4 Channel 49 VST 5 Input Channel 1 image

But to get all of the faders to change vst banks simultaneously i need to get them all to send out a midi message to the daw (button press from master module over the i2c) or connect all 16 pins assigned to a note button on each controller to a single switch and ground them at the same time (could cause issues).

This is why i was asking about the I2C comunication of midi data between modules so i can program cubase as one controller sending messages on different channels which makes the shifting of vst's easier

What are your thoughts? also i understand the stress you would be under from university and that this is a side issue. so please dont feel obligated.

Thanks In advance Sam My face time is mas.ydoblig@hotmail.com if you would like to see my setup and discuss the options in more depth.

masydoblig commented 4 years ago

Hi Peter

It looks like you have implemented the communication between master and slave is this correct?

Does this mean i can have the master connected to the DAW and send midi data to the slaves like my examples above? if so how do i do it? @tttapa

Cheers Sam

tttapa commented 4 years ago

Not directly, but you could use the MIDI Routing module to achieve something like this:

You'll have to implement the TrueMIDI_Sink interface to send MIDI to your slave, and TrueMIDI_Source to receive MIDI from your slave. How these implementations work is up to you, you can use pretty much any protocol you want.