6

I am building a bunch of slave devices (Arduinos) that operate autonomously, but will report data back to a single raspberry pi and update their clocks from the pi's time.

I've only worked with one arduino using serial, but I would imagine that 20 arduinos needs a special solution. I don't know how to split serial, but I've also considered SPI and I2C. Would either of these be the way to go?

Given that there are 20 units, I don't think I should go with wifi as I fear there would be loss of connectivity often. I prefer a hardwired method.

EDIT: Also, these arduinos won't be close to each other. They will be spread out, no more than 30 feet from the pi.

pekasus
  • 193
  • 8

4 Answers4

1

I'd use Wifi and sockets. It's relatively simple to use Qt (or even plain C++) to implement a multi-connection client/server. There are lots of tutorials on the net.

Myg0t
  • 111
  • 10
1

You should be able to use I²C over these distances with careful layout. I would suggest you use the slowest I²C speed (although the Pi default is already 100kHz). You should also use a bi-directional level converter at the Pi end as the high level would otherwise be marginal for the Arduino.

Milliways
  • 62,573
  • 32
  • 113
  • 225
1

A wired solution would be to use RS-485. You can connect many devices on a single twisted wire (two wire) cable. There is an good example at https://arduino-info.wikispaces.com/SoftwareSerialRS485Example. The modules shown are really cheap. I see vendors having 5 of them for 7.99. You can also use a USB to RS-485 dongle on the Raspberry Pi.

Andy G
  • 11
  • 1
0

schematic

simulate this circuit – Schematic created using CircuitLab

I2C will be just fine, but don't forget to apply a power and use diodes to ensure a proper power flow

Alexey Vesnin
  • 926
  • 10
  • 17