jegatheesan
Published © GPL3+

Intelligent Calling Bell

Don't want to search for calling bell, relatives don't want to wait on gate when no one in?

IntermediateFull instructions provided1,236
Intelligent Calling Bell

Things used in this project

Hardware components

speakers
×1
Motion Detector
×1
LCD Display
×1
Push button
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Plan

Code

Callingbell.ino

Arduino
#include <LSD.h>
#include <LAudio.h>
#include <LEEPROM.h>

int filenum;
String Cfilename;
int start=0;
AudioStatus status1;
int Sensor_Pin=A0;
int SensorReading=0;
int inputpin=A1;
int buttonstatus=0;
int curaddress=100;
int a1val=0;

void setup() {
  Serial.begin(9600);
  Serial1.begin(9600);  
  LSD.begin();  
  delay(1000);
  filenum = EEPROM.read(curaddress);
  if (filenum>10 or filenum<1)
  {
  filenum = 1;  
  }
  Serial1.write(22);
  Serial1.write(12);  
  delay(200);
  Display();
}

void Display()
{
    Serial1.write(128);
    Serial1.println("****HAI JEGAN***");        
    Serial1.write(148);
    if (filenum==1)
    {
      Serial1.println("    In Home    ");
    }else if (filenum==2)
    {
      Serial1.println("  Not In Home  ");
    }else if (filenum==3)
    {
      Serial1.println("  Xmas holiday  ");      
    }else if (filenum==4)
    {
      Serial1.println("     Call me    ") ;     
    }else if (filenum==5)
    {
      Serial1.println("     Silent     ")  ;    
    }    
    
}

void loop() {
  SensorReading = analogRead(Sensor_Pin);
  a1val= analogRead(inputpin);
  if (a1val > 250 && buttonstatus==0)
  {
    buttonstatus=1;
  } 
  else if (a1val < 250 && buttonstatus==1)
  {
    filenum = filenum+1;
    if (filenum>5)
    {
      filenum=1;
    }
    Display();
    if(filenum!=5)
    {
      play();      
    }
    EEPROM.write(curaddress,filenum);
    buttonstatus=0;
  }
  
  if(filenum!=5)
  {
    if (SensorReading>250)
    {
      status1 = LAudio.getStatus();
       if(status1 == 5 || status1 == -1 || start==0)
       {
        start=1;
        play();      
        delay(2000);
       }
    }
  }
  delay(250);
}

void play() 
{
  Cfilename = "";
  Cfilename = Cfilename + filenum;
  Cfilename = Cfilename + ".mp3";  
  char a[Cfilename.length()];
  Cfilename.toCharArray(a,Cfilename.length()+1);
  char *file_name;
  file_name = a;
  LAudio.setVolume(5);
  LAudio.playFile(storageSD, file_name);
}

Credits

jegatheesan

jegatheesan

18 projects • 66 followers
Simply A Mechatronics Lover.

Comments