Making a Smart BLE Receiver for My Dumb Garage Door

by taste_the_code in Circuits > Arduino

1975 Views, 15 Favorites, 0 Comments

Making a Smart BLE Receiver for My Dumb Garage Door

MVI_0636.MP4.00_00_05_02.Still001.jpg
Making a smart BLE receiver for my dumb garage door
MVI_0631.MP4.00_00_08_12.Still001.jpg
MVI_0631.MP4.00_00_22_10.Still002.jpg
MVI_0632.MP4.00_00_10_19.Still001.jpg
MVI_0626.MP4.00_00_02_05.Still001.jpg
MVI_0630.MP4.00_00_08_22.Still001.jpg

My garage door comes with a motor and a 433MHz remote that I don't always carry with me because it is quite bulky and in the way.

Because of that, sometimes when I am in front of it and I want to open it, I had to go inside and press the trigger switch that is attached to the wall next to the entry door on the inside.

Since I got tired of that, when Reyax approached me and offered to send in a BLE module for me to make a project with it, I knew that now was the right time to solve this for myself.

The final garage opener receiver uses a custom app that I built with MIT App Inventor to send a command to the Bluetooth module and a NodeMCU controller then reads that message. Once the right message is received, a relay is triggered that basically overrides the switch contacts via a relay and opens the garage door.

The entire setup is added as an add-on to the existing door and switch without interfering with it and it can be very easily removed if there is ever a need for that.

Supplies

MVI_0610.MP4.00_00_10_21.Still001.jpg
MVI_0610.MP4.00_00_27_09.Still002.jpg
Main Edit.00_01_37_00.Still001.jpg

The star of the project is the Reyax RYBG211_Lite module which is used to communicate with the phone and receive its commands. The module can connect to up to 8 devices at a time and it uses AT commands to talk to the microcontroller via UART, making it extremely easy to add Bluetooth support to any project.


The Reyax RYBG211 BLE Module can be found on the links below:

REYAX RYBG211_Lite: https://reyax.com//products/RYBG211_lite

RYBG211_Lite on Amazon: https://www.amazon.com/REYAX-RYBG211_Lite-2-4GHz-Power-Module/dp/B097Y8LSJV

RYBG211_Lite on First Component: https://www.first-components.com/en/rybg211_lite


Other parts and tools needed for the project

Making the Proof of Concept Circuit

MVI_0611.MP4.00_00_09_18.Still001.jpg
MVI_0611.MP4.00_01_00_15.Still002.jpg
MVI_0611.MP4.00_01_19_26.Still003.jpg

To begin, I first assembled the entire project on a breadboard so I can test out the code and the mobile application. The RYBG211_Lite module is connected to pins D5 and D6 and the software serial library is used to communicate with it.

The relay will be connected to pin D2, but for the POC, I only connected an LED so I can monitor the output when triggered. Most relays are controlled by pulling the pin low, so the LED anode is connected to 3.3v from the NodeMCU and its cathode is connected to pin D2.

In addition to the LED, there is also one push button that is connected to pin D1 so we can then put the entire project into pairing mode and new phones can be connected to it only in a specific time period. This is done so that we add a layer of security and prevent strangers from controlling our door.

Creating the Mobile App

MVI_0613.MP4.00_02_53_25.Still004.jpg
2022-11-19 07-05-15.mp4.00_00_03_05.Still001.jpg
2022-11-19 07-05-15.mp4.00_00_04_29.Still002.jpg

The mobile application is created using the MIT App Inventor platform. Since this is just a one-off project and to keep everything simple, the BLE module address is hardcoded inside the code so I made the APK to only work for this module. If you want to create one for yourself, you will need to update this with your module address.

Once the BLE module is connected and paired with the phone, the app has one very simple job and that is to send the "OPEN" string to the module on each button press.

An additional button is added to the top of the screen so that in case the Bluetooth module does not connect automatically, we can manually trigger the connection.

The code for the application can be found in the project repository on GitHub.

