Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Kaustubh Agarwal
Published © GPL3+

Smart Doorbell

Never miss anyone at your door! A system that notifies your phone and email whenever someone presses the doorbell.

BeginnerShowcase (no instructions)1 hour90,507
Smart Doorbell

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Push button
×1
Ethernet shield
×1

Software apps and online services

Arduino IDE
Arduino IDE
Blynk
Blynk

Story

Read more

Schematics

Doorbell

Code

Doorbell.ino

Arduino
#define BLYNK_PRINT Serial
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
#include <SimpleTimer.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";

SimpleTimer timer;

WidgetLCD lcd(V1);

void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth);

  while (Blynk.connect() == false) {
    // Wait until connected
  }
}
void notifyOnButtonPress()
{
  // Invert state, since button is "Active LOW"
  int isButtonPressed = !digitalRead(2);
  if (isButtonPressed) {
    BLYNK_LOG("Button is pressed.");

    Blynk.notify("Please open up! Somebody is on the door!");
     lcd.clear(); //Use it to clear the LCD Widget
  lcd.print(4, 0, "Open"); // use: (position X: 0-15, position Y: 0-1, "Message you want to print")
  lcd.print(4, 1, "The Door!");
  }
}

void emailOnButtonPress()
{

  int isButtonPressed = !digitalRead(2); // Invert state, since button is "Active LOW"

  if (isButtonPressed) // You can write any condition to trigger e-mail sending
  {
    BLYNK_LOG("Button is pressed."); // This can be seen in the Serial Monitor
    Blynk.email("kaustubhagarwal18@gmail.com", "Subject: Doorbell", "Please open up! Somebody is on the door!");
     lcd.clear(); //Use it to clear the LCD Widget
  lcd.print(4, 0, "Open"); // use: (position X: 0-15, position Y: 0-1, "Message you want to print")
  lcd.print(4, 1, "The Door!");

  }
}

void loop() {
  // put your main code here, to run repeatedly:
  Blynk.run();
  timer.run();
}

Credits

Kaustubh Agarwal
14 projects • 193 followers
IoT Enthusiast SDE@ASML

Comments