Motor Pro Shield For pcDuino

From LinkSprite Playgound
Jump to: navigation, search

Introduction

Motor Pro Shield is a 4 channel motor driver board which bases on TI - DRV8801. Specifically for pcDuino users to make their own robots, this shield provides rich interfaces. This Motor Pro Shield is just compatible with pcDuino 2/3/3B.

  • 4 x Motor driver interface
  • 4 xLinker kit interface(ADC、UART、GPIO、PWM)
  • 2 xUltrasonic interface
  • 1 xIMU Interface
  • 2 x Infrared sensor interface
  • Independent switch for motor power supply
  • Over current protection

SHD MOTPRO.jpg

Specification

Spec of DRV8801

Motor pro spec.jpg

Motor pro spec2.jpg

Features

Dimensions: 68×53×20mm

Net weight: 24g

Schematic

Usage

Arduino Code

//Motor pro shield test code
 
int M1_AIN1 = 11;
int M1_AIN2 = 14;
int M1_BIN1 = 10;
int M1_BIN2 = 15;
 
int M2_AIN1 = 9;
int M2_AIN2 = 20;
int M2_BIN1 = 3;
int M2_BIN2 = 22;
 
int M1_R = 16;
int M1_L = 17;
int M2_L = 21;
int M2_R = 23;
 
void Setpin()
{
  pinMode(M1_AIN2,OUTPUT);
  pinMode(M1_BIN2,OUTPUT);
  pinMode(M2_AIN2,OUTPUT);
  pinMode(M2_BIN2,OUTPUT);
 
  pinMode(M1_R,OUTPUT);
  pinMode(M1_L,OUTPUT);
  pinMode(M2_L,OUTPUT);
  pinMode(M2_R,OUTPUT);
}
 
//******************************
// MA1 and MB1 control function 
//******************************
void M1A_Forward(int speed)
{
  analogWrite(M1_AIN1,speed);
  digitalWrite(M1_AIN2,LOW); 
}
void M1A_Reverse(int speed)
{
  analogWrite(M1_AIN1,speed);
  digitalWrite(M1_AIN2,HIGH); 
}
void M1A_Stop()
{
  analogWrite(M1_AIN1,0);
  digitalWrite(M1_AIN2,LOW);
}
/******************************/
void M1B_Forward(int speed)
{
  analogWrite(M1_BIN1,speed);
  digitalWrite(M1_BIN2,LOW); 
}
void M1B_Reverse(int speed)
{
  analogWrite(M1_BIN1,speed);
  digitalWrite(M1_BIN2,HIGH); 
}
void M1B_Stop()
{
  analogWrite(M1_BIN1,0);
  digitalWrite(M1_BIN2,LOW);
}
 
//******************************
// M2A and M2B control function 
//******************************
void M2A_Forward(int speed)
{
  analogWrite(M2_AIN1,speed);
  digitalWrite(M2_AIN2,LOW); 
}
void M2A_Reverse(int speed)
{
  analogWrite(M2_AIN1,speed);
  digitalWrite(M2_AIN2,HIGH); 
}
void M2A_Stop()
{
  analogWrite(M2_AIN1,0);
  digitalWrite(M2_AIN2,LOW);
}
/******************************/
void M2B_Forward(int speed)
{
  analogWrite(M2_BIN1,speed);
  digitalWrite(M2_BIN2,LOW); 
}
void M2B_Reverse(int speed)
{
  analogWrite(M2_BIN1,speed);
  digitalWrite(M2_BIN2,HIGH); 
}
void M2B_Stop()
{
  analogWrite(M2_BIN1,0);
  digitalWrite(M2_BIN2,LOW);
}
 
void Motor_test()
{
  M1A_Forward(100);
  delay(2000);
  M1A_Stop();
  delay(1000);
  M1A_Reverse(10);
  delay(2000);
  M1A_Stop();
  delay(3000);
}
 
void setup() 
{
  Setpin();
  M1A_Stop();
  M1B_Stop();
  M2A_Stop();
  M2B_Stop();  
}
 
void loop() 
{
  M1A_Forward(100);
  M1B_Forward(100);
  M2A_Forward(100);
  M2B_Forward(100);
}