7

I work for a medical company and we produce systems which typically are composed by a data-acquisition device connected via USB to a PC where some desktop application runs so that it can control the hardware and display the connected data in realtime. Our desktop software platform is C#/.Net/WPF.

We are considering to build a prototype where a Pi would control a handful of sensing devices, pre-process the data, and send this data to the PC or laptop. The Pi would also respond to commands and requests sent by the PC application.

I have looked around, but apparently the preferred way for us - direct USB connection - is not available, since the Pi USB is a "master".

I got confused, because I had the impression that it should be easy to connect PC and Pi via physical cable so that they could "talk" to each other, so the questions are:

Is there a way to physically connect Pi and PC so that applications could talk to each other through this connection?

If physical connection is not feasible, what is the most direct way to connect a PC and a Pi for the described purpose?

By "direct" I mean least dependent on external infrastructure (modems, routers, etc.) which might be non-existent on site.

heltonbiker
  • 191
  • 1
  • 2
  • 8

6 Answers6

6

You can run this as a serial USB device (FTDI-based cable) to GPIO pins

http://elinux.org/RPi_Serial_Connection

or you can use the raspberry pi in OTG mode to run the PI as a USB peripheral. The raspberrypi zero fits this form factor very well and I think the design intent was to have folks using the zero as a USB peripheral.

https://learn.adafruit.com/turning-your-raspberry-pi-zero-into-a-usb-gadget/overview

The OTG solution is much more elegant and will impress your friends more in my opinion

on another note (being a medical device engineer myself) as regards to software and computer systems validations, please understand that if your "prototype" will be used to collect any sort of quality data (design, process monitoring, etc) it will need to undergo some sort of assessment based on the 21 CFR part 11 with regards to software validation.

bk79
  • 132
  • 9
6

Two common and fairly flexible methods would be:

  • Direct ethernet connection. This requires you have an ethernet jack on the PC that is not otherwise in use. You connect that to the Pi, and you can create a subnet with two nodes. Once upon a time this required an ethernet "cross-over" cable but generally contemporary jacks, including those on the pi, do not. This provides a relatively high bandwidth (100 Mbps) compared to the second option, and allows you to use familiar network protocols and applications. Since it is a network layer connection, it also means you can have various forms of independent communication occurring simultaneously without implementing anything special. E.g., You can have whatever client-server stuff is necessary running for your general purpose and log into the pi at the same time.

  • UART. You can use a USB serial cable to connect the PC to the serial port pins on the pi. This option is much slower (< 1 Mbps) than ethernet and, unless you write some fancy software, is awkward to use for more than one purpose at a time.

goldilocks
  • 60,325
  • 17
  • 117
  • 234
5

I'd go for Ethernet, either point-to-point or through the router. Why?

  1. It handles transmission errors, correction etc. "out of the box" - I guess it's important for medical purposes (your heart rate is now doubled because one bit changed - whoops)
  2. It can be long (up to 100 m - and can be extended)
  3. It's cheap and commonly available
  4. You can get decent quality shielded cable which would (help to) get rid of noise (some devices like an old TV or iron are real problems)
  5. If you write some kind of REST API for your product, you can connect easily with C# - and with other languages too!
  6. If you change your mind and don't want RPi anymore - you can migrate easily - just by implementing the same interface (if it's REST - it's even easier, but you can go with sockets as well)
  7. If you need wireless - plug in an USB adapter and you are ready to go.
  8. A lot of existing stuff already works with it - you don't have to start from scratch - by immibis
Mark
  • 423
  • 5
  • 13
2

The simplest, fastest, and probably most reliable connection would be a point-to-point Ethernet cable.

Alternatively a serial to USB dongle. The serial end could be on the Pi from the UART (pins 8/10) or on the PC end with a suitable RS232 adapter.

joan
  • 71,852
  • 5
  • 76
  • 108
-1

You can raspberry pi with mobile only using some adaptor which can work as two way communication. There is no any in built facility in raspberry pi to place two way communication modem. GPIO and serial port is not enable for this facility.

-3

If you want a wireless approach write a nodejs socket app