Better Living Through Technology!

Main menu

Post navigation

How To Connect A Linear Actuator To The Arduino

In the Arduino world, it’s pretty cut and dried when you want to move something with a bit of heft to it. You can precisely turn it with a stepper motor, or winch it up with a motor, or possibly move a lever or linkage arm with a servo.

But all of these have a problem – precise control over a linear (not circular) motion. Enter the linear actuator.

The ones I’m describing here are from Firgelli (now Actuonix), which are plug-in alternatives for a regular servo. The internal motor turns a threaded rod, which moves a plunger in and out of the actuator. The thread acts like a worm drive, slowing the motor but increasing the torque. And unlike a servo, the rod (and anything connected to it) moves the same speed all along its travel. More importantly, it has even torque all the way, so no weak spots while moving (if you’ve ever connected a servo to a rod, you know how the angle affects the movement and power transmitted).

Firgelli/Actuonix Actuators

For the actuators, the part numbers give the specs; for example, a part ‘L16-100-63-6-R’ (see photo) indicates the L16 model, 100mm stroke, 63:1 gear ratio, 6 volt usage, and ‘R’ (servo) style control. Other protocols besides servo are available, but for Arduino, the servo controller means a direct replacement for a servo in any circuit, and easy programming.

As for the other details, the specs vary according to needs and model. In the case of the L12 model, the length it can extend (called the stroke) can be 30, 50 or 100 millimeters, while the the ratio of gearing can go from 50:1, 100:1 up to 210:1. In practical terms, that means you can lift (or pull) from about 2.5 pounds to 10 pounds maximum, depending on the gearing, and hold it – since it’s effectively a worm drive internally, it keeps its position even with the power off.

A more powerful model, the L16, offers longer strokes (50/100/140mm), different gearing (35:1, 63:1, and 150:1) and a different motor, providing about four times the power of the similar L12 versions. That works out to be a maximum pull on the 150:1 gearing version of 40 pounds!

But enough of the specs – how can you use them with the Arduino?

Driving an Actuator Arduino Style

Arduinos come complete with a library to drive a servo – using the servo.write() command and an angle, you can turn it through the full length of its stroke. Of course, the actuator only uses degrees for convenience in programming – with the devices I had, I was able to set it with values from 45 to 145 degrees. The Arduino IDE has two built in servo examples to get you started, Knob and Sweep (via the Files; Examples; Servos; menu option).

However, for accuracy, I’d recommend using microseconds instead of degrees, and the more precise servo.writeMicroseconds() command. In this case, full range runs from about 1000-2000 usec. But rather than fuss with the numbers, let’s wrap it into some functions:

These two set the position according to required stroke percentage (where 100.0 is fully extended, and 0.0 is fully closed), and by stroke length. For the second function, you call it with the maximum length and requested length – so for example, a position of 75mm for the 140mm stroke actuator would look like this:

SetStrokeMM(75,140);

(By the way, notice that SetStrokePerc() clamps the percentage to 1-99 percent rather than 0-100; it’s always a good idea to never go too close to the limits of any servo to prevent motor strain).

Using these functions, testing the actuator is just a matter of running through the percentage in a loop – here’s a sample program:

It’s pretty straightforward – we set up myServo in setup() and then set its position varying from 1 to 99 percent, stepping by 10 (‘d’), and going up and down forever. We pause between settings to give the servo time to move into position, and then go to the next value. Tweak the variables ‘d’ and ‘delayMS’ to get a feel for how the actuator works.

Hook this program up and power up the actuator to see the results.

By the way, on the subject of power and servos or actuators, a caution: As a rule of thumb, never power any motor directly from the Arduino. Even servos (despite what some sites may say) are often too power-hungry to work properly. Plan to have a minimum of 250-750 milliamps for any servo motor to handle peak needs. A wall wart providing 5 volts at 1 or 2 amps with ground connected to the Arduino so all grounds are common should give you the juice you need to get moving.

Conclusion

Overall, I found the actuators a lot of fun to use. Up until now, I’ve thought of most ‘moving’ problems as solved by servo, motors, or stepper motors – in each case, the circular motion is fine, but their linear motion is uneven. With these actuators, I get even force all along the stroke. It comes with extra mounting hardware so it can be bolted into place, and the servo cable is long enough for my needs (they also offer an extension line on their site if you need more cable). Now I can push and pull directly without trying to jury-rig a linkage or two to turn circular motion into linear.

Looking online, I see a lot of uses for these in the hobby arena (landing gear deployment, doors/panels opening/closing, etc). They are perfect for replacing hydraulics in light duty projects, and areas where you need a simple solution for levering things. Combined with the Arduino, I’m already thinking of new projects – give them a try, and I expect you will too.

4 thoughts on “How To Connect A Linear Actuator To The Arduino”

Really appreciate your explanation and codes, as I was recommended this page by Firgelli customer service. I’m an engineering graduating student, and I’m using these Firgelli (PQ12) actuators as part of my graduation project (have little time as I’m writing this comment). So I wish if you could help me, since I’m beginner when it comes to arduino and programming, even though I’m now understanding the logic behind some codes.

In this example, you have a nice – more accurate – modification of the Servo Sweep example, good, but sadly it didn’t work for my PQ12 actuator.

Are you using the actuators here as a normal servo with one digital pin? My actuator has two options, to work as a potentiometer and a normal linear servo. I’m looking to use the latter simple option as I only need my actuator to function as ON and OFF (extend and retract) , so once it’s fully extended it should cut (interrupt) an infrared sensor line. And I’m planing to control this operation in the future using a joystick (found it’s codes and it worked according to my serial monitor).

According to the data sheet of Firgelli PQ12 actuator:

The desired actuator position is input to the actuator on lead 1 as
a positive 5 Volt pulse width signal. A 2.0 ms pulse commands
the controller to fully retract the actuator, and a 1.0 ms pulse
signals it to fully extend.

I’d appreciate it if you could help me with this, as I’m not sure if I should add or change something in the parameters you’ve given, or it should be a new sketch.