Arduino doorbell with custom sounds and buttons



You might think what's so special about this doorbell.

Well, it might be not that special but think of it this way, you have three doorbell buttons and different sound for each button. One is for your friends and family, one is for postman and one is for normal people.

Every time when postman comes he pushes the dedicated button, you will know that that's a postman because of the different sound it (arduino doorbell) will make. So for example, you got something coming by post, you will be happy and rush to the door to open it.

You might as wel think what if post man hits the other button?
Com on, most of the time people don't play around like that, specially adults. So that means you will get the right kind of doorbell sounds most of the time.

Forget the doorbell for a moment, you can even use this sketch as a door or window alert. Something like if someone opens a door or window then it will notify you which door is open or which window is open. So this sketch could be helpful in many ways.

What do you need to make it work?
* 1× Arduino board.
* 1× Catalex Serial mp3 player with micro sd card.
* 3× Push button switches.
* 3× 10k ohm resistors.
* Some jumper wires.
* And finally the sketch, which you can find right below.

Note:
Remember you need to have three soundtracks in your sd card and rename it by 001, 002 and 003.

The sketch
#include <SoftwareSerial.h>
#define ARDUINO_RX 5//should connect to TX of the Serial MP3 Player module
#define ARDUINO_TX 6//connect to RX of the module
SoftwareSerial mySerial(ARDUINO_RX, ARDUINO_TX);
static int8_t Send_buf[8] = {0} ;

#define CMD_SEL_DEV 0X09
#define DEV_TF 0X02
#define CMD_PLAY_W_VOL 0X22

const int buttonPin1 = 8;
int buttonState1 = 0;

const int buttonPin2 = 9;     // the number of the pushbutton pin
int buttonState2 = 0;         // variable for reading the pushbutton status

const int buttonPin3 = 10;
int buttonState3 = 0;

void setup()
{
    mySerial.begin(9600);
          Serial.begin(9600);
      delay(500);//Wait chip initialization is complete
      sendCommand(CMD_SEL_DEV, DEV_TF);//select the TF card 
      delay(200);//wait for 200ms

     pinMode(buttonPin1, INPUT);
     pinMode(buttonPin2, INPUT);
     pinMode(buttonPin3, INPUT);
}

void loop() {
  buttonState1 = digitalRead(buttonPin1);
  buttonState2 = digitalRead(buttonPin2);
  buttonState3 = digitalRead(buttonPin3); 

  if (buttonState1 == HIGH) {
sendCommand(CMD_PLAY_W_VOL, 0X1E01);//This doorbell is for friends and family.
  }
 
else if (buttonState2 == HIGH) {
sendCommand(CMD_PLAY_W_VOL, 0X1E02);//This doorbell is for post men.
  }

else if (buttonState3 == HIGH) {
sendCommand(CMD_PLAY_W_VOL, 0X1E03);//This doorbell for is normal people.
  } 
}

void sendCommand(int8_t command, int16_t dat)
{
  delay(20);
  Send_buf[0] = 0x7e; //starting byte
  Send_buf[1] = 0xff; //version
  Send_buf[2] = 0x06; //the number of bytes of the command without starting byte and ending byte
  Send_buf[3] = command; //
  Send_buf[4] = 0x00;//0x00 = no feedback, 0x01 = feedback
  Send_buf[5] = (int8_t)(dat >> 8);//datah
  Send_buf[6] = (int8_t)(dat); //datal
  Send_buf[7] = 0xef; //ending byte
  for(uint8_t i=0; i<8; i++)//
  {
    mySerial.write(Send_buf[i]) ;
  }
}

That's all for this post, hopefully it helps you. :)





..........
custom doorbell sounds, custom doorbell buttons, custom doorbell button, custom doorbell, arduino doorbell, doorbell with custom sounds, custom sound doorbell, doorbell custom sounds, custom doorbell sound, arduino door bell, custom doorbell mp3, doorbell arduino, push button mp3 player, arduino mp3 player, custom doorbell cover, arduino door chime, button with custom sound.

6 comments:

  1. I dont think this circuit works? When you hit the buttons it will short out the power to GND. Can you confirm the buttons are correct.

    ReplyDelete
  2. Hi ,

    This project is exactly what I am looking to do with my Arduino .I have downloaded this code and wired the UNO as you have shown but unfortunately this code does nor work for me . If I disable your 2nd and 3rd buttons I can get the first audio track to play but I have to hold the button down . I know this is an old post but I was hoping you might be able to check your code with your project again , maybe something was left out of your posted code ? Thanks for your help and great posts .

    T

    ReplyDelete
    Replies
    1. Sorry to hear about your situation , I hope things improve for you quickly . Thank you for the quick reply and the projects you have already shared .

      All the best ,
      Tom

      Delete

















  3. This circuit works with this skech !!!


    #include
    #define ARDUINO_RX 5//should connect to TX of the Serial MP3 Player module
    #define ARDUINO_TX 6//connect to RX of the module
    SoftwareSerial mySerial(ARDUINO_RX, ARDUINO_TX);
    static int8_t Send_buf[8] = {0} ;

    #define CMD_SEL_DEV 0X09
    #define DEV_TF 0X02
    #define CMD_PLAY_W_VOL 0X22

    const int buttonPin1 = 8;
    int buttonState1 = 0;

    const int buttonPin2 = 9; // the number of the pushbutton pin
    int buttonState2 = 0; // variable for reading the pushbutton status

    const int buttonPin3 = 10;
    int buttonState3 = 0;

    void setup()
    {
    mySerial.begin(9600);
    Serial.begin(9600);
    delay(500);//Wait chip initialization is complete
    sendCommand(CMD_SEL_DEV, DEV_TF);//select the TF card
    delay(200);//wait for 200ms

    pinMode(buttonPin1, INPUT);
    digitalWrite(buttonPin1 , HIGH);
    pinMode(buttonPin2, INPUT);
    digitalWrite(buttonPin2 , HIGH);
    pinMode(buttonPin3, INPUT);
    digitalWrite(buttonPin3 , HIGH);
    }

    void loop() {

    if (digitalRead(buttonPin1) == LOW) {
    sendCommand(CMD_PLAY_W_VOL, 0X1E01);//This doorbell is for friends and family.
    }

    else if (digitalRead(buttonPin2) == LOW) {
    sendCommand(CMD_PLAY_W_VOL, 0X1E02);//This doorbell is for post men.
    }

    else if (digitalRead(buttonPin3 ) == LOW) {
    sendCommand(CMD_PLAY_W_VOL, 0X1E03);//This doorbell for is normal people.
    }
    }

    void sendCommand(int8_t command, int16_t dat)
    {
    delay(20);
    Send_buf[0] = 0x7e; //starting byte
    Send_buf[1] = 0xff; //version
    Send_buf[2] = 0x06; //the number of bytes of the command without starting byte and ending byte
    Send_buf[3] = command; //
    Send_buf[4] = 0x00;//0x00 = no feedback, 0x01 = feedback
    Send_buf[5] = (int8_t)(dat >> 8);//datah
    Send_buf[6] = (int8_t)(dat); //datal
    Send_buf[7] = 0xef; //ending byte
    for(uint8_t i=0; i<8; i++)//
    {
    mySerial.write(Send_buf[i]) ;
    }
    }

    ReplyDelete



Newly posted:
Reason why rich getting richer and poor getting poorer