[Cross-posted to Electrical Engineering.]

I need a linear actuator for my IOT project but how do i make one and how do i use python to control it? i saw videos of people making it with glue sticks and servos but i don't think it will be effective. enter image description here

And i am making a auto feeder so any actuator that open and close it is ok.

  • That's gotta be a pretty high torque, not-your-average servo and/or a lot of grease is involved in the glue stick because generally they stick at the drop of a hat; I have a continuous rotation FS5103R about that size and there's no way I'd bother trying that with it -- it will stall on, e.g., the plastic tip of a small pull tie. It may be capable of rotating weight, but if there is the slightest physical resistance forget it (I dunno physics but i.e., "3 kg @ 1 cm" = practically nothing).
    – goldilocks
    Sep 1, 2016 at 13:40
  • So what should i do ? Is there a effective instead of using glue sticks and servos ? Sep 1, 2016 at 13:54
  • I'm just pointing this out so you don't rush out and buy something that looks like that -- I think the problem will be that even if the actuator isn't applying much force, it will take barely anything to produce too much friction in the screw threads. I'm a total ignoramus regarding robotic-y stuff, but I would look into a stepper motor, and/or do some research about torque requirements (and how finely you can control the motor's rotation -- my continuous rotation servo is fairly fine grained but the slowest speed amounts to I think about 1 turn in 10 seconds).
    – goldilocks
    Sep 1, 2016 at 14:12
  • Another issue is you may need something like a rotary encoder if you need to keep track of the exact position, and those won't work with servos (there are some "force feedback" servos that give position but I think they are the standard 180° type, not continuous); I have a zany 8 point led & light sensitive resistor rig that works but it would be really zany in this context. As in, there are 8 leds positioned in a circle and a light sensitive resistor in a skinny tube which rotates (which is an analog sensor, so you'd need yet more hardware, and means there's something wired rotating, etc).
    – goldilocks
    Sep 1, 2016 at 14:12
  • Again, I don't have much experience with this stuff but those are some issues that jump out at me. I know some stepper motors can include a magnetic hall sensor type encoder but I think this is only good for counting rotations, not giving an exact position, so you need to think about whether that is important. Also, different rotary encoders have different precision in this regard.
    – goldilocks
    Sep 1, 2016 at 14:12

2 Answers 2


As to how to make one, that's probably best left to electronics.stackexchange.com. To control it, you'll want a relay board. This will allow you to switch large voltages and currents (like the ones you'll need for a linear actuator) on and off when the Raspberry Pi can't provide them. The details will depend on the actuator (which I'm not an expert on) but you'll need to connect the actuator to a voltage source with enough current to drive it, and put some part of the circuit through the relay pins. Then connect the control pin of the relay to GPIO (and make sure the grounds are connected together) and use Python (or another language with a GPIO library) to change the state of the relay

Let me know if anything needs clarifying :)

  • how do i control my actuator using a relay board ? what python library should i use? is there anything that i should learn to use a relay board? Thanks for your help :) Sep 1, 2016 at 13:49
  • @TechDinoKing there are lots of types of linear actuators, and motors that drive them. If I understand correctly, you just need to work out for your type of motor how to drive it. With most motors a relay should be fine, stepper motors are the exception and need a stepper motor driver. Once you've got more details, the programming's the easy part and normally consists of outputting HIGH and LOW to the relay/stepper driver. You'll find a wider community on Electronics, I'd recommend breaking your question down and posting it there.
    – Luke Moll
    Sep 1, 2016 at 13:53


You can buy linear actuators that are better quality than glue sticks and servos but they are expensive.

To control the RC servo, the motor part of the linear actuator you need to generate PWM. You can use Python to do this

  • But this doesn't look like an actuator that open and close my feeder. How should i use this servo ? Sep 2, 2016 at 7:27
  • Yes you are correct the commercial servos do not look like glue sticks..sorry lol..:) youtube.com/watch?v=-do1gOE5DZ8 shows the size of the servo, it is easy to fit into project that you are trying to do. mad-science.wonderhowto.com/how-to/…
    – Opzet
    Sep 3, 2016 at 12:28
  • Thanks... Also could you please help me with another part of my project...I am going to build something similar to a butterfly valve pictured linkhere[link].and i need and 360 degree servo with a long shaft. Can you tell which one is best for the project i am doing(i never bought servos). Thanks Sep 3, 2016 at 19:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.