The good people at the StackExchange EE forum could not (as of this date) answer this question, so I'm wondering if Raspberry Pi is better? By way of background: https://electronics.stackexchange.com/questions/217117/linear-actuator-question-off-the-shelf-design-possible

FYI, I'm a EE (never practiced) who took assembly language lessons way back when and also programs using Visual Studio languages, not that it really matters.

In brief, what combination of hardware and software in R.Pi can extend a linear actuator (LA) rod (until it hits its limit or a limit switch, or, perhaps power ON for a few seconds until X distance traversed or the limit switch that comes with most LA's is tripped), and, upon a second command, retract the LA rod? Assume the Linear Actuator is for light use, axial load, 10 kg weight supported (and must be maintained while the LA is turned OFF, which I think is a default configuration in that most LA's will do this, that is, not move unless powered ON) and the "duty cycle" (time the linear is powered ON and OFF) is every four hours.

In short, here is the operation desired for the LA (Linear Actuator): (1) power on the LA, (2) have the LA rod go X inches (typically four inches / 10 cm), Y seconds, or until the LA limit switch is tripped by the rod, (3) power off the LA (and have it hold the load of 10 kg force / 22 lbsf)--btw powering off the LA is not a requirement of the design, just common sense, so this step is optional), and (4) upon a passage of time of four hours, power on the LA and/or have the LA retract the rod to its starting position, then repeat this cycle after another command (that is, the LA rod stays at the starting position for four hours, then the cycle repeats).

Since a LA is nothing more than a DC or AC motor, I'll also accept and will be pleased if anybody could optionally answer this just for a DC/AC motor.

For what it's worth, this project is for a not-for-profit plan to raise chickens for a developing country in southeast Asia.

I appreciate any answers.

  • Unfortunately this question is off topic here too. Firstly you have to find a suitable actuator (this is a shopping question). Then the electronics to drive it. The software is trivial.
    – Milliways
    Commented Feb 16, 2016 at 7:07
  • What you're describing sounds a hell of a lot like a cnc z-axis. This is a shapeoko 2 using a NEMA23 stepper motor to turn an acme threaded rod. There's a captive nut threaded onto the rod, and frequently limit switches to prevent the assembly from crashing into top and bottom. Look about right?
    – goobering
    Commented Feb 16, 2016 at 8:22
  • I've answered this in a rather general way. But I'm curious as to why you chose a Raspberry Pi for this when there are arduino boards that will do all this cheaper and more simply.
    – Chris H
    Commented Feb 16, 2016 at 9:01
  • @Milliways I suspect you might be right. But knowing that the software is trivial (for someone who knows or can easily pick up a suitable language) isn't in itself obvious to a beginner.
    – Chris H
    Commented Feb 16, 2016 at 9:02
  • 1
    @ChrisH True. But if the OP had passed the first 2 steps (both off-topic) the last may be relevant.
    – Milliways
    Commented Feb 16, 2016 at 9:05

2 Answers 2



As an EE you'll know more about the hardware side than I do, but I could design the hardware if it was my project. For protoyping if you're using DC motors I suggest you look at the Gertboard: here's a directory of links to the schematics, manual etc.

For the final project I suggest you use the motor driver IC off the Gertboard (or a similar one in through-hole if it's easier), combined with GPIO pins for the limit switches (perhaps using the buffer/driver IC).

Note that you may need to add a real-time clock/have network access if you want to operate at specific times of the day. This wouldn't be required if just a 4-hour pause is needed. Alternatively you could use a light sensor and solar time in this sort of application.

Software-wise, python is easy to learn (that's the point). Like you, I knew VB when I started to learn Python, and I learnt it for a specfic project. There are python examples for all the IO you'd need on this project in the Gertboard manual or online at raspi.tv. Alternatively there are C examples if you know C and would rather not learn python.

  • Chris H - good answer, but why isn't this an off-the-shelf item? Even for Raspberry Pi, why isn't this a FAQ "HOW TO"? It should be something that any beginner is taught when designing a R. Pi board, and this would be a trivial example of how to drive a piece of hardware using the R. Pi board. (I would have thought). It seems to me that hardware design is still in its infancy, perhaps because, unlike software, there aren't that many people in the field (just a guess). Anyway, I'll keep watching this thread for other answers, and, if no more, I'll mark your answer as correct. Thank you. Commented Feb 16, 2016 at 14:29
  • Essentially there are quite a few off-the-shelf hardware solutions (like the Gertboard, which is intended to be versatile, but there are other more dedicated boards -- I'm sure there's a stepper motor board out there). When you combine this with the existance of many software-only projects (or simple LED/switch projects that connect directly to the GPIOs, you end up with a huge range of projects which don't need such a board. The RPi project's ethos was also to concentrate on the computing side, and make board development easy for others.
    – Chris H
    Commented Feb 16, 2016 at 14:59

Check out this months issue of the magpi, there is an article from simon monk on using a PI to control a linear actuator

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.