Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
hIOTron
Created October 13, 2020 © GPL3+

Wireless Doorbell using Arduino and RF Module

These systems have features such as a camera, video recorder & it can be easily installed in any part of the house as it is totally wireless

Wireless Doorbell using Arduino and RF Module

Things used in this project

Hardware components

RF module
×1
Arduino UNO
Arduino UNO
×1
Buzzer
Buzzer
×1
Rotary Encoder with Push-Button
Rotary Encoder with Push-Button
×1
Connecting wires
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Code

Run a program

Arduino
Doorbell Transmitter Code

// ask_transmitter.pde
// -*- mode: C++ -*-
// Simple example of how to use RadioHead to transmit messages
// with a simple ASK transmitter in a very simple way.
// Implements a simplex (one-way) transmitter with an TX-C1 module
 
#include <RH_ASK.h>
#include <SPI.h> // Not actually used but needed to compile
 
RH_ASK driver;
// RH_ASK driver(2000, 2, 4, 5); // ESP8266 or ESP32: do not use pin 11
 
 
void setup()
{
    Serial.begin(9600);   // Debugging only
    pinMode(5,INPUT);
    if (!driver.init())
         Serial.println("init failed");
}
 
void loop()
{
    if(digitalRead(5)==HIGH){
    const char *msg = "a";
    driver.send((uint8_t *)msg, strlen(msg));
    driver.waitPacketSent();
    delay(200);
    }
}
Doorbell Receiver Code

#include <RH_ASK.h>
#include <SPI.h> // Not actualy used but needed to compile
#include "pitches.h" //add Equivalent frequency for musical note
#include "themes.h" //add Note vale and duration 
 
RH_ASK driver;
 
void setup()
{
    Serial.begin(9600); // Debugging only
    
    if (!driver.init())
         Serial.println("init failed");
     else
        Serial.println("done");
}
 
void Play_Pirates()
{ 
  for (int thisNote = 0; thisNote < (sizeof(Pirates_note)/sizeof(int)); thisNote++) {
 
    int noteDuration = 1000 / Pirates_duration[thisNote];//convert duration to time delay
    tone(8, Pirates_note[thisNote], noteDuration);
 
    int pauseBetweenNotes = noteDuration * 1.05; //Here 1.05 is tempo, increase to play it slower
    delay(pauseBetweenNotes);
    noTone(8); //stop music on pin 8 
    }
}
 
void loop()
{
    uint8_t buf[1];
    uint8_t buflen = sizeof(buf);
 
    if (driver.recv(buf, &buflen)) // Non-blocking
    {
      Serial.println("Selected -> 'He is a Pirate' ");  
      Play_Pirates();
      Serial.println("stop");
  }
}

Credits

hIOTron

hIOTron

78 projects • 2 followers
hIOTron is an internet of things based company that offers an IoT Platform, products, IoT Solutions, and IoT Training.

Comments