Search by Vehicle

L298P Motor Driver Shield

$ 25.55

Category: Brand:
The Fun­du­Mo­to L298P Motor Dri­ver Shield is a mul­ti-fea­tured motor shield based around the L298P dri­ver chip and fits Arduino Uno or oth­er Arduino with com­pat­i­ble I/O pins.KEY FEATURES OF L298P MOTOR DRIVER SHIELD:Dri­ve 2 DC motors at 4.8–24V at up to 2A peak (2.5A peak) cur­rent.Built-in Schot­tky diodes to pro­tect against motor back EMF.Dri­ve 1 ser­vo motor with a ded­i­cat­ed 5V reg­u­lat­ed pow­er.Built-in buzzer.Remote reset switch.Blue­tooth con­nec­tor (x2).Ultra­son­ic Range Find­er Ping con­nec­tor.RGB LED con­nec­tor6 Analog/digital pins brought out to 3‑pin head­ers with 5V and Gnd avail­able for each input for easy sen­sor hookup.Stack­ing female con­nec­tors for sup­port­ing anoth­er daugh­ter card.Can option­al­ly pow­er attached Arduino off the shield.Logic Power subsystemThe Arduino 5V is brought up to the shield and is avail­able on the 6 sets of red sen­sor 5V pins, the yel­low Ping con­nec­tor for Ultra­son­ic Rangefind­ers and the 2 blue dig­i­tal con­nec­tors. It is also used to pow­er the log­ic por­tion of the L298P chip.  This ensures that they have good clean 5V pow­er inde­pen­dent of what the motors are doing.The Arduino 3.3V is brought up to the shield and is avail­able on the 2 Blue­tooth con­nec­tors.The Arduino can be pow­ered sep­a­rate­ly using the nor­mal USB or DC pow­er con­nec­tor or it can also be pow­ered from the Shield.   To select this, there is a jumper near the elec­trolyt­ic cap labeled ‘OPT’.  When this jumper is removed, the Arduino must be pow­ered sep­a­rate­ly.  When the jumper is installed, the pow­er from the motor VMS pow­er con­nec­tor is con­nect­ed to the Vin pin on the Arduino which feeds the Arduino on-board 5V reg­u­la­tor.  To use this option, the motor pow­er input must be at least 6.5V to feed the reg­u­la­tor.  If pow­er­ing the Arduino off the shield, the DC pow­er jack on the Arduino should not be used to avoid a pow­er con­flict, but the USB can be used.Motor Power SubsystemThe motor pow­er comes in on the 2‑pos screw ter­mi­nal.  The VMS is the pos­i­tive motor volt­age which can range from 4.8 to 24V.  If you are using this input to pow­er the Arduino by installing the ‘OPT’ jumper, the max­i­mum input volt­age on this ter­mi­nal should be lim­it­ed to 12V to avoid over­heat­ing the Arduino reg­u­la­tor.     1 x 2 Screw Ter­mi­nal (Motor Pow­er)VMS = Motor Vcc which must be between 4.8 and 24V.GND = Motor GroundThis motor pow­er is fed to a 5V reg­u­la­tor that is mount­ed to the bot­tom of the shield.  This 5V feeds the white ser­vo con­nec­tor.  This iso­lates any ser­vo elec­tri­cal noise from get­ting back into the main 5V that pow­ers the log­ic. For this 5V reg­u­la­tor to func­tion, the VMS volt­age must be at least 6.3V.Note that if you have the OPT jumper in place and USB con­nect­ed, but there is no pow­er on the VMS motor con­nec­tor, it will try to use the USB pow­er to pow­er the DC motors.  This should be avoid­ed.If you have the OPT jumper in place and pow­er com­ing on the DC Jack on the Arduino, it will work but the DC motor noise will be cou­pled into the 5V log­ic pow­er sup­ply and may cause erad­i­cate behav­ior and so it is not real­ly rec­om­mend­ed.  In gen­er­al, if you are using the motors, you should plan to bring the motor pow­er in on the VMS pow­er con­nec­tor for the most sta­ble oper­a­tion.Driving DC MotorsThe L298P con­tains two full H‑Bridge dri­ve chan­nels that pro­vide full speed and direc­tion con­trol.  The 2 DC motor dri­ve chan­nels can oper­ate at volt­ages from 4.8 – 24V and at cur­rents of up to 2.0A (2.5A peak) per chan­nel.You can also have 2 motors share a motor dri­ve chan­nel as long as the com­bined cur­rent stays with­in the 2A and you don’t mind the motors turn­ing the same direc­tion and speed.  This is typ­i­cal­ly the case when you have a 4 wheel dri­ve robot­ic vehi­cle and the 2 wheels on each side oper­ate at the same speed and direc­tion.The L298P motor dri­ver uses Arduino pins D10, D11, D12 and D13 for motor con­trol.  Pins 10 & 11 are PWM pins and con­nect to the chip EN pins to pro­vide speed con­trol by mod­u­lat­ing the enable input.  D10 con­trols speed of motor A and D11 con­trols speed of motor B.Pins 12 & 13 are con­nect­ed to the IN inputs to pro­vide direc­tion con­trol.  Pin 12 con­trols direc­tion of motor A and Pin 13 con­trols direc­tion of motor B.  Usu­al­ly there are 2 pins used to deter­mine the direc­tion of rota­tion for each motor, but this shield has an invert­er that pro­vides an invert­ed ver­sion of the sig­nal to the two pins.  This reduces the num­ber of pins used on the Arduino, but it does remove the abil­i­ty to do dynam­ic brak­ing which usu­al­ly isn’t an issue for most projects.  Reduc­ing the speed con­trol pins to a PWM val­ue of zero will get things stopped.Speed PinsSpeed Con­trolDirec­tion PinsDirec­tion Con­trolMotor AD10PWM 0–100D12HIGH = For­wardLOW = ReverseMotor BD11PWM 0–100D13HIGH = For­wardLOW = ReverseDC Motor ConnectionsThe motor con­nec­tions are via a 4 screw ter­mi­nal block with 2 ter­mi­nals for each motor that are labeled MOTORA and MOTORB.The /- pins for each motor are not labeled, so it is some­what arbi­trary how your wire them and rel­a­tive to what you con­sid­er for­ward vs reverse motor oper­a­tion.  Basi­cal­ly if the motor goes in the oppo­site direc­tion than you expect, sim­ply reverse the wiring for that motor.     1 x 4 Screw Ter­mi­nal (Motor Con­trol)Motor A Pos­i­tive LeadMotor A Neg­a­tive LeadMotor B Pos­i­tive LeadMotor B Neg­a­tive LeadThese motor con­nec­tion points are also mir­rored on a 4‑pin female head­er for a lit­tle more flex­i­bil­i­ty.These motor dri­ve leads also have yel­low and green LEDs attached to them.  Their bright­ness will vary depend­ing on the strength of the PWM sig­nal1 x 4 Female Head­er (Black)MA = Motor A con­nec­tion (x2)MB = Motor B con­nec­tion (x2) Servo Motor ConnectionsSer­vo motors are 3 wire devices.  They require 5V, Ground and a PWM sig­nal to set its posi­tion.  The shield uses D9 for the PWM sig­nal.  One nice fea­ture of these mod­ules is that it has a ded­i­cat­ed 5V reg­u­la­tor to pow­er the ser­vo to pre­vent elec­tri­cal noise from get­ting back into the main 5V log­ic pow­er.Ser­vos are typ­i­cal­ly used to turn a small steer­ing wheel or to rotate a sen­sor, such as an ultra­son­ic rangefind­er for obsta­cle avoid­ance.To use the ser­vo, you will need to have a min­i­mum of 6.3V on the main motor pow­er con­nec­tor for the reg­u­la­tor to oper­ate.If you are not using a ser­vo, D9  as well as this ded­i­cat­ed 5V is avail­able for oth­er uses.       1 x 3 Ser­vo Head­er (White)   G = Ground 5V = Ded­i­cat­ed 5V for pow­er­ing ser­vo motor   9 = D9 is the PWM pin that the ser­vo is dri­ven off of.  This pin is avail­able for oth­er use if not using it to dri­ve a ser­vo motor.Arduino to Shield Pin ConnectionsAll of the I/O is brought up to stack­able female head­ers on the shield except for the IOREF and the two I2C pins hear the USB con­nec­tor so it can sup­port a daugh­ter shield as long as it does not con­flict with the pins in use.  In addi­tion, many of these pins are bro­ken out to oth­er head­ers for easy hookup.The shield uses the fol­low­ing pins which remain avail­able if you are not using that func­tion:Ultra­son­ic Sen­sor Ping Con­trol = D7, D8Ser­vo motor con­trol = D9DC motor con­trol =  D10,D11, D12, D13Buzzer = D4BluetoothThere are two Blue­tooth con­nec­tors on the boardThe first con­nec­tor is a 4‑pin head­er that brings out 3.3V pow­er, ground, TX and RX.  This type of con­nec­tor is com­pat­i­ble with HC-06 Blue­tooth mod­ules and per­haps some oth­ers.  The Receive pin has a 1K/2K volt­age divider to lev­el shift the TX out­put of the Arduino to be 3.3V com­pat­i­ble which is a nice fea­ture.     1 x 4 Blue­tooth ‘BT2’ Female Head­er (Black)‘ ‘ =  3.3V‘–‘ = GroundT = D0 (RX)R = D1 (TX)The oth­er Blue­tooth head­er is a 12-pin male head­er.  The TX, RX  5V and ground are hooked up to this head­er.  The only 12-pin Blue­tooth con­nec­tors are gen­er­al­ly asso­ci­at­ed with auto­mo­biles, so this con­nec­tor does not seem to be of much use.  The pin spac­ing is also 2mm rather than the stan­dard 2.54mmUltrasonic RangefinderA com­mon robot­ic inter­face is Ultra­son­ic Rangefind­ers such as the HY-SRF05.  These work by send­ing out a ping of ultra­son­ic sound and tim­ing how long it takes for the ping to come back.  The board has a ded­i­cat­ed 4‑pin head­er to con­nect the sen­sor.     1 x 4 Ping Male Head­er (Yel­low)  = 5VR = Return (D8)T = Trig­ger (D7)G = GroundAnalog / Digital SensorsA com­mon issue when hook­ing sen­sors up to an Ardi­no is that many require ground/Vcc con­nec­tions as well as an ana­log input or dig­i­tal I/O.  This board brings out the A0-A5 pins to a row of head­ers that also pro­vide sep­a­rate pow­er and ground points for each A0-A5 pin .  The white head­ers are the sig­nal lines, the red head­ers pro­vide 5V and the black head­ers pro­vide ground.The The  A0-A5 pins can be used either for ana­log inputs or as dig­i­tal I/O, so both types of sen­sors can be sup­port­ed.     3 x 6 Head­er (White/Red/Black)A0 / 5V / GroundA1 / 5V / GroundA2 / 5V / GroundA3 / 5V / GroundA4 / 5V / GroundA5 / 5V / GroundThere is also a 3‑pin blue head­er that that brings out 5V, ground and D2 that can be used for a dig­i­tal sen­sor or oth­er remote con­nec­tion      1 x 3 Head­er (Blue)G = Ground‘ ‘ = 5VS = D2 – dig­i­tal I/ORGB LEDAnd for good mea­sure, there is a 5‑pin head­er that brings out D3, D5, D6, 5V and Ground.  This puts 3 PWM out­puts along with pow­er and ground on a sin­gle con­nec­tor which can be handy for a num­ber of things like dri­ving an RGB LED.      1 x 5 Head­er (Blue)‘ ‘ = 5V – This pin is unmarked but sits next to D7B = D6 – B could be used for Blue on RGB LEDG = D5 – G could be used for Green on RGB LED‘-‘ = GroundR = D3 – R could be used for Red on RGB LEDBuzzerThe buzzer is wired to D4.  It is active HIGHReset SwitchThe shield has a remote reset but­ton locat­ed on it for easy access.OUR EVALUATION RESULTS:These shields are quite flex­i­ble and a sig­nif­i­cant step-up in ver­sa­til­i­ty from the old­er L293 based mod­ules, albeit at a high­er price.  The weak­est point is the L298P motor dri­ver IC which lim­its the size of motors that it can con­trol, but if your require­ments fall with­in its 2A per chan­nel rat­ing as most small­er robot­ic vehi­cles do, this can be a nice option for putting togeth­er a robot­ic project.The head­er pins are quite long and flex­i­ble.  You will need to coax them into align­ment as you insert the shield into the Arduino board.  Also note that the shield can sit down on the top of the USB con­nec­tor of some boards.  To avoid any short­ing con­cern, a lit­tle elec­tri­cal or kap­ton tape can be used to insu­late the top of the con­nec­tor.The pro­gram below runs the DC motor con­trol por­tion through an auto­mat­ed sequence of events.Be sure to con­nect a valid motor volt­age to the motor VMS screw ter­mi­nal and con­nect one or more small­er motors to the Moto­rA / MotorB screw ter­mi­nalsL298P Motor Driver Shield Example ProgramArduino /* * L298P Motor Shield * Code for exercising the L298P Motor Control portion of the shield * The low level motor control logic is kept in the function 'Motor' */ // The following pin designations are fixed by the shield int const BUZZER = 4; // Motor A int const ENA = 10; int const INA = 12; // Motor B int const ENB = 11; int const INB = 13; int const MIN_SPEED = 27; // Set to minimum PWM value that will make motors turn int const ACCEL_DELAY = 50; // delay between steps when ramping motor speed up or down. //=============================================================================== // Initialization //=============================================================================== void setup() { pinMode(ENA, OUTPUT); // set all the motor control pins to outputs pinMode(ENB, OUTPUT); pinMode(INA, OUTPUT); pinMode(INB, OUTPUT); pinMode(BUZZER, OUTPUT); Serial.begin(9600); // Set comm speed for serial monitor messages } //=============================================================================== // Main //=============================================================================== void loop() { // Run both motors Forward at 75% power Motor('C', 'F', 75); delay(3000); // Run both motors in Reverse at 75% power but sound beeper first Motor('C', 'F', 0); // Stop motors delay(1000); digitalWrite(BUZZER,HIGH);delay(500);digitalWrite(BUZZER,LOW); delay(500); digitalWrite(BUZZER,HIGH);delay(500);digitalWrite(BUZZER,LOW); delay(1000); Motor('C', 'R', 75); // Run motors forward at 75% delay(3000); // now run motors in opposite directions at same time at 50% speed Motor('A', 'F', 50); Motor ('B', 'R', 50); delay(3000); // now turn off both motors Motor('C', 'F', 0); delay(3000); // Run the motors across the range of possible speeds in both directions // Maximum speed is determined by the motor itself and the operating voltage // Accelerate from zero to maximum speed for (int i = 0; i <= 100; i ) { Motor('C', 'F', i); delay(ACCEL_DELAY); } delay (2000); // Decelerate from maximum speed to zero for (int i = 100; i >= 0; --i) { Motor('C', 'F', i); delay(ACCEL_DELAY); } delay (2000); // Set direction to reverse and accelerate from zero to maximum speed for (int i = 0; i <= 100; i ) { Motor('C', 'R', i); delay(ACCEL_DELAY); } delay (2000); // Decelerate from maximum speed to zero for (int i = 100; i >= 0; --i) { Motor('C', 'R', i); delay(ACCEL_DELAY); } // Turn off motors Motor('C', 'F', 0); delay (3000); } /* * Motor function does all the heavy lifting of controlling the motors * mot = motor to control either 'A' or 'B'. 'C' controls both motors. * dir = Direction either 'F'orward or 'R'everse * speed = Speed. Takes in 1-100 percent and maps to 0-255 for PWM control. * Mapping ignores speed values that are too low to make the motor turn. * In this case, anything below 27, but 0 still means 0 to stop the motors. */ void Motor(char mot, char dir, int speed) { // remap the speed from range 0-100 to 0-255 int newspeed; if (speed == 0) newspeed = 0; // Don't remap zero, but remap everything else. else newspeed = map(speed, 1, 100, MIN_SPEED, 255); switch (mot) { case 'A': // Controlling Motor A if (dir == 'F') { digitalWrite(INA, HIGH); } else if (dir == 'R') { digitalWrite(INB, LOW); } analogWrite(ENA, newspeed); break; case 'B': // Controlling Motor B if (dir == 'F') { digitalWrite(INB, HIGH); } else if (dir == 'R') { digitalWrite(INB, LOW); } analogWrite(ENB, newspeed); break; case 'C': // Controlling Both Motors if (dir == 'F') { digitalWrite(INA, HIGH); digitalWrite(INB, HIGH); } else if (dir == 'R') { digitalWrite(INA, LOW); digitalWrite(INB, LOW); } analogWrite(ENA, newspeed); analogWrite(ENB, newspeed); break; } // Send what we are doing with the motors out to the Serial Monitor. Serial.print ("Motor: "); if (mot=='C') Serial.print ("Both"); else Serial.print (mot); Serial.print ("t Direction: "); Serial.print (dir); Serial.print ("t Speed: "); Serial.print (speed); Serial.print ("t Mapped Speed: "); Serial.println (newspeed); }123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158/**  L298P Motor Shield*  Code for exer­cis­ing the L298P Motor Con­trol por­tion of the shield*  The low lev­el motor con­trol log­ic is kept in the func­tion ‘Motor’*/// The fol­low­ing pin des­ig­na­tions are fixed by the shieldint con­st BUZZER = 4;//  Motor Aint con­st ENA = 10;  int con­st INA = 12;//  Motor Bint con­st ENB = 11;  int con­st INB = 13; int con­st MIN_SPEED = 27;   // Set to min­i­mum PWM val­ue that will make motors turnint con­st ACCEL_DELAY = 50; // delay between steps when ramp­ing motor speed up or down.//===============================================================================//  Ini­tial­iza­tion//===============================================================================void set­up(){  pin­Mode(ENA, OUTPUT);   // set all the motor con­trol pins to out­puts  pin­Mode(ENB, OUTPUT);  pin­Mode(INA, OUTPUT);  pin­Mode(INB, OUTPUT);  pin­Mode(BUZZER, OUTPUT);  Ser­i­al.begin(9600);     // Set comm speed for ser­i­al mon­i­tor mes­sages}//===============================================================================//  Main//===============================================================================void loop(){  // Run both motors For­ward at 75% pow­er  Motor(‘C’, ‘F’, 75);     delay(3000);    // Run both motors in Reverse at 75% pow­er but sound beep­er first  Motor(‘C’, ‘F’, 0);  // Stop motors  delay(1000);  dig­i­tal­Write(BUZZER,HIGH);delay(500);dig­i­tal­Write(BUZZER,LOW);   delay(500);  dig­i­tal­Write(BUZZER,HIGH);delay(500);dig­i­tal­Write(BUZZER,LOW);   delay(1000);  Motor(‘C’, ‘R’, 75);  // Run motors for­ward at 75% delay(3000);     // now run motors in oppo­site direc­tions at same time at 50% speed  Motor(‘A’, ‘F’, 50);  Motor (‘B’, ‘R’, 50);  delay(3000);    // now turn off both motors  Motor(‘C’, ‘F’, 0);    delay(3000);   // Run the motors across the range of pos­si­ble speeds in both direc­tions  // Max­i­mum speed is deter­mined by the motor itself and the oper­at­ing volt­age   // Accel­er­ate from zero to max­i­mum speed  for (int i = 0; i <= 100; i )  {    Motor(‘C’, ‘F’, i);    delay(ACCEL_DELAY);  }  delay (2000);    // Decel­er­ate from max­i­mum speed to zero  for (int i = 100; i >= 0; –i)  {    Motor(‘C’, ‘F’, i);    delay(ACCEL_DELAY);  }  delay (2000);    // Set direc­tion to reverse and accel­er­ate from zero to max­i­mum speed  for (int i = 0; i <= 100; i )  {    Motor(‘C’, ‘R’, i);    delay(ACCEL_DELAY);  }  delay (2000);    // Decel­er­ate from max­i­mum speed to zero  for (int i = 100; i >= 0; –i)  {    Motor(‘C’, ‘R’, i);    delay(ACCEL_DELAY);  }  // Turn off motors  Motor(‘C’, ‘F’, 0);  delay (3000);}/* * Motor func­tion does all the heavy lift­ing of con­trol­ling the motors * mot = motor to con­trol either ‘A’ or ‘B’.  ‘C’ con­trols both motors. * dir = Direc­tion either ‘F’or­ward or ‘R’e­v­erse * speed = Speed.  Takes in 1–100 per­cent and maps to 0–255 for PWM con­trol.   * Map­ping ignores speed val­ues that are too low to make the motor turn. * In this case, any­thing below 27, but 0 still means 0 to stop the motors. */void Motor(char mot, char dir, int speed){  // remap the speed from range 0–100 to 0–255  int newspeed;  if (speed == 0)    newspeed = 0;   // Don’t remap zero, but remap every­thing else.  else    newspeed = map(speed, 1, 100, MIN_SPEED, 255);   switch (mot) {    case ‘A’:   // Con­trol­ling Motor A      if (dir == ‘F’) {        dig­i­tal­Write(INA, HIGH);      }      else if (dir == ‘R’) {        dig­i­tal­Write(INB, LOW);      }      analog­Write(ENA, newspeed);      break;     case ‘B’:   // Con­trol­ling Motor B      if (dir == ‘F’) {        dig­i­tal­Write(INB, HIGH);      }      else if (dir == ‘R’) {        dig­i­tal­Write(INB, LOW);      }      analog­Write(ENB, newspeed);      break;     case ‘C’:  // Con­trol­ling Both Motors      if (dir == ‘F’) {        dig­i­tal­Write(INA, HIGH);        dig­i­tal­Write(INB, HIGH);      }      else if (dir == ‘R’) {        dig­i­tal­Write(INA, LOW);         dig­i­tal­Write(INB, LOW);      }      analog­Write(ENA, newspeed);      analog­Write(ENB, newspeed);      break;  }  // Send what we are doing with the motors out to the Ser­i­al Mon­i­tor.    Ser­i­al.print (“Motor: ”);  if (mot==‘C’)      Ser­i­al.print (“Both”);    else      Ser­i­al.print (mot);  Ser­i­al.print (“t Direc­tion: ”);  Ser­i­al.print (dir);  Ser­i­al.print (“t Speed: ”);  Ser­i­al.print (speed);  Ser­i­al.print (“t Mapped Speed: ”);  Ser­i­al.print­ln (newspeed);}  Related
Vehicle Parts Filter
Select your currency
CAD Canadian dollar