# FANUC FOCAS to OPC UA

> Give every FANUC CNC an OPC UA address space: PLCGateway reads the control over FOCAS Ethernet and serves status, spindle, alarm and program data from its own OPC UA server.

Most MES, SCADA and historian products expect OPC UA, while FANUC controls offer FOCAS. PLCGateway bridges the two: the FOCAS driver reads the control directly on port 8193, and each value becomes a variable in the gateway's OPC UA server that clients browse, read and subscribe to.

This also works for controls without FANUC's own OPC UA server option, such as Series 0i-D or 16i/18i/21i with an Ethernet board, and all machines of the shop appear under one endpoint with the same structure.

- **Source:** [FANUC FOCAS](https://plcgateway.com/protocols/fanuc-focas.md) (`focas`)
- **Connection:** FOCAS Ethernet · TCP 8193
- **Target:** [OPC UA](https://plcgateway.com/connect.md)
- **Writing:** yes
- **Included in:** PLCGateway Connect, PLCGateway SCADA, PLCGateway Embedded

## Set it up in five steps

1. Enable the embedded Ethernet port of the CNC and FOCAS (port 8193) in the Ethernet settings of the control.
2. Add a FOCAS device with the IP address of the CNC.
3. Create the tags (status, positions, spindle, alarms, macros) or let an AI assistant create a standard machine set.
4. Open Gateway → OPC UA and choose the security modes and whether clients sign in anonymously or with user name and password.
5. Connect your OPC UA client (UaExpert, an MES, a SCADA) to opc.tcp://<gateway>:4840 and browse Objects → PLCGateway.

## Example: node ids in the OPC UA server

A device with the id cnc1 and these tags appears in the address space as shown below. Names and values are examples.

| Tag | Address | Example value |
|---|---|---|
| `Running` | `status.running` | true |
| `SpindleSpeed` | `spindle.speed` | 8000 rpm |
| `SpindleLoad` | `spindle.load` | 42 % |
| `Program` | `prog.main` | 1234 |
| `AlarmActive` | `alarm.has` | false |

**OPC UA node ids**

```
opc.tcp://<gateway>:4840
Objects / PLCGateway / cnc1
ns=1;s=cnc1.Running       = true
ns=1;s=cnc1.SpindleSpeed  = 8000
ns=1;s=cnc1.SpindleLoad   = 42
ns=1;s=cnc1.Program       = 1234
ns=1;s=cnc1.AlarmActive   = false
```

Every tag is a variable under Objects / PLCGateway / device in namespace 1; clients read it, write it and subscribe to its changes.

## The OPC UA server in PLCGateway

Every tag becomes a variable in PLCGateway's built-in OPC UA server, so MES, ERP, SCADA and historians use one standard endpoint instead of each controller's own protocol. Clients browse the devices and tags, read, write and subscribe to value changes.

The server offers the security modes None, Sign and SignAndEncrypt with automatically generated certificates; clients sign in anonymously or with user name and password.

- One endpoint (opc.tcp, port 4840) for all devices and protocols
- A folder per device and a variable per tag, with description and unit
- Subscriptions with data-change notifications; writing only where the tag allows it
- Client certificates are approved in the web interface

![OPC UA server settings: endpoint, security policies and users](https://plcgateway.com/assets/img/shots/opcua-1600.webp)

## Controllers and devices

- [FANUC FOCAS](https://plcgateway.com/protocols/fanuc-focas.md)
- [FANUC CNC](https://plcgateway.com/controllers/fanuc.md)

## Questions and answers

### Does the CNC need the FANUC OPC UA server option?

No. PLCGateway reads the control over FOCAS and provides the OPC UA server itself. Controls that do have the option can be connected with the OPC UA client driver instead.

### What do the nodes look like?

Each CNC is a folder under Objects / PLCGateway and each tag a variable with the node id ns=1;s=<device>.<tag>, for example ns=1;s=cnc1.SpindleLoad, with its description and unit.

### Can OPC UA clients write to the CNC?

Macro variables can be written when writing is allowed in the OPC UA server settings; all other FOCAS values are read only.

## Related solutions

- [FANUC FOCAS to MQTT](https://plcgateway.com/solutions/fanuc-focas-to-mqtt.md)
- [CNC OEE with FANUC FOCAS](https://plcgateway.com/solutions/fanuc-focas-oee.md)
- [Haas CNC to OPC UA](https://plcgateway.com/solutions/haas-to-opc-ua.md)
- [MTConnect to OPC UA](https://plcgateway.com/solutions/mtconnect-to-opc-ua.md)
- [Siemens S7 to OPC UA](https://plcgateway.com/solutions/siemens-s7-to-opc-ua.md)
- [Modbus to OPC UA](https://plcgateway.com/solutions/modbus-to-opc-ua.md)
- [All protocols](https://plcgateway.com/protocols.md)

_Product and model names are trademarks of their owners. They are named only to show which equipment the drivers communicate with; PLCGateway is not affiliated with these companies._

---
Source: https://plcgateway.com/solutions/fanuc-focas-to-opc-ua
