Multiple arduinos together

Hi,
I am new to the forum and my knowledge of arduino is limited. (2 months :slight_smile: )

I am connecting multiple uno boards on one mega over pcb board with for wires, some of wire will be shorted od PCB as i wont have enough pins on mega, as there are more stuff connected to. If I connect every pin individualy it would take 60 pins so this is not an option.

UNO 1 - PIN 3 OUTPUT-------
UNO 2 - PIN 3 OUTPUT---------PCB connected together-----MEGA PIN 4 INPUT (HIGH for 50ms)
UNO 3 - PIN 3 OUTPUT-------/
… (to 15)

MEGA should reset all UNO boards so one MEGA pin to ALL RESET pins on UNO boards (LOW 50ms signal to reset after will be HIGH so it doesnt reset anymore)

Every board would have it’s own power supply (as they are connected to 12 A, power supply with splitter.

Thank you

Connecting.png

If all you want are extra inputs and/or extra output, try the MCP23017 16 port i/o i2c chip or the MCPS23017 SPI version.

@Tigi, I don't understand how or why you propose to connect the UNOs and the Mega based on this

UNO 1 - PIN 3 OUTPUT-------\ UNO 2 - PIN 3 OUTPUT---------PCB connected together-----MEGA PIN 4 INPUT (HIGH for 50ms) UNO 3 - PIN 3 OUTPUT-------/ ... (to 15)

and there must be some typos in this

with for wires, some of wire will be shorted od PCB

What are all the Mega I/O pins being used for? - it has a lot of them!

As is common, if you provide a good explanation of the project you are attempting you will get much better advice

...R

Why not use i2c?

If you connect the output pins of two or more Arduinos together that is a great way to burn them out. Never connect outputs together unless they are open collector outputs. The Arduino has no open collector outputs except on the I2C lines and only then when working with I2C.

Imagine one Arduino outputs a HIGH and another outputs a LOW, then you have a dead short and things burn.

Tigi: I am new to the forum and my knowledge of arduino is limited. (2 months :) )

It would be a very good idea to describe the project so every one understands what it is you are trying to do.

The Arduino has no open collector outputs except on the I2C lines and only then when working with I2C.

Technically those would be 'open drain' as the part is all MOSFET to the best of my knowledge. The point being made does not change tho.

Multiple inputs of different parts can be connected with internal pullups enabled. Both could listen constantly, and one could pull the line low to signal the other of some situation, then go back to listening, while the 2nd pulls it low to signal acknowledges the message, or finished a task perhaps.

Let me try to explain what I am trying to do. 15 Logic games (for kids) on UNO boards and control for them on MEGA (menu, timer, score), so 4 wires (reset, difficulty, error, complete), so with reset and difficulty mega is output, and for error and complete mega is input. That is 60 wires so I am trying to use less wires, when something is finished or error will send signal of 50ms to mega so it could calculate. On mega there are wires of 16 segment display, shift registars, sound, display lcd (two of them), buttons to use meni, leds... i think that is all for now. I hope everyone understand now.

Tigi: Let me try to explain what I am trying to do. 15 Logic games (for kids) on UNO boards and control for them on MEGA (menu, timer, score), so 4 wires (reset, difficulty, error, complete), so with reset and difficulty mega is output, and for error and complete mega is input. That is 60 wires so I am trying to use less wires,

This is crazy.

Just use serial to communicate and you only need 2 wires + GND for all of them together - plus a few diodes and resistors. Or use the 4 serial ports on the Mega to talk to the Arduinos in groups of 4. Maybe even easier would be to use SPI which is designed for multiple communication - though I don't know how long the wires can be. How far apart are your Arduinos?

If you are prepared to spend a little money (about ÂŁ2 per Arduino) you could get them to communicate by wireless using nRF24L01+ transceivers. That would be my preferred option.

...R Simple nRF24L01+ Tutorial

...R

You can use pins like they are open-drain this way:

void setup ()
{
  pinMode (pin, INPUT) ;
  digitalWrite (pin, LOW) ;  // pin is commoned with others, and has a _physical_ pull-up resistor
}

void pulse_pin ()
{
  pinMode (pin, OUTPUT) ; // drive pin LOW
  delay (10) ;
  pinMode (pin, INPUT) ;  // let pin float
}

void loop ()
{
  pulse_pin () ;
  delay (100) ;
}

So if any of the connected Arduinos are pulling it LOW, it will be LOW, else the pull-up resistor pulls it HIGH.

Note than this isn't true open-drain as you can't take the output above Vcc, all the Arduino's need to be powered up for it to work at all.

Note that the calls in setup() aren't strictly needed as they are the defaults.

I know this works on ATmega based arduinos, it might have issues on other sorts.

Ok, thank you for your answers. But I have question with i2c displays and now with i2c communication if I decide to use i2c. On more arduino there are LCD displays (3) of them have same address, but using i2c i would need to connect them all together using SLA and SLC how would that work as I cannot change these addreses.

If the Arduino is using I2C for controlling a display that makes the Arduino a master, for the Mega to talk to your Arduinos that means the Arduino has to be a slave. This means that using I2C is a bad idea. You should have said that the Arduinos were already using I2C.

Can you tell me what is best way to proceed now that you know more details.

Tigi:
Can you tell me what is best way to proceed now that you know more details.

What about the suggestions in Reply #9?

…R