user69090: I have a very weird problem, at least it seems to me that way. I have connected L298N motor driver, Arduino and a hobby servo with a 6v power supply (tested with both 4xAA and 9v alkaline batteries). And wrote a simple program to rotate the servo every 10ms. There are no other motors connected as of yet.

Power supply is connected to the L298N 12v and GND.
Arduino is connected to the 5v and GND of L298N driver with the Vin and GND of Arduino respectively.
Servo's power (red wire) is connected to L298N 5v, GND is connected to the L298N's GND, and, servo's control (orange wire) is connected to pin 9 of Arduino.

The problem is that the servo hardly moves when Arduino gets power supply gets from the Vin input. However, if I connect it to the 5v of the Arduino power it works as expected. But I was under the impression that 5v pin of Arduino was to for the output and not for the input power supply. Could you guys please tell me what am I doing wrong here?


user62523: The Vin pin on the Arduino Uno board is connected to the input of the 5V onboard voltage regulator of the Arduino board.
This voltage regulator needs an input voltage that’s about 1.5V above its (regulated) 5V output that will feed the Arduino.
Arduino - note the recommended values of the Input Voltage (7-12V)
If you feed 5V into Vin, the voltage drop on the internal regulator will cause the Arduino board to be supplied with only about 3.5V, which is probably enough to make it function, but not enough to control the servos.
The solution, as you already found out, is to feed the 5V from the L298N board directly into the 5V pin of the Arduino. Please take care to measure the actual voltage from the L298N before you do this (it should be 5 Volts). Alternatively you could connect 12V to the Vin pin of the Arduino, but again, make sure you know what you’re doing.

69090: <p>I have a very weird problem, at least it seems to me that way. I have connected L298N motor driver, Arduino and a hobby servo with a 6v power supply (tested with both 4xAA and 9v alkaline batteries). And wrote a simple program to rotate the servo every 10ms. There are no other motors connected as of yet.</p>
<ol>
<li>Power supply is connected to the L298N 12v and GND.</li>
<li>Arduino is connected to the 5v and GND of L298N driver with the Vin and GND of Arduino respectively.</li>
<li>Servo's power (red wire) is connected to L298N 5v, GND is connected to the L298N's GND, and, servo's control (orange wire) is connected to pin 9 of Arduino.</li>
</ol>
<p>The problem is that the servo hardly moves when Arduino gets power supply gets from the Vin input. However, if I connect it to the 5v of the Arduino power it works as expected. But I was under the impression that 5v pin of Arduino was to for the output and not for the input power supply. Could you guys please tell me what am I doing wrong here?</p>
<p><a href="https://i.stack.imgur.com/8WM8d.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8WM8d.jpg" alt="enter image description here" /></a></p>
 62523: <p>The Vin pin on the Arduino Uno board is connected to the <strong>input</strong> of the 5V onboard voltage regulator of the Arduino board.</p>
<p>This voltage regulator needs an input voltage that’s about 1.5V above its (regulated) 5V output that will feed the Arduino.</p>
<p><a href="https://store.arduino.cc/arduino-uno-rev3" rel="nofollow noreferrer">Arduino - note the recommended values of the Input Voltage (7-12V)</a></p>
<p>If you feed 5V into Vin, the voltage drop on the internal regulator will cause the Arduino board to be supplied with only about 3.5V, which is probably enough to make it function, but not enough to control the servos.</p>
<p>The solution, as you already found out, is to feed the 5V from the L298N board directly into the 5V pin of the Arduino. Please take care to measure the actual voltage from the L298N before you do this (it should be 5 Volts). Alternatively you could connect 12V to the Vin pin of the Arduino, but again, make sure you know what you’re doing.</p>
