Garage Door Opener 2.0 using ST_Anything HubDuino

Jason Churchward from The Smarter Home Club has written another great blog post, this time, showing off his Garage Door automation!

My first ST_Anything HubDuino project consisted of a garage door opener (let’s call it Garage Door Opener 1.0). It consisted of a WeMos D1 Mini, Arduino 1 channel relay shield and a contact sensor. This had been running perfectly for months but as always things escalated and I couldn’t help myself but to build something better, so here’s 2.0!!!

After some digging around on the AliExpress website I found the following sensor components:

NodeMcu v3 CH340:

DHT12 AM2320 Digital Temperature & Humidity Sensor

HC-SR501 Infrared PIR Motion Sensor Module

1 channel Relay Shield for WEMOS D1 mini

Wired Window Magnetic door Contact Sensor

Note: you will obviously need some cable, but I found plenty around the house to re-use that was perfectly fine for the job including connectivity from the relay to the garage door unit. In addition, I installed this all within a small box from my local electronics store, but you don’t need much here.

HC-SR501 Infrared PIR Motion Sensor Module

Note: I had this connected but this specific model I found to be unreliable e.g. constantly going active / inactive and or locking up. Turns out this isn’t a great one to use but I left the details in the event someone wanted to implement another motion sensor model so they had an idea of how to do it.

VCC to 3v on NodeMCU v3 CH340
OUT to D5 on NodeMCU v3 CH340
GND to GND on NodeMCU v3 CH340

 DHT12 AM2320 Digital Temperature & Humidity Sensor
+ to D2 on NodeMCU v3 CH340
SDA to D3 on NodeMCU v3 CH340
– to G on NodeMCU v3 CH340
SCL to D4 on NodeMCU v3 CH340

1 channel Relay Shield for WEMOS D1 mini
5v to 3v on NodeMCU v3 CH340
GND to GND on NodeMCU v3 CH340
D1 to D1 on NodeMCU v3 CH340

Contact Sensor
Any to D2 on NodeMCU v3 CH340
Any to GND on NodeMCU v3 CH340

Now onto the software side. I personally use Hubitat as my home automation system (sorry not sorry!!) but some of the following is specific to that system. On the NodeMCU I configured and installed ST_Anything HuDuino see (here). I won’t go into how you load the software and sketches using the Arduino IDE (here) and the specific configurations with ST_Anything HuDuino sketches as it’s fairly well documented in their Github site but I will call out some specific key sketch changes I needed to apply for this project to work.

  • #include <PS_AdafruitAM2320_TempHumid.h> //Implements a Polling Sensor (PS) to measure Temperature and humidity using AM2320 via I2C
    • This is important under as it loads in the required libraries for the Temperature & Humidity Sensor. This is specific to AM2320 sensors.
  • #define PIN_DOORCONTROL_RELAY_1 D1  //SmartThings Capabilty “Door Control”
  • #define PIN_DOORCONTROL_CONTACT_1 D2 //SmartThings Capabilty “Door Control”
  • #define PIN_SDA D3 //SmartThings Capabilty “TempHumid”
  • #define PIN_SCL D4 //SmartThings Capabilty “TempHumid”
  • #define PIN_MOTION_1 D5 //SmartThings Capabilty “Motion Sensor” (HC-SR501 PIR Sensor)
    • These are important as they map the physical pin connections on the NodeMCU to the individual sensors. I choose to use the following, but you may find these are different for your project.
  • static st::PS_AdafruitAM2320_TempHumid sensor2(F(“AM2320_1”), 60, 20, “temperature1”, “humidity1”, false, 100);
    • This is required for the digital Temperature & Humidity Sensor given it’s a polling sensor. This is specific to AM2320 sensors.
  • static st::IS_DoorControl sensor1(F(“doorControl1”), PIN_DOORCONTROL_CONTACT_1, LOW, true, PIN_DOORCONTROL_RELAY_1, HIGH, true, 1000, 1000);
  • static st::IS_Motion sensor3(F(“motion1”), PIN_MOTION_1, HIGH, false, 500);
    • These are important as they are the interrupt sensors for the Relay and the Motion sensor. Note the HIGH mentioned under relay, that is very important as it will stop your garage door from opening when the NodeMCU loses power during an outage etc, otherwise if set to low your door will just open.
  • st::Everything::addSensor(&sensor1);
  • st::Everything::addSensor(&sensor2);
  • st::Everything::addSensor(&sensor3);
    • This is where you map the 3 new sensors you created above to the everything class.

Once you have configured and uploaded the sketch to the NodeMCU you then configure your Hubitat drivers but again no point going into this as it’s all well documented on their Github site.

Anyways if you have any questions, I am sure you can get help from either the author of ST_Anything HuDuino or I am happy to help where I can too.

Anyways good luck and enjoy and I hope this article shed some light for you. is the website for our Facebook community, The Smarter Home Club – which is an umbrella for all kinds of smart home technologies – home automation, security, custom electronics, weather stations, alternative energy, you name it. DIY focused.

If you’re interested in joining the Smarter Home Club’s Facebook group, please follow this link:

The Smarter Home Club on Facebook