Tag Archives: iot

Bringing PLC values to OPC UA, MQTT, GraphQL

With just some lines of configuration you can bring PLC values to OPC UA, MQTT and GraphQL. And to a variety of databases for tag logging…

πŸ’‘ In that example with ModBus, but thanks to #plc4x this should work in the same way also for the other protocols supported by PLC4X.

πŸ“Ί See the video, ModBus values are brought to OPC UA and MQTT.

πŸ’£ In MQTT the topic name is enriched with a UNS ISA95 topic path.

⚑ On MQTT SparkplugB encoded messages could be used.

😎 100% GUI free and Open Source.

πŸ‘‰ automation-gateway.com

Servers:
  GraphQL:
    - Port: 4000
      LogLevel: INFO
      GraphiQL: true

  OpcUa:
    - Port: 4841
      Enabled: true
      LogLevel: INFO      
      Topics:
        - Topic: plc/demo/node/holding-register:1:INT
        - Topic: plc/demo/node/holding-register:2:INT
        - Topic: plc/demo/node/holding-register:3:INT
Drivers:
  Plc4x:
    - Id: "demo"
      Enabled: true
      Url: "modbus://localhost:502"
      Polling:
        Time: 100
        OldNew: true
      WriteTimeout: 100
      ReadTimeout: 100
      LogLevel: INFO    

Loggers:
  Mqtt:
    - Id: mqtt1
      Enabled: true
      Host: 192.168.1.4
      Port: 1883
      Topic: modbus
      Format: Raw
      Logging:
        - Topic: plc/demo/node/holding-register:1:INT
          Target: enterprise/area1/line1/cell1/speed
        - Topic: plc/demo/node/holding-register:2:INT
          Target: enterprise/area1/line1/cell1/power
        - Topic: plc/demo/node/holding-register:3:INT
          Target: enterprise/area1/line1/cell1/torque

SparkplugB for Unity3D

Unlock the potential of industrial data from SparkplugB enabled devices, seamlessly integrated into Unity3D to build 3D applications?

Or start creating industry Apps for Apple’s Vision Pro with SparkplugB connectivity? πŸ•ΆοΈ

πŸ’‘ I completed a SparkplugB πŸš€ implementation for Unity. The primary objective was to acquire a hands-on understanding of SparkplugB.

πŸ‘‰ You can find it for free on GitHub It’s made on top of the “MQTT for Unity” Asset.

Disclaimer: There is no assurance that I have captured all the rules within the extensive 140-page SparkplugB specification. While Unity supports visionOS, I have not conducted testing on this platform.

MQTT for Gaming?

MQTT for Multiplayer Games? I am not a Game-Developer and I do not know how they create multiplayer internet games. But I know that MQTT can be used for that. Why?

# IoT turns to IoP

MQTT is used for connecting devices. Think about using MQTT for connecting players. “Internet of Things” (IoT) will turn to β€žInternet of Playersβ€œ (IoP).

# A Player is like a Device?

In a multiplayer game, each player is like a device. When they join the game, it’s like they’re saying “Hello, I’m here!” to everyone else – this is known as a “birth message” in MQTT terms.

# Sharing Information Seamlessly

As players move around in the game, they keep sending updates like their location, healthy state, collected goodies, …. MQTT acts like a messenger, picking up this information and delivering it to everyone else playing. 

# Handling Player Exits

What if a player leaves the game intentionally or unintentionally? MQTT has a smart feature called “last will message.” It’s like a goodbye note that tells other players someone has left the game. This way, everyone stays in the loop.

# Central Management 

A central game management connected to the central MQTT broker, written in any kind of language, could be used to observe and control the game and all the players.

# Why MQTT?

1. **Real-Time Updates**: It’s fast and perfect for real-time games.

2. **Reliable**: Even if a player’s connection is shaky, MQTT makes sure messages get through.

3. **Efficient**: It doesn’t eat up much data, so players won’t lag.

4. **Simple**: It’s not complicated to set up and to use.

# Conclusion

Using MQTT in multiplayer games is like having a super-efficient mailman who ensures everyone knows what’s happening as it happens.

For Unity there is a β€žUnity for MQTTβ€œ and a β€œGraphQL for Unity Pro” asset. Easy to use and usable with all the main build targets, including WebGL!

See the game demo I made with MQTT.. I also integrated data from WinCC Unified in the demo, with the GraphQL for Unity Pro Asset.

You can try it out: https://server.rocworks.at/unity/game/ (could be already removed when you try to access it)