Project tutorial
NERD ALERT! // Smart Doorbell with Arduino

NERD ALERT! // Smart Doorbell with Arduino

We needed a doorbell for our office's freight elevator.

  • 5,638 views
  • 2 comments
  • 11 respects

Components and supplies

A000066 iso both
Arduino UNO & Genuino UNO
×1
Grove 20starter 20kit 20plus 20  20intel c2 ae 20iot2 01
Seeed Grove starter kit plus for Intel Edison
We just need the Buzzer and RGB Backlit LCD modules, as well as the Base Shield with Arduino headers.
×1
09181 03 l
SparkFun Big Red Dome Button
Any ol' button will do.
×1

About this project

We needed a doorbell for our freight elevator. I'm pretty much the only one who uses the freight elevator. So, a NERD ALERT seemed in order...

This one uses a red-backlit LCD display, showing "NERD ALERT!", as well as a typical siren noise, to indicate that somebody needs to come rescue me when I push the button in the elevator.

Demo:

The circuit

I wanted something quick and dirty to shove in a cardboard box; it didn't need to be small or pretty, and so I used an Arduino 101 with a Seeed Grove kit. (An Uno would do just fine, and work the same way.)

After plugging the Grove base shield into my Arduino, I plugged the buzzer module into pin D3, and the RGB backlit LCD module into an I2C port. I wanted the button to be simple, since I have to run cable all the way from the door to the inside wall-mounted module, so I used a regular button with two wires attached to pin D2 (on the Arduino's standard female headers) and GND. Condensed version:

  • Buzzer module > D3 port
  • LCD module > I2C port
  • Button > Arduino pins D2, GND

Make sure you have the Grove LCD shield set to 5V! If it's on 3V3, the text doesn't show up – just the backlight.

I'm powering the whole thing with a 12V wall plug that feeds into the Arduino's barrel jack. I don't want to use a perfectly good USB cable for something that's just gonna stay plugged into the wall. ¯\_(ツ)_/¯

The code

I cobbled together something fairly disgusting from the Seeed Grove Kit examples on GitHub; you can download my code below. I did have to download and install the Arduino library for the LCD. (To do this, unzip the file and place it in your /Arduino/libraries folder.)

I figured that an alternating minor third (A-C-A-C-A-C...) would do for a siren noise, and I didn't really care what pitch or octave it ended up being, so it's probably a little inaccurate. Being fairly low-pitched, this is actually not that annoying. I may have to do better.

I used the INPUT_PULLUP mode for the button, because that means I don't have to stick a pullup or pulldown resistor in my circuit; it's all handled onboard by the Arduino.

When the button is pushed, the LCD scrolls "NERD ALERT!" on both lines, and it lights up with a red backlight.

Wrapping up

Altogether, this build took me about an hour to debug. Then, I just stuffed the main bits into a cardboard box, ran the button wire to the elevator, and mounted both to their respective walls.

Code

NERD ALERT doorbell codeC/C++
Cobbled together from a couple of Seeed Grove kit examples. Extremely annoying.
/*
  Cobbled together from Grove_Buzzer and Grove_RGB_Backlit_LCD examples
  in the Seeed Grove Kit repo:
  https://github.com/Seeed-Studio/Sketchbook_Starter_Kit_V2.0

  See the full project at https://www.hackster.io/glowascii/nerd-alert-e31fc2
*/

#include <Wire.h>
#include "rgb_lcd.h"

rgb_lcd lcd;
const int buttonPin = 2;     // the number of the pushbutton pin
int buttonState = 0;         // variable for reading the pushbutton status

int speakerPin = 3;          // Grove Buzzer connect to D3
int length = 2;             // the number of notes
char notes[] = "ca"; // a space represents a rest
int beats[] = { 4, 4 };
int tempo = 50;

const int colorR = 255;
const int colorG = 0;
const int colorB = 0;

void playTone(int tone, int duration) {
    for (long i = 0; i < duration * 1000L; i += tone * 2) {
        digitalWrite(speakerPin, HIGH);
        delayMicroseconds(tone);
        digitalWrite(speakerPin, LOW);
        delayMicroseconds(tone);
    }
}

void playNote(char note, int duration) {
    char names[] = { 'c', 'd', 'e', 'f', 'g', 'a', 'b', 'C' };
    int tones[] = { 1915, 1700, 1519, 1432, 1275, 1136, 1014, 956 };

    // play the tone corresponding to the note name
    for (int i = 0; i < 8; i++) {
        if (names[i] == note) {
            playTone(tones[i], duration);
        }
    }
}

void setup() 
{
    // initialize the pushbutton pin as an input:
    pinMode(buttonPin, INPUT_PULLUP);
    
    // set up the LCD's number of columns and rows:
    lcd.begin(16, 2);
    lcd.setRGB(0, 0, 0);

    pinMode(speakerPin, OUTPUT);
}

void loop() 
{
    buttonState = digitalRead(buttonPin);

    if (buttonState == LOW) {
      lcd.setRGB(colorR, colorG, colorB);
      lcd.print("NERD ALERT! ");
      for (int i = 0; i < length; i++) {
        if (notes[i] == ' ')
          {
            delay(beats[i] * tempo); // rest
          }
        else
          {
            playNote(notes[i], beats[i] * tempo);
          }
        // pause between notes
        delay(tempo / 2);
        }
    } else {
      lcd.setRGB(0, 0, 0);
      lcd.clear();
    }
}

/*********************************************************************************************************
  END FILE
*********************************************************************************************************/

Comments

Similar projects you might like

Smart Doorbell

Project showcase by Kaustubh Agarwal

  • 50,793 views
  • 20 comments
  • 108 respects

Smart Home - Smart Rules using ARTIK Cloud & Photon

Project tutorial by Raghavendra Ponuganti

  • 3,867 views
  • 2 comments
  • 12 respects

Home Smart Home

Project tutorial by Syed Sanoor

  • 68,547 views
  • 10 comments
  • 193 respects

Smart Parking System

Project in progress by Md. Khairul Alam

  • 43,049 views
  • 32 comments
  • 104 respects

Octopod: Smart IoT Home/Industry Automation Project

Project tutorial by Saksham Bhutani

  • 7,019 views
  • 8 comments
  • 30 respects

Safe Home Smart Home: Safety Device For Every Family Member

Project tutorial by Patel Darshil

  • 4,382 views
  • 0 comments
  • 10 respects
Add projectSign up / Login