Building a Siri/iOS HomeKit-Enabled Garage Door Control with Raspberry Pi – Part 1: Hardware

This summer, I decided to explore home automation using a Raspberry Pi. I thought that it would be fun to control my garage door with Siri/iOS HomeKit and spent some time building a basic controller using JavaScript and some nice Node.js packages.

This post serves as the first in the series, each covering a different aspect of the build:

  1. Basic hardware acquisition and installation into a project box
  2. Software installation and code for controlling the door
  3. Software camera configuration and code streaming video to HomeKit
  4. Installing and configuring adding door open/closed sensors and adding an LCD status display

Hardware Acquisition

I purchased the items in the table below, which are required for opening and closing the garage door. You may be able to find them at a lower cost elsewhere, but I have included links to Amazon for your convenience. Also note that some items include more parts than are needed (breadboard, wires, etc.).

Item Purpose Price
CanaKit Raspberry Pi 3 with 2.5A Micro USB Power Supply (UL Listed) Raspberry Pi board and power supply. An older model may work but will have slower video encoding performance. $41.99
SanDisk Ultra 32GB microSDHC UHS-I Card with Adapter, Grey/Red, Standard Packaging (SDSQUNC-032G-GN6MA) Memory card for storing OS and software. A minimum of 8 GB is recommended. $12.76
Hammond 1591ESBK ABS Project Box, Black ES – 7.5 x 4.3 x 2.2 Inch / 191 x 110 x 57 mm Plastic project box for housing components $7.31
SunFounder 2 Channel DC 5V Relay Module with Optocoupler Low Level Trigger Expansion Board for Arduino UNO R3 MEGA 2560 1280 DSP ARM PIC AVR STM32 Raspberry Pi Size: 2 Channel Relay switch for controlling the garage door $6.79
YCS Basics 6 inch USB Micro male to female OTG extension cable Size: 0.5 Ft USB extension cable for bringing power inside the project box $6.59
Generic M2.5 Nylon Hex M-F Spacer/Screw/Nut Assorted Kit, for Raspberry-Pi, Standoff Mounting standoffs for attaching the Raspberry Pi and relay to plastic project box $11.99
Adafruit Premium Female/Male ‘Extension’ Jumper Wires – 20 x 6″ [ADA1954] Wires for connecting GPIO pins to relay $6.72
UPG 77021 22-Gauge, 2-Conductor Alarm White Cable, 500′ Speedbag Wire for connecting to garage door switch and later for connecting door closed sensor $17.48
uxcell 5 Pcs 600V 15A 12 Positions 12P Dual Rows Covered Barrier Screw Terminal Block Terminal block for providing external wiring interface $7.99

I ended up wiring the Raspberry Pi to my local network using Ethernet rather than Wi-Fi as it was out of the range of my home Wi-Fi. If you’d also like to do this, you’ll need the following items:

Item Purpose Price
Leviton 5G108-RE5 GigaMax 5E QuickPort Connector, Cat 5E, Black Providing external Ethernet port on project box $4.48
AmazonBasics RJ45 Cat-6 Ethernet Patch Cable – 3 Feet (0.9 Meters) Attaching your project box to Ethernet switch $4.99
0.5FT 24AWG Cat5e 350MHz UTP Bare Copper Ethernet Network Cable – Black Attaching Raspberry Pi’s Ethernet port to external Ethernet port on project box $3.18

I also found that I needed some other items during hardware installation:

Item Purpose
Phillips screwdriver Attaching hardware to project box
Power drill and drill bit Drilling holes in project box to attach standoffs
Small hand file Trimming out plastic for mounting of USB power extension and Ethernet port
Drywall screws Attaching project box to wall
Wire stripper Cutting and stripping control wires
Needle-nose plyers Bending control wires
Superglue Attaching USB power extension and Ethernet port to project box
Small nuts/bolts Attaching terminal block to project box

Hardware Mounting and Installation

I’ve documented my build each step of the way through pictures and some instructions. You can follow along below.

