Kodolsinteze
Hello!
Is there a possiblity to somehow upload the PLC programm remotely, without a cable? 
For context, the PLC device will be made on arduino mega and it will be inaccessible, but wifi will be available. 
 
I was thinking something like an ESP32 that connects to wifi and then somehow receive and send data to plc(arduino_mega), but unclear how or if its possible to achieve that? 
 
Regards,
kodolsinteze
Reply 0 0
thiagoralves
It should be possible to add OTA update for controllers that already support WiFi natively like the ESP32, ESP8266, etc. For Arduino Mega, no, not worth the effort. Especially for a MCU that has only 8KB of RAM and therefore can't run anything larger than a traffic light... =/
Reply 1 0
Kodolsinteze
Thanks for the quick reply!
Would it be possible to send the generated files to ESP32 and then write those via serial to Arduino mega(as PLC)? 
Reply 0 0
thiagoralves
Yes, it is possible, but would require A HUGE effort both on the OpenPLC Editor side and on the ESP32 firmware side. You would have to modify the way arduino-cli uploads code for the Mega, to instead send the binary over to the ESP32. Then you must write a firmware for the ESP32 to receive this binary file over WiFi, and then implement some form of avrdude on the ESP32 to flash the binary into the Mega2560. Why not use the ESP32 itself as the CPU, which already natively supports Ethernet, WiFi, is much more powerful and has much more RAM?
Reply 0 0
Kodolsinteze
Good idea for the ESP32 as the CPU. 
Could you please give some pointers where to look on how to implement OTA for the ladder diagramm? 
Reply 0 0
thiagoralves
This is currently not implemented on the editor, but can be done without too much effort. You'll have to edit the hals.json file (editor/arduino/examples/Baremetal/hals.json) to change the upload method for the ESP32 platform. This is passed straight to the arduino-cli command-line. So you would have to figure out the correct arguments to send to arduino-cli in order to push an update over OTA. This will probably be enough to have OTA working, however you will have to hardcode the ESP32 IP address on the command line argument in your hals.json file. The better way of doing it is modifying the editor/dialogs/ ArduinoUploadDialog.py file to include a field for the IP address if the port selected is OTA. Then the value of the field can be passed from the upload dialog to the arduino-cli command-line.
Reply 1 0
Kodolsinteze
Thank you!
Reply 0 0
Reply