Electrical – Why do the motors for the Arduino RC car not respond to any command after the first command is received sometimes

arduinodc motorremote control

I'm making a mini RC car with an Arduino nano and wireless communication with RF433, with 2 motors with 2 motor drivers (L293D). I use 4 1.5V batteries to power the arduino nano and another 6V battery pack to power the motors, and use a joystick with an Arduino Mega to send commands.
I've written a program that sends specific digits when the joystick is in a certain position, i.e. when the joystick is "bent" to the front it sends a "1", a "2" is sent when the joystick is bent towards the back, and so on.

My problem is this: When I bend the joystick towards a certain direction, the RC car moves accordingly without problem; However, when I bend the joystick towards another direction (in other words send a different command), the RC car doesn't respond.
I took a look at what the RC car was receiving, and I've noticed that after the first command was sent (when I bend the joystick towards a certain direction), no more commands get to the RC car (in other words the Arduino Nano). This occurs occasionally, and I can't afford to have defects like this. I think this means the Arduino Nano "froze" after the first command.
Is this because of not enough voltage or current? Are there any alternatives to 4 1.5V batteries that are not pricey (I need to build 8 of these RC cars)?

UPDATE: These are the pictures of my breadboard and whole thing. Though I doubt it'll help. enter image description hereenter image description here

Best Answer

To add to my comment, it sounds like the Arduino is suffering a brownout condition. I think the correct term is actually called voltage sag but essentially it means a temporary drop in voltage due to high current draw and the internal resistance of the battery.

It's likely the batteries you are using are not able to deliver the instantaneous current required to drive the motors. What happens is when the motors are first switched on, they initially draw a very large current and causes the battery output voltage to dip. After a certain point, the Arduino senses a brown-out condition and shuts down.

Depending on how bad the brownout is, you might be able to get away by throwing on a huge capacitor close to the input of your Arduino (after the voltage regulator which I presume you have). Hopefully that will tide over the initial high current draw.

Otherwise, you can try having separate power sources. One dedicated to the Arduino and the other dedicated to driving the motors. I haven't looked into your motor drivers but this configuration is supported by most drivers I've seen and used. They'll usually have two power inputs on the drivers: one for logic level voltage input and one for power input.

If you want to share a single power source, consider using a battery that is able to deliver high currents. You can look on websites like HobbyKing for lithium-ion batteries that can deliver high currents. Do read up on how to handle li-ion batteries if you decide to go this route though.

Without seeing your circuit or any oscilloscope pictures of the power rail, there's not much else I can suggest at this point.

Related Topic