I have a system where I have an Arduino Opta that runs a simple Arduino script to control its relays. A PC sends serial instructions (strings) to the Opta by USB to indicate when to open or close the relays. However, I found out that if the Opta is already powered by the 24V input, then if you plug the USB to the PC, it does NOT reset and allow serial communication. The Opta is not even detected by the PC. However, if I do the opposite (connect Opta by USB THEN plug in the 24V, it works perfectly). Considering that my 24V power supply will be faster to power the Opta than the computer (which has to convert it to 5V), how am I supposed to have a working connection between the two without having to manually unplug the 24V of the Opta everytime I want the PC to connect to it?
Adding a delay of 10 seconds before the Serial.begin(9600); has not fixed the problem.
I read and send modbus messages with an usb RS485 link to my modbus bus.
When I turn my 24 V system on, it seems that the opta program is not loaded (for example the led I programmed doesnt turn on).
If I then plug the opta with the USB C used to upload the opta program (just plugging the usb with arduino IDE loaded)
Then everything works fine and I can even unplug the USB C and it keeps working.