Need help with my Arduino controlled Linear Actuator

Hi. I have a simple question. I want to control my actuator using arduino in two ways: full extend and full retract.

The materials that I have at the moment are:

-Arduino Uno Rev.3

-Linear Actuator which I got here OLX is Now Carousell, The All-in-One Preloved Marketplace in PH

-4 Channel Relay Board which I got here

Can you help me with the arduino code and the wiring connections? And also what other components should I buy if I need any? Thanks!

These two instructables will let you switch the relay on and off from your Android mobile using a custom menu you design. No coding required. All the Arduino code is generated for you and the universal Android pfodApp has already been written. (see

Also see
for relay module wiring examples.

BUT... You probably want some sort of feedback to let you know were the actuator is. Not clear from your link if there is any built in position sensor on the actuator.


I do not see how (most of) your response helps the OP with his question.
It looks more as a commercial for your website == spam

Can you please explain?

My impression of the question was how to control relays and wire them up.

Answering his question "wiring connections"
The url to relay module wiring examples is just relay choice and wiring information.

The other url shows how use a free app to generate the Arduino code need to drive the relays from a customisable Android menu. So it is answering his question on "help with the arduino code"
The actual code generator is a free app and provides template Arduino code for doing what he wants even if he does not use pfodApp to drive it. The resulting code generated is well commented so he can strip out what he does not want.

I believe my app provides an easy way do custom relay control. So I suggest it as a solution where it seems appropriate. I am not aware of any other code generator for Arduino that provides a complete solution for custom remote control of relays without having to write any code at all.

My impression of the poster's question was that he would like all the help he can get to get up and running.

Finally my post raises a question that does not seem to have been considered. That of sensing where the actuator is so you know when to turn the relay off. I may be that he will do this visually. But in that case I am not clear why he is using Arduino.

Perhaps we should wait for a reply from the original poster before trying to decide how useful my post was to him.

Thanks for the reply. Actually I have to make the actuator extend/retract without using Android Mobile.

I'm planning to use this for my project which is a gas leakage detector system. I will place the actuator in a container which simulates a room. When the gas sensor detects a certain amount of gas concentration, the actuator will automatically activate (extend). Thus, opening the container to diffuse or make the gas concentration smaller.

Is there other way of controlling the actuator? I'll be glad to hear suggestions. Thanks!

I used a surplus linear actuator to motorize a “zero gravity chair” for a friend who was about to have some surgery done and would need to operate it with minimal arm usage to rest. The only documentation I had to work with was a sticker stating the operating voltage (I think it was 24 volts).

I learned that voltage requirements for actuators are more of a suggested maximum than an actual requirement. My project runs great on a cheap 18v DC switching power supply I bought on the same trip to the surplus store. Keep in mind I was not requiring anywhere near the rated maximum force to recline the chair.

My actuator had built-in non-adjustable limit switches. To operate it, simply connect the power leads to an appropriate DC voltage. To reverse the motor, simply connect the power leads backwards. In both cases, the actuator will move to the end of its travel range and stop automatically.

I wired mine up with a simple DPDT toggle switch (also from the surplus store) that has a center off detent position. If you wire a DPDT switch with input power on one end, output on the center, and an X of wires across the four corners, the output polarity will reverse when the switch is flipped.

Note that you can do the exact same thing with a DPDT relay and have your microcontroller be in control. You’ll want to add a second relay that simply interrupts one of the input power leads to serve as a power switch if you need to stop the actuator in the middle of it’s travel (or if it doesn’t have built-in limit switches and you have a different way to detect your desired stopping point). See attached illustration of how to wire the back of a typical DPDT toggle switch to reverse the polarity.


Is there other way of controlling the actuator?

Below is a method to operate the linear actuator with relays. The actuator should already have the internal limit switches.