I'm not fully happy with how App Inventor works in this example as there were some Bluetooth issues with Android 12 at the time of writing this Instructable but it will have to do it for now.

Handling Security

MVI_0613.MP4.00_01_53_27.Still002.jpg
MVI_0613.MP4.00_00_42_29.Still001.jpg
MVI_0613.MP4.00_02_22_21.Still003.jpg
2022-11-19 07-07-30.mp4.00_00_15_05.Still001.jpg

A major part of the project is how to control what phone can connect to the receiver. If we allow all of the phones to connect, someone might come close to the door, connect to it, and then send the right data to the module so the door can be opened.

To prevent this, the project keeps a list of allowed devices. When a connection request is received, the Arduino code checks the allowed devices list to see if the connecting device is in the list and if it is not, then the connection is terminated immediately.

To add a device to the allowed list, we need to press the push button for 5 seconds so we can put the project into pairing mode. The pairing mode is active for 30 seconds and during this period, any new device that connects to the module will be added to the list.

To clear the list of devices, while in pairing mode, we can press the push button again and that will clear out all of the previously added devices.

Soldering the Circuit

MVI_0626.MP4.00_00_00_28.Still001.jpg
MVI_0626.MP4.00_00_09_09.Still002.jpg
MVI_0627.MP4.00_00_48_19.Still001.jpg
MVI_0626.MP4.00_00_12_20.Still003.jpg
MVI_0618.MP4.00_00_00_10.Still001.jpg
MVI_0618.MP4.00_00_01_03.Still002.jpg
MVI_0619.MP4.00_00_01_25.Still001.jpg
MVI_0620.MP4.00_00_00_15.Still001.jpg
MVI_0621.MP4.00_00_02_07.Still001.jpg
MVI_0623.MP4.00_00_03_24.Still001.jpg

Once I was happy with how the project worked, I used a prototyping PCB to make permanent solder connections. The project will be powered from a 12V power adapter so I used a DC-to-DC converter to reduce the voltage down to 5V to then provide it to the Vin pin on the NodeMCU.

All of the other connections are made as previously explained.

Creating a Project Enclosure

MVI_0628.MP4.00_02_28_27.Still002.jpg
MVI_0628.MP4.00_01_30_04.Still001.jpg
MVI_0629.MP4.00_00_09_10.Still001.jpg
MVI_0629.MP4.00_00_53_05.Still002.jpg
MVI_0629.MP4.00_01_50_06.Still001.jpg
MVI_0629.MP4.00_02_02_02.Still003.jpg
MVI_0629.MP4.00_02_28_20.Still002.jpg
MVI_0629.MP4.00_02_45_03.Still004.jpg

The final enclosure is made out of an electrical box in which I drilled two holes. One of the holes is for the power cable from the power adapter and the other one is for the cable that connects to the relay contact.

The components inside are held with hot glue.

Installation

MVI_0633.MP4.00_04_00_08.Still001.jpg
MVI_0633.MP4.00_05_44_16.Still002.jpg
MVI_0633.MP4.00_06_18_05.Still003.jpg
MVI_0634.MP4.00_00_02_24.Still001.jpg

Since the project does not modify the existing setup of the garage door and switch, all I had to do to install it is to remove the screw connector where the physical switch is already connected and add my wires to it from the relay.

This adds the switch and the relay in parallel so any of them can trigger the door to be opened or closed and to the garage motor controller, there is basically no difference in both, and are treated the same.

The power adapter is connected to the same outlet using a split adapter and the electrical box just sits on top of the motor housing.

Next Steps

MVI_0637.MP4.00_00_14_02.Still001.jpg

I really had fun making this project and I think that it came out really nice and practical. Since the NodeMCU has a built-in WiFi chip, I'm considering expanding the project at a later stage where I will also add the ability to trigger the garage door through WiFi and maybe even connect it to my smart home system.

If this sounds interesting to you, then be sure to subscribe to my YouTube channel and also follow me here on Instructables so you get to see my next projects.