#RealTime_Monitor_PLC_Python_Socket_HTML
Some protocol challenging. WHen the hardware prompts too fast,
It will cause the protocol data error
for example:
Normal condition:
-> Error caused by Bit issue and checksum error -> Bit issue could cause
The error data mode read, etc problem.
Solution: ????
1- Use CheckSum if-else and boolean
2- Use if else to check response code
3- Use for-loop to check byte
python Client.py (Keep prompt PLC address output 100)
Then
Python Backend
Run python RealTimeMonitorPLCAddressSocketServer.py
Frontend
node express.js
Database SQLite:
Debian: sudo apt-get install sqlitebrowser
sqlitebrowser
CREATE TABLE "PLC" (
"id" INTEGER,
"address_0" TEXT,
"address_1" TEXT,
"address_2" TEXT,
"address_3" TEXT,
"address_4" TEXT,
"address_5" TEXT,
"address_6" TEXT,
"address_7" TEXT,
"address_8" TEXT,
"address_9" TEXT,
"address_10" TEXT,
"address_11" TEXT,
"address_12" TEXT,
"address_13" TEXT,
"address_14" TEXT,
"address_15" TEXT,
PRIMARY KEY("id" AUTOINCREMENT)
);
When there is index.html run, This python Backend will receive data from the PLC
index.html is subscribing RealTimeMonitorPLCAddressSocketServer.py socket therefore it can be real time however there is some latency
INPUT:
0.03
0.05
0.07
0.09
OUTPUT:
100.00
100.01
100.02
100.03 (Alaram)
Hardware Overview:
PLC program
Backend:
Python
Platform:
Raspberry Pi
Connector:
OMRON CP1E to USB convertor
Method:
C-Command
Real Time Tech:
Socket
Frontend:
HTML
Wiring Diagram: