rf closed solenoid question


I need help creating source code for my senior project. I’m creating a door that will open and close due to light (which I will implement later). I need help creating code that will extend and retract my actuator. Any thoughts? I have input1 into gpio20 and input2 into gpio21

deleted by Community 2 days ago (RemoveAbandonedClosed)

This question was automatically deleted. Please see the help center for more information.

closed as unclear what you’re asking by joanMilliwaysSteve RobillardGhanima Mar 26 at 21:46

Please clarify your specific problem or add additional details to highlight exactly what you need. As it’s currently written, it’s hard to tell exactly what you’re asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    part of doing a project is planning, research and development …… you provided almost non-existent information ….. what type of actuator are you using? …. pneumatic, hydraulic or electric? ………. what research have you done? ….. what have you tried? – jsotola Mar 25 at 22:25
  • I’m using an electric linear actuator. I’m not familiar in coding and that’s why i’m seeking help. – Sam Romeo Mar 25 at 22:30
  • 2
    🙂 OK… so I’ll ask the obvious question: “Why does your senior project require you to write code, yet, you’re not familiar with it?” Not even familiar enough to ask a good question? – Seamus Mar 26 at 0:23
  • One brainstorming idea is to use a powerful 12/24/36V DC or BLDC motor, or a 220VAC induction motor, to push the door open, and let a door closer (, a common mechanical device that closes a door, in general after someone opens it, or after it was automatically opened. I once thought about stepper linear actuators (, but they are not powerful enough. – tlfong01 Mar 26 at 4:02   
  • And instead of linear actuators, you can actually use a pulley connected to the shaft of a motor to convert rotational motion to linear motion. Or you might build a simple door similar to a garage door. You can find youtubes on smart garage door opener, based on ultrasound sensor, such as this one: Introducing OpenGarage: an Open-Source WiFi Garage Door Opener using ESP8266 53,042 views – tlfong01 Mar 26 at 9:20   


You question is a little bit vague. Let me ask you a couple of leading questions to make you more specific.

(1) Tell us more about the “door” you are going to “create”. Is it a very small door for your smart cat and she is strong enough to push the “door” open?

(3) Now suppose your door has a light sensor and switches on a green LED when there is light.

(4) The smart cat sees the green light and knows the door is not locked, and therefore pushes the door open, otherwise she won’t bother.

(5) If my guesses are correct, then what you need is not an actuator, relay, nor a solenoid, but a “door-solenoid”, like this.

(6) Are you using Rpi Python? If yes, I can suggest you where to starting look for useful code.

Or you may like to reply to my questions to go another direction.

Solenoid Lock DC12V

In case you wish to read more before coming back, I would suggest the following links. GPIOZero is very good for python newbies.

By the way, a solenoid lock is very much like a solenoid which in turn operates like a relay, so you need to start getting to know the relay. And of course you can also google or youtube, but my references are good for newbies and also DIY hobbyists to get started.


Relays Explained – ExplainThatStaff

Relay Switch Circuit – Electronics Tutorials

Electromechanical Relays – All About Circuits

And in case you don’t like reading articles and prefer videos, I would recommend this one:

Solenoid Basics – Jeri Ellsworth 2011sep21, 643,847 views

And if you wish to try a general purpose solenoid instead of an expensive specific door lock, I would recommend the cheap ZYE1-0837AP. I have already done some research, so you carry on where I left.

ZYE1-0837AP Solenoid Characteristics

You mentioned actuator and relay. I guess you mean solenoid and relay. Actually you need a relay to control a solenoid, because Rpi GPIO is not strong enough to drive a solenoid. So what you do is to let Rpi drive a relay module (yes, a “module” which Rpi can drive, not a bare bone relay which Rpi cannot!), which in turn drives a solenoid. Here is the picture of what you can do.

Relay driving a solenoid

I will pause here. Please feel free to ask more questions or make counter suggestions and I am happy to join in.

Have a nice project, Sam.

deleted 2 days ago
  • This is not an answer. If you want to ask questions please use the comment feature. – Steve Robillard Mar 26 at 1:48
  • Ah yes, this is not the answer. This is only part of the answer. It is the leading questions to suggest the real answer. – tlfong01 Mar 26 at 1:52   
  • I am learning how to answer a question by asking more questions. This is one of the 9 things I wish to learn from the following. How To Successfully Respond To A Question – Stephanie Vozza 2016oct28… – tlfong01 Mar 26 at 6:23    
  • 2
    I admire the effort you put in helping others, but this site doesn’t work like a forum. Making reasonable assumptions about the info missing in the question is OK, but asking for clarifications should be done in comments, not answers. – Dmitry Grigoryev Mar 26 at 8:55
  • Thank you for your advice. So I will ask questions in comments. My apologies for any disconcerting caused.– tlfong01 Mar 26 at 9:26   

Categories: solenoid

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: