I have an Arduino Mega with a Motor Shield and a Raspberry Pi 4 connected using the USB ports.
with the USB cable connected, the Raspberry Pi randomly shutdowns just siting with the OS running. When I disconnect the USB cable Raspberry runs fine, And with the with the Mega connected to a PC both applications communicate and run fine.
The Raspberry Pi is powered using a Pi power source.
12vdc 2amp wall ward is plugged into the Mega.
14vdc source connected to the motor shield. -- Link to Vin is cut.
Also have a 5v0dc source that power other things, sensors etc. grounds connected to both the Mega and the Raspberry Pi.
I assume my problem is power feeding from the Mega through the USB to the Raspberry Pi. Is there a jumper on the Mega to isolate Mega power from the USB? There is not one on the Raspberry Pi.
Mega/motor shield wired to a PC work fine. Raspberry Pi WiFi to PC work. Discovered the problem when I inserted the Raspberry Pi in the middle. I have stripped things down to just the Mega, with external 12vdc power and the Raspberry Pi with a Pi power source. Disconnecting the USB stops the problem. With 36 sensors in and control of 2 relays out I don't think I have room for a wireless connection to the Raspberry Pi.