Powering Arduino through l298n

Hi,
I'm trying to build an rc car and I want to use l298n h bridge to control the motors. I would like to power the arduino nano from the 5V pin on the driver and I'm not sure, whether I have to connect it to the 5V ARduino pin, or if it's okay to use the vin pin because I want to use MPU 6050 gyroscope and accelometer and also a servo ehich both need to be powered from the 5V pin.
Thanks for any reply in advance.

Connect 5V to the 5V pin. Connecting 5V to the Vin pin will not allow the internal 5V regulator to work right.

If your car is battery powered the L298 is a poor choice for a motor driver (actually it is a poor choice in any case). It is ancient and inefficient technology. It will waste 2 to 4 Volts of your motor power as heat.

I would recommend using a modern motor driver and an external DC to DC converter to drop the motor supply voltage to 5V.

I believe the L298 module provides very little 5v current and that may not be enough to power the Arduino.

...R

Okay, so I should use two batteries, one for the driver and one for Arduino, right?

strouhanka:
Okay, so I should use two batteries, one for the driver and one for Arduino, right?

What voltage are you connecting to the L298?

...R

Robin2:
I believe the L298 module provides very little 5v current and that may not be enough to power the Arduino.

...R

Depends on the module concerned - might have a 7805 1A regulator on it, some do, but the heatsinking
may be the limiting factor and also depends on the module details.

@Robin2
sorry for the late answer, I'm using a 9V battery

So if I use two power supplies, two 9V batteries, one for Arduino, one for the L298N motor driver, do I have to make other connections between these to except from the four direction pins?

Grounds need to be connected.

So I should connect 1 power supply GND to the Arduino GND, second power supply GND to the l298n driver and then add one more wire to connect arduino GND with driver GND, right?

Connect all GNDs to one power supply Gnd. I'd use the one that has to supply the most current.