2

So, does anybody know if it is possible to connect 2 Pi's to a single Arduino board (more specifically the Mega)?

I have a project in which a robot with two pi cameras, and 2 dedicated Pi's are connected to a robot. The navigation is handled by a PlayStation 4 controller (via Bluetooth) and there is a pan and tilt servo combo, controlled by an Android phone's accelerometer (also via Bluetooth).

The need for a solution to my initial question came up when I needed two Bluetooth connections. I have been doing individual tests on the same Pi; however, the final system should be handling two Bluetooth connections at once. If I dedicate one Pi for the connection with the PS4 controller and the other will handle the phone's sensor data, would I be able to connect both Pi's to the Mega with a USB Y-cable for the means of data transport?

If not, does anyone have an alternate solution? My research has only left me with more unanswered questions.

  • Have you considered adding multiple Bluetooth USB dongles or HC-06 modules? I didn't follow the need for the Arduino Mega? I can see why you might want two PIs ... each of them hosting one high resolution camera ... but missed the Arduino tie-in. Have you considered adding multiple web cams to a single Pi? – Kolban Jul 21 '16 at 5:25
1

So, does anybody know if it is possible to connect 2 Pi's to a single Arduino board (more specifically the Mega)?

In general: yes, there will be a way to connect two Pi's to one Arduino given the numerous ways the Pi's can connect to the world and the number of interfaces on the Arduino Mega (I'll refer to the Arduino MEGA 2560, but as far as I can tell the "Mega" predecessor share these characteristics).

  • SPI - a Pi is master on the SPI bus, so two Pi's cannot share the hardware SPI of one Arduino. However given the number of GPIO pins on the Arduino it might be possible to have on Pi use the hardware SPI interface of the Arduino and the other Pi connects to a Arduino using software SPI (there's Atmel Application Notes on the topic).

  • I2C - a Pi is master on the I2C bus. The same idea as for SPI applies.

  • USB - as far as I can tell the Arduino Mega has just one USB jack (slave) that acts as an USB-serial converter. A Pi on the other hand is an USB host. So again no two Pi's can connect to one USB jack.

  • UART (serial) - the Arduino has four hardware UARTs. Each Pi3 has two UARTs (one is blocked by Bluetooth). So this would be a very simple way to go. Do mind the 5V logic level of the Arduino vs. 3V3 levels on the Pi.

  • self-made bit-banging using GPIO on the Pi and the Arduino, certainly possible (but worth the hassle?)

  • any combination of the above mentioned

would I be able to connect both Pi's to the Mega with a USB Y-cable for the means of data transport?

No. That's just evil.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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