I am making a classic XYZ gantry robot for picking up some test tubes using a machine vision system i wrote in Processing. The outline of the system looks something like the attached photo.
Basically a Raspberry Pi 3 as a brain, finding positions through a camera and taking inputs from a GUI on the touch screen.
For making the robot move i have bought a bunch of Ustepper S driver. For those not familiar with this board, it is basically a merge between a stepper driver and an Arduino UNO, but the new version will offload the CPU by using a separate chip for calculating acceleration and speed, thus hopefully enabling the robot to be very fast.
https://www.kickstarter.com/projects/301805155/ustepper-s-line
For the question in this topic they can be regarded as an Arduino Uno, but i will refer to them as UStepper.
I need someway of communicating between the Raspberry Pi and the Usteppers. From the Pi to the UStepper i need to send position, speed, acceleration and commands like "goToEndStop", "closeClaw", "openClaw" etc. From the Ustepper to the Pi i need confirmation when these commands have been executed.
I think that i can get the cables down to 2-2½m as the maximum distance. I can use as many wires as necessary, but as few as possible is desired.
So i am thinking along the lines of I2C or RS 485 (with ModBus). I2C seems to be the easiest one, since i do not need to have an RS485 translationboard inbetween the Pi and UStepper, but is the I2C robust enough?
So here is a scenario that i am afraid of: X axis are using two stepper motors to run. These need to run simultaneously, Two problems:
- Not being synchronous within a couple of milliseconds, 1/10 of a second are probably to high.
- One of the Usteppers does not get the signal because of noise or other obstacle and UStepper number two starts moving without number one.
Are wire.h (I2C lib) robust and fast enough this? Can wire.h detect if the com string has not been received by the slaves or do i need to write my own protocol to check this?
Are there another way of making this communication, that i am overlooking?
All suggestions are very welcome