Jump to content

Recommended Posts

My end goal is to send data over ethernet using the TCP/IP protocol to a raspberry pi. I already have the pi coded in python to look for a connection to its ip on a socket that I bound to it.

My problem I believe is within the V570 PLC programming logic itself. I have initialized the card with ip 10.1.10.160 and my laptop with ip 10.1.10.100. Those two communicate correctly over ethernet. My pi is at ip 10.1.10.166. The pi is bound to a socket and currently waiting for something to connect to it on port 8888. I initialized socket 3 on the PLC as a Master on port 20257 and set the name to 'raspberryplc' Like I mentioned, the PLC and PC communicate correctly over ethernet. Lastly I have the TCP/IP config block which is initialized to socket 3 at ip 10.1.10.166 on port 8888. I then use SB142, 146 and 150 to check if I'm ready to attempt a connection, all still good and expected. I get a status 0 from the TCP/IP config block which signifies an all set response. I then have my TCP/IP CONNECT block set to Socket 3 to remote ip 10.1.10.166 on port 8888. At this point SB150 never goes high and I don't establish a connection. I can see something must be happening as when I stop and start the connection attempt on the PLC side, I can see the ethernet lights blinking on the raspberry pi. Thoughts? Either I'm missing something or it's correct but my raspberry pi is messed up.

 

Thank you for any help anyone can offer.

Capture.PNG

Share this post


Link to post
Share on other sites

Socket 3 is configured as a Client and I believe the limit for the pi is that the port must be above 1024 as the first 1024 ports are reserved for system purposes. I tried 20200 anyway and still no luck.

Share this post


Link to post
Share on other sites

Thank you Joe, that was the problem. I ran a test on my raspberry pi and windows laptop to make sure it wasn't my python code being the problem. I managed to connect to the PI and PC over sockets using ethernet IP. I did find out my IP to the PI was wrong though, two different IPs, one for the WI-FI and one for hard wired. By correcting that in the PLC program, it still didn't work, but coupled with the set as server change as you mentioned, it did. Makes no sense really since both are now configured as clients but if it works I really don't care.

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...