News & Events

Connecting a TCP-IP Reader



I have a camera that will only have a tcp-ip interface with a RJ 45 connector and I want to connect it to the controller to check the numbers my equipment is printing.

How do I do it ?


What you have to know from the reader

The controller is only interested in triggering the reader and getting a result in time over the tcp/ip interface. I assume here that you know about tcp/ip and settings in a PC.

The reader setup is either automatic or the reader comes with a software that allows to set it up. The controller has nothing to do with this step. I encourage you to install the reader manufacturer software on the controller and setup the reader from there.

Be sure to know what the trigger input is. The controller will give a push/pull signal. You can use the internal 24 VDC and the opto-coupler will switch between 0 and 24 VDC. Be sure no to draw more than 10 mA, otherwise the opto-coupler will be damaged.

Be sure that the reader sends messages with the number to be read followed by carriage return (0Dhex) and Line Feed (0Ahex):


Due to the time it takes to transmit a package over Ethernet, tcp/ip might be slower than a serial interface. In our tests, the result came to the controller from the camera within 100 ms of being triggered which equates to at least 10 products per second or 36’000 p/h.


What you have to define on the controller

Define a reader of type “Cognex tcp/ip” first in the job.

Double-click to get the reader display.

Encoder is the encoder of the machine segment where the reader is on.

Trigger from Photocell is the photocell used as reference to trigger the reader.

Mode is always matching in this mode.

Trigger Position is the distance between the reference and when the reader shall be triggered.

Trigger Length is the length or duration of the trigger.

Max. Sequential Errors is the maximum number of errors in sequence before a soft stop.

Max. Matching Errors is the maximum number of matching errors in sequence.

Reader number settings have no meaning at this time


1st Code is actually the barcode read by the reader.

Time trigger to Result is the time the controller waits for a result from the reader in milliseconds.

Read Match Trace is to show the matching in the RTX window.


So, the controller is going to log what you read. The length of course varies between jobs. Furthermore, it is going to mark bad the products that do not read because the camera will have a timeout or the length is not 11.



In the Configuration tab, enter “as expert” the hardware settings.


Box is 01.

Type is Standard Reader.

Number is whatever output number you take to trigger the reader. OUT 06 is just an example

Logic is normally positive. That is, the pulse goes from 0 to 24 V.

Length is Track.

Type is push/pull.

Interface type is Ethernet tcp/ip.

Use Interface is My Interface.



How Can I test it?



Thus, if you press the trigger button, you should see OUT 06 go on and off in the connection box. The trigger signal, if well wired, should make the reader read and send a result that will be shown.

If not, the text in result will be “no result” and you will have to trace the error.

You can always plug in your laptop and check with hyper-terminal that the reader is truly sending something through the tcp/ip interface. Go to Hyperterminal and instead of a serial interface, select Winsock, the IP number and the port number which is 3000 by default.



You can also enter tcp_ip_reader –trace 1 in arguments.txt (D:\EditorGT\user\system) if you want to see what the controller driver sees at the socket.


Tested tcp/ip reader:

Cognex Insight camera (



The Cognex camera, once set up, will do fine. However, if you want to change something (like a window size in the camera) while the controller is in production, the Cognex will close the tcp/ip connection to the controller which is not good because you will have to start production again. At this point, Cogenx is working on this.