6

I read few posts and tutorials on this topic but none of them kind of answered my questions. I bought this L298N motor board and i have two motors that are rated 3V enter image description here

Now i am trying to understand how to connect it to arduino and power the motors.
For example i have a 12V (8x 1.5v AA batteries) I can connect to VCC and GND then enable ENA with a jumper and connect PWN port from arduino to INA. This way i can control the voltage that is coming out from OUTA and OUTB I can bring down the 12V to 3V.
Now the question is can i use the +5 (regulated voltage) on the driver board and connect it to arduino Vin and GND to ground to power the arduino? Is that viable solution. I actually tried it and it works. I am worried that it is not enough voltage to properly power the arduino. It's suggested to connect 7v - 12v to Vin. I am also going to connect a red lab ble shield on top of arduino that is powered by 5v

Another question is if i use 12 volts battery and step it down to 3v with PWN is that going to heat up the L298N chip?

enter image description here Another option is connecting 9V battery to arduino and then using Vin and GND to power the motor shield and the motors. The problem there if motor draws more then 1Amp that wouldn't be good for the arduino. Also if i would switch to 9v+ motors then it wouldn't work.

The third option is to have two separate power sources. 9V for arduino and 5v+ for powering the motors. Does it make sense to use two power sources?

This project seems like a good way to learn about arduino and electronics

Update

NEOMART Brand New Original High Quality Chips L298N http://www.amazon.com/gp/product/B00E58EA90/ref=oh_aui_detailpage_o04_s00?ie=UTF8&psc=1 Product Details 1. driver chip: L298N Dual H-Bridge Motor Driver IC

  1. drive section terminal supply area Vs: +5V ~ +35V; such as the need to take power within the board, the supply area Vs: +7V ~ +35V
  2. drive section peak current Io: 2A
  3. logical part of the terminal supply area Vss: +5V ~ +7V(can take power within the board +5V)
  4. logical part of the operating current range: 0 ~ 36mA
  5. Control signal input voltage range: Low:-0.3V ≤ Vin ≤ 1.5V High: 2.3V ≤ Vin ≤ Vss
  6. enable signal input voltage range: Low: -0.3 ≤ Vin ≤ 1.5V (control signal is invalid) High: 2.3V ≤ Vin ≤ Vss (control signal active)
  7. Maximum power consumption: 20W (when the temperature T = 75℃)
  8. Storage temperature: -25℃ ~ +130℃
  9. Driver Board Size: 48mm*43mm*33mm (with fixed copper pillar and the heat sink height)
  10. Other Extensions: control of direction indicators, the logic part of the plate to take power interface.

enter image description here

Update 2:

I wanted to clarify regarding using 12 volt battery and having 2 motors that I think max voltage is 3 volts. If i use PWN and step down the voltage to 3 volts will L298N produce a lot more heat to step the voltage down?
Probably in this case would be the best just to get two separate power supplies 9 volts for arduino and 4.5 volts for the motor drive to supply 3 volts for each motor. Unless i get better motors that support 6v - 9v then i can use the 12 volts battery for both arduino and motors.

As far as the motor drivers, I thought they are used to prevent the noise and power spikes from motors? I guess you still have to consider it either way.

Thanks in advance!

4
  • Can you post a link to the datasheet of that board?
    – jfpoilpret
    Aug 7, 2014 at 20:58
  • I couldn't find the data sheet for it. Everyone on amazon complained about it. I updated the answer with the link to the amazon page and some schematics but its pretty small picture.
    – Yan
    Aug 7, 2014 at 21:06
  • Found these 2 links: dx.com/p/… gives useful info of the board itself, while sparkfun.com/datasheets/Components/General/L298N.pdf is the datasheet of the IC L298N
    – jfpoilpret
    Aug 7, 2014 at 21:13
  • @Yan - there is an error in your question, "12V (6xAA batteries)" must be incorrect. 6 x 1.5V AA batteries, ordinary 'dry' cells, would be 9V, and 6 x 1.2V rechargeable ( e.g. NiMh) would be 7.1V. So do you have more than 6 batteries, or is the voltage lower than 12V?
    – gbulmer
    Aug 7, 2014 at 22:06

1 Answer 1

5

Here is a link to a robotoid page which describes a way to use it.
Here is a link to funnyrobotics which explains how to use it.

I am confident that you could use a search engine to find more examples.

One trick is to use image search. Then look for pictures which look like your photo, and which have extra writing on them. Most people who add labels and writing to the photo are writing to help beginners understand how to use something.

Edit: That L298N board claims to have a 5V regulator for powering the Arduino, in which case you could use a single power supply, and let the motor board feed the Arduino.

There are two schools of thought on powering the Arduino and motors:

  1. Use two separate power supplies, one for the motor and one for the Arduino.
  2. Use one supply for both the motor, and Arduino.

Using one supply is simple overall. One concern is electric motors can create a lot of electrical noise. If this is not adequately filtered, it might get injected into the Arduino and maybe cause the microcontroller to reset, or become temporarily unstable. The single supply advocates say the power supply to the Arduino should be properly filtered using capacitors and a proper voltage regulator usually, and the problem is solved.

