I have a small robot built on Arduino Mega 2560, using two 12V DC motors to move, which are driven by L298N. 315/433MHz RF units are also used to communicate with a remote controller (another Arduino; Nano connected to a PC. So that, from my PC I can enter commands like f,b, r,l and the robot executes them upon receiving.
The problem is that, if the engines are running the robot (RF receiver or Arduino??) does not receive any more remote commands. When stopped, it can receive commands. I tested following scenarios:
1.) Command f: FORWARD. Robot moves forward. No any other additional controls in the loop. Both motors are enabled and keep going. Never receives any messages afterwards.
2.) Command l, r: LEFT/RIGHT. These are state preserving commands, i.e., if the robot is initially stopped, it makes a left or right turn, and stop again. So, while turning process robot does not receive any message, but when stopped, it does. So I can make successive left/right turns (starting with a STOPped state).
3.) Command b: BACKWARD. Same as FORWARD.
4.) Command s: STOP. While stopped, if I send stop message it is received and aknowledged. But if the robot is on the move, it is not received. Any other message is also received and executed, with results described above.
5.) I connect the Arduino to PC via USB, so the Arduino is ON, but 12V DC is not switched on for LN298N. I send FORWARD message, it is received, but of course the motors do not start, there is no 12V DC power. Then I send a second message like STOP, or LEFT, or RIGHT. And it is RECEIVED.
6.) Same as above, plus the 12V DC is swhitched ON, but the DC motors are disconnected. So, the L298N is ON but there is no real power usage by the motors. ALL MESSAGES ARE RECEIVED, but of course not executed.
7.) From a directly attached PC via Serial interface all commands are received. So the Serial interface is working properly.
So, if motors are ON, then somehow the RF message is lost.
First I thought it was because I was using a bare L298N with no capacitors/diodes around. I added 3 100 uF capacitors, one for each motor and one for 12V DC supply. No change.
Then I bought the L298N Module 2A, with capacitors and diodes and all. Same problem.
I believe the problem has to do with power usage; case 6 clearly shows this but I tried my best. What else can I do?