Min menu

Pages

project 3 :DC Motor Control using L298N Motor Drive

Arduino DC Motor Control using L298N Motor Driver


In this project, we will see how to control a DC Motor using Arduino and L298N Motor Driver. There are different ways to control a DC Motor but the Arduino DC Motor Control using L298N Motor Driver is becoming quite popular for many reasons.

Speed Control of DC Motor using PWM

Using PWM technique, the average value of the voltage that is applied to the DC Motor is controlled by turning the power on and off at a very high rate. The frequency of this switching will be in the order of few tens of kilo Hertz.
Now, the average voltage applied to the DC Motor will depend on what is called as the Duty Cycle of the PWM Signal. Duty Cycle of a PWM Signal is nothing but the ratio of the time for which the signal is ON or HIGH to the total time period of the signal i.e. sum of ON time and OFF time.
arduino ide,arduino uno,arduino projects,arduino nano,arduino kit,arduino vs raspberry pi,arduino mega,arduino board,arduino array,arduino analogread,arduino analogwrite,arduino analog input,arduino accelerometer,arduino amazon,arduino attachinterrupt,arduino absolute value,a=arduino matlab,a arduino uno,a arduino nano,a arduino.cc,a arduino door lock,arduino a technical reference pdf,arduino a/d converter,arduino a excel,arduino bluetooth,arduino button,arduino bluetooth module,arduino buzzer,arduino blink,arduino breadboard,arduino button wiring,arduino b-l072z-lrwan1,arduino b tech projects,port b arduino,ads-b arduino,fdx-b arduino,ga6-b arduino,irig-b arduino,usb b arduino,arduino code,arduino create,arduino camera,arduino code language,arduino controller,arduino clock,arduino case,arduino christmas lights,c arduino programming,c arduino tutorial,c arduino pdf,c arduino library,c arduino serial communication,c arduino string,c arduino array,c arduino programming pdf,arduino download,arduino delay,arduino due,arduino digitalwrite,arduino digitalread,arduino data types,arduino display,arduino delay function,d arduino serial print,arduino d/a converter,arduino d pad,arduino d-sun,arduino d flip flop,arduino d pins,arduino d/a converter shield,arduino d f,arduino ethernet,arduino else if,arduino esp32,arduino editor,arduino ethernet shield,arduino esp8266,arduino eeprom,arduino encoder,e arduino ide,arduino e ink display,arduino e-paper,arduino ebook,arduino e paper library,arduino e ink screen,arduino e ink project,arduino e ink library,arduino for loop,arduino for,arduino functions,arduino forum,arduino float,arduino for kids,arduino for beginners,arduino float to string,f arduino uno r3,arduino f macro,arduino f_cpu,arduino f macro string,arduino f_cpu value,arduino f(__date__),arduino f after number,arduino f(__time__),arduino gps,arduino guitar pedal,arduino gyroscope,arduino gps tracker,arduino global variable,arduino gui,arduino getting started,arduino game controller,arduino g code,arduino g code interpreter,arduino g sensor,arduino g force sensor,arduino g code sender,arduino g meter,arduino g force meter,arduino g code reader,arduino humidity sensor,arduino hello world,arduino hall effect sensor,arduino home automation,arduino heart rate monitor,arduino help,arduino halloween,arduino hid,.h arduino,arduinojson.h,arduino h bridge,arduinoota.h,arduino.h download,arduino ble.h,arduinohttpclient.h,arduino modbus.h,arduino if,arduino interrupt,arduino int,arduino if else,arduino i2c,arduino ide windows,arduino ir sensor,i arduino app,i arduino nano,i arduino due,arduino i/o expansion board,arduino i/o shield,arduino i/o expander,arduino i/o pins,arduino i was not declared in this scope,arduino joystick,arduino json,arduino jobs,arduino joystick library,arduino jumper wires,arduino java,arduino joystick controller,arduino joystick code,arduino j type thermocouple,arduino j-link,arduino jlink programmer,j-link arduino ide,termopar j arduino,svm30-j arduino,termopar tipo j arduino,termocupla tipo j arduino,arduino keyboard,arduino keypad,arduino kit amazon,arduino kit projects,arduino keyboard input,arduino keypad library,arduino kit for kids,arduino k type thermocouple,arduino k-line,arduino k type temperature sensor,arduino k type thermocouple temperature sensor,arduino k type thermocouple code,arduino k-line library,arduino k type thermocouple shield,arduino k-bus,arduino language,arduino lcd,arduino led,arduino leonardo,arduino library,arduino led strip,arduino light sensor,arduino led projects,l arduino nano,arduino l led always on,arduino l light stays on,arduino l led flashing,arduino l led not blinking,arduino l led meaning,arduino lc meter,arduino l light blinks all the time,arduino micro,arduino map,arduino motor,arduino millis,arduino microcontroller,arduino mini,arduino mega pinout,arduino m_pi,arduino m.2,arduino mbot,arduino m_e,arduino myserial,lte-m arduino,cp/m arduino,arduino nano pinout,arduino nano every,arduino nano 33 ble,arduino nano schematic,arduino nano 33 iot,arduino nano projects,arduino nano pwm pins,in arduino,in arduino code,in arduino programming,in arduino programming what does isspace() do,in arduino programming delay(100) results in a delay of,in arduino analog value range usually from,in arduino with what extension the subroutine file is saved,in arduino the function serial.read() is,arduino online,arduino or,arduino oled,arduino oscilloscope,arduino online ide,arduino or raspberry pi,arduino online simulator,arduino output voltage,o arduino uno,o arduino é um microcontrolador,arduino o'reilly,oled arduino,arduino o_write,arduino .o files,arduino o'reilly book pdf,arduino o que é,arduino programming,arduino programming language,arduino pro micro,arduino pwm,arduino pro mini,arduino pinmode,arduino power supply,arduino p channel mosfet,arduino p mosfet,arduino p channel mosfet 12v,arduino p controller,arduino p channel mosfet tutorial,arduino quadcopter,arduino quadrature encoder,arduino queue,arduino quadruped,arduino quiz,arduino qr code reader,arduino qr code,arduino questions,arduino q and a,qtouch arduino,q=canopen arduino,/search q=arduino,get /search q=arduino http/1.0,arduino q es,que es un arduino,que es el arduino,arduino robot,arduino random,arduino reference,arduino relay,arduino robot kit,arduino random number,arduino rotary encoder,arduino relay module,r arduino serial,arduino r macro,arduino r 3,arduino r string,arduino r_trig,arduino r/c,arduino r-2r,arduino r-2r ladder,arduino serial,arduino starter kit,arduino software,arduino servo,arduino simulator,arduino sensors,arduino serial print,arduino stepper motor,s_arduino_node,arduino s meter,arduino s curve,arduino s-video output,arduino .s file,arduino s-bus decoder,arduino s.port frsky,arduino s.port,arduino temperature sensor,arduino timer,arduino tutorial,arduino time,arduino tone,arduino touch screen,arduino thermistor,arduino teensy,t arduino serial,arduino t shirt,arduino t flip flop,arduino t rex game,arduino t type thermocouple,arduino t.every,arduino t shirt india,arduino t shirt sri lanka,arduino uno pinout,arduino ultrasonic sensor,arduino uno projects,arduino uno schematic,arduino uno datasheet,arduino uno wifi,arduino uno kit,arduino u n o,arduino u-blox,arduino uint,uint8 arduino,arduino uint32,u-center arduino,8f328p-u arduino,atmega328p u arduino,arduino voltage,arduino variable types,arduino vin,arduino voltage sensor,arduino voltmeter,arduino vs evil,arduino vibration sensor,arduino v in,arduino v-usb,arduino v-usb library,arduino v plotter,arduino v-usb keyboard,arduino v-tail mixer,arduino v evil,arduino wifi,arduino web editor,arduino while,arduino wire,arduino wifi module,arduino weather station,arduino wifi shield,arduino water level sensor,e.l arduino,arduino w/ atmega328,arduino with solenoid,w-24byj arduino,7941 w arduino,logo arduino,arduino w akcji,arduino w akcji pdf,arduino xbee,arduino xbox controller,arduino xor,arduino xbee shield,arduino xinput,arduino xiao,arduino xbee library,arduino xy plotter,arduino x plane 11,arduino x y plotter,arduino x plane interface,arduino x was not declared in this scope,arduino x ray,arduino x ray scanner,arduino x y table,arduino x y z sensor,arduino yun,arduino youtube,arduino yield,arduino yun rev 2,arduino yun vs uno,arduino yun pinout,arduino yellow light flashing,arduino yun shield,arduino y python,arduino y labview,arduino y raspberry,arduino y matlab,arduino y alexa,arduino y sus partes,arduino y bluetooth,arduino y java,arduino zero,arduino zigbee,arduino z wave,arduino zero vs uno,arduino zero pinout,arduino zero schematic,arduino zoetrope,arduino zigbee shield,arduino z wave smartthings,arduino z wave hub,arduino z wave controller,arduino z wave library,arduino z,arduino z wave plus,arduino z probe,arduino 0-10v output,arduino 0-10v output shield,arduino 0-5v output,arduino 0b,arduino 0016,arduino 0.96 oled,arduino 0-255,arduino 0x,0 arduino code,arduino 0-10v input,arduino 0-10v dimmer,arduino 0-10 volt output,arduino 0-5v analog output,arduino 12v,arduino 101,arduino 1.8.13,arduino 12v power supply,arduino 12v relay,arduino 120v relay,arduino 16x2 lcd,arduino 12v output,1 arduino mkr1000 board,1. arduino uno board,1. arduino ide,1 arduino uno r3,arduino 1 wire,arduino 1 button 2 led,arduino 1 wire temperature sensor,arduino 1 button 3 led,arduino 2560,arduino 2d array,arduino 2560 pinout,arduino 24v,arduino 28byj-48,arduino 220 ohm resistor,arduino 24v relay,arduino 2.4ghz transmitter,2 arduino serial communication,2 arduino communication,2 arduinos,2 arduino i2c,2 arduino spi communication,2 arduino i2c communication,2 arduino serial communication example,2 arduino communication wireless,arduino 3d printer,arduino 33 ble,arduino 3.3v,arduino 33 ble sense,arduino 3d scanner,arduino 32u4,arduino 33 iot,arduino 3d print projects,3 arduino serial communication,3 arduino communication,3 arduino i2c,3 arduino nano,3 arduino uno,arduino 3 phase motor control,arduino 3 phase inverter,arduino 3 phase brushless motor control,arduino 433mhz,arduino 4-20ma,arduino 4g,arduino 4x4 keypad,arduino 4-20ma input,arduino 433mhz sniffer,arduino 4 relay module,arduino 4k camera,arduino 4-20ma output,arduino 4 digit display,arduino 4 relays shield,arduino 4 pin fan control,arduino 4 channel relay,arduino 5v,arduino 5v output current,arduino 5v relay,arduino 5v pin,arduino 5v output,arduino 5v pin max current,arduino 5v to 3.3v,arduino 5g,5 arduino projects,5 arduino boards,$5 arduino,arduinojson 5,arduino 5 axis cnc,arduinojson 5 to 6,arduinojson 5 github,arduino 5 minute timer,arduino 64 bit,arduino 6502,arduino 64 bit integer,arduino 6v,arduino 64 bit mac,arduino 6 pin header,arduino 6502 emulator,arduino 6v motor,arduinojson 6,arduino 6 axis robot arm,arduinojson 6 library,arduino 6 axis accelerometer,arduinojson 6 mqtt,arduinojson 6 printto,arduinojson 6 github,arduino 7 segment display,arduino 74hc595,arduino 7 segment display 4 digit,arduino 7 segment clock,arduino 7 segment display counter,arduino 7 segment display library,arduino 7 segment display multiplexing,arduino 74hc165,7 arduino touch screen,7 arduino touch screen shield,7 arduino touch screen shield with/ssd1963,7 arduino display,arduino 7 segment display code,arduino 8x8 led matrix,arduino 8 relay module,arduino 8 channel relay,arduino 8266,arduino 8 segment display,arduino 8 relay module wiring,arduino 8x8 led matrix projects,arduino 8x8 led matrix scrolling text,arduino 8 bit,arduino 8 bit music,arduino 8 bit computer,arduino 8 ohm speaker,arduino 8 channel relay code,arduino 9v battery,arduino 9v power supply,arduino 9v battery connector,arduino 9v battery life,arduino 9600,arduino 9 volt power supply,arduino 915mhz,arduino 9 axis motion shield,arduino 9 bit serial,arduino 9 volt battery,arduino 9 axis motion shield example,arduino 9 dof,arduino 9 axis motion shield library,arduino 9 bit uart

Code


int PWMPin = 10;

int motorSpeed = 0


void setup()

{


}


void loop()

{


for (motorSpeed = 0 ; motorSpeed <= 255; motorSpeed += 10)

{

analogWrite(PWMPin, motorSpeed);

delay(30);

}


for (motorSpeed = 255 ; motorSpeed >= 0; motorSpeed -= 10)

{

analogWrite(PWMPin, motorSpeed);

delay(30);

}

}
reaction: