Specifications
- Controls 2 DC motors @2A max per DC motor, or one stepper motor
- Driver: L298N Dual H Bridge
- Driver input voltage: 5V~35V (or 7V~35V depending on power supply needs)
- Max average current Io: 2A each
- Maximum power dissipation: 20W@75 degree Celsius
- Control signal input level: High level 2.3V <= Vin <= Vss; Low: -0.3V <= Vin <= 1.5V
The onboard 78M05 linear regulator provided a stable 5V (up to 0.5A) that can be used to power the L298N H-bridge and other parts.
L298N block diagram
L298N pin connections
Logic table
L=Low, H=High, X=Don’t care, Z=High impedance, Vin=Input voltage, Vdrop=Voltage drop
Note: There is a voltage drop between the input voltage and the L298’s motor outputs, you can expect a 1V to 3V drop depend on the input voltage and current draw.
Schematic
How to Control DC Motors
The first DC motor is connected to Out1 and Out2 of the Motor Driver Controller Board which is controlled by In1 & In2. Set In1=HIGH and In2=LOW cause the motor to go forward, reverse the input signal (In1=LOW, In2=HIGH) cause the motor to go backward. Set both In1 & In2 to LOW make the motor stop immediately.
ENA is HIGH by default that make the motor running at a constant speed. In order to control the speed of the motor, the jummper must removed from EnA, then connect it to PWM capable digital output of a micro-controller.
In certain circumstances, ENA is connected to a non-PWM digital output of the micro-controller in order to stop the motor slowly.
The above connections and methods can be applied to controlling the second DC motor.
Controlling DC Motors with an Arduino
By connecting the L298N Motor Driver Controller Board to an Arduino, you can control two DC motors. Code below is the Arduino sketch that control two motors at a constant speed.
Controlling Motors speed with an Arduino
Sketch below control the speed of two DC motors.
Please remove the jumper from ENA & ENB, ENA & ENB is then connected to Digital 9 and Digital 10 respectively.
Stepper Motor Basics
There are two types of stepper motors: unipolar and bipolar stepper motors. A unipolar stepper motor only operates with positive voltage (requiring only one power source, e.g. 5V and 0). A bipolar stepper motor has two polarities (requiring two power sources, e.g. 2.5V and -2.5V).
- 4-wire motors are bipolar.
- 6-wire motors are unipolar.
- 8-wire motors can be run as either bipolar or unipolar.
Stepper Modes
Stepper motors can be driven in different patterns or sqeunces.
- Wave Drive (One-Phase on)
Consumes the least power, only one phase is energized at a time. - Full Step Sequence (unipolar stepper motor only)
In the full step sequence, two coils are energized at the same time which offers an improved torque-speed product and greater holding torque. - Half Step Sequence (unipolar stepper motor only)
In Half mode step sequence, motor step angle reduces to half the angle in full mode.
Note: The L298N only work with bipolar stepper motor, It would not work with unipolar stepper motor.
Controlling Bipolar Stepper Motors with an Arduino
There is a stepper library allows you to control unipolar or bipolar stepper motors, please click here for more information.
Related article
I also wrote an article on how to use a wireless router to control the L298N Module, please click here for details.