Case study of a custom electrical and software control system design and build for the US Naval Research Laboratory.
Introduction
The Naval Research Laboratory reached out to me through our website after hearing about the TcMatrix library, which they thought was very relevant to the work in their group’s lab. They have been developing a 6-DOF stewart-platform style material testing system for over a decade, and they were ready to move it out of the lab and make it a standalone industrial controlled machine for other departments to use.
After a quick introductory call to see if we were a good fit, we met up a second time to go over the details of what they needed delivered:
- A control box to provide:
- Power, enable, and analog signaling (-10V to 10V control and feedback) to each of the 6 parker hydraulic servo valves
- Read the status of 6 independent high resolution BISS-C renishaw encoders
- Read the loads on an existing 6-Axis loadcell through an ethercat amplifier
- Replace the manual pendant controls for the hydraulic grippers
- Panel mounted connectors for all devices and facility connections
- Significant room for expansion as this is a prototype project
- A TwinCAT Software library to provide high level control of the machine to their own custom TwinCAT software
- An example TwinCAT project implementing the library with a commissioning and testing HMI
The project was scoped into two fixed-price phases:
- Phase I: Delivering a complete electrical schematic and BoM, along with a software interface document
- Quoted as 62 Hours, mostly electrical design
- Phase II: Delivering an assembled electrical control box with corresponding software library and commissioning project
- Quoted as 72 hours, mostly software development and electrical build
Electrical Design
The electrical design for this project was very straightforward. It uses standard 120V wall power through a NEMA L5-15R and a rotary disconnect. There is a hefty embedded IPC (CX2043) per the customer’s request and a single line of Beckhoff IO managing all of the peripherals. Fortunately, all safety is handled through an external circuit connected to the hydraulic pump so the PLC is only responsible for reporting the status of the ESTOP circuit back to the operator for diagnostic purposes.
The trickiest part of the electrical design was handling the 10V analog control and feedback signals to the hydraulic valves with the minimum amount of signal distortion. The first issue was that the 10V output signal from the Beckhoff EL4134 draws its power from the EBUS voltage and not the peripheral voltage, so I needed to isolate the analog cards from any noisy power sources (like the shared CPU power source on the CX2100 at the beginning of the IO rack). In the end this just means a few extra cheap EL9410s than you might normally use on a build this size.
The parker D1FP valves use a 7 pin MIL spec (5015) connector and the customer wanted to keep that connector on the control cabinet as well. Pre-made panel mount cordsets for that connector style in the manufacturer required 16AWG conductor size were basically impossible to find, but Mencom agreed to make them (without shielding). This meant that I would be responsible for building the braided shield around the purchased cordset later on, but at least I would get a lot of control over the grounding pathway.

Everything else was fairly routine. While the customer supplied some components themselves (load cell amplifier, Beckhoff parts they had previously purchased) I was able to source the rest of the parts (terminals, breakers, connectors) mostly from Phoenix Contact. Some connectors and other parts came from whatever was in stock at Mouser, Digikey, and Automation Direct in order to keep the project moving quickly.
With some final feedback from the customer on things like plug naming and cabinet mounting options the schematic was approved and released. I partnered with Joe’s Controls for electrical design and drawing review. Fortunately, because this is a public non-controlled project I can share the full schematic here. This project was created in SkyCAD Professional, with the main benefit being that the customer can make small modifications in the future with the free version of SkyCAD Electrical.
Control Cabinet Build
There are a lot of connectors in this build so I broke out the connectors into a few groups and gave them each a dedicated breakout panel. I was able to quickly cut and mark the holes on the router and laser cutter while waiting for the parts to start arriving.

The backplane layout was very straightforward: 3 rows of DIN rail with a loop of wire ducting around the center. The AC was all contained in the lower right corner of the panel which helped reduce noise on the sensitive analog signals in the upper left. The IO cards for the servo valves are located directly over terminals for their power, allowing the shield to stretch the entire length of the cable in the ducting.

The ducting got a lot more cramped once the shielding and cable wrap was added to the six servo valve cables coming in on the left.

After putting the covers, door, feet on it was ready for checkouts! The final enclosure shipped LTL freight along with a few boxes of spare parts.
Software Development
The core software deliverable was a TwinCAT library project that facilitates the cyclic control of the hydraulic servo valves based primarily on the encoder and loadcell feedback. A few classes (FB’s) in a basic hierarchy ended up being a good way to represent the entire system:
- System : The FB to control the entire system, with simple indicator devices for the operator
- Platform : The physical platform that is moving and its feedback
- Loadcell Channel (x6) : Six axis loadcell, broken into 6 channels
- Actuator (x6) : Encoder and Hydraulic Servo devices
- Gripper : The hydraulic gripper system that mounts the materials being tested
- Platform : The physical platform that is moving and its feedback
The interfaces of these FB’s were mocked for the Phase I software architecture deliverable and went basically unchanged into the Phase II software design deliverable. I used the built in TwinCAT code-based documentation to provide live documentation during library implementation as well as exported PDF documentation for the deliverables.

There was no real control loop in this project – the interfacing application from the customer is responsible for closing the loop using their own proprietary software. This library is merely responsible for translating and collating data between integer representations of engineering units and integer representations of output units. Again, because this was a public non-controlled government project I am free to share the code in its entirety as a reference in this tszip archive file.
The example commissioning project highlights just how simple the library System FB is. The project is merely a GVL with an Inputs struct, Outputs struct, and System FB allocated while the main program is a cyclic call to the System FB. The device tree includes named components to match the schematic and all relevant IO is mapped to either the Inputs or Outputs struct in the GVL. I used the old TwinCAT PLC HMI product to create a very simple winforms-like interaction with the sensors and actuators of the control system.

We were able to use this HMI to validate the full system (hydraulics, cables, etc) one day on-site in the Naval Research Lab offices in Washington DC.
Future Work
The Naval Research Lab is tasked with doing long term basic research to serve the needs of the Navy in a 10-30 year horizon; in this case by advancing the state of the art for material testing. They are hopeful that the program will expand to include multiple 6-DOF test systems working together on full-sized test vehicle structures and I hope to remain involved as the program continues to evolve from laboratory to production environments.
I enjoyed working with the extremely smart folks at the Naval Research Lab and appreciate how open minded they were to moving beyond laboratory style electronics towards real industrial control systems. While I joined the project too late to impact some of the mechanical and hydraulics system choices, I was able to make it clear to the team that the most impactful change they could make would be to move away from analog control of the hydraulics and use the modern, direct EtherCAT controlled versions of the same valve. This would cut the size and assembly time of the control cabinet in half, completely eliminating the biggest risk point in the control system.

