use esp easy to open/close garage door with a relay ?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
alen
Normal user
Posts: 12
Joined: 02 Jun 2016, 01:05

use esp easy to open/close garage door with a relay ?

#1 Post by alen » 14 Jun 2016, 11:57

Hi all,

I'm still a rookie in the esp8266 world. I've flashed ESOeasy on my nodemcu chip.
What I would like to next is to use it to open/close my garage door. So my plan was to connect a relay to the nodemcu and use the relay to send an impulse to the garage door unit
But given the GPIO's output will be 3.3V which relay could I use? Any recommendations?

Many thanks
Alen

JR01
Normal user
Posts: 260
Joined: 14 Feb 2016, 21:04
Location: South Africa

Re: use esp easy to open/close garage door with a relay ?

#2 Post by JR01 » 14 Jun 2016, 12:25

A relay like this http://www.ebay.com/itm/1-2-4-8-Channel ... 97VcUAx-Yw will switch from 3.3v to 230v. Or, if you find 3.3v stability issues, use a 3.3v to 5v logic level converter like this: http://www.ebay.com/itm/10PCS-IIC-I2C-L ... SwnH1WZ8eR, point the GPIO output to the 3.3v side of the logic converter "LV", and use the 5v "HV" side of the converter, and drive the relay with that. Remember wie up on both side of the logic converter other required wiring, which is GND bot side, and 3.3V vs 5V on other.
-----------
IOTPLAY. Tinkerer, my projects are @ http://GitHub.com/IoTPlay, and blog https://iotplay.org. Using RPi, Node-Red, ESP8266 to prove Industry 4.0 concepts.

CoolWombat
Normal user
Posts: 30
Joined: 31 Oct 2015, 08:00

Re: use esp easy to open/close garage door with a relay ?

#3 Post by CoolWombat » 14 Jun 2016, 13:31

Hi Alen

Depending on what garage door opener you have, it might actually be easier and cheaper to use a general purpose NPN transistor and a 1K resistor. An easy way to figure out how to connect it is to measure the voltage of the two wires going to your local hardwired door control switch. The hardwired switch is the one you install inside the garage. If you don't have one installed, have a look at the back of your control unit. There should be some connection point to connect one. I have a B&D CAD4 - http://www.bnd.com.au/files/bnddocs/CAD ... manual.pdf see page 18. For mine, connection point labelled 1 is sitting at around 24VDC and connection point 2 is at Ground. When I press the door switch, I am effectively grounding connection point 1. So, you can use a relay to short the two wires, or alternately use a cheap general purpose NPN transistor. I think I used a BC548 from my junk box. For my case, I connected the collector of the NPN transistor to point 1 (measuring at 24VDC, yours might be different maybe at 12V or 5V) and emitter to point 2 (Ground/0V). I then connect the 1K resistor between the base of the transistor and one of the GPIO, I picked GPIO12 (pin 6) on my ESP-12E. To "press the switch", pull GPIO high and then withing a short while, say 1 second or so, pull it low again.

Good luck!

User avatar
lucaberta
Normal user
Posts: 59
Joined: 09 May 2016, 11:26
Location: Lausanne, Switzerland
Contact:

Re: use esp easy to open/close garage door with a relay ?

#4 Post by lucaberta » 14 Jun 2016, 15:57

I am working on something precisely the same, Alen, and am using the two relay board shown in the message from JR01.

I have not used any level converter though, as the relay works fine using 3.3V as the switching voltage. In fact, it is active low so the relay works when the GPIO is pulled low, rather than kept high. At any rate the relay has both a normally closed and a normally open contact to connect to the garage door electronics.

The only trick is to power the relay on a separate 5V rail, so the coils will use 5V but the switching signal going into the transistor on the relay board works equally well if it's 3.3V.

I prefer to have a relay to provide some isolation between the two circuits, rather than going the transistor path as described by CoolWombat.

Ciao, Luca

dduley
Normal user
Posts: 93
Joined: 06 Feb 2016, 17:56

Re: use esp easy to open/close garage door with a relay ?

#5 Post by dduley » 14 Jun 2016, 17:45

lucaberta wrote:I am working on something precisely the same, Alen, and am using the two relay board shown in the message from JR01.

I have not used any level converter though, as the relay works fine using 3.3V as the switching voltage. In fact, it is active low so the relay works when the GPIO is pulled low, rather than kept high. At any rate the relay has both a normally closed and a normally open contact to connect to the garage door electronics.

