2

I have a project where I need to have a high speed connection between 3 Raspberry Pi Zeros that all talk to one Pi3. I know this can be done over Serial but the connection needs to be relatively fast and since the Zero doesn't have networking is there any way to do this?

I've looked at libUSB but it seams that it can only talk to pre-existing devices, not ones that need custom functionality.

  • A Pi Zero doesn't have built-in networking, but with the addition of a dongles for a few dollars, it would feel that would be the easiest way. – Kolban Jul 14 '16 at 19:18
  • Hmm i suppose. On the other hand I could configure the USB port as an Ethernet device and use that but I would prefer direct USB communication as that would make it a cleaner solution... – user3797758 Jul 14 '16 at 19:21
  • You can connect a zero as a tethered USB device -- I think you are already aware of this, and that is as "clean" and "high speed" a solution as you are going to get. There's no reason you couldn't connect three that way. If you want the zero to pose as something customized, then you will have to write some custom code. – goldilocks Jul 14 '16 at 19:37
  • I all for writing custom code (programmer by career) I'm just not to familiar with the USB protocol and was hoping that there was a library that was able to handle both sides of the USB communication rather than just the host. At the moment i'm having trouble getting the configuration of the USB right so that it is recognised correctly :( – user3797758 Jul 14 '16 at 19:45
  • Well, I'm fine with leaving this question open here, but if this is the case, it sounds like stuff you'd be better off asking about on Stack Overflow. It doesn't really matter what brand the equipment is. USB drivers (it sounds like that's what you want to create) are usually implemented in kernelspace -- which is going to be a lot of work vs. just using the USB net interface and normal inet sockets. Dunno if the speed is arbitrarily limited there though. – goldilocks Jul 14 '16 at 20:02
2

Turn the Zeros into USB "Ethernet" devices (a matter of loading some kernel modules on Raspbian) and use Ethernet emulation to communicate with them. You can now use SSH , MQTT , HTTP/REST or raw sockets to "talk" with them easily - and they can answer back.

http://alexfabre.com/include/project/RaspGadget.html

  • This is super clever. On the Pi 3 (similar to the howto) you would just need to bridge each new Ethernet adapter and operate a DHCP server (or have one upstream of the Pi 3) in order to facilitate Ethernet connectivity allowing a zillion premade TCP or UDP solutions to work. – Jeff Meden Jul 15 '16 at 13:58
  • Well i was thinking of this as a backup solution if no one could find a solution for direct USB communication. I wonder how much overhead USB Ethernet would bring? probably not much since its a direct connection... – user3797758 Jul 15 '16 at 15:14
  • @JeffMeden With the correct configuration you don't actually need a DHCP server to setup a connection, you can give it a static IP when initialising the USB Ethernet. See: isticktoit.net/?p=1383 – user3797758 Jul 15 '16 at 15:18
  • @user3797758 yes you could, I was trying to go by the document as much as possible (which is good for Linux on a RPI3 except for the part where you click "share connection" since theres no similar thing). Assigning static IPs would work fine, and for maximum speed and minimum overhead don't bother forwarding/routing, just assign an IP to each adapter on the RPI3 as well, that way theres no broadcast traffic on other adapters. As to performance, i am sure speed will be amazing except cases where the CPU is overwhelmed, since the usb/Ethernet emulator happens in software. – Jeff Meden Jul 15 '16 at 19:17
  • @JeffMeden sharing a connection between them isn't required as I litterily only want to talk to the devices and request data without them needing to go to the Internet or get anything other than what I send them – user3797758 Jul 16 '16 at 15:43

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.