Ethernet communication between Jetson Nano and PLC

Hello everyone,
I follow this website and learn too many things. Thank you.

I need to send data from Jetson Nano to PLC. This data is not binary data. It will be any number. I think I can connect Jetson Nano and PLC with ethernet cable, but how I will make them communicate? Is someone here connected and successfully communicate between Jetson Nano and PLC?

Are you able to add your own programs to the PLC? Does the PLC have any kind of predefined network software?

The Jetson side is easy to program using TCP or UDP sockets, and is no different than programming a desktop PC running Linux (and there is an enormous set of examples and tutorials on the internet for this since virtually all versions and distributions of Linux support this in exactly the same way). The real question is what the PLC supports, and we know nothing about this.

PLC have MODBUS TCP communication. I can program PLC. If I can send data to PLC, the rest is easy. I do only image processing and artificial intelligence implementations on Jetson. I don’t know how to send or receive data from other devices. Which settings should I do? What kind of code should I write? I don’t know about these. Is there any tutorial about this?

What language do you code in? I typically stick to C/C++, but there are examples in all languages. More details would help, but if you are interested in reliable communications, then you probably want a TCP programming tutorial in your preferred language. If you have local networks and need low latency but can tolerate some dropped data, then you probably want a UDP tutorial. If there is a standard interface for network data on the PLC, then you might need to combine that with TCP or UDP.

In some cases the program “netcat” (the command “nc”, see “man nc”) can be used over the network just like “cat” can be used with an ordinary text file on a local computer (e.g., “cat /proc/cmdline” to see the boot options…this is just a text file, and “nc” can do this between two computers instead of to the local console…redirects can use that as a program’s data).

Many more details on the nature of the data would be required before being able to make specific suggestions. Details like whether it is binary data might help, if there is a continuous stream of small amounts of data, if it is a lot of data (e.g., a 4k 60Hz monitor’s data for images would be a lot, reading a temperature probe once per second would be tiny; copying files in a batch mode would change how you do this versus continuously streamed data). Maybe information on how critical latency is would help.

I will use Python language. I will do image processing on Jetson nano and send numerical values (e.g. 253, 1653, 50, 154 etc) to PLC. That is all. I do not need communication to be very fast. The speed is not important.

Will I use pins or communicate by ethernet cable?

Thanks for your reply.

Is there an ethernet port on the PLC? If so, then if the PLC has an address assigned, then just connect Jetson and PLC to the same network switch (a router would be used to assign an address to the Jetson, and if the PLC can also use a router to assign an address, then you are all set other than the actual communications).

Network programming is a broad topic, but typically a program will simply name an address/port/protocol, and then do read or write operations. It’s hard to narrow it down since there is so much out there, but Google might show something of interest:
https://www.google.com/search?source=hp&ei=KL7SXdiNJJbL-gSqkorICQ&q=linux+python+network+tutorial&oq=linux+python+network+tutorial&gs_l=psy-ab.3…33i22i29i30l3.856.8413…12389…2.0…0.121.2460.27j4…0…1…gws-wiz…0j0i131j0i22i30j0i22i10i30j0i8i13i30.JWnAXoB3j-c&ved=0ahUKEwjYwdvwjvTlAhWWpZ4KHSqJApkQ4dUDCAc&uact=5

If in doubt, and if the PLC supports TCP, start with that.

Yes, PLC has an ethernet port. I wanted to learn that if it is enough to connect Jetson and PLC through ethernet ports. I will start according to your suggestion. Thank you very much.

@mubarstugan , how did you solve this problem… I also need to get numbers from my Jetson Nano to a Siemens PLC by ethernet. Can you please help me? Thanks a lot

@mattijsk14
PLC - Python Seri ve MODBUS TCP HaberleĹźmesi.pdf (1.1 MB)

In the PDF, there is three different communication examples:
1- Jetson Nano - PLC via serial communication
2- Python (computer) - PLC via MODBUS TCP/IP
3- Python (computer) - HMI via MODBUS TCP/IP

The second example will run on Jetson Nano also, if you change the Nano’s IP address as 192.168.3.50 for example. PLC is 192.168.3.255. The “3” needs to be same.

Please read the PDF, it is in Turkish unfortunately, but if you have questions you can ask me.

1 Like