Arduino crashing when turn on motors

Hello good morning everyone!

I am developing a project for a battery-powered cable-controlled robot, and to the point I am having problems locking up on Arduino when I start the engines.

Some specifications:

  • Arduino MEGA;
  • 16v 15A/h battery with fixed voltage regulator for 12v output so that there is no variation in circuit input;
  • Cable distance of 100 meters CAT6e;
  • Motors;
  • SyRen25 Driver;
  • RS485 communication protocol.

I am developing software that will be the control interface, which communicates with the Arduino through the serial port through the RS485 communication protocol, and is also reading the data from the sensors that the car has, such as the MQ-2, DHT22, MPU6050 , HC020K, INA219, among a few others.
The problem happens when I start the engines of the car, that with a ramp of 5 seconds, they start spinning, but at the same moment they stop suddenly and the Arduino crashes, having to reset it on the button, or even have to turn it off and on again to make it work again.

What may be causing this lockup?

The sketch uses 18966 bytes (7%) of program storage space. The maximum is 253952 bytes.
Global variables use 819 bytes (9%) of dynamic memory, leaving 7373 bytes for local variables. The maximum is 8192 bytes.

This is my output from the IDE, I believe it is not for lack of memory.

Thanks in advance

I'm guessing the "car" and the "robot" are the same thing? What components exactly are in the car and what is on the other end of the 100m of cable?

A circuit diagram would be useful. In particular we need to know how everything powered. I.e. what is the specification of the 12V regulator and what is powered directly from the 12V and what if anything is powered from the 5V out of the Mega.

Almost all problems of things crashing when motors are running are eventually traced to power problems, often trying to pull too much power from an Arduino 5V pin (that's why I get worried when people say things like "among a few others").


What may be causing this lockup?

Electrical noise, large voltage spikes and severe voltage drops in the power supply and wiring. The motors have 15 Ampere start/stall current!

Suspects include long cables, poor connections, improper grounds, poor shielding, inadequate voltage regulation, inadequate power supply filtration, and inadequate power supplies.

This is a common problem and difficult for an inexperienced person to solve. You will probably need an oscilloscope and/or a friend with considerable expertise in electronic circuit design to help troubleshoot.

If you want help from this forum, you will need to provide a lot more information, including a complete wiring diagram and links to all the components and modules (with full voltage and current specifications for all the motors, motor drivers and power supplies).

Hello guys, thank you for your time!

So, I think that the circuito here not will help a lot, because is so large and is working normally. I noticed that when I remove the cables of INA219 from the motor everything back work normally. I think that it can be the problem, in I2C protocol, when the motor will run and the sensor get this signal and send to Arduino is when the Arduino crashes. I'll have 4 INA219 sensors + 1 MPU6050 sensor in I2C ports togheter. The problem can to be here?

1- Yes, the robot and the car is the same;
2- In the end of the cable have one USB converter RS485, that made the communication between the software in my PC and the Arduino a large distances, having an converter RS485 in robot;

"So, I think that the circuito here not will help a lot, because is so large and is working normally."

If everything is working normally then you should not have a problem.
You have a problem, so everything is NOT working normally.
Perhaps you have over looked something in your circuit wiring. A circuit diagram would help others to help you help yourself.


Hi guys, sorry for the delay.

At the request of steve, follow the diagram, was the better than I can make.

In the moment, the project is workink fine, because I've removed the Vin- and Vin+ of INA219, but when I turn on this cables again it back crash the board. In my tests, I'm using just one INA219, with other all sensors.

Now, it help?

I would be inclined to temporarily strip the thing down, so that it contains the bare minimum i.e. battery, dc-dc converter, arduino, one motor control board, and one motor. See what happens with that. If that works without problem, then add other bits, testing each bit as you go. Just write a simple test progam to deal with the motor.

I have a similar problem in an enclosure. A power pack, 240V AC input 12V 6.6A output, is supplying 2x DC-DC converters, Mega 2560, 8x 5V relays, Nrf24, 2x 12V computer fans, a large led light array, and a few more bits. I thought the 6.6A supply was adequate. If I have a few relays energised, plus the light, and then turn the fans on then everything loses power, the Mega resets, and the power comes back again. If I leave the light off, and just have a couple of relays energised, then I can turn the fans on without a problem. I think I am overloading the DC supply. I must get in there, measure things, and fix it someday; but for now I don't turn everything on all at once.

As I say, maybe try testing it with just the minimum number of components to get the motor ramping, and see what occurs.