Home Code Ardumoto shield example

Ardumoto shield example

by shedboy71
[lebox id="1"]

The Ardumoto  is a motor shield for Arduino that will control two DC motors. Based on the L298 Dual Full Bridge Driver

The Ardumoto can drive up to 2 amps per channel. The board takes its power from the same Vin line as the Arduino board, includes blue and yellow LEDs to indicate active direction, and all driver lines are diode protected from back EMF. The new version of this shield allows for either 3.3 or 5v logic, a separate and more robust VIN connection, and the PWM input has moved to pin 3.

Control for motor attached to OUT1/2 is connected to digital line 12 (direction A) and digital line 3 (PWM A). Control for motor attached to OUT3/4 is connected to digital line 13 (direction B) and digital line 11 (PWM B).

Specs

  • The Logic Control Voltage: 4.5~5.5V
  • Motor Supply Voltage: 6~15V
  • Max Drive Current: 2A
  • Maximum Power Dissipation: 25W (T = 75 degree Celsius)
  • Operating Temperature: -25 degree Celsius ~ +130 degree Celsius
  • Output Duty Range: 0%~100%

Here is a picture of the shield that I used

Ardumoto

Ardumoto

 

It was a simple task to connect a DC motor to the shield , here is a fritzing image of this

 

Ardumoto and dc motor

Ardumoto and dc motor

The code is fairly straight forward and requires no additional libraries to be installed

Code

[codesyntax lang=”cpp”]

// Clockwise and counter-clockwise definitions
#define CW  0
#define CCW 1

// Motor definition
#define MOT_A 0

const byte PWMA = 3;
const byte DIRA = 12;


void setup()
{
  // All pins should be setup as outputs
  pinMode(PWMA, OUTPUT);
  pinMode(DIRA, OUTPUT); 
  // Initialize all pins as low
  digitalWrite(PWMA, LOW);
  digitalWrite(DIRA, LOW);
}

void loop()
{
  // Drive motor A at various speeds, then stop.
  moveMotor(MOT_A, CCW, 255);
  delay(1000);
  moveMotor(MOT_A, CW, 127);
  delay(1000);
  stopMotor(MOT_A);
  moveMotor(MOT_A, CW, 255);
  delay(1000);
  moveMotor(MOT_A, CCW, 127);
}

// moveMotor drives motor
void moveMotor(byte motor, byte dir, byte spd)
{
    digitalWrite(DIRA, dir);
    analogWrite(PWMA, spd);
}

//stop motor
void stopMotor(byte motor)
{
  driveArdumoto(motor, 0, 0);
}

[/codesyntax]

 

Link

A reasonable priced shield that you can pick up for $9. i ran 2 motors with no problems, if you have ever seen the all popular low cost arduino robot kits on the internet that come with a couple of motors and various other parts and need assembled these are what I tested with.

Motor Driver Shield L298P Ardumoto

Share
[lebox id="2"]

You may also like