Page 1 of 1

Monstermoto Compatible High Power Motor shield (HCARDU0082)

Posted: Wed May 28, 2014 11:59 am
by admin
Image

Description:

The Hoby Components high power motor drive shield (MonsterMoto compatible) is based on the Sparkfun reference design and uses two ST Microlectronics VNH2SP30-E full bridge high power motor drivers to independently control the speed and direction of two DC motors. The pinout of the shield means that each motor can be directionally controlled with two DI0 pins, and its speed easily controlled using a single Arduino analogWrite() command (see our exclusive sketch in our support forum).

Order Yours Here.


Specification:

Max motor supply voltage: 16V
Max instantaneous current: 30A*
Max continuous current: 14A*
Max PWM frequency: 20KHz
Current sensing linked to Arduino analogue pins
On-resistance: 19 mΩ (per leg)
Safety shut-down features including thermal overload, under and over voltage protection

PLEASE NOTE: When using the shield at its maximum current and voltage specifications, additional heat sinks may be required


Example Arduino Sketch:

Code: Select all

/* FILE:    ARD_MonsterMoto_Shield_Example
   DATE:    28/05/14
   VERSION: 0.1
   
REVISIONS:

28/05/14 Created version 0.1

This is an example of how to use the Hobby Components MonsterMoto compatible
Arduino shield (HCARDU0082). The sketch will cause a DC motor connected to
the shield's output A1-B1 to rotate firstly in one direction and the in the other
at different speeds.

You may copy, alter and reuse this code in any way you like, but please leave
reference to HobbyComponents.com in your comments if you redistribute this code.
This software may not be used for the purpose of promoting or selling products 
that directly compete with Hobby Components Ltd's own range of products.

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES,
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY
REASON WHATSOEVER.
*/

#define CW 0  // Clockwise motor direction
#define CCW 1 // Clockwise motor direction
#define BREAK_GND 2 // Break motor to GND
#define BREAK_VCC 3 // Break motor to GND

#define MOTOR1 0 // Used to select motor output 1 (A1-B1)
#define MOTOR2 1 // Used to select motor output 2 (A2-B2)

#define INA1 7 // DIO pin used for motor A1 control
#define INB1 8 // DIO pin used for motor B1 control
#define INA2 4 // DIO pin used for motor A2 control
#define INB2 9 // DIO pin used for motor B2 control
#define PWM1 5 // DIO pin used for motor 1 PWM speed control
#define PWM2 6 // DIO pin used for motor 1 PWM speed control


void setup()
{
  /* Set control pins to outputs */
  pinMode(INA1, OUTPUT); // Motor 1 control A
  pinMode(INB1, OUTPUT); // Motor 1 control B
  pinMode(INA2, OUTPUT); // Motor 2 control A
  pinMode(INB2, OUTPUT); // Motor 2 control B
  pinMode(PWM1, OUTPUT); // Motor 1 PWM speed control
  pinMode(PWM2, OUTPUT); // Motor 2 PWM speed control
  
  /* Set both motor outputs to stop */
  MotorState(MOTOR1, BREAK_GND);
  MotorState(MOTOR2, BREAK_GND);
}

/* Main program */
void loop()
{
  MotorState(MOTOR1, CW); // Set motor to clockwise direction
  MotorSpeed(MOTOR1, 128); // Set motor 1 to half speed
  delay(500);
  MotorSpeed(MOTOR1, 255); // Set motor 1 to full speed
  delay(500);
  MotorSpeed(MOTOR1, 128); // Set motor 1 to half speed
  delay(500);
  MotorState(MOTOR1, BREAK_GND); // Stop the motor
  delay(500);
  
  MotorState(MOTOR1, CCW); // Set motor to counter clockwise direction
  MotorSpeed(MOTOR1, 128); // Set motor 1 to half speed
  delay(500);
  MotorSpeed(MOTOR1, 255); // Set motor 1 to full speed
  delay(500);
  MotorSpeed(MOTOR1, 128); // Set motor 1 to half speed
  delay(500);
  MotorState(MOTOR1, BREAK_GND); // Stop the motor
  delay(500);
  
}


/* Sets the state of one of the motors where Motor is either 
   MOTOR1 or MOTOR2 and State is one of 4 options:
   CW = Motor turns in clockwise direction
   CCW = Motor turns in counter clockwise direction
   BREAK_GND = Breaks the motor to GND
   BREAK_VCC = Breaks the motor to VCC */
   
void MotorState(byte Motor, byte State)
{
  switch(State)
  {
    case CW:
      digitalWrite(Motor ? INA2 : INA1, HIGH);
      digitalWrite(Motor ? INB2 : INB1, LOW);
    break;
  
    case CCW:
      digitalWrite(Motor ? INA2 : INA1, LOW);
      digitalWrite(Motor ? INB2 : INB1, HIGH);
    break;
    
    case BREAK_GND:
      digitalWrite(Motor ? INA2 : INA1, LOW);
      digitalWrite(Motor ? INB2 : INB1, LOW);
    break;
    
    case BREAK_VCC:
      digitalWrite(Motor ? INA2 : INA1, HIGH);
      digitalWrite(Motor ? INB2 : INB1, HIGH);
    break;
  }

}

/* Sets the motor speed where Motor is either MOTOR1 or MOTOR2
   and Speed is a number between 0 and 255 where 0 = stopped 
   and 255 = full speed. */
void MotorSpeed(byte Motor, byte Speed)
{
  if (Motor)
  {
    analogWrite(PWM2, Speed);
  }else
  {
    analogWrite(PWM1, Speed);  
  }
}

Downloads:
MonsterMoto_Shield_Schematic.pdf
VNH2SP30_Datasheet.pdf