How to Control Linear Actuators from a PLC or Microcontroller!

LeMaster Tech
183 followers
448 Video Views·Sep 27, 2025
This video covers how to wire up and control a linear actuator! We show wiring for a hand switch, or using relays to be controlled from a PLC or a Microcontroller like a raspberry pi, Arduino, or ESP32!
Linear Actuator: https://amzn.to/42PAXWw
DIN Rail Relays: https://amzn.to/3KGC1FY
5 Volt Arduino Compatible Relays: https://amzn.to/4pJCHKM
Power Supply: https://amzn.to/3It9X8x
Arduino Uno: https://amzn.to/4gPwLMA
PLC I used: https://amzn.to/3KgQ70T
Be sure to drop any questions you have in the comments below and let me know what you'd like to see next on the channel!
Don't forget to leave a like on the video and subscribe to the channel! And if you love the channel consider checking out my patreon: https://www.patreon.com/LeMasterTech
A linear actuator is a very strong and very common way to achieve linear motion from a
simple DC motor.
They come in all sizes and can be found in every factory in the world, but also in household
objects like automated recliners.
Because they typically use 12 or 24 volt DC, and the majority of actuators are controlled
by just two wires, you need to design your electronics to control the actuator for your
specific needs.
In this video, we will cover how to control a linear actuator from a variety of methods.
We will start with just hand control, and then add in a microcontroller and a PLC so
that this video covers whatever use case you are looking for.
So let's get started right away.
When you have two wires on a DC motor, one needs to be given DC power, in this case 12
volts, but it can be whatever voltage your motor was designed for.
And then the other wire needs to be given 0 volts DC to close the loop.
It will spin in one direction, which in the case of the linear actuator means it's turning
a gearbox in the base of the actuator that is driving a ball screw down a shaft in one
direction.
If you flip those wires, putting positive voltage on the wire that previously had 0
volts, and 0 volts to the previously energized wire, we will reverse the directionality.
One nice thing about most linear actuators is you don't really have to worry about them
stopping before they reach their end limits super precisely.
Because if you leave them energized, there are usually limit switches integrated into
the body of the actuators, or a comparable mechanical stop that protects it from damage.
So the very simplest method to get the actuator to turn is with hand switches.
In particular, if you get a polarity reversing rocker switch like this one, you can control
extending, retracting, and off with a very simple wiring scheme.
There are really three states we need to achieve with a linear actuator for total control.
Extending, retracting, and off.
This is why something simple like an on-off two position switch or button is insufficient.
At most that can get you two of the three states you need.
Let's look at these three states one at a time and it should make total sense.
Extending means wire number one has 12 volts DC on it and wire number two has zero volts.
Retracting means wire number one has zero volts and number two has 12 volts.
And then off either means both wires can have zero volts DC or that there is an open circuit
as if something isn't connected at all.
In the case of a three position polarity reversing rocker switch, we really only need two wires
in and two wires out.
The two wires out will be the two wires going to your linear actuator.
In the case of a three position switch, you usually have a set of contacts in the middle
known as the common contacts that switch between making contact with one set when rocker is
pressed one way to the other set of terminals when it's pressed the other way or not making
contact with any when left alone creating an open circuit.
So you land your two linear actuator wires to these two terminals.
The two wires in will be zero and 12 volts DC and we can land them to the top or bottom
set of terminals.
It doesn't matter much unless you've already labeled like extending or retracting on one
side.
Then you want to add these jumper wires to cross the sides on your rocker.
So when you press the switch in one way, the polarity will be opposite of when you press
them in the other way.
Most rocker switches come with the wires you need to make these connections.
I can leave all hardware used in this video linked in the description below if you need
it or want it, including the actuators I'm using.
This is great.
And if you have a very simple application, that may be all you need or want.
But let's take a look now at how to achieve this same functionality as part of a larger
project where you would want to control these actuators from a main controller.
Secret sauce to replacing this three position rocker switch with something that can be controlled
electronically is a component called a relay.
A relay takes voltage in on one side and switches based on that voltage.
And the switch contacts are electronically isolated on the other side, meaning they have
nothing to do with the side that pulls the coil in and releases it.
So in simple terms, you can use a 5 volt or 12 volt or 24 volt or even beefy like 120
volt AC signals from PLCs with AC output cards.
And you can use those to switch a 12 volt DC control signal or anything else on the
downstream side that has nothing to do with the switching side.
So to show this functionality, I'll describe the wiring that we need to do with these larger
DIN rail mounted relays that are most commonly found in industrial control cabinets for PLCs.
And then I'll do the same example with those and these smaller blue cube relays that can
be controlled by an Arduino or other microcontroller with just 5 volts DC.
In both cases, the input signals are considered A1 and A2 on the pin out.
One of those needs to be connected to 0 volts DC and the other gets tied to a digital output
channel or pin on your controller for whatever voltage the relay was designed to be switched
on and off by.
Then the other side has a normally open, normally closed and common contact.
Common describes the wire that gets switched between normally open and normally closed
channels.
Normally closed means when the relay is not active or energized, the channel is making
contact with the common channel.
Then normally open means the opposite, where it's not in contact with the common wire unless
the relay is energized.
But when that happens, the common channel gets pulled into contact with the normally
open channel and is no longer making contact with the normally closed channel.
Because we have two wires that need switching, we either need two relays or one relay with
two switching channels.
This video would take about 20 more minutes if I also went into all the different types
of relays, so I will stick to the simplest kind which is single pole single throw, or
SPST.
Feel free to look up DPST, DPDT, or SPDT relays as well if you're curious to learn more.
Now this means each wire going to the linear actuator gets landed on the common terminal
of one of these relays.
But since I need to achieve directional switching, I need positive power on normally closed for
one relay and I'll jumper that to normally open on the other relay.
Then I land 0 volts DC on the other normally open or normally closed terminal and jumper
those together too.
So now as long as I energize these relays at the same time, the actuator will switch
directions with the state of the relay.
This means I can use the signal from my PLC or microcontroller of either a 1 or a 0 to
mean forwards or reverse and jumper it to both relays so that it switches at the same
time.
Now the problem we haven't accounted for here is the off state unless we always want the
actuator moving, or we only want it to stop if it reaches one of the extremity points
that are mechanically limited.
We need to be able to account for being able to fully stop at any time, and this means
we either need an additional relay or an additional PLC output if you have a relay output PLC
card.
Basically, you want the 12 volts DC on the downstream side of the relay to not be directly
connected to power all the time, but to get switched on and off by another PLC or microcontroller
signal that says on off or 1 and 0.
For this A1 and A2 you need your output signal from the controller and the common wire is
the wire running to feed the other two relays.
And on one side you put 0 volts DC, or honestly you cannot land a wire here because an open
circuit works just as well for off, but on the other terminal you want to land 12 volts
DC, or whatever your control voltage is.
But now you have a way to turn the motion of the actuator fully off, so regardless of
the state of your relay telling it which direction to move in, if the on off command is not active,
the relay won't move.
This wiring is definitely slightly past beginner and more towards intermediate, but it makes
whatever logic you're writing to control the actuator very simple.
Basically, turn one output on when you want the linear actuator moving, and then switch
a second output on or off to change the direction that it's moving in, and these electronic
switches called relays will do the rest.
So I know that is a jam-packed tutorial and we covered a lot very quickly, but I also
think we covered it pretty thoroughly.
So any remaining questions, just let me know in the comments below.
Let me know what you want to see next in the comments below, and be sure to check out the
hardware linked in the description of this video.
I hope you found the lesson useful.
Thanks for watching and see you next time.
Thanks.
Bye.
