Jump to content

communication b/w PLc V1040 and raspberry pi


Recommended Posts

 i so far finished my ladder programming in unitronics V1040 plc and created a webpage to use in raspberry pi to view the same HMI screen in my webpage at the same time whatever output i get from the Plc HMI. now i hv the problem is, how can i communicate plc and raspberry pi.can i connect the i/o and o/p of both plc and raspberry pi . is any coding ive to write in the raspberry pi terminal for the communicate with plc. please advice me. 

Link to comment
Share on other sites

Hi,

Do you wish to communicate between the Raspberry and the V1040 using communication (TCP) or IO?

If you wish to use communication you can use FB protocol IP (structure your messages ) or TCP_RAW Send & Receive.

In case you wish to use IO let me know the IO specification of the Raspberry.

  • Upvote 1
Link to comment
Share on other sites

Hi;

I have interfaced a V1040 into a couple of Pi's.

I used the TCP-RAW Method  and it worked well. Sent Integer data between them to trigger the Pi Camera.

Used Python 3  for all the programming. Took a bit of research  and trial and error to get it going as some information out there is a bit incomplete or misleading.

Also  used the MODBUS TCP method - there is a Python  based Modbus program out there. It works well.  I has more flexibility in some ways..

I will get the code  for both methods and post it in a day or so. 

Current project is connecting a Pi to a  Blind(display dead) Lego NXT via USB - working, needs cleanup.

Aim is to get it all working together ( Vision, Pi, NXT, and a PIFace Digital I/O interface.)

 

Dan

.

 

  • Upvote 2
Link to comment
Share on other sites

On 5/16/2017 at 0:45 AM, Ofir said:

Hi,

Do you wish to communicate between the Raspberry and the V1040 using communication (TCP) or IO?

If you wish to use communication you can use FB protocol IP (structure your messages ) or TCP_RAW Send & Receive.

In case you wish to use IO let me know the IO specification of the Raspberry.

im going to use modbus. plc as slave and raspberry as master bec plc is going to send the its output to raspberry pi.  ive attached my program. can you please check wether modbus ive included in ladder program is correct or not. can anybody help me in the raspberry pi as well. any help to write the coding to receive the hmi output in raspberry pi.

modbus car spray1.vlp

Link to comment
Share on other sites

  • MVP 2023

First off, use COM Port 2 for Modbus unless you have no other choice.  Port 1 is used for programming and OS updates - the PLC will stomp on your communication code if you need to log in while the program is running.

You want to use the SCAN_EX block in new applications.  The SCAN blocks are for legacy support.  

Be sure to read the Help on "Slave Address Tables" to see how Unitronics maps Modbus addresses.

I modified your code a bit to show good programming practices.  You had several logical statements in one net in several locations, which is generally a no-no.  Look at what I've done and you'll understand.  Additional nets cost nothing, but having too much going on in one network can cause unexpected behavior because of the compiler.

I found this on the web for the Pi side:

https://www.cooking-hacks.com/documentation/tutorials/modbus-module-shield-tutorial-for-arduino-raspberry-pi-intel-galileo/

Joe T.

 

modbus car spray1 JT.vlp

  • Upvote 1
Link to comment
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...