Can I connect 4 arduinos by serial?

Greetings everybody!

I’m new in Arduino, but I’m trying to do a hard proyect (because easy proyects bores me) and I think to do a MIDI Controller for Ableton Live. I want to “clone” the famous Novation Launchpad.

So, I need a lot of memory for some layers that I will change with 4 buttons (session, user1, effects and mixer) and I need too a lot of Input.

I’m thinking so to do a small Launchpad, like the original design, so I think to use four Arduino Pro Mini interconnected, but, I don’t know if this is possible, I make a fast design with Paint (I Attach it)

My idea is make 4 independent boards with an arduino each one for process the data and after that put it together.

Some help?

Thanks you!

PD: Sorry for my bad english

Topics with "HELP" in the title are viewed with particular disfavour by many contributors here, as that implies a substantial misunderstanding of the purpose of the forum.

Bad English on the other hand, is usually accepted with little or no comment unless the poster claims to be proficient in English. :smiley:

Oh, sorry! In Spanish forums is very normal put [HELP] in subject. now, I'll edit the subject haha, thanks you!

In your diagram you probably need to add a small diode on the pro mini tx pin with the band side of the diode connected to the pro mini tx pin.

You won’t do anything good with that hookup. You have 5 Tx’s talking, and all onto the same line. A Tx must be wired to an Rx.
You also have 5 Rx’s listening to each other. In effect, all the talkers are talking to nothing that can hear them, and all the listeners are listening to nothing that can talk to them.

You can, conceivably, wire one Tx to all the other Rx’s, but you can’t have multiple Tx’s talking to one Rx (or to all other Rx’s). The only way to do something like that is to use something like RS485, which is designed for multi-drop communication.

You could use a “round robin” form of communication, where each Tx talks to one other Arduino’s Rx, and that Arduino’s Tx passes the characters on to the next Arduino’s Rx, and so on, all around the circle. If you do something like this, you’ll need to devise a protocol to address the data so that each node “consumes” the data and sytops passing it on. In this scheme, each node can pass on data received from the previous node, but can also originate data on its own. The Arduinos are fast enough that you shouldn’t be able to tell the difference between simultaneous and round robin trasnfer.

Attached is a (crudely) modified diagram showing what I mean. I suggest the Mega2560 or the Leonardo, because you don’t need to use SoftwareSerial. The Uno only has one hardware Serial port.

That is a much more appropriate title. People can see what it is you want, and are more likely to contribute.

Now the “long and the short of it” is that you are clearly “barking up the wrong tree”!

You do not add more inputs and outputs by adding more Arduino microcontrollers. That causes more problems than it solves, so while people will tell you how to do it, it is the wrong thing to do!.

For the lamp outputs, you should be using a MAX7219 8 by 8 LED matrix multiplex driver. This requires three pins to drive, even if you wish to use more than one of them in a chain for more than 64 LEDs.

There are various ways to connect the buttons, but multiplexing is generally the most sensible one, a common way is to use a 74HC4017 or similar which is a counter that puts one of ten outputs high at a time, and you can use eight inputs on the Arduino or only three outputs to a 74HC4051 multiplexer and one input. You need a diode for each button.

So you can have 80 buttons and lights using 7 port pins on any Arduino. If you have a MIDI interface, you do not need the USB attachment and a Pro Mini will do the whole job.

Now you should know that imitating the Novation Launchpad is an extremely common and popular project, detailed many times over on various forums and such, including these, using Arduino, PIC, MSP430, 8051 and whatever, but almost always only a single processor.

If you need a lot more memory and pins, start with an Arduino MEGA:

More capability than 4 UNOs:

  • 54 digital input/output pins
  • Flash Memory 256 KB of which 8 KB used by bootloader
  • SRAM 8 KB
  • EEPROM 4 KB

There are legal copies out there like THIS: or just google MEGA and Ebay.

DISCLAIMER: Mentioned stuff from my own shop...

Thanks to all people!

My idea of use 4 arduino pro mini is because is smaller, and I have 64 true inputs. I have read that if I multiplex the input, I cant push 2 or more buttons at the time, because multiplexer cant send more that 1 date at the time. I can use multiplexing and have 2 or more buttons pressed at the time?

Attach my actually code, I used 4 buttons and 4 leds (I will change for RGB leds with Common Anode):

#include <MIDI.h>
int action=2;
byte incomingByte;
byte note;
byte velocity;

//line 1
const int buttonDoPin = 2;
const int button2Pin = 3;
const int button3Pin = 4;
const int button4Pin = 5;

//line 1
int noteDo = 36;
int note2= 37;
int note3= 38;
int note4= 39;

int buttonDoState = 0;
int button2State = 0;
int button3State = 0;
int button4State = 0;

int lastButtonDoState = 0;
int lastButton2State = 0;
int lastButton3State = 0;
int lastButton4State = 0;

int val;
void setup() {
  pinMode(8,OUTPUT);
  pinMode(9,OUTPUT);
  pinMode(10,OUTPUT);
  pinMode(11,OUTPUT);

pinMode(buttonDoPin, INPUT);
pinMode(button2Pin, INPUT);
pinMode(button3Pin, INPUT);
pinMode(button4Pin, INPUT);
MIDI.begin(MIDI_CHANNEL_OMNI);

}
void loop() {
if (Serial.available() > 0) {
    incomingByte = Serial.read();
     if (incomingByte== 144){ 
      action=1;
    }else if (incomingByte== 128){ 
      action=0;
    }else if ( (action==0)&&(note==0) ){
      note=incomingByte;
      playNote(note, 0);
      note=0;
      velocity=0;
      action=2;
    }else if ( (action==1)&&(note==0) ){
      note=incomingByte;
    }else if ( (action==1)&&(note!=0) ){
      velocity=incomingByte;
      playNote(note, velocity);
      note=0;
      velocity=0;
      action=0;
    }else{
      //Nothing
    }
}
    

buttonDoState = digitalRead(buttonDoPin);
if (buttonDoState == 0)
{ MIDI.sendNoteOff(noteDo,0,1);}
else if (buttonDoState == lastButtonDoState)
{}
else { MIDI.sendNoteOn(noteDo,127,1);}

button2State = digitalRead(button2Pin);
if (button2State == 0)
{ MIDI.sendNoteOff(note2,0,1);}
else if (button2State == lastButton2State)
{}
else { MIDI.sendNoteOn(note2,127,1);}

button3State = digitalRead(button3Pin);
if (button3State == 0)
{ MIDI.sendNoteOff(note3,0,1);}
else if (button3State == lastButton3State)
{}
else { MIDI.sendNoteOn(note3,127,1);}

button4State = digitalRead(button4Pin);
if (button4State == 0)
{ MIDI.sendNoteOff(note4,0,1);}
else if (button4State == lastButton4State)
{}
else { MIDI.sendNoteOn(note4,127,1);}

lastButtonDoState = buttonDoState;
lastButton2State = button2State;
lastButton3State = button3State;
lastButton4State = button4State;
}

void noteOn(int cmd, int pitch, int velocity) {
Serial.write(byte (cmd));
Serial.write(byte (pitch));
Serial.write(byte (velocity));
}

void playNote(byte note, byte velocity){
  int value=LOW;
  if (velocity >10){
      value=HIGH;
  }else{
   value=LOW; 
  }
  
  if(note==36){
   digitalWrite(8, value);
    }
  if(note==37){
   digitalWrite(9, value);
    }
  if(note==38){
   digitalWrite(10, value);
    }
  if(note==39){
   digitalWrite(11, value);
    }
}

Thanks everybody

Greetings