jonas_rotter
Hey OpenPLC community,
I recently discovered some weird behaviour of my Arduino Mega when using it with OpenPLC. The microcontroller is connected via USB to a Raspberry Pi 3 on the one side and to an 8 channel relay board via jumper cabels on the other side. From time to time (generally speaking about 5 minutes after I start OpenPLC) the Arduino completely turns off - no TX/RX signals anymore and therefore no input/output signals to the Raspi. Sometimes (I'm not sure if that's really related) even the 4g hat module which is connected to the Raspberry Pi loses it's serial connection to the Raspi as well. I already tried different Arduinos, Raspberry Pi's and 4g hat modules. 

I'm not sure if this is about interference or anything, I read that it could be related to a USB cable which is too long (the one currently used is about 30 cm long) or to the powering of the Arduino itself which is, like I said, currently done through the USB cable. This tutorial claims that one shouldn't use the output pins of the Arduino when powering through USB to drive "power hungry devices": https://www.instructables.com/id/4-Ways-to-Feed-Power-to-an-Arduino/
If that's the case, how do you handle powering your Arduino?

Thanks for your answers!
Quote 0 0
thiagoralves
It’s hard to know without the hardware in hands, but I would say that it is most likely that the culprit is your power supply. Weird errors like those usually happens when your power supply is not strong enough to handle all the devices attached to it. By what you described, having everything hooked up to a single Pi is definitely not a good idea. Try powering the Arduino separately using a 6V input. Also, try upping your Pi power supply to something that can provide at least 4-5A.
Quote 0 0
jonas_rotter
Thanks for your fast answer Thiago.
I already got my Pi powered with a Phoenix Contact 5V/6,5 A power supply. The Arduino crashes whether I use this power supply or the offical one. But yeah, I know it's hard to make a remote diagnosis.

So would you recommend to use both the USB and the DC barrel plug or do you mean powering it through the 5V VIN pin?

Otherwise I could also try to use an ESP32. And still there are some options with connecting the Arduino to the Raspberry Pi, so let's see.
Quote 0 0