Phone calls makes hundred miles distance looks like just a myth and has provide the power to connect with anyone by conversation on the go. But, have you ever wondered that how it would be like to control any device or home appliances by just making a phone call.

In this tutorial, you will learn to automate things by your any cellular phone. Here, we a DTMF Decoder along with Arduino and Relay that’s all.

Project Level: Intermediate

Warning: This project involve interfacing HIGH VOLTAGE supply, so check connection 
twice and seek the help from elder or someone, who have better knowledge of 
handling High Voltage supply.

So, let’s get started!

Components Required:

  • Arduino Uno/Nano/Mega (Amazon/Ebay/Flipkart/AliExpress)
  • Relay Module (Amazon/Ebay/Flipkart/AliExpress)
  • DTMF DECODER (Amazon/Ebay/Flipkart/AliExpress)
  • Jumper Wires (Amazon/Ebay/Flipkart/AliExpress)
  • Connecting Wire/Switch Board

*Please note: These are affiliate links. I may make a commission if you buy the
components through these links.

I would appreciate your support in this way to help this website!

Connection:

Code Section:

  //This is written by Alok Shaw, author of www.roboshala.com. Anyone one is free to use and modify the code. 
 //  Visit : www.roboshala.com for more info.

int D0=2; //Data pins 0 of DTMF Decoder
int D1=3; //Data pins 1 of DTMF Decoder
int D2=4; //Data pins 2 of DTMF Decoder
int D3=5; //Data pins 3 of DTMF Decoder
int Relay1=6;
int Relay2=7;
int Relay3=8;
int Relay4=9;
void setup()
{
 pinMode(Relay1,OUTPUT);
 pinMode(Relay2,OUTPUT);
 pinMode(Relay3,OUTPUT);
 pinMode(Relay4,OUTPUT);
 digitalWrite(Relay1,HIGH);
 digitalWrite(Relay2,HIGH);
 digitalWrite(Relay3,HIGH);
 digitalWrite(Relay4,HIGH);
}

void loop() 
{
        // When 0 pressed : 0 0 0 0 (Turning all the relays to off state
  if (digitalRead(D3)==0 && digitalRead(D2)==0 && digitalRead(D1)==0 && digitalRead(D0)==0 )  
  {
     digitalWrite(Relay1,HIGH);
     digitalWrite(Relay2,HIGH);
     digitalWrite(Relay3,HIGH);
     digitalWrite(Relay4,HIGH);
     delay(200);
  }

      // When 1 pressed : 0 0 0 1
  if (digitalRead(D3)==0 && digitalRead(D2)==0 && digitalRead(D1)==0 && digitalRead(D0)==1 )  
  {
     digitalWrite(Relay1,LOW); // Turning the Relay1 ON state
     delay(200);
  }

      // When 2 pressed : 0 0 1 0
  if (digitalRead(D3)==0 && digitalRead(D2)==0 && digitalRead(D1)==1 && digitalRead(D0)==0 )  
  {
     digitalWrite(Relay2,LOW); // Turning the Relay2 ON state
     delay(200);
  }

      // When 3 pressed : 0 0 1 1
  if (digitalRead(D3)==0 && digitalRead(D2)==0 && digitalRead(D1)==1 && digitalRead(D0)==1 )  
  {
     digitalWrite(Relay3,LOW); // Turning the Relay3 ON state
     delay(200);
  }

       // When 4 pressed : 0 1 0 0
  if (digitalRead(D3)==0 && digitalRead(D2)==1 && digitalRead(D1)==0 && digitalRead(D0)==0 )  
  {
     digitalWrite(Relay4,LOW); // Turning the Relay4 ON state
     delay(200);
  }

       // When 5 pressed : 0 1 0 1
  if (digitalRead(D3)==0 && digitalRead(D2)==1 && digitalRead(D1)==0 && digitalRead(D0)==1 )  
  {
     digitalWrite(Relay1,HIGH); // Turning the Relay1 OFF state
     delay(200);
  }

      // When 6 pressed : 0 1 1 0
  if (digitalRead(D3)==0 && digitalRead(D2)==1 && digitalRead(D1)==1 && digitalRead(D0)==0 )  
  {
     digitalWrite(Relay2,HIGH); // Turning the Relay2 OFF state
     delay(200);
  }

      // When 7 pressed : 0 1 1 1
  if (digitalRead(D3)==0 && digitalRead(D2)==1 && digitalRead(D1)==1 && digitalRead(D0)==1 )  
  {
     digitalWrite(Relay3,HIGH); // Turning the Relay3 OFF state
     delay(200);
  }

      // When 8 pressed : 1 0 0 0
  if (digitalRead(D3)==1 && digitalRead(D2)==0 && digitalRead(D1)==0 && digitalRead(D0)==0 )  
  {
     digitalWrite(Relay4,HIGH); // Turning the Relay4 OFF state
     delay(200);
  }

}

 

LEAVE A REPLY

Please enter your comment!
Please enter your name here