A diagram showing the concept of using a Robustel edge gateway to collect data from a Fanuc CNC router via the FOCAS protocol for cloud monitoring.

Step-by-Step: Connecting a Fanuc CNC Router via FOCAS Protocol

Written by: Robert Liao

|

Published on

|

Time to read 6 min

Author: Robert Liao, Technical Support Engineer

Robert Liao is an IoT Technical Support Engineer at Robustel with hands-on experience in industrial networking and edge connectivity. Certified as a Networking Engineer, he specializes in helping customers deploy, configure, and troubleshoot IIoT solutions in real-world environments. In addition to delivering expert training and support, Robert provides tailored solutions based on customer needs—ensuring reliable, scalable, and efficient system performance across a wide range of industrial applications.

Summary

This step-by-step guide details how to connect your Fanuc CNC router and collect data using the powerful but complex Fanuc FOCAS protocol. We'll walk through the network setup, software requirements, and data acquisition logic needed to unlock the rich stream of real-time information available from Fanuc controllers. By leveraging an industrial edge gateway as the integration platform, you can simplify this process and reliably bridge your Fanuc CNC router to your modern monitoring and analytics systems.

Key Takeaways

The Fanuc FOCAS library/protocol is the standard way to access deep operational data from Fanuc CNC controllers over Ethernet.

Successfully implementing Fanuc FOCAS data collection requires careful network setup, the correct library versions, and application logic to make specific API calls.

An industrial edge gateway provides the ideal hardware platform: it offers the necessary Ethernet connectivity, runs the required software (often in a container), and securely bridges the data to IT systems.

