RobotPower MegaMoto Control Shield Description

About: Progressive Automations is your primary source for electric linear actuators, motion control systems and automation accessories. For over a decade, we have supplied various industries with top quality automa...

The MegaMoto Plus H bridge and the MegaMoto GT motor controllers are shields for the Arduino to control motors. The MegaMoto Plus takes an input voltage from 5-28V, and can output 20A of current, with 40A spikes. The MegaMoto GT, with the added fan and heatsinks, can take an input voltage of 6-35V, and can output 35A of current, with 50A spikes.

The MegaMoto Plus boards can be stacked 3 high on an Arduino board to give bi directional control of 3 motors. Each shield can be used as uni directional control for 2 motors, so with 3 stacked you can control 6 uni directional motors. You can control 3 MegaMoto GT's as well, but with the fan they don't stack easily.

The boards have built in current detection, so you can set maximum limits in your code to help keep your hardware safe.

See the user manual here: http://www.robotpower.com/downloads/MegaMoto-user-...

See the schematic diagram here: http://www.robotpower.com/downloads/MegaMoto-v1.5-schematic.pdf

Step 1: Control Pins/Power

Both MegaMotos use a series of jumper pins to choose which pins the Arduino uses to communicate with it. This gives a large amount of flexibility to control multiple MegaMotos at once, or interface the MegaMoto with other shields. Below is an explanation of each of the jumpers.

Enable Pins:

The enable pin is what pin "turns on" the board, allowing it to control the motor. If the board is disabled, the motor will be stopped and cannot be controlled. If you choose D8, D12, or D13, the board will be enabled when you write the digital pins 8,12, or 13 HIGH. If you choose 5V, then the board will be enabled as long as it has power (as long as it is plugged into the Arduino).

PWMA/B:

These pins are used to move the motor. PWMA/B will control extension/retraction depending on how you connect the actuator to the A/B terminals. The speed of the motor can be controlled by using analogWrite on the corresponding pin to create a PWM signal. Speeds can be between 0-255, giving the motor 0-100% of voltage from the power supply (0-12V).

Sensor:

The sensor pins have 2 jumpers on them. The one jumper (vertical), connecting A2/A3 is used to link the current sensors of both halves of the H bridge together. Each side of the H bridge has a transistor on it, that the current is read from. If you are using the MegaMoto to control 1 actuator bidirectionally, then there will be the same current flowing through both transistors. If you leave the jumper connected, then both current sensors will be in parallel, giving you half of what the current reading is. If the jumper is disconnected, the current reading will be the full load. For high current (10A+) applications, it is recommended to keep the jumper connected to prevent too much current from going through the sensors, extending their lives.

The formula for current reading is: 0.075V per amp of current for the MegaMoto Plus, and 0.051V per amp of current for the MegaMoto GT.

Ex: If you're using a MegaMoto Plus, and the motor is pulling 20 amps and the jumper is disconnected, the current feedback pin will be at 20*0.075 = 1.5 volts, which will give a reading of ~300 when using the analogRead() function. If the jumper is connected, the reading will be 0.75 volts, or ~150 via analogRead().

The second jumper (horizontal) chooses which analog pin that the Arduino will read feedback from.

If you are using a 12V (or less) power supply to power the MegaMoto, you can use that same supply to power the Arduino. Just connect a small wire from the BAT+ to the Vin pin. See the second picture.

Step 2: Programming the MegaMoto

This code has an example motion routine programmed for a MegaMoto board. The code is written for having 3 boards stacked, but lines are commented out so only one board is enabled. You can comment and uncomment lines to control up to 3 shields.

This code reads the sensor pins, but does not use the values beyond printing them to the serial monitor.

/*  Sample code for the Robot Power MegaMoto.  This board can be stacked up to three
  times to control three motors.  The code is included for each motor in the setup routines,
  uncomment the lines of code to enable the motors you need.

  The main loop of this program ramps the speed of the first board from zero to max (0-255)
  over 1 second, holds it at max speed for 2 seconds, then ramps back down (255-0) for 1 second.
  The pins swap, so the direction changes, and the loop repeats.

  Modified by Progressive Automations, using the original example code from:
   http://www.robotpower.com/downloads/

  Hardware:
  - 1 to 3 RobotPower MegaMoto control boards
  - Arduino Uno
  
  Wiring:
  -Connect the +/- of the actuator to the A/B motor channels
  -Connect the +/- of the power supply to the +/- BAT connections

  This example code is in the public domain.
 */

