beamer
Hi everybody,
 
has anyone already tried to install OpenPLC on a so-called DTWonder board (ESP32-based)
 
 
Best regards,
beamer
Reply 0 0
fg71
 Why do you think that board is Arduino compatible when the manufacture do not say anything about it.
Also you couldn't install OpenPLC Runtime on MCU you need SBC.
Reply 0 0
thiagoralves
Since it has an ESP32 on it and OpenPLC is compatible with ESP32, most likely you will be able to upload a program to it using the ESP32 entry on OpenPLC. However, to control the relays you might need to change the IO mapping or write a custom hal driver depending on how the board is wired internally.
Reply 1 0
fg71
I do not think so, the board use OTA Server to update firmware so how would a user be able to compile a plc program and send it to the board on WiFi or Ethernet. All application on that board is based on event-driven application in other words IoT. There the communication is WiFi or Ethernet.
Reply 0 0
thiagoralves
There seems to be a UART header right next to the ESP32. Using that it should be possible to upload an OpenPLC program to it. The downside is that it would obviously replace the current firmware in the board, which might not be desirable.
Reply 0 0
fg71
The way I see it the board could be used as Modbus device. There Modbus Client set the state of the Relay.
This way you could read/write to the device from other OpenPLC compatible device.
Reply 0 0
richw
When I purchased the DTWonder boards I was informed by the seller the firmware was locked and could not be changed. I would have to order them unprogrammed to be able to use them with Arduino. thiagoralves is correct, the board is able to be programmed with the 4/6 pin header which is UART and I2C. The problem I ran into was a different ethernet chip. I'm not a C programmer but somehow I added support for the chip and re-compiled the ESP32 Arduino software and it worked, it took many hours. I used OTA in Arduino IDE to update the old OpenPLC firmware Arduino code to make it a slave for a RPI running OpenPLC. This worked well. Not sure This would work well with OpenPLC because of the ethernet chip issue. I requested to ESP32 Arduino forum to add the new ethernet chip but that never happened, and that was about a year ago.
Reply 0 0
beamer
Thank you very much for the many helpful answers!
 
As stated by richw, the manufacturer mentions:
"This is a finished board, not a study board. Our default version don’t support flash by yourself,
if you want to flash custom firmware, please leave a message ”send relay board with test firmware” when order"
Like this, alternative firmware should be possible.
Some information on programming the board can be found at: https://github.com/dtlzp
Since the inputs and outputs are addressed via shift registers, OpenPLC will probably not work “out-of-the-box” for ESP32
Reply 0 0
thiagoralves
I was taking a look, it seems that these DTWonder boards and the DN22D08 (link here: https://www.aliexpress.us/item/3256805404061042.html 😉 are great products to get official support on OpenPLC. They are very cheap, sells like water, and are DIN rail mountable. Seems like the perfect option for cheap automation. I guess the main problem with DTWonder boards is that they can only be programmed using OTA, so I will need to implement that on OpenPLC first.
Reply 1 0
richw
@beamer the 2 and 4 relay versions don't use shift registers. The I/O is connected directly to the ESP32 I/O pins. As I stated before the main issue is the JL1101 ethernet chip driver is not included in the ESP32 Arduino core. If you look at the link you posted, the info about the driver is there and doesn't sound all that hard to add. If we could get them to include that driver in the ESP32 Arduino core this would an awesome addition to OpenPLC
Reply 0 0
fg71
The approach I would do if I need Relays is to use GPIO expander and use smbus and then I will make a driver for OpenPLC Runtime. The GPIO expander use i2c protocol in other words I could extend it to 128 Relays. In other words the smbus communicate with a channel and read/write to a register. You could have 8 channels with 16 I/O that is 128 I/O. That is something I would like to see in OpenPLC Runtime and a good starting point is to invest in Raspberry Pi.
Reply 0 0
fg71
Other point of view is a Arduino board like Uno use 20-40mA current per pin. If a plc program set the state of 4 relays at same time there is not enough current. To solve this the board maker need to use transitor/mosfet or optocoupler (that use less current). Also it makes sense to use separate power supply as input signal to relay. And to make it simple 24VDC could be used as input signal and output of the relay. Its common to think that optocoupler is used for safety (its is) but not only.
 
The output of the Relay often 250VDC 5A, 7A or 10A, any of this need to be in safety environment. In other words I could connect 240V to output relay of LOGO PLC but its never recommended to do so, a better approach is to use contactor that use magnet coil for 24VDC that are build for higher current and relay are. And still we need a safety relay if we like to use high current. Other aspect is if a contactor is used the power supply maybe need to be greater 16VDC for magnet coil to activate. There is a reason why 24VDC is used in the industry and separate from high current loads.
Reply 0 0
Reply