*As Featured on NI.com
Original Authors: Christopher Farmer, Wired-in Software Pty Ltd
Edited by Cyth Systems
Laser Etching using an NI CompactRIO controller.
Develop a reliable, embedded, high-speed laser engraving control and positioning subsystem within eight weeks.
Develop, integrate, and test the application using CompactRIO hardware and the LabVIEW Real-Time and LabVIEW FPGA modules to control the output signals with transition times between 100 ns and 10 us.
Manufacturing processes include critical components to be tightly synchronized within the 100 ns to 10 us range. In the case of laser engravers, timing, and positioning is controlled within the manufacturing system and is a critical part of the process. The customer in question has had a previous solution based on custom hardware; however, this has become outdated and can no longer be serviced and maintained. Being a crucial part of their system failure will lead to great risk to production.
We designed and developed the high-speed laser engraver control subsystem based on CompactRIO technology. It produces patterns of analogue and digital output signals, all within tight transition times (of 100 ns and 10 us). We rapidly developed this reliable and expandable solution in eight weeks. Because we used the CompactRIO platform, the solution was purely a software development effort—no custom hardware was required. This resulted in a much faster solution than if a custom electronic solution had been developed.
This embedded system application consists of a single controller running in a headless configuration. We designed it to run 24/7 without any user interaction. The PROFINET slave receives commands from a PROFINET master. The controller transmits its status back to the master and returns a fault if the received parameters are invalid, or if an issue is present (such as input is missing or nonresponsive). On receiving a trigger signal (via a digital input), the encoder counter (via digital inputs) is reset. A sequence of control events is derived from the PROFINET parameters. It is used to position both the motor (via an analog output) and enable the laser (via a digital output) at specific encoder counts and must carry out each change within less than 0.1 ms. The sequence is restarted upon every trigger received.
Left: Remote Panel Access to RT_Main.vi, Right: Trace from a Tektronix Oscilloscope
The software involves both the LabVIEW Real-Time and LabVIEW FPGA modules, which ensure deterministic code for this application with strict timing requirements. The control algorithm, written with LabVIEW FPGA, runs on the FPGA inside the CompactRIO system. The FPGA code has a state machine architecture within a Single Cycle Timed Loop. The control system has two modes of operation: auto and manual. During auto mode, the FPGA controls the motor position and laser signals based on the combination of encoder counts, trigger signal, and PROFINET parameters. The PROFINET parameters sent by the master can be changed dynamically, which the FPGA code can read at the start of each trigger. In manual mode, the received PROFINET parameters can change only the position of the motor.
The real-time code is used for setting up the simulation and provides remote panel access for diagnostic purposes only. The real-time panel can be easily viewed through a web browser.
CompactRIO During Development
During development (with the system offline and disconnected from the PROFINET master, encoder, and trigger), the PROFINET parameters were simulated in the real-time front panel. This allowed us to test the conversion of 128-byte numeric arrays into meaningful parameters.
The FPGA code has some simulation functions that can be turned on/off from the real-time panel. With the existing I/O available, we connected wires in a loopback type configuration (that is, wire some digital outputs straight back into digital inputs for the encoder and trigger signals). Then, within the FPGA software, we can generate encoder and trigger pulses to stimulate the system inputs.
We developed an independent LabVIEW application to take readings from a Tektronix 1 GS/s oscilloscope to verify the system operation (that is, check the timing of the trigger, encoder, motion, and laser). Using the Tektronix device drivers downloadable from ni.com, it was simple to assemble an application for test data acquisition that didn’t disrupt the core application development. We saved the files in TDM Streaming file format, allowing for post-analysis in another independent LabVIEW application.
We based the system on cRIO-9035 to meet the following requirements:
6 C Series slots (PROFINET slave requires an empty slot beside it
Ample FPGA resources
High-speed timing requirements—need to act within 0.1 ms or less
Configurable I/O simplifies hardware design
CompactRIO Controller and Chassis
CompactRIO PROFINET Slave Module
Receives commands from the PROFINET master
Reads the encoder pulses
Controls the motor
Receives the trigger signal
Enables the laser
The LabVIEW graphical dataflow programming environment makes the development process easier and faster. With the add-on toolkits and modules, such as LabVIEW FPGA and LabVIEW Real-Time, we can use LabVIEW for domain-specific industrial applications.
The client’s system to be replaced was a custom-designed embedded PC-based solution that is no longer supported. After an extensive search, CompactRIO was the only off-the-shelf solution that did not require custom hardware to meet the system requirements. LabVIEW FPGA is easy to develop, and abundant resources are available to fast-track development (such as the CompactRIO Developer’s Guide, and online real-time and FPGA training for valid subscriptions), and thus enabling us to meet the timeline.
By adopting an NI software and hardware solution, we designed and built a high-speed control subsystem using LabVIEW Real-Time and LabVIEW FPGA within a tight timeline. The PROFINET controller gave us a sophisticated interface to the factory’s distributed control system. The spare I/O was leveraged to be used as simulation outputs. The FPGA code’s deterministic nature ensures that every encoder pulse change was captured. CompactRIO is a reliable and robust solution for the application, which is required to run continuously for extended periods of time.