Eric (Modern Day Tech): Having a Smart Home Door Closer has been a vision of mine for over a year. But to my surprise, nobody has made one, so I decided to make my own. After months of trials & tribulations and probably a thousand dollars of different parts, I finally have a smart door closer that works great. Not only does it work in HomeKit, but you also set this up with Alexa and Google Home, if you use those platforms. I look forward to seeing what other people come up with to make this project better and hopefully we can come up with a safer DC/battery option.
- DO THIS AT YOUR OWN RISK – Playing with electricity, motors, wires & relays could be dangerous if you’re not familiar with the health and safety factors involved!
BUY FROM AMAZON (affiliate links)
- High Torque Motor – https://geni.us/HighTorqueMotor
- Motor Mount – https://geni.us/MotorMount
- 7mm to 8mm coupling – https://geni.us/7to8Coupling
- 8mm to 10 mm coupling – https://geni.us/8to10Coupling
- Power Cord – https://geni.us/ElectricalACWire
- Wire Nuts – https://geni.us/WagoLeverNuts
- Shelly 2.5 Relay – https://geni.us/Shelly25
- Flexible Shaft – https://geni.us/FlexibleShaft
- 1/4 Bit Set – https://geni.us/HexBitSet
- Door Hinge Pin Closer – https://geni.us/Nuk3yDoor
- Electrical Residential Wire – https://geni.us/Romex
- Drywall Screws & Anchors – https://geni.us/DrywallAnchorsKit
When it comes to the motor, you’re going to need one with high torque, but also has a connector for three wires, which as you’ll see later, allows you to turn the motor back to its original position (via an automation), once it has completed its initial job of closing the door. This is to avoid the motor staying in its closed position after the door has closed, which will make the door almost impossible to open without damaging both the door and motor.
The motor mount is due to the fact the motor is going to be in close proximity to your door, and so will need to be placed close by, but out of the way. This being the case, a suitable set of drywall screws and anchors will be needed.
As the motor needs to be powered, you’ll need a 2-pin power cable (Type A for North America).
Because the motor is away from the door, you’re going to need the flexible shaft to connect the motor to the door (via the door hinge pin closer). The flexible shaft connects to the motor using the 7 to 8mm coupling, with the other end of the shaft being fitted with a 1/4″ bit, which in turn connects to the 8 to 1omm coupling.
The 8 to 10mm coupling then attached to the Door Hinge Pin Closer (which only requires the main pin section). The door hinge pin closer does the job of pushing the door closed, with the help of the motor, and via an automation, will return the hinge to its original position. This is achieved with the use of the Shelly 2.5 relay.
The Shelly 2.5 relay is the part that will work with HomeKit, and whilst it isn’t natively HomeKit compatible, this tutorial will explain how that’s possible. In order for the relay to connect to the motor, you’re going to need some electrical residential wire, along with a wire nut, with sockets for three wires.
TOOLS FOR THE JOB
You don’t need many tools, but these are the ones I’d consider to be essential to make the job go as smoothly as possible.
- A Hex driver or Allen Key
- A 9/32 deep socket and ratchet
- A Phillips head screwdriver
- a small flat head screwdriver
- Wirecutters and/or a wire stripper
First off, affix the torque motor to the motor mount using the ratchet and screwdriver to tighten the provided screws that will secure the motor to the mount.
With that done, you next need the 7 to 8mm coupling. The 7mm end connects to the bottom of the motor…
…with the 8mm end connecting to the flexible shaft. The end that you need in this case is the ‘male’ end with the hex screw, not the hex socket.
With the motor fixed to the mount, and the motor also connected to one end of the flexible shaft, we place the 1/4″ bit into the other end of the flexible shaft – the one with the hex (female) socket. with the bit in place, we then connect the 10 to 12mm coupling to the other end of the ‘bit’ coming from the flexible shaft.
The 10 to 12mm coupling in turn connects to the door hinge pin closer. Make sure, as already mentioned, that the top part, including the top screw for this hinge, is removed so that the coupling can fit over the top part of the hinge pin.
POWERING THE MOTOR
For this section, you’ll need four pieces of the electrical wire (two white, two grey), the Shelly 2.5 relay, wire nut, and the power cord.
Take the 2-pin power cable, and begin with the wire connected to the positive pin, which has writing on it (in the case of the N. American Type A plug, it’s the smaller pin of the two),
…and insert that into one of the L inputs on the Shelly relay. You then need two white pieces of the wire, connecting one piece to one of the L inputs on the Shelly…
…with the second white piece of wire going into the middle input of the connector on the motor. The other wire from the power cable along with the two ends from the two white wires already connected will go into the wire nut, as shown in the second image above.
Finally, the two grey pieces of electrical wire are connected thus; one wire is connected to the 02 input on the Shelly, and wired to the left-hand (as you look at it) input on the motor, with the other wire connected to the 01 input on the Shelly, with the other end connected to the right-hand input on the motor.
As regards wiring, that’s all that needs to be done. Next is getting the Shelly relay working. Simply power everything up to begin the next phase.
SOFTWARE & FIRMWARE
First of all, you’ll need to download the Shelly app from the App Store, which will be the way to first get the Shelly 2.5 relay working.
- Simply follow the app instructions to install the relay, although be aware that installing Shelly devices tend to require you to connect to the devices’ WiFi signal initially
- Then open up a browser on the device you’re setting up the Shelly with (iPhone/iPad), type in the following URL – 192.168.33.1, which will open up the Shelly Cloud page
- in the web app, click on ‘Internet & Security’
- Click on ‘WiFi Mode – Client’ and enter your WiFi details, then click Save
- Return to the WiFi settings on your device, and change your network settings back to your own network
- Open up the Shelly app
- You should see the Shelly 2.5 Relay listed, so press ‘Click to Add’
- Name your device, and assign it to a room, and select which device type it is – in this case, a relay
- Click ‘Save Device’, which then adds the relay to the ‘cloud’ enabling Amazon Alexa and Google Home control in the first instance. HomeKit is added later in the process
IMPORTANT – Before proceeding further, ensure that any firmware updates for the Shelly 2.5 Relay are installed via the Shelly app. This has to be done before you go through the process of adding the device to HomeKit.
ADDING HOMEKIT FUNCTIONALITY
If you want HomeKit support (and why wouldn’t you…), be aware that the procedure will remove Shelly Cloud access to the device once the HomeKit firmware is installed.
- Go into the Shelly app, select the relay
- Select Settings for the relay
- scroll to the bottom option – Device Information
- This will list the IP address of the relay
with this information, you’ll now need access to a computer.
- Type in the IP address, which will bring up the UI for the relay on your computer
- Open another tab and go to the following address – http://mdfm.co/HomeKitShelly
- You will see a list that contains links to Zip files for different Shelly devices
- You need the one called ‘Shelly 2.5’ – copy the URL
- Paste the URL into a new window on your browser
- Before clicking return/enter on your keyboard, replace the section of the URL shown as A.B.C.D, with the IP address of the Shelly 2.5 relay you copied just before
- Click return/enter on your keyboard, and let the firmware download, unzip and install
- Give it a couple of minutes, refresh the page, and you should get a new UI with a header showing a ‘Shelly-Homekit’ banner and some options for controlling various aspects of the relay
SHELLY-HOMEKIT UI & THE HOME APP
- In the general settings for the relay, make sure that ‘mode’ is set to ‘Switch’.
- Scroll to ‘HomeKit Settings’ and type in an 8-digit HomeKit code of your choice (make a note of it)
- Click Save
- Open the Home app, click the ‘+’ icon to add an accessory
- Select ‘I don’t have a code or cannot scan’
- The Shelly relay should show up – select it
- You’ll get a warning that the device is not certified – click ‘Add Anyway’
- Enter the HomeKit code you created just before
- The Home app will then connect to a virtual bridge created by the Shelly relay
- It will then ask you to select a room for the bridge – choose your room
- Once the ‘bridge’ is added, the two switches within the relay will appear, which also requires you to name them – simply name it ‘door’ for now and add it to the room your door and motor are located
- Set it up as a ‘switch’ (the other options are ‘Fan’ and ‘Light’)
- Do the same with the second switch that shows up, but call it ‘reset’ for now
- If you then go into the room where you’ve placed the two switches, you should see both switches listed – ‘door’ and ‘reset’
AUTOMATING THE SHELLY AND THE MOTOR
- Whilst still in the Home app, select the ‘Automation’ tab to add a new automation
- Select ‘An Accessory is Controlled’
- Select the ‘door’ switch then select ‘When’ the ‘door’ turns on
- on the next screen, scroll to the bottom of the page, and select ‘Convert to Shortcut’
- Click the ‘+’ icon, and select ‘Scripting’
- Select ‘Wait’ and increase the ‘1 second’ to ‘5 seconds’ by selecting it and tapping the ‘+’ button
- Move this section of the automation to the top of the screen by clicking and dragging it
- Now tap on the panel that says ‘Set Scenes and Accessories’
- Select the ‘Door’ switch, click Next, and set the switch to ‘Off’ on the next screen and select ‘Done’
- Click ‘+’ to add another ‘Wait’ command’ and leave it set at ‘1 second’
- Click ‘+’ again, and select ‘control XXX’ (XXX is the name of your HomeKit home)
- This adds another panel with ‘Set Scenes and Accessories’ – click on the highlighted text
- Select the ‘Reset’ switch you created earlier, click Next, set that switch to ‘On’, and click done
- You’ll return to the shortcut again, so click on ‘+’ once again, to create a third ‘wait’ script, which in this case can be 3 seconds
- Click ‘+’ one last time, select ‘control XXX’ again, and select the ‘Reset’ switch again, but this time make sure that its state is set to ‘Off’ – click Done.
- Click Next, then click Done to save the automation
So in essence, in this automation shortcut when the ‘Door’ switch is turned on (ie the motor is activated to move in the closed direction, it will then wait for 5 seconds, set the ‘Door’ switch to ‘Off’, wait for 1 second, turn the ‘Reset’ switch on (ie the motor is activated to move back into the open direction), wait for 3 seconds, and then turn the ‘Reset’ switch off. This last half doesn’t reopen the door but does ensure that the hinge pin that the motor is controlling, is reset to the open position so that when you or someone else reopens the door, the hinge pin allows this.
INSTALLING THE HINGE PIN
First of all, remove one of the original hinge pins in your door.
If your door has three hinges, replace the middle one with the hinge pin closer. If your door only has two hinges, select the top hinge, for the least amount of resistance.
You then need to fit the motor near to the hinge pin, taking care to avoid contact with the door itself, so it doesn’t stop the door from opening freely. It does need to be close enough to the hinge pin opener though, of course. You also need access to a nearby power outlet in order to power the motor, to begin with. If there’s no power outlet near the door, you’ll simply need to run an extension cable to the nearest outlet.
As everyone has different scenarios with regards to their doors, doorframes and surrounding doors, it’s down to you to figure out the best way in which to mount the motor. In this instance, a piece of wood helped to mount the motor flat on with the door frame.
You can check out the full video below for a more visual version of this tutorial.