Stigma
Posts: 19
Joined: Wed Jun 26, 2019 6:57 pm

Sanity Check: Multiple Raspberry Pis sharing data and tasked independently

Tue Jul 30, 2019 5:23 pm

How would I go about setting up having one Raspberry Pi driving motors and running ultrasonic sensors, while having another Raspberry Pi running another set of components like cameras, more sensors, etc, while passing the sensor data and commands to between Pi's? I would like to divide up the load between multiple Raspberry Pis. I have read the popular solution is using a network switch and and passing the data that way, but is this fast enough for communicating sensor data between two boards in real time? Let's say Raspberry Pi #1 detects object ahead, and I send the command to Raspberry Pi #2 to turn Right to avoid. I've seen this done on Atmega and Arduino boards before, where ppl have an Arduino driving motors, and the larger Atmega board has all the control logic, but that was even without any need for a Switch - it was just two Atmega boards talking to each other.

drgeoff
Posts: 9900
Joined: Wed Jan 25, 2012 6:39 pm

Re: Sanity Check: Multiple Raspberry Pis sharing data and tasked independently

Tue Jul 30, 2019 5:28 pm

Network switch is not necessary. Quite possible to have an ethernet cable between the two RPis and give them both static IP addresses.

Or two or three wires between the GPIO headers to use the serial ports.

User avatar
neilgl
Posts: 1113
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: Sanity Check: Multiple Raspberry Pis sharing data and tasked independently

Tue Jul 30, 2019 5:46 pm

Or maybe set one pi up as a WiFi access point and have the other connect to that SSID. Then use python programs on each with websockets to talk back and forth. Or mqtt on each to pass commands and data etc.

mattmiller
Posts: 2113
Joined: Thu Feb 05, 2015 11:25 pm

Re: Sanity Check: Multiple Raspberry Pis sharing data and tasked independently

Tue Jul 30, 2019 7:13 pm

I'd use MQTT to send the data between the two Pi - just run a mosquitto broker on one of them and link the two together with a short network cable

Aydan
Posts: 699
Joined: Fri Apr 13, 2012 11:48 am
Location: Germany, near Lake Constance

Re: Sanity Check: Multiple Raspberry Pis sharing data and tasked independently

Thu Aug 01, 2019 10:07 am

I think mqtt adds a lot of unnecessary overhead here.
I'd start out with simple network sockets.
They are supported in Python out of the box, and most other languages have the necessary libraries included as well.
For mqtt you'll normally need extra libraries.
If it's only two PIs, you can connecte them together with an ethternet cable directly.
For more than two, you'd need an ethernet switch.
Serial ports might be a solution also. But you'd have to connect the PIs point to point then.

Regards
Aydan

PhatFil
Posts: 1423
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: Sanity Check: Multiple Raspberry Pis sharing data and tasked independently

Thu Aug 01, 2019 10:36 am

Check out Node Red ..

User avatar
neilgl
Posts: 1113
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: Sanity Check: Multiple Raspberry Pis sharing data and tasked independently

Fri Aug 02, 2019 8:01 pm

Have we had a reply from OP

Andyroo

Re: Sanity Check: Multiple Raspberry Pis sharing data and tasked independently

Fri Aug 02, 2019 8:43 pm

neilgl wrote:
Fri Aug 02, 2019 8:01 pm
Have we had a reply from OP
No be the OP was on the board today - worried for some reason?

Return to “Advanced users”