# Auto Close Pocket Door

**URL:** <https://forum.core-electronics.com.au/t/auto-close-pocket-door/10614>\
**Category:** Arduino\
**Created:** [8 July 2021 06:12 UTC](https://forum.core-electronics.com.au/t/auto-close-pocket-door/10614 "2021-07-08T06:12:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anthony168421](https://avatars.discourse-cdn.com/v4/letter/a/4da419/32.png) [@Anthony168421](https://forum.core-electronics.com.au/u/Anthony168421)\
**Post date:** [8 July 2021 06:12 UTC](https://forum.core-electronics.com.au/t/auto-close-pocket-door/10614/1 "2021-07-08T06:12:30Z")

</div>

Hi, wondering if I can get some advice. I want to build a project to automatically close a sliding pocket door, to our pantry. My initial thought was to use an Ardrino, connected to a stepper motor and shield, with some reed switches. It’s been suggested thought that I use a DC motor with some limit switches, which may be valid and simpler, the focus will be on quiet and slow closing door, so a geared brushless may be appropriate? The door moves with under 1Kg of Force applied to it so the motor will need to handle this.  
This will need to detect if there was any movement, close by and deactivate the motor if this is the case, so the door can be opened again. My initial thoughts for this were to use a PIR (in-place), connected to Home Assistant and some SHELLY 1switch that I have spare to power off the device when this occurs.  
In whatever I do I want this to be reversible to the door, so not keen on talking if off or modifying it, heavily.  
Given the above then are there any suggestions as to how I should approach this and what components? aka what motor, shield, power-supply etc…

Many Thanks Anthony

---

<div class="post-metadata">

**Author:** ![James](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/james/32/4400_2.png) [@James](https://forum.core-electronics.com.au/u/James)\
**Post date:** [8 July 2021 06:26 UTC](https://forum.core-electronics.com.au/t/auto-close-pocket-door/10614/2 "2021-07-08T06:26:06Z")

</div>

Hi Anthony,

If you’re tossing up between steppers (for cost) and servos (for noise), there are a lot of stepper drivers, especially the ones by Trinamic, that can be put into a slightly-less-powerful silent mode. Here’s a video by my favourite hyper-German Marco Reps on the plusses and minuses of each:

[![](https://img.youtube.com/vi/p4ltHDpxrbI/maxresdefault.jpg "Precision motion control: ODrive Servo? Trinamic Stepper? Chinese Hybrid?") ](https://www.youtube.com/watch?v=p4ltHDpxrbI)

A key take-away from this though, is that the comparison only gets important when you’re talking about the precise positioning of a CNC machine, and positioning doesn’t even need to come into effect in your case.

One of my colleagues actually suggested that you may not even _need_ an arduino, if all you wish to do is close a door after a time limit, whilst ever there is nothing in the way.

Regardless, I’m keen to see what you come up with! Maybe some napkin-sketches of your pantry door might help us choose a motion system better 🙂  
-James

---

<div class="post-metadata">

**Author:** ![Bryce](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/bryce/32/3631_2.png) [@Bryce](https://forum.core-electronics.com.au/u/Bryce)\
**Post date:** [8 July 2021 06:48 UTC](https://forum.core-electronics.com.au/t/auto-close-pocket-door/10614/3 "2021-07-08T06:48:44Z")

</div>

Hey Anthony,

Thanks for jumping on the forum! 😄

> [@Anthony168421](#):
>
> My initial thought was to use an Ardrino, connected to a stepper motor and shield, with some reed switches. It’s been suggested thought that I use a DC motor with some limit switches, which may be valid and simpler, the focus will be on quiet and slow closing door, so a geared brushless may be appropriate? The door moves with under 1Kg of Force applied to it so the motor will need to handle this.

An Arduino (or maybe a Pico) is likely the way to go for a small microcontroller that you can use to trigger the door to open and control your motor appropriately. I’d highly suggest going with a brushed, DC motor rather than brushless or a stepper motor, as brushless motors are usually used when you need to control the RPM precisely (and usually for most brushless motors this is quite fast as they have the advantage that the only part that wears is the bearing). Similarly for steppers they provide precision rotation and holding torque, but can tend to be quite noisy and large if you need high power output.

To engineer a solution to solve some problem it’s usually best to start by looking at the functional requirements. If the problem statement was, doors need to be manually opened and closed, then your functional requirement would be that the door needs to open and close without manual interaction.

From there you can then start to go into defining the specifics of what manual interaction, open, and close means and start to identify your edge cases and functional specifications (in systems engineering, this is known as the V and is a classic approach to ensuring that the correct problems are solved, and the method by which they were solved was correct).

 ![image](https://canada1.discourse-cdn.com/flex028/uploads/core_electronics/original/2X/6/6462297bbdbd3c4060802adafea1dfa43f3182f9.jpeg)

Breaking what you’ve described down, it sounds like what you need is a way to be able to detect that a door must be opened, fully open the door without slamming it, detect that it is safe to close the door, safely and fully close the door without slamming it, and then wait for the detection to trigger the door to open again.

A potential method (breaking down exactly what each functional and technical requirement and then specification means to design an optimal solution is likely more important than experimenting first-up) to solve this would be to have a microcontroller to detect the PIR sensor was triggered and control the voltage to the motor appropriately, an L298N or similar board to supply power to your motor and board safely, some microswitches or reed switches, and a magnet on the door to identify when the door is fully opened or closed, some 22AWG solid core to wire everything together easily (I assume that you have equipment for soldering available?) and finally a battery or power supply which suits your chosen motor.

I’ve linked a potential list of what may be suitable below for you although I’d go for a motor that is intentionally slightly overpowered for the application so that you can use PWM from your Pico to slow it down if required, but it will have enough kick to move the door (your power supply will need to be suitable for this). Just be sure to check the ratings on your H-Bridge or use another type of motor driver to ensure that you don’t accidentally burn it out:

> **[PIR Infrared Motion Sensor (HC-SR501)](https://core-electronics.com.au/modmypi-pir-infrared-motion-sensor-hc-sr501.html)**
>
> PIR sensors often referred to as, "Passive Infrared" or "IR motion" sensors, enable you to sense motion

> **[Raspberry Pi Pico (Without Headers)](https://core-electronics.com.au/raspberry-pi-pico.html)**
>
> Welcome to your Raspberry Pi Pico, the new flexible microcontroller board from Raspberry Pi.

> **[Reed Switch](https://core-electronics.com.au/reed-switch.html)**
>
> This is a small device called a reed switch. When the device is exposed to a magnetic field, the two ferrous materials inside the switch pull together and the switch closes. When the magnetic field is removed, the reeds separate and the switch opens....

> **[Magnet Disk - 0.709"](https://core-electronics.com.au/magnet-disk-0-709.html)**
>
> This is your standard fridge magnet, perfect for holding up quite a bit of weight. Grade C8, ceramic disk magnet. Magnetization is throughout the thickness of the magnet. We used this part with the SparkFun flame kits found at our various workshops....

> **[Hook-up Wire Spool Set - 22AWG Solid Core - 6 x 25 ft](https://core-electronics.com.au/hook-up-wire-spool-set-22awg-solid-core-6-x-25-ft.html)**
>
> Perfect for bread-boarding, free wiring, etc. This box contains 6 spools of solid-core wire. The wire is easy to solder to and when bent it keeps its shape pretty...

> **[L298 Dual H-Bridge Motor Driver (Seeed Studio)](https://core-electronics.com.au/l298-dual-h-bridge-motor-driver-seeed-studio.html)**
>
> Double H driver module uses ST L298N dual full-bridge driver, an integrated monolithic circuit in a 15- lead Multiwatt and PowerSO20 packages. It is a...

Make sure to let us know if you have any further questions and how you go with it!

---

<div class="post-metadata">

**Author:** ![Robert93820](https://avatars.discourse-cdn.com/v4/letter/r/ac91a4/32.png) [@Robert93820](https://forum.core-electronics.com.au/u/Robert93820)\
**Post date:** [8 July 2021 07:34 UTC](https://forum.core-electronics.com.au/t/auto-close-pocket-door/10614/4 "2021-07-08T07:34:31Z")

</div>

Hi Anthony.  
Yes I think a brushed DC motor (which is reversible) with limit switches would be the simplest way to go. There are a couple of things to consider with limit switches.  
They should cut power to the motor directly. Don’t rely on other electronics to do this.  
To prevent damage due to over run the limit switch should switch a diode (with the correct polarity) across the motor to stop it dead. If the motor is left to run on it could go past the limit switch and re-power and keep on going.  
There needs to be a diode connected across the NO contacts of the limit switch of the correct polarity to enable reverse voltage to be applied to the motor to enable it to run in the other direction.  
This may sound complicated but is necessary and not too hard to do. All diodes should be capable of carrying the motor stall current.  
Cheers Bob

---

<div class="post-metadata">

**Author:** ![Anthony168421](https://avatars.discourse-cdn.com/v4/letter/a/4da419/32.png) [@Anthony168421](https://forum.core-electronics.com.au/u/Anthony168421)\
**Post date:** [8 July 2021 09:15 UTC](https://forum.core-electronics.com.au/t/auto-close-pocket-door/10614/5 "2021-07-08T09:15:23Z")

</div>

Thanks James, Bryce & Robert for the prompt responses, let me absorb and may come back with further questions. Once again Thanks
