Intro To MegaMoto Motor Controllers

Two of our most popular motor controllers are the LC-80 MegaMoto Plus H bridge and the LC-81 MegaMoto GT, which act as shields for our Arduinos and can control our linear actuators. They can be configured as a single H-bridge circuit or as two individual half-bridge circuits. They are usable for a wide range of DC loads as long as they stay within the current and voltage limits of your application. They come with built-in current detection as well so you can set maximum limits in your code to keep your application safe.

The MegaMotos use a series of jumper pins to choose which pins to communicate with on the Arduino. This allows a lot of flexibility to control multiple MegaMotos at once. The jumper pins can be explained like this:

ENABLE PINS

This pin turns the board on, making it able to control a motor. For example the motor of one of our linear actuators. If this pin is disabled the motor will stop and you will lose control capabilities.

LC-80-3

PWMA/B PINS

These are the pins that control the movement of a motor, like the extension and retraction of a linear actuator. The extension and retraction limits will depend on how you connect the actuator to the A/B terminals.

SENSOR PINS

The sensor pins have 2 jumpers on them. The first vertical jumper that connects A2 and A3 is used to link the current sensors of the H-bridge together. For high current applications (over 10A) it is recommended to keep this jumper connected to prevent too much current going through the sensors. The second horizontal jumper decides which analog pin the Arduino will monitor feedback from.

LC-81-3

Now that we've briefly gone over the pins and their functions we can show an example on how to program these MegaMoto motor controllers. The code below is an example motion routine that is written with having three boards stacked, however lines are commented out so that only one board will be enabled. This example code will read the sensor pins.

/*  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

 

This code can be modified to provide a variety of different control options and movement capabilities, including motion control of up to six linear actuators. The MegaMotos can be used and combined with many our of different control systems. If you'd like to learn more about how they work and what can be done with them please contact us to get in touch with one of our highly trained engineers. We can even custom make a control system for you based on your specifications.

Servicing Top Brands:

Please wait...