I am involved in a project for clasification of cardboard boxes using artificial vision.
I'm pretty much done with the vision part but now I have to communicate the vision result (A number from 0 to 9) to a yet unknown PLC.
So I was wondering if an Arduino would be a good option to do this.
All the logic work would be done by the vision software wich would then order the Arduino to set 4 digital outputs to a binary value from 0 to 9 which would be read by the PLC plus, I guess, a 5th output wich would do a pulse to notifiy the PLC of the sending of data.
I've developed my project under C++ in Ubuntu 10.04. I have little experience with electronics, the actual wiring would be done by someone else but I'd have to do the programming. And I have no experience at all with Arduino.
Thus I'd like advice if this is a good way to do it. And if so which model should I use.
You could easily do this with an Uno (something from RuggedCircuits might be your best bet, depending on the environment you are using this in, but if the environment isn't overly harsh, a standard Uno will work); your software on the Ubuntu side would need to send whatever values via the virtual serial port (USB) to the Uno, then the Uno would simply (heh) read the serial port, and output the HIGH/LOW values to the selected pins via digitalWrite(). These pins would be interfaced to the PLC. The next question would be what voltage the PLC is expecting on its inputs; if it can be configured as 0-5V logic-levels, you're golden. If not, and you need to use higher or lower voltages (likely, with a PLC, it would be higher), then you'd need level conversion. The easiest way to do so here would be with an NPN transistor (a 2n2222, or something like a ULN2003 if you wanted it in a DIP package) on each output. Or, you might opto-couple (4n25, 4n26) to the PLC (that's might be a very good option, actually).
I'm tempted to say why not have whatever hardware the vision software is running on drive the plc directly. However, if the vision software is running on a PC, that would require some sort of interface attached to the PC to generate signals of the right voltage/current to drive the plc. In which case, an Arduino would be suitable if the plc requires 5v logic signals. You would connect the Arduino to the PC via USB as usual, have the PC vision software write data to whatever COM port the Arduino appears as, and have the Arduino read its serial port and set the outputs to the plc appropriately.
Most PLCs these days have a user serial port on them that the user can send and receive values via normally a modbus protocol. So it is possible to have the PC directly communicate the values to the PLC. Or it's possible to have the Arduino 'talk' to the PLC via serial Modbus to pass data instead of using PLC digital input channels.
So interfacing via PC to Arduino to PLC digital input pins is certainly doable. I would just try and keep it simple (KISS concept) and use direct serial mod bus communcations from the PC to the PLC, unless there are other functions you want the arduino to perform, either independently or via the PLC?
I would tend to agree with dc42. You need outputs from the PC and inputs on the PLC so why not just plug something like a USB to digital Output adapter (e.g. MiniBee PC Automation and Robotics for the Hobbyist ) into the PC then connect those outputs to digital inputs on the PLC. It might be an idea to output a number in the range 1...10 rather than 0...9 otherwise you might have a problem knowing if 0 (all outputs off) is really a reading from your vision software.
Using serial communications to the PLC could also be done but might be complex and expensive. Most PLCs will use RS232 serial ports and your PC may only have USB so straight away you would need a USB to Serial converter. If you wanted to use MODBUS on the PLC you might need to buy a MODBUS module, which would be more cost.
I am new to Arduino but there is no doubt it could do the job. It is just that a USB to Digital Output adapter might be simpler, faster and cheaper.