Technical Article

Using a PLC to Track Data Within Automated Equipment

April 11, 2024 by Shawn Dietrich

There are a few options when it comes to tracking part data throughout a process or assembly of a machine. Follow along as we explain just a few of the more common methods.

Automated assembly equipment, such as automotive assembly lines, generates data as parts are added to pallets or as the final assemblies are created. This data can sometimes be very important and will need to be stored for many years.

In the automotive industry for example, if there is a recall on specific parts after the car has left the assembly plant, owners need to be made aware. By tracking part serial numbers and combining them with VINs, dealerships can identify exactly which vehicles and customers might be affected by the recall.

Some equipment generates data for its own process cycle, but it is not retained after the part exits the assembly line. The type of data, how much, and if it needs to be retained play an important role in deciding how you are going to track data throughout your equipment.

 

Technician entering data into a process machine

Figure 1. Understanding how to log and track data from a production process is critical. Image used courtesy of Unsplash

 

Temporary Data Storage: PLC Memory

Digital memory comes in many forms today. RAM and hard disk storage are the typical forms of temporary and permanent computer memory, and are usually fairly affordable and expandable. The memory in a PLC, by contrast, is very expensive and is not often expandable. Some PLCs use branded SD cards or CFast cards for memory storage that can be replaced with bigger sizes, while other PLC memory is hard-wired inside and not expandable.

Every rung of logic and every tag consumes memory within the PLC, and most PLC programs are very small, typically less than the size of a high-resolution digital photo.

Some PLCs require the user to designate a section of memory to be retentive, these are tags whose value will be retained in the event of a power cycle to the PLC. This designated memory bank will be taken from the total amount of available memory.

Understanding the memory in a PLC is important for data storage because, unlike a computer datalogger, we cannot simply save a ton of data points over and over to a text or CSV file in the PLC. Logging data locally on an SD card is often an option, but it’s limited in terms of real-time or remote access. In today’s connected world, there are many other options.

 

Part Data Logging in PLC Memory

When an assembly is assembled in an automated machine, data about that assembly is generated, such as the time of creation, serial numbers of parts, part types, pass/fail flags, and any test result data. This data needs to flow through the machine as the assembly enters each station. As the assembly moves through the station, more data is generated and needs to be stored. As more assemblies are created, more data is generated.

As I’m sure you can tell by now, if we don’t flush the data periodically, we will run out of PLC memory. Before we overwrite or destroy data, we need to know if the customer requires us to store or maintain the generated data. Some applications only require data retention while the assembly is in the machine, while other customers will require the data to be offloaded to another system.

 

Tracking Data Within The PLC

If you are only required to keep the data as long as the assembly is in the machine, then you might be able to use the PLC memory to track the data. Most equipment will have a carrier (perhaps a pallet) that moves parts or assemblies from station to station. These carriers often have barcodes or RFID tags on them to identify the carrier or pallet number to the control system.

 

Creating a UDT for data

Creating an array of UDT tags

Moving data between UDTs in an array

Figure 2. A user-defined data type can be created for the part tracking (top), then an array of these UDTs can be created, one for each pallet or assembly. Image used courtesy of the author

 

A common method for internal part tracking is to create a controller-scoped array of part data in a UDT, that array being just as long as the number of pallets. When a pallet enters a station, the pallet number is read and used as a pointer in the part tracking array. The value of the array index is copied to a local tag of the same type. Now the station can work on the assembly and update the data as required. Once the station is complete, the local data is copied back to the array index.

 

Radio frequency ID products

Figure 3. RFID products can track data, but allow the data to remain external to the PLC tags. Image used courtesy of Balluff

 

Another method would be to utilize the RFID tag. These tags can be written multiple times, provided your data is small enough and your throughput is low, all of the data as it is generated can be written to the tag.

As the pallet enters the station, the data is then read from the RFID tag. While this method might seem simple, RFID tags have a finite number of write cycles. So if your throughput is high, you might be replacing tags on a yearly or even monthly basis. RFID tags also have memory restrictions, as the maximum memory grows, so does the size of the tag and the read/write head required.

 

Tracking Data With A Network System

If your data is rather large or the customer requires the data to be stored for an undermined amount of time, you might have to offload the data from the PLC to an edge server. Exporting data from the PLC can be done in a variety of ways.

An OPC UA server is commonly used as most, if not all, PLCs support this protocol. Third-party software can be purchased if your PLC doesn’t support OPC UA natively. Once the data is exposed to the OPC UA server, it can be entered into a relational database.

 

Cabled network router

Figure 4. Networked systems can store large amounts of data externally to the PLC or offsite form the facility. Image used courtesy of Unsplash

 

Some companies might opt for a more DIY method and build a TCP listener. TCP messages are sent from the PLC with the data contained in the payload. The listener is a service that resides on the edge computer and receives the messages, decodes the data, and stores the data in a relational database.

Exporting the data from the PLC can happen when the part is offloaded from the equipment or it can occur after each station. Similar to the array and index method mentioned above, each time the pallet enters the station, data is retrieved from the database. When the station work has been completed, the new data is pushed back to the database.

 

Making The Decision

Deciding how to track part data can sometimes be difficult. If you decide to track within the PLC and the data grows throughout the project, you might be stuck implementing an edge server late into your project.

Try to understand the data collection requirements early in on in the design phase. If there is any testing or if there are multiple parts with serial numbers, you will likely have to track all that data. If integrating an edge server, make sure you have a plan to offload the data to long-term storage. The best method when storing data is to keep it simple, collect only what you need to, and try to reduce the locations where you overwrite data.