On this venture, we are going to see methods to management a DC Motor utilizing Arduino and L298N Motor Driver. There are other ways to manage a DC Motor however the Arduino DC Motor Management utilizing L298N Motor Driver is turning into fairly common for a lot of causes.

Overview

A DC Motor is the best of motors that learners and hobbyists encounter. It is rather easy to function: join the 2 leads of the motor to the 2 terminals of a battery and voila! Your motor begins rotating.

Should you swap the leads i.e. reverse the polarity, the motor will rotate in the reverse route. It is so simple as that.

If you wish to manage the pace of rotation of an easy DC Motor, then there’s an approach known as PWM DC Motor Management. The Pulse Width Modulation or PWM sign generated by this method will enable us to manage the typical voltage that’s being delivered to the DC Motor.

Velocity Management of DC Motor utilizing PWM

Utilizing the PWM approach, the typical worth of the voltage that’s utilized to the DC Motor is managed by turning the ability on and off at a really excessive charge. The frequency of this switching shall be within the order of a few tens of kiloHertz.

Now, the typical voltage utilized to the DC Motor will depend upon what known as because of the Responsibility Cycle of the PWM Sign. Responsibility Cycle of a PWM Sign is nothing however the ratio of the time for which the sign is ON or HIGH to the full-time interval of the sign i.e. the sum of ON time and OFF time.

Responsibility Cycle is normally expressed in % and the next to determine represents totally different PWM Indicators of a 12V provide with totally different responsibility cycles of 0%, 25%, 50%, 75%, and 100% respectively.

Arduino DC Motor Control using L298N PWM Duty Cycle

Now that we have now managed the typical voltage that’s to be equipped to a DC Motor, how can we apply this voltage to the motor? Right here comes the usage of Transistor.

The PWM Sign from any supply like Arduino on this instance may be given to the gate of a MOSFET and relying on the responsibility cycle of the PWM Sign, the pace of the DC Motor will range.

The next picture exhibits an easy circuit diagram, the place a PWM output from Arduino is given to a MOSFET and the 12V DC Motor is linked by means of the MOSFET.

Arduino DC Motor Control using L298N MOSFET

The code for this circuit is given beneath. Utilizing this code, the Arduino will range the pace of a DC Motor in a fading vogue i.e. steadily will increase the pace to peak after which steadily decreases the pace to halt.

Code


This circuit is sweet for controlling the pace of the motor however not an efficient option to change the route of rotation. For altering the route of rotation without reversing the leads of the motor each time, it’s good to use a particular circuit known as H-Bridge.

DC Motor Management utilizing H-Bridge

An H-Bridge is an easy digital circuit consisting of 4 switching parts like transistors (BJT or MOSFET) that may drive a motor in each the instructions without switching the leads.

The title “H-Bridge” refers back to the look of the connection consisting of 4 transistors and a motor within the heart forming the letter “H”.

An easy H-Bridge connection utilizing 4 transistors and a motor are proven beneath. By activating two explicit transistors on the identical time, we are able to manage the movement of the present by means of the motor and therefore the route of rotation.

Arduino DC Motor Control using L298N H-Bridge using Transistors

The 2 management inputs A and B within the above circuit will decide the route of rotation of the motor. If A is LOW and B is HIGH, transistors Q1 and This autumn shall be turned on and permit present to move by means of the motor in a specific route.

If the management enters A is made HIGH and B is LOW, then transistors Q2 and Q3 will activate and the move of the present by means of the motor is reversed and so the route of the rotation.

By combining each the options i.e. PWM approach for pace management and H-Bridge connection for route management, you possibly can have whole management on a DC Motor.

It’s tedious to make use of transistors for making an efficient H-Bridge connection. For this objective, there are devoted H-Bridge Motor Driver IC obtainable out there and the 2 frequent IC’s are L293D and L298N.

We’ve got already seen methods to manage the pace of a DC Motor utilizing L293D in an earlier venture. On this venture, we are going to deal with the extra superior L298N Motor Driver and see Arduino DC Motor Management utilizing L298N Motor Driver utilizing PWM approach. 

A Temporary Notice on L298N Motor Driver

L298N Motor Driver IC is a 15-lead excessive voltage, excessive present Motor Driver IC with two full bridge drivers. The logic ranges of L298N IC are suitable with customary TTL and IC can be utilized to drive totally different inductive masses like DC Motors, Stepper Motors, Relay, and so on.

The next picture exhibits the Pin Diagram of the L298N IC in Multiwatt Bundle (Multi Leaded Energy Bundle).

Arduino DC Motor Control using L298N Motor Driver Pin Diagram

For the reason that L298N Motor Driver IC is a twin full bridge driver IC, you possibly can management two motors on the identical time with particular person inputs. The logic provides voltage is 5V, however, the motor provide voltage may be as excessive as 45V. The height output present per channel is 2A.

Typically, L298N Driver is obtainable as modules that incorporates all the mandatory parts and connectors for controlling two DC Motors. One such module is proven beneath. I’ll clarify a few vital parts on this module.

Arduino DC Motor Control using L298N Motor Driver Module

The L298N Motor Driver Module consists of two 2-pin screw terminal blocks for connecting two motors. It additionally has six pin male headers for connecting the 2 allow inputs and the 4 enter pins (two for every motor).

There’s a 3-pin screw terminal block by means of which it’s good to give the provision voltage to the motor. If the motors used are rated for 12V or much less, then the 12V provide is given by means of this screw terminal and the onboard 5V regulator will present the 5V logic provide to the L298N IC.

Arduino DC Motor Control using L298N Motor Driver Module Pins

You can too entry this regulated 5V by means of the third pin within the 3-pin screw terminal block. The jumper supplied close to the 3-pin screw terminal should be engaged to provide voltages as much as 12V as this jumper will allow the onboard regulator. The 5V output from the third pin of the 3-pin screw terminal is obtainable solely when the jumper is engaged i.e. provide voltage is 12V. This 5V output can be utilized to energy your Arduino Board.

If the provision voltage is bigger than 12V, then take away the jumper as it would harm the regulator. In this case, the logic provides of 5V to the L298N IC is given by means of the third pin of the 3-pin screw terminal.

Arduino DC Motor Management utilizing L298N

We are going to now see an easy circuit the place we management the pace and route of a DC Motor utilizing Arduino and L298N IC. You want a few extra parts for this venture and the entire listing is given beneath. Within the Arduino DC Motor Management utilizing L298N Undertaking, we are going to management each the functionalities of an easy DC Motor i.e. pace and route of rotation utilizing a mixture of PWM Sign and L298N (H-Bridge).

Circuit Diagram

Arduino DC Motor Control using L298N Circuit Diagram

Elements Required

Code

Purposes 

  • Arduino DC Motor Management utilizing L298N Motor Driver venture may be the start step of many superior initiatives. 
  • Virtually all robots have wheels and we have to manage the motors linked to these wheels. Therefore, any Arduino based mostly robotic can implement the sort of motor management utilizing L298N. 
  • Among the Robotic Purposes of L298N Motor Driver is Hand Gesture Managed Robotic, Line Follower Robotic, Impediment Avoiding Robotic, and so on.

LEAVE A REPLY

Please enter your comment!
Please enter your name here