loading

The MultiMoto is a 4 channel H bridge that lets you control the speed and direction of up to 4 actuators. It can supply 6 amps continuously to each channel while handling spikes up to 8 amps. It can take an input voltage of 6 - 36 volts.

In this Instructable, we'll be going over the basic functions of the MultiMoto, and learn how to use it to control our linear actuators. Due to the current limitations on each channel, it is only meant for use with our PA-14, PA-14P, and PA-11 actuators.

We will need:

- 1 to 4 Actuators

- 12V power supply

- Arduino Uno

- MultiMoto Control Shield

Let's get started!

Step 1: Wiring the Board

To start plug the MultiMoto shield into the Arduino.

Connect the actuators to the M1, M2, M3, M4 connectors. For our actuators if you connect the black wire to the right and red to the left, then in programming, 1 corresponds to extension and 0 corresponds to retraction.

Connect power from your 12V supply to the BAT terminal. Red to +, black to -

Power is transferred from the MultiMoto to the Arduino so there is no need to connect to Vin.

That's all there is to it!

Step 2: Programming

The programming looks more confusing than it really is, there are just lots of variables to be initialized. Once everything is set up control is easy.

This code runs all the setup then moves the actuators in and out at half speed and full speed.

The important things to note when controlling the MultiMoto:

- Use digitalWrite() to enable the motors, LOW = enabled, HIGH = disabled

- Use digitalWrite() on the direction pins to set direction of the motors. 1 or 0 as extension or retraction depends on how you connected the actuator to the M1-M4 terminals.

- Use analogWrite() on the PWM pins to set the speed (0-255)

/*    Example code to control up to 4 actuators,using the Robot Power MultiMoto driver.
   Hardware:
    - Robot Power MultiMoto
    - Arduino Uno

    Wiring:
  - Connect actuators to the M1, M2, M3, M4 connections on the MultiMoto board.
  - Connect the negative (black) to the right connection, positive (red) to the left.
  - Connect a 12 volt source (minimum 1A per motor if unloaded, 8A per motor if fully loaded)to the BAT terminals. Ensure that positive and negative are placed in the correct spots.

   Code modified by Progressive Automations from the example code provided by Robot Power
     <a href="http://www.robotpower.com/downloads/" rel="nofollow"> http://www.robotpower.com/downloads/</a>

    Robot Power MultiMoto v1.0 demo
    This software is released into the Public Domain
*/

// include the SPI library:

#include <SPI.h>
// L9958 slave select pins for SPI
#define SS_M4 14
#define SS_M3 13
#define SS_M2 12
#define SS_M1 11
// L9958 DIRection pins
#define DIR_M1 2
#define DIR_M2 3
#define DIR_M3 4
#define DIR_M4 7
// L9958 PWM pins
#define PWM_M1 9
#define PWM_M2 10    // Timer1
#define PWM_M3 5
#define PWM_M4 6     // Timer0


// L9958 Enable for all 4 motors
#define ENABLE_MOTORS 8

int pwm1, pwm2, pwm3, pwm4;
boolean dir1, dir2, dir3, dir4;

