Contents
- Introduction.
- Componentes and configuration.
- Install.
- Extracting variables in javascript.
- Writing Variables in javascript.
- Download.
Introduction.
The server node address must be assigned automatically
Componentes and configuration.
Informations Raspberry piLinux 4.4.50-v7+ #970 SMP Mon Feb 20 19:18:29 GMT 2017 armv7l GNU/Linux
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 8.0 (jessie)
Release: 8.0
Codename: jessie
Informations Orange pi zero
Linux 4.11.3-sun8i #8 SMP Tue Jun 13 14:17:33 CEST 2017 armv7l GNU/Linux
Distributor ID: Debian
Description: Debian GNU/Linux 8.7 (jessie)
Release: 8.7
Codename: jessie
Install
Packages to install:sudo apt-get install libssl-dev
sudo apt-get install libcurl4-openssl-dev
Application:
- Copy the folder comFinsOmron in your raspberry.
- Go to the folder comFinsOmron.
- Open the file requests.txt and configure your reading requests
- Run the command: sudo ./comOmron "IpServerPLC" portPLC portWS. where:
IpServerPLC is the ip address of your PLC
portPLC is the port of the server PLC (9600)
port WS is the websocket port
sudo ./comOmron "192.168.2.53" 9600 1900
The application read 20 words at the address DM0 each 175ms and 20 words at the address DM100 each 250ms
The port websocket (portWS) must be opened in your firewall.
- Copy the folder webOmronWS in your websites folder (/var/www/html).
- Open the file websocket.js and put the ip address of your raspberry(line 98) .
- In your browser, go to the address http://localhost/webOmronWS/index.html
- Change the name of the file certSecure.pem in cert.pem.
- Change the name of the file keySecure.pem in key.pem.
- Open the file websocket.js and change "ws://ipRaspberryPi/" in "wss://ipRaspberryPi/" (line 98) (ipRaspberryPi is the ip address of your raspberry)
- In your browser, go to the address https://ipRaspberryPi:portWS
- Clic on exception and accept
- In your browser, go to the address https://localhost/webOmronWS/index.html To test the example, you need an Internet access.
Extracting variables in javascript.
The function "processFrameReceived(frame)" in the file "websocket.js" extract all the variables read from the PLC.Writing Variables in javascript.
WINT16, memory area, address, value (to write an integer 16 bits INT, UINT)Sending the string “WINT16,DM,8,32294” write 32294 at the address DM8
WINT32, memory area, address, value (to write an integer 32 bits DINT, DUINT)
WFLOAT32, memory area, address, value (to write a float 32 bits FLOAT)
Sending the command "WFLOAT32,DM,5,147.25" write 147,5 at the address DM5(2 words)
WCOIL, memory area, word address , num bit, value (to write an relay 1 bit)
Sending the string “WCOIL,CIO,101,3,0” write 0 in the output 101,3
Sending the string “WCOIL,DM,10,12,1” write 1 in the bit 12 of the word DM10
Each command is returned by the server
Download.
You can download the zip file at DownloadMore...
You can see more at this linkSee also this blog Modbus RTU to Pusher server


hello,
ReplyDeletei installed the raspbian stretch and got the following error after the command sudo ./comOmron "192.168.168.1" 9600 1900 : /lib/ld-linux-armhf.so.3: No such file or directory.
The file requests.txt is missing too.
Can you help me with that?
thanks!
Hello,
DeleteTry to download the new version at https://phlag.info/download/Omron/OmronComTcpFins.zip
In this compressed file, I created a folder "comFinsOmronRaspberryStretch". You can find in the new files . I hope it works.
I tested it with:
Linux raspberrypi 4.9.59-v7+ #1047 SMP Sun Oct 29 12:19:23 GMT 2017 armv7l GNU/Linux
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 9.3 (stretch)
Release: 9.3
Codename: stretch
Thanks
Hello, thanks for the fast reply. I tried this, but with no luck. I think that I know what the problem is: I installed the raspbian desktop for PC in a vmware workstation environment to test your project, but the binaries are compiled for arm processors. Is that possible?
DeleteHello,
DeleteYes the binaries are compiled for arm processor architecture.
Thank you to pay attention to this project.
Today, I tried with the raspberry pi (raspbian stretch) and everything is working. Thanks.
DeleteOK, Happy Holidays and Happy New Year
Delete