The only trick is to power the relay on a separate 5V rail, so the coils will use 5V but the switching signal going into the transistor on the relay board works equally well if it's 3.3V.

I prefer to have a relay to provide some isolation between the two circuits, rather than going the transistor path as described by CoolWombat.

Ciao, Luca
I agree with Luca,
The relay for this type of thing is the best to ensure isolation. It always makes me pucker to see un-conditioned I/O lines extend more than a few inches away from the processor. That's a great way to introduce noise and cause weird behavior like random resets. The easiest thing would be to buy a relay board from one of the Chinese vendors as previously mentioned. They are ridiculously cheap and easy to drive. a two relay board fully assembled is usually under $5 bucks. One strange thing about the relay boards is that they usually do incorporate opto isolators as part of the relay drive circuit but the ground is common to both the non-isolated and isolated sides. This normally would render the "isolation" useless but in this case the opto isolator is not there to isolate but to turn a high impedance transistor drive circuit into a current loop and therefore immune to noise. It requires a few milliamps to drive the LED in the opto isolator so a long lead or induced noise won't false trigger the relay.
I currently do this for my garage and front gate

Regards

Dave

User avatar
lucaberta
Normal user
Posts: 59
Joined: 09 May 2016, 11:26
Location: Lausanne, Switzerland
Contact:

Re: use esp easy to open/close garage door with a relay ?

#6 Post by lucaberta » 14 Jun 2016, 22:52

I agree with Dave on the additional insulation provided by boards with relays driven by an opto isolator.

As a matter of fact, the pictures shown in the eBay ad posted by JR01 show opto isolators only on the 8-channels board, but I have just found a 2 channels board with opto isolators for dirt cheap on AliExpress:

http://www.aliexpress.com/item/Free-shi ... 47693.html

This board also allows for the ground planes to be separate, so that the signal and the 5V power to the relay coils can be completely separate from one another, see the jumper with the blue cap.

Ciao, Luca

5ko
Normal user
Posts: 33
Joined: 03 Jan 2016, 17:58
Contact:

Re: use esp easy to open/close garage door with a relay ?

#7 Post by 5ko » 15 Jun 2016, 00:47

Hi all,
Hi Alen, understand your interest in opening the garage door via ESPeasy and because yours question contains a question regarding the hardware you've got a very fair and accurate answers and I also agree with everyone, however, perhaps this is a good place for another question ... Do you want to control your garage door from your local network or from the internet ?

I'd love to if someone raised his system with MQTT server and Node Red (what I find in fragments on forum) to teaching us a little about the settings of such a system ..and later perhaps as the last step to make a small mobile / Android App in the App Inventor (simplest for beginners) to the end as the target one complete solution that is interesting for many of us ...

I would only add that BLYNK is a simple and elegant for this, but since it is our goal with ESPeasy to have our own solution for garage doors ...

Regards
Petko

CoolWombat
Normal user
Posts: 30
Joined: 31 Oct 2015, 08:00

Re: use esp easy to open/close garage door with a relay ?

#8 Post by CoolWombat » 15 Jun 2016, 13:02

Hi Petko

I guess everyone has their own setup. Mine is with OpenHab running MQTT to communicate with the ESP chips. On my OpenHAB garage door screen I have this -
garagedoor.jpg
garagedoor.jpg (71.64 KiB) Viewed 19749 times
showing the status of my garage door. I can also click on the Open/Close button to open or close the garage door. The chart below is basically to show when the door was open and closed. It's data from a reed switch next to the ESP chip mounted close to the garage door opener. I cable tied a surplus magnet I got from an old disk drive to the chain that drives the door opener and positioned it such that it will be next to the reed switch when the door is closed. I have it running for a few months now and it has been fairly stable. With the newer beta code I did notice that I loose MQTT connection and have to reboot the ESP three times so far for it to reconnect. I can still connect to it via a web browser, but in the log I will see "Uptime xxx ConnectFailures yyy....." where yyy is no longer zero. When that happens it will no longer report the status of the door and also not response to the Open/Close button from OpenHAB. I will have to connect to the ESP via a web browser and goto the "Tools" screen and click on the "Reboot" button for it to work properly again. Happy to share my codes if anyone is interested.

manjh
Normal user
Posts: 516
Joined: 08 Feb 2016, 11:22

Re: use esp easy to open/close garage door with a relay ?

#9 Post by manjh » 15 Jun 2016, 18:50

How about using a Sonoff? Contains a relay, so it should be all you need!

CoolWombat
Normal user
Posts: 30
Joined: 31 Oct 2015, 08:00