Fig 1 – External overview of the project with the lid to the project box closed.

  1. Drill mounting holes for Raspberry Pi and relay in project box.
  2. Attach the Raspberry Pi using tall standoff mounts so you will have enough space to work with the breadboard.
  3. Attach the Relay using standoff mounts. In my case, I was able to superglue the bottom of the standoffs to the project box. You may want to drill and attach similarly to the Raspberry Pi. I plan to add the capability to monitor garage door open/closed status later. I left some room in the project box for a breadboard to accommodate this.

Overview-Front
Fig. 2 – Basic layout inside the project box.

Back
Fig. 3 – Back side of the project box with standoff mounts.

  1. Cut the short Ethernet patch cable on one end and wire into the RJ-45 jack. Leave the other end for connecting to the Raspberry Pi.
  2. Drill hole for mounting Micro USB extension cable in project box, then hand file the hole, making the opening large enough to fit extension cable.
  3. Drill hole for mounting Ethernet port in project box, then hand file the opening large enough to fit the port.
  4. Superglue each into place.

Outside-Power/Ethernet Detail
Fig. 4 – RJ-45 jack and Micro-USB extension mounted to the project box.

  1. Connect the Micro-USB extension to the incoming Micro USB port on the Raspberry Pi for power.
  2. Connect the short Ethernet patch cable to the RJ-45 jack on the Raspberry Pi.

Inside-Power/Ethernet Detail 1
Fig. 5 – How to pass the Ethernet and Micro-USB extension cables to the Raspberry Pi.

Inside-Power/Ethernet Detail 2
Fig. 6 – How to pass the Ethernet and Micro-USB extension cables to the Raspberry Pi.

  1. Wire up a ground pin and 5V power pin from the GPIO on the Raspberry Pi to the GND and VCC on the relay, respectively.
  2. Wire up two GPIO pins on the Raspberry Pi to the IN1 and IN2 on the relay. You can use any two GPIO pins. In this case, we used GPIO 17 and GPIO 27.

Inside-GPIO to Relay Detail
Fig. 7 – How to connect the GPIO pins to the relay.

Inside-Relay from GPIO Detail
Fig. 8 – How to connect the GPIO pins to the relay.

  1. Drill mounting holes for the terminal block and attach with two nuts and bolts. You may want to do this step earlier to avoid messy plastic shavings all over your components.
  2. Drill holes to pass through the control wires from the relay to the terminal block.
  3. Using 22-gauge wire, connect the K1 and K2 switches as shown in the photo to the first two and the second two.

Inside-Relay to Door Switch
Fig. 9 – Connect the relay to the terminal block, providing external access to the control wires.

Outside-Terminal Block Detail
Fig. 10 – Connect the relay to the terminal block, providing external access to the control wires.

We now have a good foundation for our project. In the next part of this series, I’ll cover software installation, configuration, and code for controlling the the garage door open/close operation using the Raspberry Pi’s GPIO interface.

Conversation
  • Scott says:

    I’ve got a Genie PMX300IC/B opener that has three screws with wires going into it. They are labeled “Push Button”, “COM”, and “Safety Beam”. One pair of wires goes to the first two and the other pair goes to the second two. I assume that means my switch uses the first two screws and the child safety beam uses the last two. So, in your example, would I simply not have the K2 wire?

  • Tony says:

    Is there someone that can make me one complete? I will pay obviously for your time. I have everything in my house homekit except the garage door. :-/

    • Zach says:

      Have you ever played with a raspberry pi? Pretty fun, relatively simple, and tons of resources. I asked for more detailed pics inside the box but no reply yet. Prolly busy… I’d like to recommend a pi 3 and a sensor kit from amazon. Any will work and give you a better idea of what’s goin on. I’m no EE or programmer, only know just enough sql to be dangerous hehe have some more faith in yourself! :D it’s all about the journey and what’s learned on the way.

  • SG says:

    Hello,
    Thanks for the detailed instructions. What would you suggest for 2 garage doors with 2 openers in the same house. I would love to build one but would like it for both garage doors?

  • Slip says:

    Thanks for the instrucitons. Very cool. Curious if this works with Siri through CarPlay, or will Siri on CarPlay not pass through the relevant instructions?

  • Comments are closed.