USB or Ethernet for communication between software and Arduino

Next month I'm going to start building the desktop application part of my Arduino project: a motion picture film scanner. I'm about 80% of the way there getting all of the individual components working under Arduino control, and then I need to begin writing software to trigger the board to perform these functions on demand.

I'll be writing the application in Xojo (RealBasic), which will allow me to do either serial or TCP-based communication with the board. I'm currently using a Mega 2560, which controls various motors and reads data from a series of sensors in the scanner. So I'd obviously need to get an ethernet shield if I was to go the TCP route - not a problem.

I can envision two ways the system might work, and I plan to test both of them:

1) (Depending on the camera being used, which is TBD), I might be able to do almost everything from the Arduino. In this scenario, there would be minimal communication between software and the microcontroller. I'd issue a command to scan the next X frames and the camera would control the motors, sensors and trigger the camera, which would in turn automatically write the files to the predefined location on the computer. When complete it would send back a response code. Minimal communication, most of the heavy lifting done by the Arduino.

2) The software (desktop application) is more hands on, sequencing the series of events: Advance frame (wait for response), engage pressure plate (wait for response), communicate with camera to scan the image (wait for response), disengage pressure plate (wait for response), repeat.

So obviously there's a lot more back and forth in the second scenario but I feel like it'll provide greater control than doing it on the Arduino. My concern is about performance - I'm not looking to make this scanner realtime - if I get 1-2 frames per second I'll be very happy. The camera probably won't be capable of more than 4-5fps anyway, and in my current testing, I've got the mechanicals running at just between 1 and 2fps.

In the second scenario, would TCP be faster than Serial? Is one inherently easier or harder than the other? What about reliability? Anything I should be thinking about?

Thanks!

It seems to me that you're relying on the scanner doing almost everything for you either way, so there should be minimal data being passed between the Arduino and the PC, and between the Arduino and the scanner. A hardwired serial USB connection between the Arduino and the PC will be slightly simpler and more robust than using a network interface, and would also reduce the number of cables (since you can power it via USB as well) but I would not expect performance to be an issue in either case since you're only talking about a few frames per second. The hard part is going to be handling the image transfer, which obviously doesn't involve the Arduino at all.

Thanks - I suspected as much, but it's good to hear someone else say it!

The Arduino is actually doing a lot of the work. While I'm using external motor drivers for the steppers, the Arduino is gathering and processing quite a bit of sensor data, as well as starting and stopping the motors, etc. If I wind up with a camera that has serial control, my thinking is to use my software to set up the image parameters (settings like cropping, color correction, file locations, etc), but have the Arduino trigger the image capture itself. The camera then sends that image to the PC, which handles the incoming file. It would certainly simplify things, and probably allow me to run the system even faster, since there would be less back and forth with the PC.

If there's no serial control or way to trigger an image externally, then I'll have to do it from software over the interface between PC and camera.

As an aside, I'm blown away by how easy this has been so far. I never would have pictured that I'd be this far along if you had asked me 3-4 weeks ago. I credit a lot of that to the Arduino being so simple to use.

friolator: The Arduino is actually doing a lot of the work.

It doesn't sounds as if there will be much for the Arduino to do relative to the rest of the solution. The Arduino is ideally suited to act as a smart interface between a PC and external electrical devices as you're proposing to use it, and moving a few stepper motors and reading sensors and so on is entirely reasonable. It's the PC application to control all this and cooperate with the scanner to store the images which is far less clear and where I suspect the obstacles will be found.