I agree in principle. However, I have seen situations where the transient failure was so brief it looked 'mysterious'. It took time and effort to track it down. Sometimes it was because the motor power supply was underpowered. When the motor 'stalled', for example when changing direction, taking maximum current, the power supply voltage might dip enough to cause the Arduino supply to dip, and reset the chip.

Summary, if you are going to use a single power source for both motor and Arduino, ensure it has plenty of electrical noise filtering, and is a bit over-engineered to cope with the motor stalling. Specifically, it should be able to supply the motors stall current without dipping too low for the Arduino. The 'professional' approach is to have the Arduino monitor the main power supply, and detect that voltage dip. However, that is more complexity, and I suggest you avoid that.

Edit: If you are concerned you might have weird, hard to trace problems, using a single supply, try to design the system so that the Arduino can be 'unplugged' and given its own supply. That should be easy to do with that L298N board as the connections are screw terminals.

Using two separate power supplies should reduce the chances of electrical noise from the motors getting into the Arduino. In some circumstances is it useful to be able to change the motor power supply, or switch it off, without powering the Arduino off.

When the motor voltage is a lot higher than the 5V needed by the arduino, simple techniques to step down the voltage (linear regulators, like the part on that L298N board) convert the excess power to heat, which is quite inefficient. Much above, about, 18V it can generate enough heat to reach quite a high temperature (i.e. 100C) unless it has a good heatsink.

In that case, a simple, cheap solution is to use a second small power supply for the Arduino. An Arduino is likely using under 100mA, so a PP3 would be okay for, maybe, a few hours. A longer term approach is to step the motor voltage down efficiently.

If you use two power supplies, connect the two 'ground' (i.e. or most negative battery connections) together so that they have a common 'ground' reference. That way the Arduino signals will control the motor driver reliably.

Edit: PWM does not step down voltage. It gives the illusion of less power because the full voltage is only applied for a fraction of each millisecond. When it is on, it is providing (very close to) the full 'motor' voltage. If the 'motor voltage' connected to that L298N board is 12V, then the motor will see 12V.

However, even if the motor is rated at only 3volts, it is unlikely to break only because 12V is applied across it. A 3V motor is as likely to break because it gets too hot, or spun too fast (e.g. the bearings get damaged).

It will likely get too hot under load, or spin too fast if the PWM signal is on for more than, WAG 50% of the time (but there is no warranty with WAG = Wild-A$$-Guess).

If, and only if, your software doesn't run PWM more than 50%, then those motors may be okay. That is a risk I might be prepared to take if the motors are cheap, and replacements easy to get.

Skimming the datasheet, the L298N needs an absolute minimum motor supply of 2.3V+2.5V = 4.8V.
Also, the output switches which control the motor appear to 'drop' a minimum of 1.8volts.
So I think it would be okay with 6V or 7.2V (maybe upto 9V) motor voltage.

IIRC the arduino will work okay with 7.2V upwards, i.e. 6 x NiMh batteries. A higher voltage is just converted to heat by the on-board voltage regulator. I might be tempted to experiment with the L298N boards 5V output, unless you have seen complaints about it.

I am assuming the motors are brushed DC motors (and not steppers or something exotic)

The motor driver will handle switching the current that the motor needs. However, each time the current is switched on or off, the motor will draw current, or generate current (remember it is a motor and also a generator). That could cause the power rail to dip, or even feed current into power or ground. There are diodes on the board to prevent those spikes doing anything awful to the chip, but there is still current flowing through wires.

Further, every rev of the motor, the brushes will break one connection, and make a different connection with the commutator, typically 6 times. (The commutator is the mechanical system that directs the current to flow the correct way round in the motors spinning electromagnet). That creates electrical noise. In some cases so much that you can hear it on an old fashioned radio receiver or analogue TV.

So noise may be a problem. People typically put a 10nF-100nF, relatively high voltage (say 50V), capacitor directly across the motors power connections, at the motor end.

If things get bad, I did a quick search and this blog looked okay, it illustrates ways to use capacitors and inductors to reduce motor noise.

I wouldn't worry too much. Put 10nF-100nF across the motor wires, and see what happens.

3
  • Thanks for the reply. I updated my question and it's 8 AA batteries not 6. I seen these tutorials and i am able to get the motors running but i am new to electronics and wanted to know the logistics behind connecting motors to the driver and arduino plus stepping down voltage and effect on the driver chip. Also i don't think any of these tutorials talked about powering the arduino itself. I am not sure it is assumed that is powered from USB or need a separate power source
    – Yan
    Aug 7, 2014 at 22:39
  • Thank you very much!!! This is exactly the information i was looking for which was not included in the other tutorials. This greatly helps me to continue on with the project. If don't mind i updated the question with few more questions that i want to ask you. Either way i am accepting the answer :) Have a great day!
    – Yan
    Aug 8, 2014 at 1:54
  • This is a severely underappreciated answer. Sep 12, 2018 at 21:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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