In Miscellaneous

Controlling a linear actuator is fun and easy. They’re really strong and can be used for all kinds of things: raising your TV out of a hidden pocket; crushing your enemies; or building an RC backhoe or dump truck. I did this entire project in about 20 minutes for around $150 CAD.

Linear Actuator Circuit Parts

Linear Actuator Circuit Assembly

The board comes with screw terminals and male/male headers unattached. I used my trusty Solomon SR-998 soldering iron to attach them. The board has four large holes for wires that are not the right spacing for the screw terminals. Immediately next to the large holes are pairs of smaller holes that work perfectly.

I then attached the rest of the components. Here’s a simplified circuit diagram.

Actuator circuit

Actuator circuit. Click for larger version.

The female power plug screwed into GND/VIN on the VNH5019 so I could unplug the power supply with ease. You could put switch in here for an E-stop.

The Arduino is powered from the USB connection. For this demo you have to have the USB and the 12v5a power connected. The Arduino can handle 12v so you could get a 12v6a power supply and power everything without a USB. I wanted to keep this simple, but feel free to discuss it in the forums.

Linear Actuator Code

I carefully read the VNH5019 instructions before I made my purchase. You’d do your homework too, right? Right. That’s how I knew what to put in the Arduino code.

Get the code here: https://github.com/MarginallyClever/vnh5019_linear_actuator/

Now you

Did this tutorial help you? Give us a shout on the forums and show your creation. We’d love to share it with the world.

Got questions? See something that could be better? Post below!

Showing 18 comments
  • Adam

    How are you controlling the linear actuator? How would you control it remotely?
    Thank you

    • Dan
      Dan

      take a look at the link to the code in the article. This could be changed to listen for commands from the serial line (sent from the PC). Another way would be to use a NodeMCU instead of an arduino, and then you could access it remotely over the internet.

      • Adam

        How about using RF?

  • Tony

    Could you explain how it could be controlled using a sensor i.e. when object is detected, it moves in one direction, and the reverse direction when there is no object.

    • Dan
      Dan

      The arduino can turn on the power of the h bridge to drive the actuator in or out. The arduino could also listen to a sensor and when the sensor changes state (it detects something) the arduino could then decide what action to take (move actuator in, for example)

  • Kyle

    Could you control the distance and force applied?

    Could it run out to a certain distance but if there is to much force in the way it would stop, then try again. Say as to change a gear in a gear box.

    • Dan
      Dan

      Out of the box this actuator does not have a distance sensor or a force sensor. Both would need to be added to do what you ask.

  • sap

    Hello Dan,

    I try your tutorial for the electrical actuator. it’s working for the forward, but not for the Backward.

    What happen ?

    I need your help on

    Regards

    • Dan
      Dan

      post a video of your circuit to the forums and a link to your code. Then maybe I can see the problem.

      • Kevin

        I am having this same issue, Im using a longer stroke actuator. It slowly moved forward but never back. I used the same wiring and code. I’m jus wondering what i will need to change the code to have this move a bit quicker and backwards in a loop.

        • Dan
          Dan

          What controller are you using? Does the light change when the direction changes? (see video) My guess from no information given is that the direction is not being reversed.

  • John

    Thank you for ths tutorial, I am actually a student dping this as a project so excuse my lack of experience. My question is the following : How did you exactly attatch the male male header the arduino ? Is there a special wire used to connect the Arduino to the pins ? Were the long parts of the pins facing the ground when you inserted them before soldering ? Thank you very much.

    • Dan
      Dan

      male male headers fit into the female headers on the Arduino. I don’t understand where you’re stuck.

  • Ludwig

    Hi Dan, can you please share the Polulu VNH5019 library you used for Arduino ?
    Thanks in advance.

    • Dan
      Dan

      I don’t remember a library. It was a very short arduino sketch.

  • Alec

    I have copied your same code and wired everything as you explained and the actuator only moves out. The light is green and red at the same time and then when it is extended fully, it just stays fading green on and off. I am also using a longer stroke actuator. Thanks.

    • Dan
      Dan

      If your results differ, something has changed. Different model of board? Different wiring? Different pins on the Arduino?

  • _emanuello

    The code uses PIN 2, 3, 4, while in the circuit diagram you wrote 3, 4, 5.
    I was having the same issue as Sap and Kevin, I think that’s the reason they’re having it too!

    Fixed the wiring (or the code, your choice!) and everything worked!

    Just a note: the actuator goes more forward than backward so, after a while, I’ll the actuator fully extend. I’ll fix it in the code, no big deal!

    Thank you Dan!

0
Save & Share Cart
Your Shopping Cart will be saved and you'll be given a link. You, or anyone with the link, can use it to retrieve your Cart at any time.
Back Save & Share Cart
Your Shopping Cart will be saved with Product pictures and information, and Cart Totals. Then send it to yourself, or a friend, with a link to retrieve it at any time.
Your cart email sent successfully :)