Wireless Doorbell mod

Hey,
I recently picked up this cheap ($15) RF doorbell system and have been playing around with getting to work with a Promini and DFPlayer mini. the plan is to have a wireless Mp3 doorbell using the existing RF system.

After probing about i found that one pin on the IC inside the bell sits at 0v and climbs to 3v when the transmitter is pressed.

I've soldered a wire to the pin hoping that this 0v - 3v could be used as a low, high function on the arduino? if im completely wrong set me straight lol.

cheers.

Useless image is useless. Nothing to see there.

Is that an incoming or outgoing signal?

Anyway, what's stopping you from trying it out? Just make sure you put two or three diodes and small resistor (200-500 Ohm) in the line to drop the voltage to 3V (I assume you have a 5V Arduino) and limit current (protection of both sides - you don't know what you're connecting to really) and see what happens.

Here is a picture of the IC and the pin that sits at 0v untill the transmitter is pressed. im hoping this change can replace the function of a regular switch. this is the code i've uploaded to the arduino.
D0 of the IC is running into pin2 of the arduino

/*********************************
**Wire:
*Pin10 - player TX;
*Pin11 - player RX;
*pin12 - player BUSY
**********************************/
#include <SoftwareSerial.h>
#include <DFPlayer_Mini_Mp3.h>

SoftwareSerial mySerial(10, 11); // RX, TX
int inPin = 2;
int val = LOW;
int play_state = HIGH;
long lastDebounceTime = 0;
long debounceDelay = 500;

void setup () {
pinMode(inPin, INPUT);
pinMode(13, OUTPUT);
Serial.begin (9600);
mySerial.begin (9600);
mp3_set_serial (mySerial); //set softwareSerial for DFPlayer-mini mp3 module
delay(1); // delay 1ms to set volume
mp3_set_volume (30); // value 0~30
}
void loop () {
val = digitalRead(inPin);
play_state = digitalRead(12);// connect Pin12 to BUSY pin of player
if ( ((millis() - lastDebounceTime) > debounceDelay) && (val == HIGH) && (play_state == HIGH)) {
lastDebounceTime = millis();
mp3_play (1);
//zz = ++zz;
//if (zz > 3) { zz = 1; }
digitalWrite(13, HIGH);
}

else if ( (val == HIGH) && (play_state == LOW) ) {

lastDebounceTime = millis(); //set the current time
digitalWrite(13, LOW);
delay(1000);
digitalWrite(13, HIGH);
delay(1000);
//mp3_next ();
}
}

CIR2272GM-pinout-datasheet.gif

So you want to use this output to control the Arduino instead? First I figured it's the other way around.

Should work.

Connect the GND of Arduino to the GND of your door bell, 3V should be high enough even on a 5V system to detect as HIGH when you digitalRead() the pin. Otherwise you can always use an analogRead() and see if the value is high enough (should be about 600 for 3V).

please post code between code </> tages, so it looks like this.

Scanning your code I see you have some debounce in it - why? It's not a button.

Its just some code i found i'm trying this now but cant get it to work.

///              MP3 PLAYER PROJECT
/// http://educ8s.tv/arduino-mp3-player/
//////////////////////////////////////////


#include "SoftwareSerial.h"
SoftwareSerial mySerial(10, 11);
# define Start_Byte 0x7E
# define Version_Byte 0xFF
# define Command_Length 0x06
# define End_Byte 0xEF
# define Acknowledge 0x00 //Returns info with command 0x41 [0x01: info, 0x00: no info]

# define ACTIVATED LOW

int buttonNext = 2;
int buttonPause = 3;
int buttonPrevious = 4;
boolean isPlaying = false;



void setup () {

pinMode(buttonPause, INPUT);
digitalWrite(buttonPause,HIGH);
pinMode(buttonNext, INPUT);
digitalWrite(buttonNext,HIGH);
pinMode(buttonPrevious, INPUT);
digitalWrite(buttonPrevious,HIGH);

mySerial.begin (9600);
delay(1000);
playFirst();
isPlaying = true;


}



void loop () { 

 if (digitalRead(buttonPause) == ACTIVATED)
  {
    if(isPlaying)
    {
      pause();
      isPlaying = false;
    }else
    {
      isPlaying = true;
      play();
    }
  }


 if (digitalRead(buttonNext) == ACTIVATED)
  {
    if(isPlaying)
    {
      playNext();
    }
  }

   if (digitalRead(buttonPrevious) == ACTIVATED)
  {
    if(isPlaying)
    {
      playPrevious();
    }
  }
}

void playFirst()
{
  execute_CMD(0x3F, 0, 0);
  delay(500);
  setVolume(20);
  delay(500);
  execute_CMD(0x11,0,1); 
  delay(500);
}

void pause()
{
  execute_CMD(0x0E,0,0);
  delay(500);
}

void play()
{
  execute_CMD(0x0D,0,1); 
  delay(500);
}

void playNext()
{
  execute_CMD(0x01,0,1);
  delay(500);
}

void playPrevious()
{
  execute_CMD(0x02,0,1);
  delay(500);
}

void setVolume(int volume)
{
  execute_CMD(0x06, 0, volume); // Set the volume (0x00~0x30)
  delay(2000);
}

void execute_CMD(byte CMD, byte Par1, byte Par2)
// Excecute the command and parameters
{
// Calculate the checksum (2 bytes)
word checksum = -(Version_Byte + Command_Length + CMD + Acknowledge + Par1 + Par2);
// Build the command line
byte Command_line[10] = { Start_Byte, Version_Byte, Command_Length, CMD, Acknowledge,
Par1, Par2, highByte(checksum), lowByte(checksum), End_Byte};
//Send the command line to the module
for (byte k=0; k<10; k++)
{
mySerial.write( Command_line[k]);
}
}

Ok, i just uploaded this to the board

//Digital Read with Button


int pushButton =2; //digital pin 2 has a push button attached to it. Give it an name

//the setup routine runs once when you press reset
void setup() {

  Serial.begin(9600); //initialize serial comm. at 9600 bits per second

  pinMode(pushButton, INPUT); //make the push button's pin an input
}

//the loop routine runs over and over again forever
void loop() {

  int buttonState = digitalRead(pushButton); //read the input pin

  Serial.println(buttonState); //print out the state of the button

  delay(1); //delay in between reads for stability
}

and I'm getting 0's when not in use and 1's when the transmitter is pressed. so i guess it is working.

That's a good start.
Now it's a matter of adding your mp3 playing code.

any chance you could point me in the right direction from here? would the code a posted previously work with some alterations? i tried it and nothing happens.

No debouncing needed of course; but you want only to start playing as the pin becomes high so upon change. Keep track of that. You code will be something like this:

#define DOORBELL_PIN 1 // set this to the pin that reads your doorbell.
bool buttonState = false;

void setup() {
  pinMode(doorbellPin, INPUT);
}

void loop() {
  if (digitalRead(DOORBELL_PIN) && buttonState == false) {
    buttonState = true;
    playMP3();
  }
  else buttonState = false;
}

void playMP3() {
  // play your mp3 file.
}

Hi,
You need to now write code solely for the player, forget the switch input at the moment.

@wvmarle has shown you how to add the player code but first get it going on it own.

There may be example code around that may help you get the MP3 going.

Tom... :slight_smile:

yeah i figured that. I'm not great with code but I'm working on splicing some example code with what @wvmarle has told me, cheers for the help!

Remember to put all functionality in separate functions - that makes copying them into other code a lot easier.

In your case start with an mp3 player example, maybe modify it a bit (move player code into a separate function) and then you can just copy the relevant function into your sketch.