Adding IndustrialShields support from Arduino IDE to Platformio


I have recently bought one of the esp32 PLCs made by industrialshields, specifically the ESP32 PLC 19R. This device has Arduino IDE support, but not yet Platformio support.

Considering that I enjoy the development process in Platformio, I am hoping that someone is willing to help me get around the hurdles of getting the device to work on this platform!

I have made a github repo with the contents of the .arduino15 folder that seems to contain the same directories, so hopefully this will help a bunch.


The files in the repo are direct copies of the ones that get downloaded by Arduino IDE using the custom url provided by industrialshields.

Looking at the files it seems that there are some changes/additions made eg /hardware/esp32/2.1.2/cores/industrialshields/expanded-gpio.c, so that seems to suggest that files have been changed/added in core.

what steps do you think I should follow to get this to work ?

I just did one tiny commit to add a package.json so that PlatformIO can install the core as a package

then I created this test project and made the necessary adaptions for it to correctly build this new core and set the PLC 19R+ as the board

can you check if that compiles + uploads + works for you?

Hello @maxgerhardt !

I have compiled and uploaded it and it is working as expected! I made a small change to the code since there is no visible builtin LED, but I made it turn a relay on and off which is lined to an LED!


#include <Arduino.h>

#define LED1 R0_1
#define LED2 R0_2

void setup() {
    pinMode(LED1, OUTPUT);
    pinMode(LED2, OUTPUT);


void loop() {
    digitalWrite(LED1, HIGH);
    digitalWrite(LED2, LOW);

    digitalWrite(LED1, LOW);
    digitalWrite(LED2, HIGH);

That worked like a charm!! crazy how such a small change can make it compatible!

Thanks a lot for your help!

For other people that may want to use it, should they link to your repo ? or should I merge your changes into mine ?

The above project is just a “Proof of Concept” to see whether it works at all, but if we want this to go into mainline platform-espressif32, it probably needs to be its own package (framework-arduinoespressif32-industrialshields) and all the board definitions need to properly there as json file so that you could just say board = industrialshield_esp32_plc_19r.

I can work on that and file a PR in Pull requests · platformio/platform-espressif32 · GitHub.

I’d then ask you to retest a new project to see if it still works.

If you are willing to put the time into making the PR , then I will gladly test it for you!

Just to be sure:
The industrialshield esp32 does do this strange thing where it “hijacks” functions such as digitalWrite to write to I2C to write to certain “pins” eg the ones i used for my simple example to trigger the relays (R0_1 and R0_2)

My example works so PlatformIO is using the “hijack” correctly. Can we then safely assume that all other functions will work as intended as well ?

The compiler flags and built sources can be directly compared in the verbose output of the Arduino IDE and PlatformIO. So if they’re the same and the same toolchain versions are used, the output is the same. That can be checked once and then it should be good.

Of course you can also throw a more complicated sketch at it.

when running verbose flags for both PlatformIO and Arduino IDE a large amount of text is generated, making it relatively hard to compare.

But, I have tried the arguably more complicated wifi connection example on their website link

and that also worked as intended.

@maxgerhardt is there anything I can do now to help with merging this into mainline platform-espressif32?

I tried compiling the test project and am getting errors, I even forked and merged 2.1.3 and am still getting the same compile errors.

framework-arduinoespressif32/tools/sdk/esp32/include/hal/include/hal/adc_types.h:90:27: error: expected ‘,’ or ‘}’ before ‘attribute

framework-arduinoespressif32/cores/industrialshields/Arduino.h:184:12: error: ‘std::round’ has not been declared

Nevermind - I had an old platform version of espressif32 installed. It works now.

1 Like

Hi, I just bought an IndustrialShields board, and looking for some information I came to this thread.

I have an M-Duino 38R+ LoRa with an Arduino Mega inside, I think the repo you posted above will not work for me, so ¿Do you know where I can find some information for doing this integration for my particular board?

to get it to work for the mduino i would look at what max gerhardt did here. He only had to add one file in order to get it to work.

To get the relevant content, look at my original post where I indicate where i found the files.
Hopefully this will help!