TheRealMike
I have a PLC from IndustrialShields.com [this one: https://www.mouser.com/ProductDetail/Industrial-Shields/034001000200?qs=DRkmTr78QAT%252BraKFStBmOA%3D%3D] that I'm trying to program with OpenPLC. However, it isn't listed in the available boards in the programming section, how can I add it?
 
This particular PLC is running an ESP32-Wroom module, and the manufacturer recommends using the arduino IDE for programming. I've reached out to the manufacturer and they said it should be possible to program it with OpenPLC, so I'm looking for some direction on how to go about adding a new board to the list and how to define the I/O of those boards. I'm working with the board manufacturer to get the information I will need from their end, and they seem very helpful.
 
So how do I add a new board?
 
Can anyone help?
Reply 0 0
thiagoralves
This won't be very straightforward as the PLC has custom hardware around the ESP32-Wroom module. You will be able to program the ESP32-Wroom module inside it using OpenPLC, but that's about it. Accessing all the PLC's peripherals and I/Os requires a driver to be written for that platform so that OpenPLC knows how to handle the PLC's custom hardware.
Reply 0 0
TheRealMike
This won't be very straightforward as the PLC has custom hardware around the ESP32-Wroom module. You will be able to program the ESP32-Wroom module inside it using OpenPLC, but that's about it. Accessing all the PLC's peripherals and I/Os requires a driver to be written for that platform so that OpenPLC knows how to handle the PLC's custom hardware.
I'm OK with putting in the work.
 
It's open source, right? I'll work on a driver if that's what is needed. How do I go about that? I just need some examples to look at and I should be able to get the particulars from the manufacturer. Is there any documentation on making drivers?
Reply 0 0
thiagoralves
@filou wrote some nice documentation here that should be quite easy to follow: https://openplc.discussion.community/post/add-a-new-arduino-platform-13477511?trail=15
Reply 1 0
filou
First use the link from OEM and install IIndustrialShields-ESP32 in your Arduino IDE:
Then test your hardware using Arduino IDE . If it works, follow the tutorial. It looks like there are also some IOs that are directly connected to the MCU, I would start with those. To do this, take a look at the file arduino_MC32.cpp and the others in the "hal" folder.
 
Have fun
Reply 1 0
TheRealMike
Thanks, both of you. I've got some work to do now. I'll report back.
Reply 0 0
TheRealMike
 
OK, I successfully got my PLC code running on a Raspberry Pi, so now I'm going to attempt to get this board working.
 
I'll try to document the process here as I go.
 
Here are the board details:
.\arduino-cli-w64.exe board details -b industrialshields:esp32:esp32plc
Board name: ESP32 PLC Family
FQBN: industrialshields:esp32:esp32plc
Board version: 2.2.4
Package name: industrialshields
Platform name: Industrial Shields ESP32 Boards
Platform architecture: esp32

Option: Model cpu
ESP32 PLC ✔ cpu=esp32plc
ESP32 PLC 19R IO+ cpu=esp32plc19r
ESP32 PLC 21 IO+ cpu=esp32plc21
ESP32 PLC 38AR IO+ cpu=esp32plc38ar
ESP32 PLC 38R IO+ cpu=esp32plc38r
ESP32 PLC 42 IO+ cpu=esp32plc42
ESP32 PLC 50RRA IO+ cpu=esp32plc50rra
ESP32 PLC 53ARR IO+ cpu=esp32plc53arr
ESP32 PLC 54ARA IO+ cpu=esp32plc54ara
ESP32 PLC 57AAR IO+ cpu=esp32plc57aar
ESP32 PLC 57R IO+ cpu=esp32plc57r
ESP32 PLC 58 IO+ cpu=esp32plc58
Option: Version version
v3 ✔ version=v3
v1 (Legacy) version=v1
Option: Extension module 1 module1
None ✔ module1=none
GPRS module1=gprs
NB module1=nb
Option: Extension module 2 module2
None ✔ module2=none
GPRS module2=gprs
NB module2=nb
Programmers: ID Name
esptool Esptool
 
I don't have "arduino_MC32.cpp" in my "/user/OpenPLC/editor/arduino/src/hal" folder, but I do have "esp32.cpp" and "esp32.hal" which seems to be close to what I need.
 
 
ESP32-WROOM-32 has 38 pins. See pin definitions in Table 2.
Table 2: Pin Definitions
Name No. Type [Function]
GND 1 P [Ground]
3V3 2 P [Power supply]
EN 3 I [Module-enable signal. Active high.]
SENSOR_VP 4 I [GPIO36, ADC1_CH0, RTC_GPIO0]
SENSOR_VN 5 I [GPIO39, ADC1_CH3, RTC_GPIO3]
IO34 6 I [GPIO34, ADC1_CH6, RTC_GPIO4]
IO35 7 I [GPIO35, ADC1_CH7, RTC_GPIO5]
IO32 8 I/O [GPIO32, XTAL_32K_P (32.768 kHz crystal oscillator input), ADC1_CH4, TOUCH9, RTC_GPIO9]
IO33 9 I/O [GPIO33, XTAL_32K_N (32.768 kHz crystal oscillator output), ADC1_CH5, TOUCH8, RTC_GPIO8]
IO25 10 I/O [GPIO25, DAC_1, ADC2_CH8, RTC_GPIO6, EMAC_RXD0]
IO26 11 I/O [GPIO26, DAC_2, ADC2_CH9, RTC_GPIO7, EMAC_RXD1]
IO27 12 I/O [GPIO27, ADC2_CH7, TOUCH7, RTC_GPIO17, EMAC_RX_DV]
IO14 13 I/O [GPIO14, ADC2_CH6, TOUCH6, RTC_GPIO16, MTMS, HSPICLK, HS2_CLK, SD_CLK, EMAC_TXD2]
IO12 14 I/O [GPIO12, ADC2_CH5, TOUCH5, RTC_GPIO15, MTDI, HSPIQ, HS2_DATA2, SD_DATA2, EMAC_TXD3]
GND 15 P [Ground]
IO13 16 I/O [GPIO13, ADC2_CH4, TOUCH4, RTC_GPIO14, MTCK, HSPID, HS2_DATA3, SD_DATA3, EMAC_RX_ER]
SHD/SD2* 17 I/O [GPIO9, SD_DATA2, SPIHD, HS1_DATA2, U1RXD]
SWP/SD3* 18 I/O [GPIO10, SD_DATA3, SPIWP, HS1_DATA3, U1TXD]
SCS/CMD* 19 I/O [GPIO11, SD_CMD, SPICS0, HS1_CMD, U1RTS]
SCK/CLK* 20 I/O [GPIO6, SD_CLK, SPICLK, HS1_CLK, U1CTS]
SDO/SD0* 21 I/O [GPIO7, SD_DATA0, SPIQ, HS1_DATA0, U2RTS]
SDI/SD1* 22 I/O [GPIO8, SD_DATA1, SPID, HS1_DATA1, U2CTS]
IO15 23 I/O [GPIO15, ADC2_CH3, TOUCH3, MTDO, HSPICS0, RTC_GPIO13, HS2_CMD, SD_CMD, EMAC_RXD3]
IO2 24 I/O [GPIO2, ADC2_CH2, TOUCH2, RTC_GPIO12, HSPIWP, HS2_DATA0, SD_DATA0]
IO0 25 I/O [GPIO0, ADC2_CH1, TOUCH1, RTC_GPIO11, CLK_OUT1, EMAC_TX_CLK]
IO4 26 I/O [GPIO4, ADC2_CH0, TOUCH0, RTC_GPIO10, HSPIHD, HS2_DATA1, SD_DATA1, EMAC_TX_ER]
IO16 27 I/O [GPIO16, HS1_DATA4, U2RXD, EMAC_CLK_OUT]
IO17 28 I/O [GPIO17, HS1_DATA5, U2TXD, EMAC_CLK_OUT_180]
IO5 29 I/O [GPIO5, VSPICS0, HS1_DATA6, EMAC_RX_CLK]
IO18 30 I/O [GPIO18, VSPICLK, HS1_DATA7]
IO19 31 I/O [GPIO19, VSPIQ, U0CTS, EMAC_TXD0]
NC 32 - [-]
IO21 33 I/O [GPIO21, VSPIHD, EMAC_TX_EN]
RXD0 34 I/O [GPIO3, U0RXD, CLK_OUT2]
TXD0 35 I/O [GPIO1, U0TXD, CLK_OUT3, EMAC_RXD2]
IO22 36 I/O [GPIO22, VSPIWP, U0RTS, EMAC_TXD1]
IO23 37 I/O [GPIO23, VSPID, HS1_STROBE]
GND 38 P [Ground]
 
 
Reply 0 0
TheRealMike
Here's a block diagram for the ESP32 PLC 14 that I received from the Tech at IndustrialShields
 
[image]
Reply 1 0
thiagoralves
It looks like they have all that hardware implemented in their own Arduino FBQN platform. If that's the case, integration with OpenPLC should be very straightforward if you use their FBQN instead of the ESP32 one.
Reply 0 0
Reply