Garage Door Opener

Good morning/afternoon/evening folks:

I'm looking to make a garage door opener using the Arduino IDE. I have Nanos, Megas, NodeMcu ESP8266's, and so fourth. As it stands, I'm just using a car remote that clips to your visor so I can't tell if the door is opened or closed. What I'd like to do is design something that uses an Arduino of some flavor and a button, possibly a pull up resistor. I already have some generic door contacts (magnets) to I can see the garage door status.

So now that I've bored you with the particulars, the help I'm looking for is the hardware. I prefer to code it myself but I'm sure I'll be back asking for help when the time comes. I was looking at the NRF24L01+ 2.4GHz Wireless RF Transceiver which looked pretty interesting but I'm not entirely sure if this is a good way to go. Any help would be appreciated, thanks and Merry Christmas to everyone!

I’m unsure what you are proposing here - using a low power radio won’t tell you , if you are far away, if the door is open or shut .
Can you explain a bit more?

Sure and thanks for responding. I already have another means of using WiFi to open and close the garage door, I'm looking to replace the garage remote that I've been using. My house is detached from the garage otherwise I would use the hard wired switch that it came with. It's not a far distance, maybe 10-20 feet away. I thought maybe using two Arduinos and a relay and the NRF24L01.

I love those ittle radios now that i know how to use them. They can be tricky to get working and there are a lot of bogus units out there.

An alternative to the RF24 is the HC-12. The HC-12 has range comparable to the rf24, uses only 2 or 3 pins instead of 5 and (in my opinion) are easier to use. HC-12 operates like a serial port. Buy from a reputable vendor.

I'm looking at the HC-12 right now. I think I'll go that route. They're a little more expensive that the other one but I like the fact that it's a longer range. Thanks for your help I truly appreciate it. Merry Christmas to you my friend.

I believe that the extra expence is offset by the 2 or 3 pins gained and ease of use.

Do be aware that you cannot continously transmit with those radios. Be aware of the restrictions when using any radio frequency device.

It's for a garage door opener. Just need it as a momentary button.

So there will be no 2 way communication?

What sort of range do you want, 100 feet, 1000 feet?

For 1 way communication there are these modules

You must buy or make (very easy) antennas for those modules for them to work.

No there has to be 2 way communication so I can get the status of whether the door is opened or closed.

I'm going to use some generic door contacts to send back that info. If the door is open, a red LED lights up, closed will light a green, and the momentary button will light a blue LED for 2 seconds.

Couple of points ( ok a few more )

  1. The range of some of these devices is short and they may not work inside the car . If it only works within your view if the door …

  2. Your indication of open or closed will need to be sent back , with another transmitter receiver pair - how often do you want confirmation sending ?
    You can change the direction of signal on the RF24 and I guess you might be able to use the ACK signal in some way ??

  3. What about an SMS system - you could get your status via a text and open /close from anywhere in the world and have a shortcut in the car phone to operate it .

  4. Something with Arduino cloud , where you can look at the status or operate the door from your phone

Beware you need something to check the door can operate without squashing anyone , hitting the car , or trapping someone inside - if you can’t see it operate !

Very good advice from @hammy .

Good morning and Merry Christmas! Thanks for the info, I already have a garage door opener with the little eyes installed at the bottom of the rail. If someone steps into its view, the door will either stop closing, or if it's already open it simply will not operate. SMS? I'll have to look into that, I already have a way to open or close from anywhere, I was just looking to add a buttonn inside the house to compliment the system I already have.

Hello All:

Hope you all had a Wonderful Christmas and a happy new year. I'm trying to build a garage door opener using two Arduino Nano's and two NRF24L01 modules. I currently have a garage door opener but the main control pad is in the garage which is detached from my house. The unit that will go in the house (transmitter) will have a push button, and three LED's (one RGB LED.)

The garage unit (receiver) will contain a single relay which will be wired into the existing garage door opener main unit, which will close for 650 milliseconds triggering the door to close, and a reed switch which will send data back to the transmitter.

At the transmitter the three LED's will be used to display the status of the garage door, opened or closed. Green light means closed, red means opened, and blue means activity as when I press the button. When the button is pressed a signal is sent to the receiver which closes the relay. So far I got the relay to close.

The problem: I got the reed switch working at the receiver which lights up a red or green light but only at the receiver, I'm not coding it correctly to get the signal back to the transmitter so the remote lights light up. The reed switch is connected to the receiver and is working but I can't seem to get the signal back.

The code I have is in two parts, one for the transmitter and one for the receiver. Please see the attached code. Links to the hardware I'm using can be found below. Thanks to everyone in advance for your help.

