3

I am trying to setup L298N motor driver controller with my Arduino. Different online schematics about how to connect them are mostly similar - but they differ in powering the Arduino from the drive controller's 5v pin.

I am connecting 7.5v to the Vin and Gnd to the motor driver controller screw terminal , and I wish the power the Arduino from the 5v screw terminal. Since I am planning to use the 5v screw terminal as output I am choosing to leave the 5v jumper on.

Here are 3 of the schematics I've found online,

  1. Source Homemade-circuits: enter image description here

This is what I was expecting to see. But from Arduino Uno Rev3 Faq,

Vin -- The input voltage to the Arduino board when it's using an external power source (as opposed to 5
volts from the USB connection or other regulated power source). You can supply voltage through this pin,
or, if supplying voltage via the power jack, access it through this pin.

5V -- This pin outputs a regulated 5V from the regulator on the board. The board can be supplied with power
either from the DC power jack (7 - 12V), the USB connector (5V), or the VIN pin of the board (7-12V).
Supplying voltage via the 5V or 3.3V pins bypasses the regulator, and can damage your board. We don't advise it.

This one looks wrong to me. I am under the assumption that Vin pin is expecting 7-12V because it's connected to voltage regulator which will cause a 2v drop. Which mean I should not connect 5v from the motor controller to Vin - making this schematic incorrect. Is my analysis correct? Here is an answer that says I can not use the 5v pin to power an Arduino since it an input pin and not an output pin.

  1. Source teachmemicro: enter image description here

This one looks ok to me since the 5v source at motor controller is a regulated source and that's what exactly Arduino is expecting on 5v pin based on aforementioned FAQ. Can I implement is safely?

  1. Source Instructables: enter image description here

I do not know if it's correct or not. Notice that the 5v screw terminal is not connected to Arduino in any way. Is it setup going to work? I am wondering where the Arduino is getting its power from?

I am wondering which schematic should I follow. I am hesitant to hook up my L298N motor driver and Arduino without without understanding why each schematic is choosing to power the Arduino differently.

3 Answers 3

2

Clearly, your design (last image) won't work, because as you expected, the Arduino won't have power. It is a feasible design however, if you use it while still developing and you have the USB cable connected. Because then the Arduino will draw the power for itself from there.

Vin expects 7-12V, but allows an unregulated input (which is fine for connecting a battery). You can use the 5V pin to supply power from a regulated output as well. Since (pressumably) the output of the motor driver is regulated, that could work, however I would not advise it and directly connect the battery to the VIn pin.

Connecting the 5V output of the motor driver to the VIn pin might work. While this will likely not destroy anything, it may be to low to drive the internal regulator, which might cause the Arduino to run on undervoltage levels. You might see weird behavior in that case (pins not correctly recognizing high from low, incorrect measurements on analog inputs or even software crashes).

7
  • If I understood it correctly, you are suggesting a 4th options which is connecting the motor drive controller and Arduino(using Vin and Gnd) in parallel to the 7.5v battery? Commented Jan 19, 2021 at 8:27
  • 1
    Yes, I would directly connect the Arduino to the battery.
    – PMF
    Commented Jan 19, 2021 at 8:30
  • 1
    I should have said that it would be my second choice. The quality of the power output of the motor controler may vary, while the one on the Arduino is known to be built for it. Also, a motor controller is subject (from the motors) to severe interferences, which I would try to avoid by reducing the connections to it to the required minimum.
    – PMF
    Commented Jan 19, 2021 at 8:50
  • 1
    You do not normally have to worry about that, since the loads that require external power (such as a motor driver) are designed already to have a very high resistance input and drive the output trough a series of transistors. If you were to build your own motor driver, you would need to ensure this yourself, though.
    – PMF
    Commented Jan 19, 2021 at 9:30
  • 1
    If you connect 5V from the motor board to the 5V pin on the Arduino, the varying loads on the motor controller's 5V line could cause the 5V input to the Arudino to bobble around (Even a regulated output fluctuates some under varying loads). That is an argument against that approach. You might want to add a filter capacitor between 5V and ground and close to the Arduino if you use that approach. It will even out the noise on the 5V line caused by changing loads.
    – Duncan C
    Commented Jan 19, 2021 at 20:58
0

I was facing same problem but I solved it by attaching L298 power pins to icsp power pins

icsp pins

Remember the voltage should be constant and there should not be any fluctuation other wise atmega will go in programming mode

-1

enter image description here

I happened to just set up a similar circuit yesterday on a RC car. L298 is powered through a 3S lipo batterie, Uno is powered through the 5v output which also powers a servo. Uno powers a rc receiver. I burnt an Uno trying to power both servo and receiver.

1
  • Please note the picture is the very first version when servo was powered from receiver and receiver from uno. Not a good option, sketchy servo behavior
    – Cobactan
    Commented Jan 20, 2021 at 19:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.