Friday, August 2, 2013

Capturing an item passing on a conveyor belt

We are taking the following steps to see every time that an item passes by on a conveyor belt:

We have a PLC (programmable logic controller), but it does not need any programming, just on one line ladder logic program that says end, to allow us to put the unit into run mode.  We set up port 2 on the device at 38400 baud, odd parity, 1 stop bit and connected it via a serial port to USB converter to a PC running Kepware.

The basic Kepserver EX can be set up as a Modbus RTU Serial device, while to PLC is a Modbus  slave.  Once the communication parameters are set up to match the PLC, Kepware can monitor the PLC, looking at ports numbered 100001 and 100002.  On the PLC, these are known as X1 and X2.

We use the Kepware DataLogger to capture the changes to a MS SQL Server.  We have to create a new logger, and then identify the Kepware OPC registers we wish to monitor.  We are currently only watching the ON/OFF flag, but we can watch the timestamp to get more accurate readings, since we are only polling the PLC once a second.

These registers are mapped back to a table in the sql server, and kepware triggers (not SQL Server triggers!) are configured to write a row to the database whenever the data changes.  Our next step would be to create a sql server trigger to perform the appropriate behavior following each database write.


No comments:

Post a Comment