Avoiding Unstable Rotations of BLDC motors _ RS485 serial ROV system

I am trying to develop an Underwater ROV system using Nick Gammon's RS485 library. System consists of 4 BLDC motors for ROV movements( Thrusters) , one servo motor for camera rotation and a LED lighting system controlled by L298N PWM module. I have used pressure , temperature , leak detection and voltage sensors for the ROV. Thrusters are controlled by a PS2 wireless joystick. Camera rotation and brightness of lights controlled by potentiometers. Arduino mega 2560 is used as the master on surface, which is used to send all control signals. Inside of the ROV Arduino uno used as the slave which is receiving data and reading all sensors sending back to the surface.

Everything worked perfectly. Data passing without any distortion from both ends. but when I am not sending any control signals, BLDC motors are rotating two or three rounds and stops. This happens continuously with same time interval.( like 3 seconds). Servo motor and lights are acting same as BLDC motors. How can I stop this?

My code is also attached here.

Master code and Slave code

SSerial_Twoport_M.ino (4.86 KB)

SSerial_Twoport_S.ino (9.63 KB)

I would suggest that you determine whether the master is sending rogue data, the slave thinks it is receiving rogue data or the slave is just doing its own thing (aka a bug in your slave code).

You currently have 2 unknowns - the master system and the slave system. What you need is a known 3rd device you trust to discover who's doing what.

I've generally got a few spare USB->TTL serial boards lying around and they are great for listening in on conversations between serial devices. All you need is to connect the USB->TTL serial board GND signal to the GND signal on your master or slave. The connect the USB->TTL serial board RX (or RXD, or RXI) pin to the TX pin on your master and you can listen in on what the master is saying.

Connect the RX & GND signals to your slave RX and GND and you can listen in to what the slave is supposed to be receiving.

Another thing you can do to isolate the problem is to disconnect the master and see if the slave still behaves the same way.