Reed Switch

Arduino Nano

Relay

NRF24L01

Push Buttons

TRANSMITTER CODE

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#define blueLed 2
#define redLed 4
#define greenLed 5
#define CE 7
#define CSN 8
#define buttonPin 3
int buttonState = 0;
int sensorState = 0;
int rdt = 650;

RF24 radio(CE, CSN);

byte addresses[][6] = {"pass1", "pass2"};

void setup() {
  Serial.begin(115200);
  pinMode(buttonPin, INPUT_PULLUP);
  pinMode(blueLed, OUTPUT);
  pinMode(redLed, OUTPUT);
  pinMode(greenLed, OUTPUT);
  digitalWrite(blueLed, LOW);
  digitalWrite(greenLed, HIGH);
  digitalWrite(redLed, LOW);
  radio.begin();
  radio.setChannel(124);
  radio.setPALevel(RF24_PA_MAX);
  radio.openWritingPipe(addresses[1]);
  radio.openReadingPipe(1, addresses[0]);
  radio.stopListening();
}
void loop() {
  buttonState = digitalRead(buttonPin);
  //sensorState = digitalRead(Sensor);
  if (buttonState == 1) {
    buttonState = 1;
    digitalWrite(blueLed, LOW);
    digitalWrite(greenLed, HIGH);
    digitalWrite(redLed, LOW);
  } else if (buttonState == 0) {
    buttonState = 0;
    digitalWrite(blueLed, HIGH);
    digitalWrite(greenLed, LOW);
    digitalWrite(redLed, LOW);
  }

  //Serial.print("Button State ");
  //Serial.print(buttonState);
  // Serial.print(" Sensor State ");
  // Serial.println(sensorState);
  Serial.print("\t");
  radio.write(&buttonState, sizeof(buttonState));
}

RECEIVER CODE

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#define redLed A0
#define Relay A1
#define greenLed A5
#define sensorPin 2
#define CE 7
#define CSN 8
int rdt(650);
int buttonState = 0;
int sensorState = 0;

RF24 radio(CE, CSN);

byte addresses[][6] = {"pass1", "pass2"};

void setup() {
  Serial.begin(115200);
  pinMode(sensorPin, INPUT_PULLUP);
  pinMode(redLed, OUTPUT);
  pinMode(greenLed, OUTPUT);
  pinMode(Relay, OUTPUT);
  digitalWrite(redLed, HIGH);
  digitalWrite(greenLed, HIGH);
  digitalWrite(Relay, HIGH);
  radio.begin();
  radio.setChannel(124);
  radio.openWritingPipe(addresses[0]);
  radio.openReadingPipe(1, addresses[1]);
  radio.setPALevel(RF24_PA_MAX);
}
void loop() {

  sensorState = digitalRead(sensorPin);
  if (sensorState == 1) {
    digitalWrite(redLed, HIGH);
    digitalWrite(greenLed, LOW);
  } else if (sensorState == LOW) {
    digitalWrite(redLed, LOW);
    digitalWrite(greenLed, HIGH);
  }
  
  radio.startListening();
  while (!radio.available());
  radio.read(&buttonState, sizeof(buttonState));


  if (buttonState == 1) {
    digitalWrite(redLed, LOW);
    digitalWrite(Relay, HIGH);

  } else if (buttonState == 0) {
    delay(rdt);
    digitalWrite(redLed, HIGH);
    digitalWrite(Relay, LOW);
  }
}

Hello musicman608

I have been following the topic of using this type of wireless module and the associated software functions for some time now.

For wireless projects, I recommend using the HC12 module.

What are the advantages:

  1. no external functions from a library are needed.
  2. the development of a communication protocol is in your hands
  3. the necessary development steps can be programmed and tested without using the wireless module
  4. the radio module can be easily configured for the project requirements
  5. both transmitter and receiver are contained in one radio module.

hth

Have a nice day and enjoy coding in C++.

Thanks for the info, I do have several HC12's, however I'd rather stick with the NRF24L01's. I'm already knee deep into the research just to come up with the code I already have. Thanks again my friend.

1 Like

Please post an annotated schematic showing exactly how you have wired it. Be sure to show all connections, power, ground and power sources. Note any wires over 10"/25cm. PS I do not follow frizzes very well.

I think ACKs are enabled by default so you're TXer is prolly getting the acknowledgement. So in your TX sketch you will want to do that radio.read to catch that ACK back.

EDIT: Acknowledgements are enabled by default. But will need to enable ACK payloads as described rather well in below post by Robin2.