

applying both pins to LOW or both to HIGH will stop the motor. If you want the motor A to rotate in one direction, apply a HIGH pulse to IN1 and a LOW pulse to IN2.įor motor B, you should apply HIGH and the other one LOW the motor should rotate as per your logic. Input 1 and input 2 control motor A, and input 3 and 4 control motor B. The input pins control the direction the motors rotation. However, note that for small duty cycles, the motors might not spin, and make a continuous buzz sound. The motor speed is proportional to the duty cycle.

#L298n motor driver arduino how to
Now, that you’re familiar with the L298N Motor Driver, let’s see how to use it to control your DC motors. The input pins are used to control the direction of your DC motors, and the enable pins are used to control the speed of each motor. If you supply more than 12V, you should remove the jumperĪt the bottom right you have four input pins and two enable terminals. Jumper removed: you need to provide 5V to the +5V terminal. Jumper: jumper in place – uses the motors power supply to power up the chip.Acts as a 5V output if jumper is in place +12V: The +12V terminal is where you should connect your power supply.If you supply more than 12V, you need to remove the jumper and supply 5V to the +5V terminal. The +5V terminal is used to power up the L298N chip. The +12V terminal block is used to power up the motors. This three terminal block with +12V, GND, and +5V. The L298N H-Bridge module has facilitate with additional external input power supply source to handling handle starting current requirement for both DC motor. Let us build an example project that will rotate a DC motor in both direction with few seconds delay.Īs specified in L298N H-Bridge module the motor driver has a two motor terminal block to connect DC motor. Here is a diagram of the pinouts of an L298N integrated circuit: The L298N can also be used to drive a single stepper motor. This makes it ideal for robotic projects, as most robots have either two or four powered wheels. The L298N actually contains two complete H-Bridge circuits, so it is capable of driving a pair of DC motors. The L298N can handle up to 3 amperes at 35 Volts DC, which is suitable for most hobby motors. The difference between the family members is in the amount of current they can handle. The L298N is a member of a family of IC’s that all have the designation “L298”.

This causes change in spinning direction of the motor. Closing two particular switches at the same time reverses the polarity of the voltage applied to the motor. An H-Bridge circuit contains four switches with the motor at the centre forming an H-like arrangement. A common technique for doing this is to use an H-Bridge. The DC motor’s spinning direction can be controlled by changing polarity of its input voltage. H-Bridge – For controlling rotation direction The higher the duty cycle, the greater the average voltage being applied to the dc motor(High Speed) and the lower the duty cycle, the less the average voltage being applied to the dc motor(Low Speed).
#L298n motor driver arduino series
A common technique for doing this is to use PWM (Pulse Width Modulation) PWM is a technique where average value of the input voltage is adjusted by sending a series of ON-OFF pulses. The speed of a DC motor can be controlled by varying its input voltage. DC Motor Controlling can be achieved by combining these two techniques. In order to have a complete control over DC motor, we have to control its Speed and Rotation Direction. Coupling the L298N H-Bridge to a microcontroller like an Arduino Uno, ESP32 board will give you the ability to control both the speed and rotation direction of two DC motors. The L298N H-Bridge module is a simple way to achieve that. If you supply high pulse to both IN1 and IN2, then it will act as brake and your motor will stop rotating.In this tutorial, we will learn How to control DC motor with ESP32 using L298N-Bridge Motor driver ?.

If you supply low pulse to IN1 and high pulse to IN2, then your motor will rotate in reverse direction. The module is build to work on two inputs for each motor, if you power up the circuit and supply high pulse to IN1 and low pulse to IN2, then your motor will rotate in forward direction. It can drive motors from 2v to 10v with zero standby current. It also equipped with built-in thermal protection and automatic restore function. It can drive up to two dc motors or a 4-wire steeper motor, can be operate to change the motor direction and speed using PWM. This module is tiny and efficient to drive dc motors up to 2.5A without external heat sink.