Using a gateway with pre-built FOCAS drivers (like Robustel's Edge2Cloud Pro) can dramatically simplify the integration compared to building a custom application from scratch.

You're standing in front of a sophisticated CNC router powered by a Fanuc controller. You know it's a goldmine of data—real-time axis positions, spindle loads, alarm histories, tool offsets—data that could revolutionize your maintenance and efficiency. But how do you get it out? You've heard the term "FOCAS," but it seems complex and daunting.

Let's be clear: Fanuc FOCAS is powerful, and interfacing with it requires a methodical approach. But it's far from impossible, especially when you have the right platform acting as your intermediary. This guide will provide a clear, step-by-step path.


A diagram showing the concept of using a Robustel edge gateway to collect data from a Fanuc CNC router via the FOCAS protocol for cloud monitoring.


What is Fanuc FOCAS?

FOCAS (Fanuc Open CNC API Specifications) is a library provided by Fanuc that allows external applications to communicate with Fanuc CNC controllers over an Ethernet network. It's essentially a dictionary and a set of tools enabling your program to "ask" the CNC specific questions and get detailed answers. You don't just get basic status; you can potentially access hundreds of different data points.

Prerequisites for Connecting Your Fanuc CNC Router

Before you start, ensure you have:

  1. A Fanuc Controller with Ethernet and the FOCAS Option: FOCAS is typically a paid software option that must be enabled on the CNC controller itself. Verify this is active.
  2. Network Connection: An Ethernet cable to connect the CNC controller to your edge gateway.
  3. An Industrial Edge Gateway: A device like the Robustel EG5100 or EG5120 running an open OS (like RobustOS Pro based on Debian) capable of running applications.
  4. FOCAS Library Understanding (or a Driver): You either need access to the Fanuc FOCAS development libraries (usually obtained from Fanuc) to build a custom application, OR you can use an edge gateway software platform that already includes a FOCAS driver, like Robustel's Edge2Cloud Pro, which significantly simplifies the process.

Step-by-Step: Fanuc FOCAS Data Collection via Edge Gateway

Step 1: Establish Network Connectivity

This is the physical foundation.

  • Connect: Plug an Ethernet cable from the Fanuc controller's Ethernet port directly into one of the LAN ports on your Robustel edge gateway.
  • Configure IPs: Assign static IP addresses to both the CNC controller and the edge gateway's LAN port, ensuring they are on the same subnet (e.g., CNC: 192.168.1.10, Gateway LAN: 192.168.1.11).
  • Security Note: This connection should ideally be on an isolated network segment, protected by the gateway's firewall. Do NOT connect the CNC directly to your main corporate network.

Step 2: Set Up the FOCAS Application Environment on the Gateway

The FOCAS communication logic needs to run somewhere. The edge gateway is the ideal place.

  • Option A (Easier - Using Edge2Cloud Pro): If your gateway runs Edge2Cloud Pro, the FOCAS driver is likely pre-integrated. You simply configure the connection parameters (CNC IP address) and select the specific data points you want to read through the platform's graphical interface. Edge2Cloud Pro handles all the low-level FOCAS API calls for you.
  • Option B (Advanced - Custom Application): If building from scratch, you'll need to:
    1. Obtain the FOCAS library files from Fanuc.
    2. Develop your application (e.g., in C++ or using available Python wrappers) on your PC.
    3. Package this application and the required FOCAS libraries into a Docker container.
    4. Deploy this container to run on the EG5100/EG5120's RobustOS Pro environment.

Step 3: Implement Data Acquisition Logic

Your application (either configured in Edge2Cloud Pro or your custom container) needs to periodically make specific FOCAS function calls to read the desired data.

  • Example Function Calls (Conceptual):
    • cnc_rdaxisdata(...) - To read current axis positions.
    • cnc_rdspload(...) - To read the spindle load percentage.
    • cnc_rdalmmsg(...) - To read current alarm messages.
    • cnc_rdparam(...) - To read specific CNC parameters.
  • Polling Strategy: Determine how often you need to read each data point (e.g., axis positions every 100ms, alarms every 1 second).

Step 4: Normalize and Forward the Data

Once the data is successfully read from the CNC router via FOCAS, the edge gateway performs its final critical task.

  • Normalization: It converts the raw FOCAS data into a standardized JSON format.
  • Transmission: It securely sends this JSON payload northbound using MQTT or another standard protocol to your central monitoring platform or database.

Why Use an Edge Gateway for Fanuc FOCAS Data Collection?

The 'aha!' moment is realizing the edge gateway solves multiple problems at once:

  • Provides the Execution Environment: Runs the FOCAS application reliably on the factory floor.
  • Simplifies Integration: Pre-built drivers (like in Edge2Cloud Pro) eliminate complex FOCAS programming.
  • Acts as a Secure Bridge: Isolates the CNC from the IT network and encrypts outbound data.
  • Offers Remote Management: The gateway itself can be managed via RCMS, simplifying deployment and maintenance.

A diagram comparing two software approaches for Fanuc FOCAS data collection on an EG5120: using pre-built drivers or deploying a custom Docker container.


Conclusion: Unlocking the Riches of Your Fanuc CNC Router

Connecting to a Fanuc CNC router using the FOCAS protocol opens up a universe of valuable, real-time data. While the protocol itself can be complex, leveraging a modern industrial edge gateway as the integration platform transforms this challenge into a manageable process. Whether using pre-built drivers or deploying your own containerized application, the edge gateway provides the secure, reliable, and powerful foundation needed to finally unlock the operational intelligence hidden within your Fanuc machines.


An example snippet of standardized JSON data output generated by an edge gateway after collecting and normalizing data from a Fanuc CNC router using FOCAS.


Frequently Asked Questions (FAQ)

Q1: Do I need to buy a license from Fanuc to use FOCAS?

A1: Typically, yes. The FOCAS option needs to be enabled on the CNC controller itself, which is often a purchased software license from Fanuc. You may also need a separate development license if you plan to build your own custom application using their libraries.

Q2: Which Fanuc controllers support FOCAS over Ethernet?

A2: Most modern Fanuc controllers with an Ethernet port support FOCAS (e.g., Series 0i-MODEL D and later, Series 30i/31i/32i). However, the specific data points available can vary by controller model and software version. Always consult the Fanuc documentation for your specific controller.

Q3: Is FOCAS the only way to get data from a Fanuc CNC router?

A3: No, but it is often the most comprehensive. Some newer controllers also support standards like OPC UA. For simpler status monitoring, you might also use basic digital I/O or Modbus if supported. However, for deep, real-time operational data, FOCAS is Fanuc's primary mechanism.