Introduction
In my last post I demonstrated how to use MCP to give Gemini access to exported PLC programs and let it analyze and explain how complex PLC program works. This post moves the topic a bit forward by using Snap 7 to grant live data access to Gemini.
Here we go.
What is Snap 7
Snap7 is an open-source, multi-platform Ethernet communication suite designed to interface natively with Siemens S7 PLCs. For more information about Snap 7, you can access the Snap 7 website.
In my application, I am using the Python ported library python-snap7.
S7 Communication Limitations
Legacy Communication with High Cyber Security Risks
S7 communication is a legacy communication protocol that has been there for decades and started when the world of Cyber Security was very different.
Multiple US federal agencies including the NSA, CISA, the FBI, the DOE, and the EPA—issued joint advisory AA26-231A warning of active cyber threats and reconnaissance targeting internet-exposed S7 controllers and their main concerns are about the S7 communication.
However, for years SIEMENS has advised users to avoid exposing S7 communication to the Internet. All we should do is cautiously use it and choose safer alternative if available.
My post is purely technical and not advising anyone to do the same in their systems.
Existing TIA Portal Safety Restrictions
SIEMENS is well aware of the S7 communication Cyber Security risks and as of TIA Portal V19 and CPU firmware V3.1 (V4.7 for S7-1200), S7-1500 and S7-1200 CPUs have improved management of users, roles and CPU function rights. This requires advanced configuration for PUT/GET access.
If the “Permit access with PUT/GET communication from remote partner” option is greyed out in your TIA Portal, you can enable it by follow the SIEMENS instructions.

The Demonstration
How Does It Work
In short, on top of the application that I made last, week, I added a tool for Gemini to access the live PLC data in any non-optimized DB in the PLC that is accessible from the laptop that run the tool.
Demo
As shown below. I asked Gemini to access the PLC DB and grab a tag value for me. Gemini used the tool and correctly understood the Snap 7 error response saying that I had provided the wrong DB number, which I did.
Then I gave the correct DB number to Gemini and it instantly recovered the correct DB value and gave it back to me.

Conclusion
I see great potential to use AI to analyze and troubleshoot control systems issues and it can be way more than just in the SIEMENS world. Like it or not, AI is going to do the control engineers’ job in the very near future.