Electric Gates with Hassio, Mqtt, Nodemcu

Hey, I’m wondering if the community can assist me with the first home automation project I’m attempting using Hassio. I’m trying to control electric gates using Hassio, Mqtt and Nodemcu (esp8266).

I’m looking to achieve 2/3 buttons on hassio (open, close and stop) to carryout the corresponding names along with the gate status. When for example “Open” is pressed I would like it to turn on a relay - and when the gates completely open by the rail pressing a physical button it will change the status of the gates to “Open” and turn off the “Open” button on the hassio interface.

I’ve tried a few different methods but haven’t been successful and was hoping someone could provide more insight as I’m not keen on having one button that turns on the gates but will go in the opposite direction of the current state.

To note: This isn’t connected to a electric gate hub, I’m using relays to directly control two motors with a trigger on either end of the motor to tell it when to stop.

If there is anymore information needed please say! :slight_smile:

Let me tell you the simplest implementation should be on the ESP8266.
Making that working to control your gate, with safety.
So the basic condition might require that the relays working on the movement motor are linked to the limit switches. So they should be connected in series.
Then you may have to sense if the motor has completely stop. To do this you may check it by a current sensing or just simply testing a secondary contact on the limit switch and/or the relay. (See the picture)
As soon your ESP8266 discover these condition then it will be able to inform the Home Assistant about such status.

Forgive me if there might miss some detail on the schematics, it is just an example.

There are many excellent tutorials on how to control garage doors that are equally applicable to electric gates. e.g.

Ok thank you, I was sorta thinking about this a coupe of hours after making the thread as in to use the method some 3D printers use as endstops in terms of when there is no power running then automatically stop, you’ve taken it a step further to directly integrate the endstops directly into the power going to the motor… or at least the relay that controls the motor.

Thank you for that, I’ll try this method.

I’d like to also note, the way the motors work for my setup at least is when you connect let’s say positive to “left wire” and negative to "right wire - it would open and when these wires are flipped around it would close it just, just mentioning that since I’ve seen some with 3 wires.

At the moment I’m mainly concentrating on a good baseline for sending and receiving data from the nodemcu (esp8266). Some code I’ve discovered has been using the arduino “json” library but that stuff confuses me when others are using information to send the data without it. I think I have the “callback()” sorted with receiving the data, but what about sending the data, what’s the function I would use because I seen some use “publishdData()”, could someone provide more information on this?

The implementation I’m using doesn’t involve an existing control box for the motor that moves the garage door which in my case - electric gates. I’ve seen quite a few of his videos and I like them but using Sonoof isn’t really my style, what @HomAut suggested is more down my alley in terms of what I need considering there’s no control box.

You are right. I took the simplest example.
You should check what kind of AC motor you have. If reversing the phases will do the rotation reverse then it might be similar to the schematics, If you have a AC motor which has a capacitor to implement as 2 phases motor then I think I’ve to search you that kind of solution…
This seems to be a good description. I just took the first on a searching result :wink:

So one wire should be connected to Neutral. The one which is not connected to the capacitor. The other two will be connected in turn according the wanted direction. :wink:

Yea the motors I’m using is FAAC #S418, I’ve had them working before via a few relays and then the main 12v power that feeds the motors come from a computer power supply.

So mostly your are done, just make sure that the relay disable each other. Just for a safety guard.
Like the above picture, you should take the contact 5 & 6 to disconnect the opposite relay. So that should be a NC contact rather than NO.

I’ll try get my head around the diagrams and once I’ve completed it I’ll post the finished relay setup and code for anyone else that is looking to do a similar thing.

You really should look at esphome, it will make it easy to interface the esp8266 with home assistant.

Exactly, the code should have the bell & whistles to dialog with HA.

I’ll try using that addon.

@HomAut I’m currently going through the relay setup which would integrate the safety you recommended. :slight_smile:

Hey @JordanHinks how did the project go in the end? Tks

Hi @rosscullen, the project wasn’t completed in terms of having the motors reconnected to the gates however, I can confirm that it had worked on a test bench and the safety mechanisms worked as intended.

1 Like

thanks @JordanHinks