Make a Automatic Self Sensing Opening and Closing Door With Arduino!

Introduction: Make a Automatic Self Sensing Opening and Closing Door With Arduino!

About: I am a 20 year old student who likes electronics and programming Skills languages c# java css and html Interests home automation 3d printing Arduino's Electronics that make life easier

Ever wanted to make your door open automatic just like in sci-fi movies? Now you can by following this Instructable.

In this instructable we will build a door which can open and close automatically without you touching the door. Ultrasonic sensors on the door will detect you from 50 cm away and will open the door automatic. You don't have to touch the door it will do everything automatic!

**If you like this instructable please vote for me in the contest!!**

For a demonstration check out the Youtube video.

For this project we need:

1x breadboard

1x arduino

1x Electric motor ( I am using a old windshield motor from a VW Golf 3 )

1x Computer powersupply

2x ultrasonic sensor

A piece of metal (Can be wood but will be less strong)

A couple of wires

All these parts can be get for under 20$.

Step 1: Get and Mount the Electric Motor

Motor Choice

First of all we need an electric motor. It is very important that the electric motor has a lot of torque and a low speed. This is why I am using a windshield wiper motor. Any windshield wiper motor wiper motor from any car will do. You can also use another DC motor you have lying around, but just make sure it has enough torque to move the door.

Power to the motor

The 12 V DC motor I am using can use up to 12 A of power. This is why it is so strong but now it needs a strong power supply to power it. That is where the Computer power supply comes in. I am using a 300 watt power supply but something lower/higher than that could also work. It will give 12 A on its 12 V rail which is plenty for our DC motor. To get power from it we first have to short the green wire with a black wire. This will act as the power button. Without it the power supply wont start up. Check the picture above to see the wires and how to short it.

Door mechanism

To get the door to open we need to build a mechanism. Check out the pictures above. It consists of two metal pieces. One is 20 cm and the other 25 cm long. It can probably also be made from wood but I am not sure how strong that is. It is important that there are two points which can move. One is where the two pieces connect to each other and the other is where the longer piece connects to the door post. The other side of the smaller piece needs to be mounted on the electric motor. Because I am using metal parts I welded it on the motor. This maybe sounds a bit unclear but if you watch the video it will all be clear.


After you have made the mechanism you need to mount it on your door. I have done this by first screwing in some screw above where the motor needs to go. Then I got some zip ties and zip tied the motor to these screws. After that I used a lot of hot glue to mount in complexity. I have mounted the motor about 10 cm to the right of the center of the door and I have mounted the long piece of the mechanism a couple cm to the right of the center of the door post.

This is the hardest part of the project. If you find that the motor has not enough power to open the door or the door does not open completely try changing the location of the motor or change the length of the mechanism pieces.

Step 2: Get the Arduino Ready

As the brains of this project i am using an Arduino UNO. Any other Arduino compatible device will work to like a Arduino nano.

We first have to download the code wich can be found on my github:

Click the clone/download button and click download as ZIP.

Then unzip the package and open the AutomaticDoor.ino file with the Arduino IDE.

Then upload the code to the arduino board

In the Arduino IDE you can see the code. Above in the code there is a config part just like in the picture above. There is one very important which is the MotorDelay variable. This one decides how long the motor gets power. The longer this variable is, the longer the motor will turn and the longer the motor turns, the more the door opens. So if the door opens not completely or if it smashes into something, because if it opens to much, change this variable. Then upload the code again and see if it works correct now.

Step 3: Making the Controller and Wire Everything Up


To control the movement of the DC motor we have to build a motor controller. For this we use a H-bridge configuration like in the pictures above. I have build a H bridge using 5v relays but you can also use 4 N-channel mosfets. Just build it like the schematic above and make sure to use thick wires and high amperage components. If you are using mosfets i recommend using the IRFZ44n because they are logic level operated.

After the H bridge is completed we need to connect a couple of wires. Connect the coil pins from the relay (following the 2nd picture above) A1 and B2 together and B1 and A2 together. If you are making a mosfet H-bridge connect the Gate pins together like in the relay H bridge.

If you still don't understand the H-bridge check out this video below.


Now we have the H-bridge we need to connect it to the Arduino. Follow the schematic in the pictures and connect all the other thing to.

If you have wired everything up place one ultrasonic sensor on one side of the door and the other on the other side.

If the door is opening while it needs to close and other way around switch the wires on pin 8 and 9.

Step 4: Your Finished

Hope it was not to difficult. If you have done everything correct you now have your very own SciFi door! If something still is not working just sent me a message i am happy to help.

This project will get an update where the door will open automatically when you say: "Hey Cortana, please open the door". So stay tuned for that!

In the mean time check out my other projects which also involve home automation.

Arduino Contest 2017

Participated in the
Arduino Contest 2017

Be the First to Share


    • Reclaimed Materials Contest

      Reclaimed Materials Contest
    • 3D Printed Student Design Challenge

      3D Printed Student Design Challenge
    • Hide It Challenge

      Hide It Challenge



    4 months ago on Step 4

    How long does the entire project take to build?


    Tip 8 months ago

    DON"T USE THE DIAGRAM AND 4 RELAYS. Use only two relays.


    Question 11 months ago on Step 3

    Is that an inductor or resistor in the blackbox with the transistor? Also what is the rating if they are inductors? and if they are resistors, what type because I have 330 ohm ones. I am recreating this circuit and I am having difficulty understanding it since I am not super familiar with electric circuits.

    Thanks for the clarification


    Question 1 year ago on Step 3

    Will the door still open and close manually?


    Answer 11 months ago

    It doesn't seem like it. The motor seems to be a car window motor meant to NOT budge, otherwise people would be able to just press or pry the window and then just push it down. Have you ever seen a person get locked out and they just were able to pry the window and push it down to get in?

    If it is a windshield wiper motor it might?


    Reply 11 months ago

    Yes the door can be opened and closed manually. However it is not good for the gears inside the windshield wiper motor. But in emergency situations it can.


    12 months ago

    Hello. Very nice! I'm planning to build something similar for our cats.
    But - isn't Arduino unnecessarily sophisticated for that? The logic between sensors and H-bridge must be trivial, or not?
    Thanks and good luck in your electro-adventures! :)


    Reply 11 months ago

    All you need is a time delay DPDT relay and a sensor. Or the sensor has the time delay and a regular DPDT relay. The first one is easier.

    Set the DPDT relay time off delay for the length of time needed to open the door and time to walk through. What happens is when the PIR senses motion it sends 5v high signal to the relay module. The relay is triggered and remains on for whatever time you set it to. Once it turns off the door closes. No Arduino is need just simple components.

    If you can't find a cheap DPDT time delay relay, just get a cheap regular one and get a SPDT 5v relay module with time delay. (Use 5v so the PIR can trigger the relay with out having to add more components) Use the SPDT relay to operate the DPDT relay.


    Reply 12 months ago

    Could probably be done with some logic ic's. But when looking at costs a Arduino is much cheaper. Only 2 euros for a clone from china which works great. Also it will be much easier to change for example the delay times for opening and closing the door with a Arduino.