I am doing a small car project using Arduino Uno and 2 ultrasonic sensors (HC-SR04). I am trying to control 2 Dc motors by using a motor controller (L9110S). My purpose is to control the direction of the motors according to the values that I get from the ultrasonic sensors. However I am reading values all over the place (readings are mostly 0 or a really high number like 1240(I don't remember the exact reading but it is always same number). (Sometimes I am getting the correct values for a second but it is really rare.)
After working on my code and ultrasonic sensors for a few day, I realized that when I disconnect the motor controller from the 5V of the Arduino, I am getting the correct readings from the sensors.
Is this the problem? Should I power the motor controller with a separate power supply? If I power the motor controller with AA batteries, does it damage the motor controller? Is it possible to solve the problem without an external power supply?
If it is not the problem, what might be the possible problems? I am not sure if my code is wrong but as I said, when i disconnect the motor controller from the Arduino, the ultrasonic sensors works just fine.