-1

Can I connect 5 raspberry pi's with one another? If yes how? Can I use gpio's to connect or are there any other ways?

I have a task where I need to connect raspberry pi and make them communicate with each other.

I will have a main raspberry pi which will be Master and 4 slaves wherein 4 slaves will send master their data and master will perform some task.

How will I achieve it ?

Thank you in advance

  • 4
    Welcome to Raspberry Pi! Please take the tour and visit the helpcenter to see how things work here. "Connect together" to do what? Please be more descriptive about that. – Ghanima May 1 '17 at 19:22
1

I have a half-dozen of them, monitoring various sensors around my solar power plant.

All of them have Arduino Nano's connected to the Pis via USB serial port, to do the ADC necessary for measurements. The Pis collect data as it comes in to /dev/TTYUSB0. Arduino IDE is installed on each Pi to make reprogramming of the Nanos very simple, via the same serial cable.

Most use T-cobbler boards to give room for extra circuitry like voltage dividers and extra connections for various sensors and their power requirements.

One innovation I use is to use one set of power rails on the cobbler board as a local I2C bus, connecting the Pi to the Nano to the sensors.

Each Pi also archives its data to a USB flash drive every 30 minutes. They generally go around to take readings at 1-minute intervals so the data files are small yet provide enough detail for my purposes.

The Pis all connect to a dedicated router by WiFi. It provides a subnet just for them so other traffic can't interfere.

The WAN port on that router is then connected into the larger network, so PiNet becomes a subnet. All the Pis have full Internet access for updates and downloads when necessary. All the Pis have clocks synchronized by NTP

Each of my Desktop PCs has, in addition to cables to the larger network, WiFi adapters which connect to PiNet, for remote access to the Pis via RDP. This is how I can reprogram both the Pis and the Arduinos while sitting in the office.

My Tablet runs Remoter so I can connect directly into any of the Pis when I am working on their hardware.

Every other device, from PC to Pi, is using external USB WiFi adapters with those 2-foot tall high-gain antennas. Two of them use mag-mounts with extension cords for the same kind of antennas - so the Pis can be kept away from the hot air temperatures while maintaining communications. These antennas provide rock-solid connections for data throughput.

The Pis can all talk to each other, and one of them is the "master" that uses cron to periodically archive the data to a USB flash drive from the others.

My NAS PC uses a Windows Task to bring in the archived data (via scp) to hard disk for backup at midnight every night.

gnuplot to produce graphs of what all is happening.

Very inexpensive and reliable way to make it work.

--EDIT - I solved the problem of my MASTER's script constantly prompting me for passwords as it consolidates the data from the other 5 Rpi3s that are collecting data.

Turns out it is simplicity itself. You can see my post on the subject here:

How can I use scp/ssh in a cron script without entering a password?

I'm now free to let the computer just do it for me.

  • Tip-o-the-hat to @Joan for helping me understand how to use I2C on the Pi. Especially for allowing the Nanos to be the master on I2C so they never get interrupted. – SDsolar May 2 '17 at 19:45
4

The obvious way is to use the Pi's Ethernet port and network them with a switch or router.

Using the GPIO will be far more complicated and much slower.

This question has nothing to do with the Pi in the way you have asked. It is a general network question.

Not the answer you're looking for? Browse other questions tagged or ask your own question.