void setup() {
  unsigned int configWord;

  // put your setup code here, to run once:
  pinMode(SS_M1, OUTPUT); digitalWrite(SS_M1, LOW);  // HIGH = not selected
  pinMode(SS_M2, OUTPUT); digitalWrite(SS_M2, LOW);
  pinMode(SS_M3, OUTPUT); digitalWrite(SS_M3, LOW);
  pinMode(SS_M4, OUTPUT); digitalWrite(SS_M4, LOW);

  // L9958 DIRection pins
  pinMode(DIR_M1, OUTPUT);
  pinMode(DIR_M2, OUTPUT);
  pinMode(DIR_M3, OUTPUT);
  pinMode(DIR_M4, OUTPUT);

  // L9958 PWM pins
  pinMode(PWM_M1, OUTPUT);  digitalWrite(PWM_M1, LOW);
  pinMode(PWM_M2, OUTPUT);  digitalWrite(PWM_M2, LOW);    // Timer1
  pinMode(PWM_M3, OUTPUT);  digitalWrite(PWM_M3, LOW);
  pinMode(PWM_M4, OUTPUT);  digitalWrite(PWM_M4, LOW);    // Timer0

  // L9958 Enable for all 4 motors
  pinMode(ENABLE_MOTORS, OUTPUT); 
 digitalWrite(ENABLE_MOTORS, HIGH);  // HIGH = disabled

/ /******* Set up L9958 chips *********
  ' L9958 Config Register
  ' Bit
  '0 - RES
  '1 - DR - reset
  '2 - CL_1 - curr limit
  '3 - CL_2 - curr_limit
  '4 - RES
  '5 - RES
  '6 - RES
  '7 - RES
  '8 - VSR - voltage slew rate (1 enables slew limit, 0 disables)
  '9 - ISR - current slew rate (1 enables slew limit, 0 disables)
  '10 - ISR_DIS - current slew disable
  '11 - OL_ON - open load enable
  '12 - RES
  '13 - RES
  '14 - 0 - always zero
  '15 - 0 - always zero
  */  // set to max current limit and disable ISR slew limiting
  configWord = 0b0000010000001100;

  SPI.begin();
  SPI.setBitOrder(LSBFIRST);
  SPI.setDataMode(SPI_MODE1);  // clock pol = low, phase = high

  // Motor 1
  digitalWrite(SS_M1, LOW);
  SPI.transfer(lowByte(configWord));
  SPI.transfer(highByte(configWord));
  digitalWrite(SS_M1, HIGH);
  // Motor 2
  digitalWrite(SS_M2, LOW);
  SPI.transfer(lowByte(configWord));
  SPI.transfer(highByte(configWord));
  digitalWrite(SS_M2, HIGH);
  // Motor 3
  digitalWrite(SS_M3, LOW);
  SPI.transfer(lowByte(configWord));
  SPI.transfer(highByte(configWord));
  digitalWrite(SS_M3, HIGH);
  // Motor 4
  digitalWrite(SS_M4, LOW);
  SPI.transfer(lowByte(configWord));
  SPI.transfer(highByte(configWord));
  digitalWrite(SS_M4, HIGH);

  //Set initial actuator settings to pull at 0 speed for safety
  dir1 = 0; dir2 = 0; dir3 = 0; dir4 = 0; // Set direction
  pwm1 = 0; pwm2 = 0; pwm3 = 0; pwm4 = 0; // Set speed (0-255)

digitalWrite(ENABLE_MOTORS, LOW);// LOW = enabled
} // End setup

void loop() {
    dir1 = 1;
    pwm1 = 255; //set direction and speed 
    digitalWrite(DIR_M1, dir1);
    analogWrite(PWM_M1, pwm1); // write to pins

    dir2 = 0;
    pwm2 = 128;
    digitalWrite(DIR_M2, dir2);
    analogWrite(PWM_M2, pwm2);

    dir3 = 1;
    pwm3 = 255;
    digitalWrite(DIR_M3, dir3);
    analogWrite(PWM_M3, pwm3);

    dir4 = 0;
    pwm4 = 128;
    digitalWrite(DIR_M4, dir4);
    analogWrite(PWM_M4, pwm4);

    delay(5000); // wait once all four motors are set

    dir1 = 0;
    pwm1 = 128;
    digitalWrite(DIR_M1, dir1);
    analogWrite(PWM_M1, pwm1);

    dir2 = 1;
    pwm2 = 255;
    digitalWrite(DIR_M2, dir2);
    analogWrite(PWM_M2, pwm2);

    dir3 = 0;
    pwm3 = 128;
    digitalWrite(DIR_M3, dir3);
    analogWrite(PWM_M3, pwm3);

    dir4 = 1;
    pwm4 = 255;
    digitalWrite(DIR_M4, dir4);
    analogWrite(PWM_M4, pwm4);

   delay(5000); 

}//end void loop

Step 3: Conclusion

In this Instructable we learned how the MultiMoto motor controller can be used to control the motion of multiple actuators. These code snippets and wiring diagrams can be combined with the 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 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.

Follow, Like and Subscribe!

Twitter - twitter.com/ACTUATORS1

Facebook -www.facebook.com/ProgressiveAutomations

Youtube -www.youtube.com/user/MrActuators

About This Instructable

1,881views

18favorites

License:

Bio: 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 ... More »
More by Progressive Automations:DIY Portable Single Axis Solar Tracker Hall Effect Sensors 3: PID Control Hall Effect Sensors 2: Synchronizing Motion 
Add instructable to: