Open close motor in one motion by sensor

Hello. Im new to all this stuff and i would think this should be very easy for someone who is not.

I want a 12v dc motor that will open 90 degrees and then immediately close after being triggered by a sensor like a motion or similar sensor. The motor should be able to lift approximately 2 pounds.
So to recap. Motion sensor triggers then motor opens 90 degrees and then immediately goes back to starting point. I would like a list of all parts needed for this if possible.
Thank you

1 Like

Hello @Joshbuilds and welcome to the forum,

Are you absolutely sure that you want a 12V DC motor? As the movement is limited to 90 degrees I think a Servo Motor would be an excellent choice.

For the motion sensor you could use a Passive Infrared Detector.

You would also need a Microcontroller to read and process the sensor data that will trigger the motor.

Depending on the motor you choose you may or may not need a Motor Controller.

And you will need a Battery but that also depends on the motor you choose.

Let me know if you have any other questions

1 Like

First off thank you. I could use any motor that can run off a battery. Will a servo run off a battery? Also with a controller is it easy to set up the motion i want it to do? To both open and then close after sensor is tripped? How do decide on size of motor to open and close the weight of around two pounds? I some articles attached to your response so i will read those too.

1 Like

Hey Josh,

It is really easy to control a Servo Motor using the all-ready made library of Arduino.

I know there exist some servo motor controller but the Arduino is just easier to use.

Note that you will have to power up the Arduino as well as the Servo motor. Most of the servo will works on 5V but make sure you read the spec of the motor.

You will see it is really easy to control a servo, the red wire is the positive voltage, the black wire is the negative and the yellow wire is the signal. (most of the time but this can vary)

The signal is where you send the command from a PWM pin of the Arduino
This may sounds complicated without seeing the setup but really, it requires few components:
-Arduino (or microcontroller)
-Servo Motor
-Some Wires (breadboard wires are best)
-Power supply (for the Arduino and the Motor)

Let me know if this helps.

1 Like

Will a servo run off a battery?

Yes, a servo motor can run off a battery (well, you power it with a battery and generate the control signal with a servo controller or a microcontroller), as Phil mentioned, if you use an Arduino you can use the Servo library to control the motor. You could even power the servo with the Arduino but that depends on the nominal voltage of the servo you choose, but it best if you simply power it directly from the battery.

with a controller is it easy to set up the motion i want it to do? To both open and then close after sensor is tripped?

Definitely. Again, if you use an Arduino you simply need to get the sensor data and according to it trigger the servo using the Servo library. For example:

*Note that in that tutorial they power the servo with the Arduino but you could also power it like this

How do decide on size of motor to open and close the weight of around two pounds?

Calculate the estimated torque it would need

So ty for helping me. I was going to buy these parts for my project. Can you let me know if they will all work together? Also will this motion sensor work to detect a mouse or rat from several inches away? I know with some PIR they work for larger objects like humans. If it wont work what would you suggest?
Thanks josh!
image|258x460
These are the parts i was planning on getting

Can you let me know if they will all work together?

Yes, they will work together. Just remember you will need a power supply for the Arduino, a battery for the servo, and maybe some jumper cables.

Also will this motion sensor work to detect a mouse or rat from several inches away?

I couldn’t find much information on the range of the sensor but as it states that it is capable of detecting a person at 7m, if the detection distance for your project is only a few inches it will definitely work. However, if you want to be able to adjust the detection range a better option could be this one:

1 Like

So does this mean this will need a external power supply for the Arduino for this to all work? The arduino wont work off the battery? I was hoping this could all be working together off a battery so it does not need to be plugged into anything.

So does this mean this will need a external power supply for the Arduino for this to all work?

Not necessarily, you can use also use a battery to power the Arduino.

If you have an Arduino UNO here are the power options:

The Arduino Uno board can be powered via the USB connection or with an external power supply. The power source is selected automatically.

External (non-USB) power can come either from an AC-to-DC adapter (wall-wart) or battery. The adapter can be connected by plugging a 2.1mm center-positive plug into the board’s power jack. Leads from a battery can be inserted in the GND and Vin pin headers of the POWER connector.

The board can operate on an external supply from 6 to 20 volts. If supplied with less than 7V, however, the 5V pin may supply less than five volts and the board may become unstable. If using more than 12V, the voltage regulator may overheat and damage the board. The recommended range is 7 to 12 volts.

The EzRobot Heavy Duty Servo operating voltage is 4.8V to 8.4v (“this servo is happy to accept 7.4v LiPo battery power.”)

So yes, you could use the same battery to power both but as motors produce noise it is best to use a different battery for the Arduino.

If you need help selecting the battery/ies check this tutorial: