Zigster
Published © GPL3+

Connect multiple Arduinos to one computer

I have connected 3 UNOs and 1 Mega 2560, each to a different COM port, separately programmable. Top image shows 2 connected, bottom shows 4.

IntermediateFull instructions provided19,346
Connect multiple Arduinos to one computer

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
Any 2-4 types of Arduino boards can be attached simultaneously to program. Here, 2 are attached for programming.
×2
Jumper wires (generic)
Jumper wires (generic)
Five for each of the matching circuits of this demonstration.
×10
Solderless Breadboard Half Size
Solderless Breadboard Half Size
×1
LED (generic)
LED (generic)
Your colour choice. I used 1 red and 1 green.
×2
Pushbutton Switch, Momentary
Pushbutton Switch, Momentary
Mine were colour-coded red and green but ID them your own way.
×2
Resistor 220 ohm
Resistor 220 ohm
Choose your own value, but I suggest not less than 220 ohm for each.
×4

Story

Read more

Schematics

Two Arduinos independent on one PC

It is a demonstration that you can connect multiple Arduinos to one PC AND independently program them. Basic image is Fritzing with added editing for clarity.

Proof four Arduinos attached.

Demonstrates that you can attached 4 Arduinos

Code

GREEN_or_RED_Button

Arduino
Copied and pasted to make two separate programs for two simultaneously PC-connected, independently programmable Arduinos.
/* GREEN or RED LED-Arduino. Copy and paste the
code into each program connected to a different
Arduino, giving one the  name GREEN_LED and the 
other RED_LED.
The basic code and the  circuit setup is public 
domain  but  taken  from  Massimo Banzi's book, 
"Getting Started with Arduino". In his version,
the LED is plugged into 13 and GND, next to it, 
on  the  Arduino  board - and  you can use that 
method if you prefer. I extended  this onto the 
breadboard, the colour-coding is easily visible.
*/

const int LED = 13; /* "const int" because uses 
less memory and does not change */
const int BUTTON = 7; // Pin 7 for LED test
                      // = ON or OFF
int val = 0; // val stores the button state
int old_val = 0; // stores the old val-ue 
int state = 0; // 0 sets LED OFF 1 sets LED ON

void setup() {
  pinMode(LED, OUTPUT); // Defines Pin 13 as output
  pinMode(BUTTON, INPUT); // BUTTON is an input to
                          //record when pressed.
}

void loop() {
val = digitalRead(BUTTON); // read and store the LED 
                           //state is it HIGH? Maybe
                           //change state.
if ((val == HIGH) && (old_val == LOW)){
    state = 1 - state;
    delay(10);
}
old_val = val; // 
if (state == 1) {
  digitalWrite(LED, HIGH); // turn LED on
} else {
  digitalWrite(LED, LOW);
}
}

Credits

Zigster

Zigster

0 projects • 4 followers

Comments