One of the things that can make your life easier is being able to remotely control your gate. Same to me! I was always wanting to add WiFi control to my intercom, so that I could open it from my phone wherever and whenever I want.
After weeks and weeks trying to find a technician who has experiences about the intercom, and seems nobody knows, or maybe they just don’t want to mess with my intercom’s board – it’s a very old device. Even worse, there isn’t any mark, or manual, all wires are the same, black color.

Well, it seems I will have to do it by myself, again!

I had to check every wire and port, to trace the circuit that controlled the gate opening mechanism. I’ve also found some diagrams from internet, but seems my wires are connected in different ways…
So I tried plan B: Using a Relay module with an ESP01S board to hook into the “Open gate” button. Pretty easy!
Basically, the Relay module has 5 ports (NO – COM – NC and GND – VCC), and other 8 holes to connect with the ESP01S board.

I wrote a simple Arduino program that creates a web server and listens for commands to close the circuit (NO – COM) – by writing LOW into Relay PIN, then connect NO and COM ports with the intercom’s button. Don’t forget the release it (write HIGH into Relay PIN) after, or the gate will always open!

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WiFiMulti.h> 
#include <ESP8266WebServer.h> 

ESP8266WiFiMulti wifiMulti;

ESP8266WebServer server(80); 

#define RELAY 0

void setup(void){
  pinMode(RELAY, OUTPUT);
  digitalWrite(RELAY, HIGH);
  wifiMulti.addAP("---WIFI-NAME---", "---WIFI-PASSWORD---");

  while ( != WL_CONNECTED) {

  server.on("/", handleRoot);
  server.on("/high", handleHigh); 
  server.on("/low", handleLow); 
  server.on("/high-low", handleHighThenLow); 
  server.on("/low-high", handleLowThenHigh); 


void loop(void){

void handleRoot() {
  server.send(200, "text/plain", "Hello!");
void handleHigh() {
  digitalWrite(RELAY, HIGH);
  server.send(200, "text/plain", "HIGH");
void handleLow() {
  digitalWrite(RELAY, LOW);
  server.send(200, "text/plain", "LOW");
void handleHighThenLow() {
 digitalWrite(RELAY, HIGH);

 if (server.arg("delay") != ""){
 } else {
 digitalWrite(RELAY, LOW);
 server.send(200, "text/plain", "HIGH-LOW");

void handleLowThenHigh() {
 digitalWrite(RELAY, LOW);

 if (server.arg("delay") != ""){
 } else {

 digitalWrite(RELAY, HIGH);
 server.send(200, "text/plain", "LOW-HIGH");

void handleNotFound(){
  server.send(404, "text/plain", "404");

However, I couldn’t find any power line to power the board, so I used a 500mAh small battery, connect to GND (-) and VCC (+) ports. It’s very small, allows me to fit everything inside the intercom and make the system more discreet.

After connecting the battery to the ESP board, I was able to connect to the web server using my smartphone and send GET request (http://–Board-IP–/low-high) to open the gate. It worked perfectly, so happy with the result!

Update: After learning a bit about ESPHome, I’ve tried to rewrite the firmware again, so it could connect with my Home Assistant server easily.

  name: esp01-relay

  name: ${name}
  name_add_mac_suffix: true
    name: esphome.esp01-relay
    version: "1.0"

  board: esp01_1m

  ssid: "---WIFI-NAME---"
  password: "---WIFI-PASSWORD---"


  - platform: gpio
    id: relay
    pin: GPIO0
    name: "Relay"
    restore_mode: ALWAYS_OFF
    inverted: true
  - platform: template
    name: "Pulse Relay"
    - switch.turn_on: relay
    - delay: 1000ms
    - switch.turn_off: relay

- platform: safe_mode
  name: Safe Mode Boot
  entity_category: diagnostic

Update 2: I’ve found a better solution! Check it here!