How to Collect Data from CNC Machines: Fanuc, Siemens, and Mazak
Last updated: June 2026 · 11 min read
Your CNC Machine Is a Gold Mine of Data
Every CNC machine on your shop floor knows exactly what it's doing — spindle speed, axis positions, feed rate, tool life, alarm status, part count, cycle time. This data is sitting inside the controller, waiting to be extracted. The question is: how do you get it out?
The answer depends on which CNC controller you have. This guide covers the three most common controllers in mid-size factories: Fanuc, Siemens SINUMERIK, and Mazak, plus a universal approach for everything else.
Fanuc CNC: FOCAS Protocol
Fanuc is the world's most popular CNC controller, installed on millions of machines. Most modern Fanuc controllers (16i, 18i, 21i, 30i, 31i, 32i, 0i-D, 0i-F series) support FOCAS (Fanuc Open CNC API Specifications) — a built-in Ethernet communication library.
What You Can Read via FOCAS
- Machine status — Running, stopped, alarm, emergency stop
- Axis positions — All axes (X, Y, Z, etc.) in real-time
- Spindle data — Speed, load, temperature
- Program info — Current program number, sequence number, block count
- Tool data — Tool life, tool number, wear offsets
- Alarm history — Alarm codes, timestamps, severity
- Production data — Part count, cycle time, power-on time
- PMC data — Internal ladder logic signals (custom data)
How to Enable FOCAS
Common Gotchas
- FOCAS requires a wired Ethernet connection — WiFi is not reliable enough for real-time data
- Some older controllers need a PCMCIA Ethernet card (Fanuc Option C720 or similar)
- FOCAS is read-only by default — writing to the CNC requires additional safety considerations
- Polling rate should be 100ms to 1 second — faster polling can slow down the CNC's internal processing
Siemens SINUMERIK: OPC UA Native
Siemens took a different approach. SINUMERIK 840D sl and ONE controllers have OPC UA built in — no extra hardware or licenses needed for basic data access.
What You Can Read via OPC UA
- NC variables — Axis positions, spindle speed, feed override, program number
- Machine data — All MD parameters (hundreds of data points)
- PLC variables — Any signal from the integrated SIMATIC S7 PLC
- Drive data — Servo load, temperature, status (via DRIVE-CLiQ)
- Alarm system — Active alarms, alarm history, diagnostic messages
- Tool management — Tool list, tool life, wear data
How to Enable OPC UA on SINUMERIK
Advantages over Fanuc
- No additional license cost — OPC UA is included in the base SINUMERIK package
- Standard protocol — works with any OPC UA client, not just vendor-specific software
- Rich data model — data is self-describing with names, types, and units
- Built-in security — authentication, encryption, and audit logging
Mazak: MTConnect + Smooth API
Mazak CNC machines support MTConnect — an open, royalty-free protocol specifically designed for manufacturing data collection.
How MTConnect Works
MTConnect uses HTTP/XML. A small agent (software) runs on the CNC or a connected PC, exposing machine data as a structured XML stream. Any system can request data by sending HTTP GET requests to the agent.
What You Can Read
- Execution state (running, idle, stopped)
- Spindle speed, feed rate, axis positions
- Program name and line number
- Part count and cycle time
- Alarm and event messages
Enabling MTConnect
Newer Mazak machines (SmoothX, SmoothG controllers) come with MTConnect agent pre-installed. For older machines, you may need to install the Mazak MTConnect adapter on a connected PC. The adapter communicates with the CNC via Mazak's proprietary protocol and exposes data via MTConnect.
Universal Approach: For Any CNC Controller
What if your CNC doesn't support FOCAS, OPC UA, or MTConnect? You still have options:
Option 1: Macro B Output
Many CNC controllers support custom macro programming. You can write a macro that outputs data (part count, cycle time, alarm codes) to a serial port or Ethernet socket at the end of each cycle. This works on virtually any CNC with macro capability.
Option 2: I/O Monitoring
Every CNC has digital I/O signals — machine ready, cycle start, cycle end, alarm. You can tap into these signals with a simple digital input module connected to a gateway. This gives you basic status monitoring without touching the CNC software.
Option 3: Current Sensing
A current transformer (CT) clamp on the spindle motor power cable can tell you when the machine is cutting, idle, or off. This is the least invasive method — no electrical connection to the CNC at all.
Choosing the Right Approach
| Controller | Best Method | Data Richness | Setup Difficulty |
|---|---|---|---|
| Fanuc 0i/16i/18i/30i | FOCAS | ⭐⭐⭐⭐⭐ | ⭐⭐ |
| Siemens SINUMERIK | OPC UA | ⭐⭐⭐⭐⭐ | ⭐⭐ |
| Mazak SmoothX/G | MTConnect | ⭐⭐⭐⭐ | ⭐ |
| Any CNC (basic monitoring) | I/O + Current | ⭐⭐ | ⭐ |
| Any CNC (full monitoring) | Macro B Output | ⭐⭐⭐ | ⭐⭐⭐ |
Related Articles
- How to Connect Old Siemens PLCs to Modern Networks (No Hardware Replacement)
- The Hidden Cost of Manual Data Collection in Manufacturing
- Factory Digital Transformation on a Budget: A Practical Roadmap for SMEs
FAQ
- Q: Will data collection slow down my CNC?
- No, if done correctly. FOCAS, OPC UA, and MTConnect are designed for background data extraction. Polling rates of 500ms-1s have zero impact on CNC performance. Avoid polling faster than 100ms.
- Q: My Fanuc doesn't have FOCAS enabled. What do I do?
- Contact your machine builder (OEM) to purchase the FOCAS option. Alternatively, use the I/O monitoring approach for basic status, or the Macro B approach for cycle data.
- Q: Can I collect data from multiple CNC machines with one gateway?
- Yes. A single edge gateway can typically connect to 10-50 CNC machines over Ethernet, depending on the data polling rate and number of data points per machine.
- Q: Do I need to stop production to install data collection?
- For Ethernet-based methods (FOCAS, OPC UA, MTConnect): no downtime needed. For I/O monitoring: a brief stop (10-15 minutes) to install current sensors or tap into digital signals.
- Q: What about Heidenhain, Mitsubishi, or Haas controllers?
- Heidenhain supports DNC/DCI protocol. Mitsubishi supports MELSEC communication. Haas supports MTConnect (newer models) or serial output. Each has its own approach — contact us with your specific controller model for detailed guidance.