Re: use esp easy to open/close garage door with a relay ?

#10 Post by CoolWombat » 16 Jun 2016, 03:56

Certainly manjh, if you have a spare sonoff you can use. You will need to modify it a bit as the relay in a standard sonoff is switching live power. If you cut the tracks from the live power to the relay, then you can use it to open and close the garage door. For me, all my sonoff are being used to drive lights, so no spare ones. Furthermore, as esp modules are cheap enough at around USD1.70 each I usually have a few lying around. So in my case, I just used one of my spare esp modules and hardwired it into my garage door opener. I have one of those 50 cent regulator modules to convert the 24V in the garage door opener to 3.3V to drive the esp.

manjh
Normal user
Posts: 516
Joined: 08 Feb 2016, 11:22

Re: use esp easy to open/close garage door with a relay ?

#11 Post by manjh » 19 Jun 2016, 10:16

CoolWombat wrote:Certainly manjh, if you have a spare sonoff you can use. You will need to modify it a bit as the relay in a standard sonoff is switching live power. If you cut the tracks from the live power to the relay, then you can use it to open and close the garage door. For me, all my sonoff are being used to drive lights, so no spare ones. Furthermore, as esp modules are cheap enough at around USD1.70 each I usually have a few lying around. So in my case, I just used one of my spare esp modules and hardwired it into my garage door opener. I have one of those 50 cent regulator modules to convert the 24V in the garage door opener to 3.3V to drive the esp.
Ah, you've got a point there. An ESP plus a cheap single-channel relay board then. AliExpress sells those for $0.50, so the whole setup would be less than $2.50. :)

User avatar
pmayer
Normal user
Posts: 26
Joined: 12 Jun 2016, 20:04
Location: Germany
Contact:

Re: use esp easy to open/close garage door with a relay ?

#12 Post by pmayer » 22 Jun 2016, 11:23

Hi,

in germany these are sold: https://ex-store.de/ESP8266-WiFi-Relay-V3

Image
Image

You have to solder the AC side for yourself - be aware working on high voltages!!!

The shops loads the ESP-07 with an own (closed source) firmware which exposes the device via http, udp and mqtt. I've flashed ESPeasy to this thing and it worked flawlessly.

There's only one detail you have to pay attention for:
This board uses a motor driver (http://www.elecrow.com/download/datasheet-l9110.pdf) to switch the relay (5V) from the 3.3V logic - normaly you would use a common transitor for that as already said in this thread. So the board needs to switch not only one GPIO but a second one contrary.

Here's my openHAB Switch for that:

Code: Select all

Switch wzRelay1Lamp "Stehlampe" (gWz) { 
    mqtt=">[mqttbroker:wzrelay/gpio/12:command:OFF:1],
          >[mqttbroker:wzrelay/gpio/13:command:OFF:0],
          >[mqttbroker:wzrelay/gpio/12:command:ON:0],
          >[mqttbroker:wzrelay/gpio/13:command:ON:1]" 
}
"wzrelay" is the name of the espeasy, the topic can be changed in Tools -> Advanced -> Subscriber/Publish Template.
The general info is taken from here to make it work: http://www.esp8266.nu/index.php/Tutorial_OpenHAB_Switch

As I understand it right, openHAB-mqtt in espeasy is somewhat generic. I switch this relay also from HAP-nodeJS and homegear via MQTT using the "openHAB mqtt"-option.


so long,
p

JR01
Normal user
Posts: 260
Joined: 14 Feb 2016, 21:04
Location: South Africa

Re: use esp easy to open/close garage door with a relay ?

#13 Post by JR01 » 23 Jun 2016, 07:57

Gr8 post!
-----------
IOTPLAY. Tinkerer, my projects are @ http://GitHub.com/IoTPlay, and blog https://iotplay.org. Using RPi, Node-Red, ESP8266 to prove Industry 4.0 concepts.

nunofgs
New user
Posts: 1
Joined: 28 Sep 2016, 00:59

Re: use esp easy to open/close garage door with a relay ?

#14 Post by nunofgs » 28 Sep 2016, 01:01

CoolWombat wrote:You will need to modify it a bit as the relay in a standard sonoff is switching live power. If you cut the tracks from the live power to the relay, then you can use it to open and close the garage door.
I have a spare sonoff and I'm trying to do just that, but I'm not very experienced with electrical circuits. Can you elaborate on how to cut the tracks and how I would wire it to the garage door?

Post Reply

Who is online

Users browsing this forum: No registered users and 67 guests