int EnablePin1 = 8;
//int EnablePin2 = 12;
//int EnablePin3 = 13;
int duty;

//Use the jumpers on the board to select which A and B signals you want
int PWMPinA1 = 11;  // Timer2
int PWMPinB1 = 3;
//int PWMPinA2 = 9;  // Timer0
//int PWMPinB2 = 10;
//  int PWMPinA3 = 6;  // Timer1

//  int PWMPinB3 = 5;

const byte CPin1 = A0;  // analog input channel
//const byte CPin2 = A1;  // analog input channel
//const byte CPin3 = A4;  // analog input channel

int CRaw1;      // raw A/D value
//int CRaw2;
//int CRaw3;

void setup() {

Serial.begin(9600);

  pinMode(EnablePin1, OUTPUT);
  //pinMode(EnablePin2, OUTPUT);
  //pinMode(EnablePin3, OUTPUT);//Enable the boards

  pinMode(PWMPinA1, OUTPUT);
  pinMode(PWMPinB1, OUTPUT);
  //pinMode(PWMPinA2, OUTPUT);
  //pinMode(PWMPinB2, OUTPUT);
  //pinMode(PWMPinA3, OUTPUT);
  //pinMode(PWMPinB3, OUTPUT);//Set motor outputs

}//end setup

void loop() {
  digitalWrite(EnablePin1, HIGH); //enable the board
  analogWrite(PWMPinB1, 0); //Set pinB to 0, when speed is written to pinA the motor will extend
  for (duty = 0; duty <= 255; duty += 5) // ramp up speed
  {
    analogWrite(PWMPinA1, duty);
    delay(5);
  }
  analogWrite(PWMPinA1, 255);//end at max speed
  CRaw1 = analogRead(CPin1);

  Serial.println("Feedback");

 Serial.print(CRaw1);


  delay(2000);//hold speed
  for (duty = 255; duty >= 0; duty -= 5) // ramp down speed
  {
    analogWrite(PWMPinA1, duty);
    delay(20);
  }
  analogWrite(PWMPinA1, 0); //set to 0 speed
  delay(500);
 
  digitalWrite(EnablePin1, LOW);// Toggle enable to reset the power chips if we have had an overcurrent or overtemp fault

  delay(500);  // Swap pins to make the motor change direction
  if (PWMPinA1 == 11)
  {
    PWMPinA1 = 3;
    PWMPinB1 = 11;
  }
  else
  {
    PWMPinA1 = 11;
    PWMPinB1 = 3;
  }

  /*if (PWMPinA2 == 9)
    {
    PWMPinA2 = 10;
    PWMPinB2 = 9;
  }
  else
  {
    PWMPinA2 = 9;
    PWMPinB2 = 10;
  }*/

  /*if(PWMPinA3 == 6)
    {
     PWMPinA3 = 5;
     PWMPinB3 = 6;
   }
   else
   {
     PWMPinA3 = 6;
     PWMPinB3 = 5;
   }*/

}//end main loop

Step 3: Conclusion

By using and modifying this code, you can control the motion of up to 6 actuators. A modification idea is use the feedback to set a limit for current, if the current is above that limit the motor will not move. These code snippets can be combined with other examples in our other instructables to make your project however you like.

If you'd like to take a look at our selection of linear actuators, motions control systems and microcontrollers then please visit us at http://www.progressiveautomations.com/ for all your actuator needs! We can even build a custom actuator or control system for you based on your own custom specifications with the help of our highly trained staff of engineers! You can learn more about the custom order process right here.

Share

    Recommendations

    • Epilog X Contest

      Epilog X Contest
    • Cardboard Challenge

      Cardboard Challenge
    • Faux-Real Contest

      Faux-Real Contest

    Discussions