I am trying to run an Arduino UNO and 2 DC geared motors via an L298N module with 4 NiMH AA batteries. I have connected the batteries to the L298N module and the Vin pin of the Arduino. Everything worked fine, but when the 2 motors are running the Arduino sometimes resets and I think my ultrasonic distance sensor can get a false positive. I fixed this problem by powering the Arduino with 2 separate AAA batteries in a power shield and now I don't have the problem. I am guessing that this was happening because when the motors faced sufficient resistance (such as running on the ground and not in the air) the input voltage spiked causing the Arduino to reset or the sensor to have a false positive. Does this sound right?
However, I am now using 6 batteries to power my little car and I would like to go back to using just 4. To do this I considered using a voltage regulator between the batteries and the Arduino, but the 4 batteries wouldn't provide enough input voltage. Would a DC-to-DC converter perhaps work to regulate the voltage here? I would appreciate any feedback on this matter.
Another possibility I found on this forum is cutting off the end of a USB cable and connecting the batteries to that to power the Arduino through the USB port instead of the Vin pin. However, I am unsure if I would have the same problem doing that if indeed the input power supply is spiking when the motors are under stress.
When mixing motors and Arduino, it is always best to use two power supplies, especially when working with low voltage and low capacity AA cells. Don't forget to connect the grounds together.
With only a single battery pack, as the motors start up or stall, the voltage drops and that resets the Arduino. Likewise, electrical noise generated by the motors can damage delicate circuitry or cause it to malfunction. Both problems get worse as the batteries age.
I connected the batteries to both the L298N and this module and then have a USB cable running from the module to the Arduino. It seems to be working fine, but perhaps there is some reason that it is not a good idea.
If I understand the module correctly it takes in a variable 0.9 to 5V and outputs a steady 5V. Perhaps I am mistaken though. It was working fine for a Raspberry Pi car I made with an even higher input voltage of around 7V so I thought I would try it for an Arduino car. I would appreciate your thoughts though.
I connected the batteries to both the L298N and this module and then have a USB cable running from the module to the Arduino. It seems to be working fine, but perhaps there is some reason that it is not a good idea.
If I understand the module correctly it takes in a variable 0.9 to 5V and outputs a steady 5V. Perhaps I am mistaken though. It was working fine for a Raspberry Pi car I made with an even higher input voltage of around 7V so I thought I would try it for an Arduino car. I would appreciate your thoughts though.
Yes your setup will be fine, but as @jremington has pointed out , the L289 is an old motor controller and you loose about 2V across it because it uses BJT switching transistors.
A more efficient MOSFET type would be better.
Tom...
Thank you both for your help. I will consider trying a different motor driver in the future. Most online instructions I have come across for these kinds of cars seem to use a L298 though. I haven't found them to get particularly hot which is a concern of mine as I would like children to be able to play with these. That would be a concern I have about the MOSFET as the webpage says it can get hot and it doesn't seem to have a heatsink. Again, I would like these to be safe for children.