Introduction: WIFI Garage Door Remote V2

About: For work I am a scientific instrumentation consultant and my hobbies are woodworking, electronics, gardening, etc ... anything that serves as a creative outlet.

Not long after I built my WIFI Garage Door Remote I realized it lacked a specific feature that would be very useful to me. I wanted to be able to tell if the door was open or closed from the app. This would require a couple of sensors and some changes to both the Wemos D1R2 board I used as well as the Android app. I spent some time trying to decide what type of sensor would be ideal for my purpose. I had 3 options to choose from:

  1. Limit switches
  2. Light (photo reflective) sensors
  3. Proximity (or Hall) sensors

I use my garage a lot for wood working and that creates a lot of dust (despite using dust collection). Dust getting into switches or covering up optical sensors would render them less reliable. Proximity sensors however, would be immune to this and thus that is the option I chose.

Step 1: Design and Materials

I searched for various proximity sensor packages and I decided to use the follow two:

  1. NJK-5002C (easy to find on ebay)
  2. Melexis US5781 in a TO-92 package (from Digikey)

My plan was for these sensors to detect the same magnet mounted at the top end of the door panel when it was in two different positions. When the door is fully open, a sensor mounted at the end of the track (NJK-5002C) can easily detect the magnet's position (see photo). When the door is closed, that same magnet will be (in my case) about 6 cm from the bottom of our heating duct enclosure. I used the more compact sensor for that location. The sensors themselves are rather easy to use. I planned to use two more digital pins on the Wemos board and just need a 10k ohm resistor and a 0.1uF ceramic capcitor for the US5781 sensor. The NJK-5781 sensor needed no additional components and could be wire up directly. It even features a built in LED that lights up when activated.

Step 2: Software and Hardware Testing

I decided to test it on the bench substituting a Wemos D1 mini for the controller. The family had come to rely on their phones to open the garage door and I could not just take away the Wemos board without upsetting everyone. Both sensors activate when sensing the south pole of a magnet and in order to get the best range, I picked the strongest magnet I had. It was a Neodymium magnet salvaged from some old equipment and measured 20 mm in diameter by 6 mm thick. Both sensor would trigger at about 2 cm distance from it.

I modified the Wemos code to update the status of the garage door to the app. It would not only send out a message whether the door was closed or open, but also send a message whether the door was "opening" or "closing" based on the position of the door prior to receiving the "click" command from the app.

The Android app was completely rewritten using MIT App Inventor. The code I used is attached. It actively polls for messages from the Wemos board and the garage door status is updated every second. As our garage door takes 13 seconds to close, that gives sufficient updates on its position.

Step 3: Assembling the Hardware

The magnet was installed (epoxied) into a recess I drilled into the top end of the garage door panel (see photo). The recess was only about 3mm deep and did not reach the insulation layer. The NJK-5002C sensor needed a mounting bracket and that was made from some scrap aluminum I had. The leads also needed to be extended and for that I used some 4 conductor telephone cable. I stripped as much as I needed from either end of the cable and cut away the 4th conductor, since I only needed 3. To connect to the Wemos board I used some mating Molex (0.062") connectors that I had left over from another project. Some heat-shrink was used to protect the exposed ends.

The US5781 sensor was soldered to a small piece of PCB together with the resistor and capacitor. I made a similar extension cable for it terminated with those same Molex connectors. To protect the module from physical damage I decide to pot it in epoxy. I used a small piece of roughly 20 mm diameter tubing to create a mold and simple put tape over one end. I filled the mold with 5 minute epoxy, stuck the sensor assembly in it and left it to cure hard. Out of some scrap aluminum I made a mounting bracket for it as well.

The Wemos board then received some pigtails with the mating Molex connectors and everything was then put into place. All cabling was secured with wire ties and clips so nothing was dangling about in the garage.

It works great and if I do find some other "upgrade", I will likely make a custom PCB for it and perhaps even switch to using a much more compact Wemos D1 mini board.

IoT Challenge

Participated in the
IoT Challenge