Connecting 2 Megas + Uno + Raspberry Pi 3

Hello,

I have just one single question, I have 2 Arduino Megas, one Uno and one Raspberry Pi 3 B. I would like to communicate between them, the Raspberry Pi as Master and the Arduino's as clients. The Arduinos do not have to communicate to each other. So maybe a solution is to communicate over RT and TX that all the RX from Arduinos are connected to the TX from Raspberry Pi and all TX from the Arduino's are connected to RX from Raspberry Pi, but with a level shifter (3V3 - 5V). Am I thinking wrong or do you have any other ways you prefer? (I am using this combination for my Märklin trains, the Uno is with the CanDiy Shield from Sparkfun, so I am not sure if I have problems to talk to the Uno)

Best reguards, Ludwig Müller

PS: Sorry if there are many mistakes in writing English because I'm still a student in Germany :)

Ludwig98Mueller: So maybe a solution is to communicate over RT and TX that all the RX from Arduinos are connected to the TX from Raspberry Pi and all TX from the Arduino's are connected to RX from Raspberry Pi, but with a level shifter (3V3 - 5V).

You cannot do this easily. If you still want to, Google serial multidrop bus.

Or look into I2C or SPI bus instead.

The Mega has four proper serial ports while I believe Raspberry Pi has only one. This implies that it will be a lot easier to have a Mega as the master - if only for communications. The shield conventions are such that pins DS0,D1 are available by pass-through to another connection on top, and the Candiy should not be a problem.

Nick_Pyner: The Mega has four proper serial ports while I believe Raspberry Pi has only one. This implies that it will be a lot easier to have a Mega as the master - if only for communications. The shield conventions are such that pins DS0,D1 are available by pass-through to another connection on top, and the Candiy should not be a problem.

That isn't what he has in mind.

He wants [u]all[/u] of the RX pins to be connected together, and [u]all[/u] of the TX pins to be connected together.

Hello,

and thanks ieee488,

you are completely right! I will use one of my Mega's as Master and connect it to the Raspi with RX and TX 0 and then the other devices I can connect over RXTX1,2 and 3 right?

Thanks in advance, Ludwig

Indeed.

Ludwig98Mueller: Hello,

and thanks ieee488,

you are completely right! I will use one of my Mega's as Master and connect it to the Raspi with RX and TX 0 and then the other devices I can connect over RXTX1,2 and 3 right?

Thanks in advance, Ludwig

That's not what you wrote in your initial post.