"SmartGATE" - The ultimate Doorbell and Gate Logger!

The face plate arrived today!
Looks pretty good!

Also including a photo of the back of the case and how I connect the button to the controller.

I’ve also updated the code to reflect some newly discovered SimpleTimer shorthand coding.

Get it here: https://github.com/jaminNZx/ESP8266-Blynk-Gate-Logger-And-Counter/releases/latest

1 Like

Cool project. Does it still work ? I’m having trouble compiling it

Compiles fine, what error is it giving you?

I’ve made it work than tried another version and can’t get it to work. Would it be hard to make it work with Arduino Ethernet ? And what does bell button do ?also I could swear I saw somwhere how to set it up but I can’t find it anywhere.

This version works for me. I have just recompiled a fresh WeMos D1 Mini now.

It’d litterally take 1min to change it in setup() and switch in the blynk libraries to match the hardware.
Refer to the Blynk connection documention.
I personally have never used Ethernet but Blynk supports it!

You may have only seen a mention in this thread or another thread of mine… SmartLED Controller

The bell basically sends out a Blynk Bridge command to another ESP on the network.

We wanted a silent bell in our house so we used lights as a inidcation someone is at the door/gate.

So if you use the SmartLED Controller with a WS2811 LED strip in your house, just enter its auth code in to the settings for the SmartGate and it will flash the lights like a strobe for 2 seconds when the gate is opened or the bell is pressed.

You could add an actual sound to make it a proper bell if you wanted or just make it notify your phone/send an email etc. Think of it as just an extension. You can disable it in settings.

@Zbx did you see my post above?

Yes ,sorry I was going to respond but I wanted to make it work with Arduino Ethernet but I ran into some problems. Latest version worked for me
I have some questions.
I uncommented notifications in your code and it doesn’t work (not sure why). Email notification works fine. So my question is what part of code do I need to change to notifi me right away after switch gate was open?

hello !
im trying to use Jamin’s “SmartGATE” - The ultimate Doorbell and Gate Logger! project with arduino ethernet i’ve made some changes to his sketch but it doesn’t work
any help greately appreciated!

changes that i’ve made

//#define Blynk_PRINT Serial

//#include <ArduinoOTA.h>
//#include <ESP8266WiFi.h>
//#include <BlynkSimpleEsp8266.h>
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
#include <SimpleTimer.h>
#include <TimeLib.h>
#include <WidgetRTC.h>

#include "settings.h"
#include "globals.h"
#include "functions.h"
#include "triggerBell.h"
#include "triggerGate.h"
#include "blynk_writes.h"
char auth[] = "xxxxxx";

void setup() {
 // Blynk.begin(AUTH, WIFI_SSID, WIFI_PASS);
  //while (Blynk.connect() == false) {}
  /*********** OTA *************/
  /*********** TIMERS & RTC *************/
  timer1 = timer.setInterval(2000, []() {
    Blynk.virtualWrite(vPIN_CUR_DATE,  getCurrentDate() + String("  ") + getCurrentTime() );
   // Blynk.setProperty(vPIN_CUR_DATE, "label", String("WIFI: ") + String(map(WiFi.RSSI(), -105, -40, 0, 100)) + String("% (") + WiFi.RSSI() + String("dB)") + String(" IP: ") + WiFi.localIP().toString());
  timer2 = timer.setInterval(1000, []() {
    Blynk.virtualWrite(vPIN_GATE_HELD, formatTime(GateSwitchMillisHeld));
    if (GateSwitchSecsHeld > 0 && GateSwitchSecsHeld >= notifyDelay) sendNotification();
  timer3 = timer.setInterval(1000, []() {
    if (year() != 1970) {
      today = day();
      printOutput("Sync'd RTC - Interval: 5min");
      timer.setInterval(15 * 60 * 1000, []() {
        if (day() != today) {
          GateDailyCounter = 0;
          BellDailyCounter = 0;
          Blynk.virtualWrite(vPIN_GATE_COUNTER, 0);
          Blynk.virtualWrite(vPIN_BELL_COUNTER, 0);
          today = day();
  /******** pinModes **************/
  /******** READY **************/
  printOutput(String("Blynk v" BLYNK_VERSION ": Device started"));
  /******** SYNC **************/

void loop() {

Did you end up using my advice in the original post?

Also you need to provide compile error codes instead of just saying “doesnt work”

Everything compiles with no problem , only says low memory available, stability problems may occur. In blynk app shows offline device

@Zbx Please don’t create multiple topics for same issue… I have merged your posts back into here.

Never worked for me on iOS and local server because we’re still waiting for support for it hence why its commented out.
I think only android and cloud server accept the blynk.notify command.

I have no experience with Ethernet as I mentioned but I’m sure you have the correct connection setup according to the code in your other post. If you are having connection issues then start with the most basic blynk ethernet example and just get a simple connection running.

Line 17 in triggerGate.h…

Just remove my own personal code and replace with your own.

if (GateSwitchCurrent == HIGH && GateSwitchPrev == LOW) {
    GateSwitchFirstTime = millis();
    // LOG WHEN
    GateLastOpened = getCurrentDate() + String("   ") + getCurrentTime();
    Blynk.virtualWrite(vPIN_GATE_LAST, GateLastOpened);
    Blynk.setProperty(vPIN_GATE_HELD, "color", "#23C48E");

    // run your own code in here

    // only run code in here if silent mode is off
    if (!silentGate) {
      // enter your code here

    // only run code in here when nightTime is active
    if (nightTime) {
      // enter your code here
    Blynk.virtualWrite(vPIN_GATE_COUNTER, GateDailyCounter);
    printOutput("Gate Opened >>");

Ok so I got it working. I guess code is too long to work with Arduino Uno+Ethernet so I tried Arduino Mega+Ethernet and it worked right away.
I’ll play around with your code and hopefully I’ll adjust it to my needs :slight_smile:
Thanx a lot and once again cool project!
Best regards!

1 Like

Oh yeh throw the Uno in the bin hah :stuck_out_tongue: The WeMos D1 Mini is the best choice for 95% of arduino projects these days.

I agree but I had some connection stability issues. Nothing beats wired connection. :relieved:

1 Like

Hello Jamin.
I have made my own gate control and i just want to ask you if you have found any way to
display the table log in reverse order… Meaning the last entry on top.

Thank you!

Wow wow
Cool project :muscle::muscle:

1 Like

Wow …I saw your photo that I am quite curious on your LED button then I have just reviewed your code …yes its LED is on when no pressed … so kool man !!!
So due to this its wiring to the LED button should be minimum 3 wires (GND / incoming signal to board - pullup? to be striggered L when pressed? / outgoing signal to feed the LED - pullup, to be changed stage when pressed) ? :slight_smile:
My story: I was very curious why the LED has more than 2 pins until I know about IoT devices :smiley: … do you have for the same ? :wink:

Thanks for the sharing us …cheers !

1 Like

The 3 pin connector that you see in the photos is for a switch with a built-in LED. The description says that the LED and switch share a common ground, so one wire is ground, one wire is the switch (which will be pulled to ground when the button is pressed) and the other wire is the positive feed to the LED.

The GPIO pin that the LED positive lead is connected to (via a current limiting resistor) can be set HIGH to turn the LED on, or LOW to turn it off.


1 Like