How to Use Our Actuators with an Arduino and MegaMoto

How to Use Our Actuators with an Arduino and MegaMoto

Guninder Malhi
Guninder Malhi
PA Engineer

Arduino microcontrollers are perfect for controlling a Progressive Automations linear actuator. However, like most microcontrollers, it has pin input/output current limitations. If these limitations are exceeded, it can cause instant and permanent damage to the Arduino, especially when operating a high-powered industrial linear actuator. Even a micro or mini linear actuator could be too much for the Arduino to power directly.

The solution is to use a MegaMoto motor control shield with Arduino (MegaMoto Plus H bridge or MegaMoto GT controller). These shields allow you to power a linear actuator separately without worrying about producing magic smoke from the Arduino. They also allow you to trigger the forward and reverse movements with an Arduino signal.

Let’s go over what the MegaMoto can offer and how to control a linear actuator with Arduino.

Browse our range of linear actuators to find your perfect application match!

What MegaMoto Model Is Right for Your Project?

MegaMoto shield

The MegaMoto is a shield, meaning you can attach it directly on top of an Arduino without needing to solder additional wires. This shield feature also means you can stack 3 of the Plus models on top of one another to provide bi-directional control of 3 linear actuators or uni-directional control of 6 linear actuators. If you are going to stack the shields, we would suggest you use the Plus model since the GT model’s fan does not allow for easy stacking.

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. Either model will do but, depending on your application, ensure the linear actuator you choose does not have a current at full load that exceeds the maximum current of the MegaMoto.

 

What You Will Need

Here is a list of things you will need to get started to implement the MegaMoto:

 

Step 1: Wiring Control Pins/Power

The wiring for controlling linear actuators with Arduino is quite simple and can be broken down into three main parts, namely, connecting the MegaMoto to the Arduino, the MegaMoto to the power supply, and the MegaMoto to the linear actuator. An optional step is to add an ultrasonic sensor to trigger the forward and backward movement of the linear actuator. If you decide to not use the ultrasonic sensor, you will need to adjust the linear actuator Arduino code for this project.

MegaMoto to Arduino

This does not require any additional wiring. Simply line up the pins of the MegaMoto with the pins of the Arduino.

MegaMoto to Power Supply

  • MegaMoto + to V+
  • MegaMoto - to V-

Actuator (6-Pin Connector) to Arduino/MegaMoto

  • Motor+ to MegaMoto A
  • Motor- to MegaMoto B 

Ultra-Sonic Sensor to Arduino/Megamoto

  • VCC to 5V
  • GND to GND
  • Trig to Pin 35
  • Echo to Pin 40

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. 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.

Pair your linear actuator with an Arduino microcontroller!

Step 2: Programming the Arduino

The MegaMoto receives commands from the Arduino to trigger the H-bridge circuit and provide power to the linear actuator. Another command from the Arduino can switch the H-bridge and reverse the movement of the linear actuator.

Connect the Arduino via USB to a laptop/desktop computer and upload the linear actuator Arduino code below using the Arduino IDE. Ensure you have selected the right board and COM port in the IDE.

Access the code here

The ultrasonic sensor transmits an ultrasonic ping that is triggered by one of the pins on the Arduino. That ultrasonic ping is then reflected off an object and detected by the receiver. When the receiver detects the ping, it sends a pulse to the Arduino. An equation within the code can determine how far away an object is.

If the object is a certain distance away, Arduino can be programmed to either extend or retract based on your needs. Since most of our actuators have internal limit switches, the actuator will automatically stop at each end even if the MegaMoto keeps supplying power as the limit switch cuts it off.

 

Step 3: Modifying the Code

The linear actuator Arduino code can be modified in various ways depending on your intended application. For example, you could use a Progressive Automations linear actuator that does not have a Hall effect sensor or an ultrasonic sensor. You can trigger the MegaMoto with the Arduino at programmed intervals or by using a push button connected to the Arduino.

In the above case, you can comment out lines of code that relate to the ultrasonic sensor and Hall effect sensor. PWMA/B will control extension/retraction depending on how you connect the actuator to the MegaMoto A/B terminals.

The speed of the motor can be controlled by using an analogWrite command 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.

Another linear actuator Arduino code idea is to set current limits to switch the MegaMoto off when the current passes a threshold value, but this requires a raw current to actual current calculation and is not 100% accurate.

Browse our full range of PLC controls for ultimate!

Conclusion

Using linear actuators with microcontrollers, and sensors

Using a MegaMoto with an Arduino is a convenient way of controlling a Progressive Automations linear actuator with a high current at full load. Moreover, it provides a quick and seamless method for controlling the forward and backward directions of the actuator. Now that you know how to control a linear actuator with Arduino, adjust the code to suit your application, but first start with the basics, and add more complex components and code as you go to avoid time-consuming troubleshooting.

If you have any queries about this article or any of our products, please contact us and we will be glad to help!

Guninder Malhi

PA Engineer
I immigrated to Canada in 2013 for my bachelor's in mechatronics. During my time at the university, I started my professional career by doing my initial co-ops at the university. It helped me learn more about programming and its use in medical and agricultural devices. I went on to do a few additional co-ops to gain a deeper understanding of embedded systems.