안녕하세요.

PLC 읽어보기 작업 후 오랫만에 다시 포스팅 합니다.

Mitsubishi, Omron PLC 읽어보기가 마무리 안됐는데 시간되면 작업해서 포스팅할 예정입니다. 

이번에 작업한 내용은 위즈네트 W5500 칩과 ESP32-WROOM 모듈을 이용하여 이더넷 연결을 해 보았습니다.

W5500 칩을 MACRAW 모드로 사용했기에 ESPRESSIF사의 개발플랫폼인 IDF(IoT Development Framework)에 있는 다양한 프로토콜 예제들을 모두 Reuse할 수 있다는 장점이 있으니 한번씩 살펴보시기 바랍니다.

Device Type : IoT Gateway

Spe                                                   Specificationcification
Processor Tensilica dual-core Xtensa® 32-bit LX6 MCU
Crystal 40 MHz
ROM 448 KB
RAM 520 KB
QSPI flash/SRAM 4 MB
Ethernet WIZnet W5500
10/100 Ethernet MACRAW Mode
User Input Boot Button / Reset Button
Connectivity WiFi, BLE
IO GPIO 20 pins connector with all ESP32 ports
Protocol Built-in programmer for ESP-IDF and Arduino
Operating Voltage 3.3V
Input Voltage 2.7~5.5V
Dimension(mm)/Weight TBD

Result :

W5500+ESP32 SDK

다음 회부터 IDF 개발환경 셋업, 보드 구성, 소스 작업의 순으로 포스팅할 예정이니 기대해 주시기 바랍니다.

전 회를 다시 보면 하기의 전송 내용을 볼 수 있습니다.

Send data(binary):[39]
4c5349532d58475400000000003301001300000054000200000001000900254d57303030303030
Received data(binary):[34]
4c5349532d58475400001202a01101000e0001305500020000010000010002000100
2020-05-19 12:38:23.786288  [0]1 0x1

Request Format을 보면

4c5349532d584754 : "LSIS-XGT" string

0000 : 예약영역

0000 : don't care

00 : PLC side

33 : client -> PLC

0100 : 순서 ID

1300 : Application Instruction byte 크기 예, 19(0x13) bytes

00 : PLC side

00 : 예약영역

5400 : Read Request

0200 : Data Type 예, 0x02 = WORD

0000 : dont' care

0100 : read variable 개수 예, 1(0x01) 개

0900 : 직접변수 길이 예, 9(0x09) length

254d57 : "%MW"

303030303030 : 어드레스 예, 000000 또는 0

 

Response Format을 보면

4c5349532d584754 : "LSIS-XGT" string

0000 : 예약영역

1202 : CPU TYPE, 상태 예, 1번 bit가 1인 것으로 보아 XGK/R-CPUH 모델 확인가능

a0 : CPU info 예, 0xa0 = XGK

11 : PLC->client

0100 : 순서 ID

0e00 : Application Instruction byte 크기 예, 14(0x0e) bytes

01 : 모듈의 Slot, Base 번호

30 : 체크섬

5500 : Read Response

0200 : Data Type 예, 0x02 = WORD

0001 : don't care

0000 : 0값은 정상, 아니면 에러

0100 : read variable 개수 예, 1(0x01) 개

0200 : 직접변수 길이 예, 2(0x02) length

0100 : read data 예, 1(0x01)

 

LS산전 PLC M0 셋팅 화면
client<->PLC data 교환 화면

다음 회에는 Mitsubishi PLC의 전송 Format을 살펴보도록 하겠습니다.

'PLC' 카테고리의 다른 글

PLC Data 읽어보기 단계2  (0) 2020.05.19
PLC Data 읽어보기 단계1  (0) 2020.05.14
PLC Data 읽어보기 단계0  (0) 2020.05.12

Host Device로는 BeagleboneBlack을 사용했습니다.

Host Device으로 사용한 Beaglebone Black

현장에서 Smart Factory 네트워크 구성도를 보면 하기 Case1이나 Case2로 이루어져 있습니다. Host Device에서 PLC의 Data를 읽은 후 Server나 DB에 전송하는 과정을 반복하게 됩니다.

Case1 네트워크 구성도
Case2 네트워크 구성도

첨언을 좀 하자면 저는 개인적으로 Case2처럼 구성을 추천 드립니다.

하기의 이미지가 Host Device에서 LS산전 PLC로 Request Format을 보낸 후 받은 Response Format을 디버깅할 수 있게 Hex값을 String으로 출력한 내용입니다. 맨 마지막 줄에 최종적으로 받은 값 1(0x1)을 보여주고 있습니다.

Host Device<->LS산전 PLC 연동 화면

Format에 대한 분석은 다음 회에 진행해 보도록 하겠습니다.

'PLC' 카테고리의 다른 글

PLC Data 읽어보기 단계3  (0) 2020.06.03
PLC Data 읽어보기 단계1  (0) 2020.05.14
PLC Data 읽어보기 단계0  (0) 2020.05.12

결론부터 보여드리고 시작하면

LS산전 PLC의 MW0에서 1값 읽어보기 화면

LS산전 PLC의 경우 IP만 설정하면 Protocol에 따라서 Request Format의 Data를 보내면 Response Format의 Data를 보내옵니다.

LS산전 PLC의 XG5000 Tool이나 관련 문서는 하기 링크에서 확인할 수 있습니다.

https://www.lselectric.co.kr/ko/download/

우선 XG5000을 사용하여 LS산전 PLC의 IP를 설정합니다. Port는 2004를 사용합니다.

LS산전 PLC IP 설정 메뉴 화면

이후 MW0에 1값을 저장합니다.

LS산전 PLC Memory 설정 화면

Host Device가 따로 없다면 PC나 노트북에서 LS산전 PLC로 Request Format을 보낼 수 있습니다.

하기 화면의 마지막 2Byte가 MW0에서 읽어온 1(0x1)값을 의미합니다.

LS산전 PLC의 MW0에서 1값 체크 화면

다음 회에서는 Host Device에서 LS산전 PLC와 주고 받은 Data를 분석해 보는 시간을 갖도록 하겠습니다.

기대해 주세요.

'PLC' 카테고리의 다른 글

PLC Data 읽어보기 단계3  (0) 2020.06.03
PLC Data 읽어보기 단계2  (0) 2020.05.19
PLC Data 읽어보기 단계0  (0) 2020.05.12

오랜만에 블로그 활동을 다시 시작했습니다.

현재 구상으로는 PLC연동, CNC연동, ESP32연동, RFID연동 순으로 작업을 해 볼 예정입니다.

물론 중간 중간에 Term이 생길 수 있습니다.

첫 시리즈로 PLC(LS산전, Mitsubishi, Omron)로부터 Data를 읽어볼 생각입니다.

요새 Smart Factory라고도 하고 Industry4.0이라고도 많이 하는데 제가 보기엔 현재는 공장에 이미 설치되어 있는 PLC로부터 읽어온 Data를 DB에 저장하거나 Display에 적용하는 정도의 수준이 아닐까 합니다. 물론 쓰기 동작도 가능하지만 이후의 포스팅에서는 다루지는 않을 예정입니다. 

하기의 그림처럼 PLC가 주어졌네요.

왼쪽부터 Omron PLC, LS산전 PLC, Mitsubishi PLC

우선 자료 구하기가 용이한 LS산전 PLC부터 다음 회에서 읽어보기 단계를 진행해 보도록 하겠습니다.

'PLC' 카테고리의 다른 글

PLC Data 읽어보기 단계3  (0) 2020.06.03
PLC Data 읽어보기 단계2  (0) 2020.05.19
PLC Data 읽어보기 단계1  (0) 2020.05.14

IoT Base Platform with RaspberryPi, WIZ850io : Platform Device Driver

​I know RaspberryPi platform for IoT. Recently WIZ850io is announced by WIZnet. So I implemented a RaspberryPi application by Ethernet SW modification because I can handle a source code easily. You can test Platform Device Driver through RaspberryPi and WIZ850io. Please refer to the following step.

Step 1: Prepare Materials

Please refer to the following.

1. Raspberry Pi 3 Starter Kit

2. WIZ850io

3. UART2USB adapter

4. LAN cable

5. USB cable

Step 2: Hardware Connection

Please connect an USB, LAN cable, WIZ850io and UART2USB adapter.
You can get more HW info by the following site.

​https://pinout.xyz/pinout/spi 

​http://wizwiki.net/wiki/doku.php?id=products:wiz850io:start

Step 3: Prepare Development Environment

Raspberry Pi 3

https://www.raspberrypi.org/documentation/

https://www.raspberrypi.org/documentation/linux/kernel/building.md

Step 4: Software

Linux Kernel : WIZnet Platform Device Driver

I modified menuconfig to use WIZnet Platform Device Driver as module type.

Step 5: How to Run : Result

I copied w5100, w5100-spi modules into Raspberry Pi.

loopback.tar

w5100_devicetree.tar

IoT Base Platform with RaspberryPi, WIZ850io : Ethernet Module Driver

​I know RaspberryPi platform for IoT. Recently WIZ850io is announced by WIZnet. So I implemented a RaspberryPi application by Ethernet SW modification because I can handle a source code easily. You can test Ethernet Module Driver through RaspberryPi and WIZ850io. Please refer to the following step.

Step 1: Prepare Materials

Please refer to the following.

1. Raspberry Pi 3 Starter Kit

2. WIZ850io

3. UART2USB adapter

4. LAN cable

5. USB cable

Step 2: Hardware Connection

Please connect an USB, LAN cable, WIZ850io and UART2USB adapter.
You can get more HW info by the following site.

​https://pinout.xyz/pinout/spi 

​http://wizwiki.net/wiki/doku.php?id=products:wiz850io:start

Step 3: Prepare Development Environment

Raspberry Pi 3

https://www.raspberrypi.org/documentation/

https://www.raspberrypi.org/documentation/linux/kernel/building.md

Step 4: Software

Linux Kernel : WIZnet Ethernet Module Driver for W5500

https://github.com/borg42/w5x00

Step 5: How to Run : Modification

I modified the source code to fit Raspberry Pi.

w5x00-master.tar

Step 6: How to Run : Result

I copied w5x00 module into Raspberry Pi.

loopback.tar

IoT Base Platform with GCC, Eclipse, WIZwiki-W7500 : Serial to Ethernet

I know WIZwiki-W7500 platform for IoT. Recently WIZwiki-W7500 board is announced by WIZnet. So I implemented a firmware of WIZwiki-W7500 board by Ethernet SW modification because I can handle a source code easily. You can know the status of equipment even if it is so far. If you want to know how to use S2E(Serial to Ethernet) function, please refer to the following step.

Step 1: Prepare Materials, Hardware Connection, Prepare Development Environment

Please refer to the link below.

https://www.instructables.com/id/IoT-Base-Platform-With-GCC-WIZwiki-W7500/

http://opensrclab.tistory.com/50

I prepared GCC development environment by the following site.

http://opensrclab.tistory.com/33 

I installed GNU Toolchain, Java JDK, Eclipse, Cygwin.

If you install all tools, you are ready for running this project.

You can use a Configuration Tool by the following temporarily.

http://wizwiki.net/wiki/lib/exe/fetch.php?media=products:wiz550s2e:wiz550s2e_configuration_tool_ver1.03beta_20151005.zip

How to use a CFG tool : http://wizwiki.net/wiki/doku.php?id=products:wiz550s2e:wiz550s2epg_en#configuration_tool

Step 2: Software 

https://github.com/bingdo/IIoT_WIZwiki-W7500_Eclipse

Step 3: Software : S2E(Serial to Ethernet)

Insert MAC address.

Modify IP, Port, Working Mode.

To test operation of S2E function.

Step 4: How to Run : Modification

Modify common.h

#define F_ENABLE_DHT11
#define F_ENABLE_TCPClient

Step 5: How to Run : Result

IoT Base Platform with arm MBED, WIZwiki-W7500 : EchoServer

I know arm MBED platform for IoT. Recently WIZwiki-W7500 board is announced by WIZnet. So I implemented a firmware of WIZwiki-W7500 board by Ethernet SW modification because I can handle a source code easily. You can understand how to use arm MBED platform. Please refer to the following step.

Step 1: Prepare Materials, Hardware Connection

Please refer to the link below.

https://www.instructables.com/id/IoT-Base-Platform-With-GCC-WIZwiki-W7500/

http://opensrclab.tistory.com/50

Step 2: Prepare Development Environment

Do you know arm MBED platform?

https://developer.mbed.org/handbook/Homepage

Step 3: Software : EchoServer

​EchoServer Example

https://developer.mbed.org/teams/WIZnet/code/TCPEchoServer-WIZwiki-W7500/?platform=WIZwiki-W7500

Step 4: How to Run : Preparation

Refer to the arm MBED link. https://www.mbed.com/en/

To create your account. https://developer.mbed.org/

To open cloud development environment.

Import Programs or Libraries.

Import mbed_blinky project.

Modify LED pins.

mbed_blinky_WIZWIKI_W7500.bin

Step 5: How to Run : Result

Import TCPEchoServer-WIZwiki-W7500 project.

https://developer.mbed.org/teams/WIZnet/code/TCPEchoServer-WIZwiki-W7500/?platform=WIZwiki-W7500

Modify MAC address.

Monitor Debugging COM Port.

IoT Base Platform with GCC, WIZwiki-W7500 : MQTT

I know WIZwiki-W7500 platform for IoT. Recently WIZwiki-W7500 board is announced by WIZnet. So I implemented a firmware of WIZwiki-W7500 board by Ethernet SW modification because I can handle a source code easily. You can know the status of equipment even if it is so far. If you want to know how to use MQTT protocol, please refer to the following step.

Step 1: Prepare Materials, Hardware Connection, Prepare Development Environment

Please refer to the link below.

https://www.instructables.com/id/IoT-Base-Platform-With-GCC-WIZwiki-W7500/

http://opensrclab.tistory.com/50

Step 2: Software

MQTT Example

​I uploaded source code. You can download this 7zip file.

After compile, you can send sensor data to Thing+ cloud server.

W7500_MQTT.7z

Step 3: How to Run : Preparation

To the following steps.

http://support.thingplus.net/en/open-hardware/arduino-noSSL-user-guide.html

Step 4: How to Run : Modification

To must modify MAC address, MQTT parameters in firmware code.

Step 5: How to Run : Result

To check the result of Dashboard through Thing+ Server.

+ Recent posts