I'll get straight to the point. I'm relatively new to Arduino, so I'm confident my issue is far from unique, however I haven't been able to find a solution browsing the internet thus far.
Background: I'm building a self balancing robot. I had the system working a few months ago, and have recently decided to upgrade. I bought new motors, a new motor driver, and lipo battery to power the motors. I have a separate power supply for the Arduino (9V) and motors (11.1V lipo), and a common ground.
Problem: My code works fine when the lipo battery is disconnected. However when I connect the lipo to the motor driver powering both motors, the motors work for a few seconds before the Arduino errors and starts outputting "NaN" for the angle. Sometimes it can work for 10 to 15 seconds, but it will inevitably shutdown.
My current line of thought is that the Arduino is not as decoupled from the motors as I think it is. Is it possible for high frequency noise to enter the Arduino via ground and trip some reset? I believe it is some sort of coupling problem, but I'm not familiar enough with circuits to understand if that is true (as I do have separate power sources for the Arduino and motors), and then if it is a coupling problem how to resolve the issue. I should note that during my troubleshooting I found that when only 1 motor is connected the code works as expected. The addition of the second motor causes the error, which I find quite interesting but I don't know how to use this information yet...
Thanks in advance for reading this,