Menu Close

DTMF based Home Automation on Arduino

Robo India presents tutorial on automation of home or industry using DTMF technology. The project is based on Arduino. 

1. Introduction:

This tutorial explains how to automate home or industry with DTMF module or Robo India without using micro controller.

It can control 4 AC/DC devices. 

2. Platform Assembly

The platform of the Kit has following understandings. In order to assemble the kit you need to take all screws(bolts), metal studs, platform, Arduino Board, DTMF module and Relay board.

Now tight the studs to the kit platform with the help of nuts. After tightening these studs to the kit platform it will look like –

Now you need to tight Arduino Board, DTMF module and Relay board to these studs with the help of bolts.

3. Connections

Once you are done with kit platform assembly, take assembled platform and rest of the kit contents and make the following connections.

3.1 DC and Signal Connections

3.2 AC Connections / Devices Connection

Connect the devices that are to be controlled to relay board. If AC devices are to be connected, You need to  be very careful, do not touch any bare AC terminal / wire.

Complete connections are as shown below – 

4. Programming

Till the above step you have made all of the connection and your motors are connected to the correct terminals. The following programme is DTMF based automation programme.

You may download this sketch from here.

// Robo India DTMF Home / Industrial Automation Tutorial
// www.roboindia.com

  
const int Q1 = 8;  // Defining Digital Input Pins from DTMF Module
const int Q2 = 9;
const int Q3 = 10;
const int Q4 = 11;

const int D1 = 4;  // Defining Digital output Pins for Relay Board
const int D2 = 5;
const int D3 = 6;
const int D4 = 7;


int SoQ1 = 0;     // Defining variable to store the status(HIGH/LOW) of above inputs.
int SoQ2 = 0;
int SoQ3 = 0;
int SoQ4 = 0;
int oldCon = 0;  //  Variable to know what was the last button pressed.  

void setup(){ 
   pinMode(Q1, INPUT);  // Defining pins as input.
   pinMode(Q2, INPUT);
   pinMode(Q3, INPUT);
   pinMode(Q4, INPUT);
   
   pinMode(D1, OUTPUT);  // Defining pins as output.
   pinMode(D2, OUTPUT);
   pinMode(D3, OUTPUT);
   pinMode(D4, OUTPUT);
 
}

void loop(){
  SoQ1 = digitalRead(Q1);  // Reading status of Input Pins. It can be LOW or HIGH
  SoQ2 = digitalRead(Q2);
  SoQ3 = digitalRead(Q3);
  SoQ4 = digitalRead(Q4);
  
   if(SoQ4==LOW && SoQ3==LOW && SoQ2==LOW && SoQ1==HIGH )  // Condition for Button 1. It is equal to Binary - 0001 
    {
      if (oldCon!=1){
         digitalWrite(D1, HIGH);
       }
      oldCon=1;  
    }
  
  else if(SoQ4==LOW && SoQ3==LOW && SoQ2==HIGH && SoQ1==LOW )  // Condition for Button 2. It is equal to Binary - 0010 
    {
      if (oldCon!=2){
        digitalWrite(D1, LOW);
       }
      oldCon=2;  
    }
  else if(SoQ4==LOW && SoQ3==LOW && SoQ2==HIGH && SoQ1==HIGH )  // Condition for Button 3. It is equal to Binary - 0011 
        {
      if (oldCon!=3){
         digitalWrite(D2, HIGH);
       }
      oldCon=3;  
    }
 
  else if(SoQ4==LOW && SoQ3==HIGH && SoQ2==LOW && SoQ1==LOW )   // Condition for Button 4. It is equal to Binary - 0100 
    {
      if (oldCon!=4){
        digitalWrite(D2, LOW); 
       }
      oldCon=4;  
    } 
  else if(SoQ4==LOW && SoQ3==HIGH && SoQ2==LOW && SoQ1==HIGH )   // Condition for Button 5. It is equal to Binary - 0101 
    {
      if (oldCon!=5){
         digitalWrite(D3, HIGH);  
       }
      oldCon=5;  
    }    

  else if(SoQ4==LOW && SoQ3==HIGH && SoQ2==HIGH && SoQ1==LOW )   // Condition for Button 6. It is equal to Binary - 0110 
    {
      if (oldCon!=6){
         digitalWrite(D3, LOW); 
       }
      oldCon=6;  
    }
    
  else if(SoQ4==LOW && SoQ3==HIGH && SoQ2==HIGH && SoQ1==HIGH )   // Condition for Button 7. It is equal to Binary - 0111 
    {
      if (oldCon!=7){
         digitalWrite(D4, HIGH);
       }
      oldCon=7;  
    } 

  else if(SoQ4==HIGH && SoQ3==LOW && SoQ2==LOW && SoQ1==LOW )   // Condition for Button 8. It is equal to Binary - 1000 
    {
      if (oldCon!=8){
        digitalWrite(D4, LOW);
       }
      oldCon=8;  
    } 
  else if(SoQ4==HIGH && SoQ3==LOW && SoQ2==LOW && SoQ1==HIGH )   // Condition for Button 9. It is equal to Binary - 1001 
    {
      if (oldCon!=9){
         digitalWrite(D1, LOW);
         digitalWrite(D2, LOW);
         digitalWrite(D3, LOW);
         digitalWrite(D4, LOW);  
       }
      oldCon=9;  
    }
    
delay(50);   // Debounce Delay.
  
}



5. Operating 

Dial the number of the attached phone to the kit. Receive the call. The kit will behave in the following manner –

if you press 1 – Device 1 will be ON.

if you press 2 – Device 1 will be OFF.

if you press 3 – Device 2 will be ON.

if you press 4 – Device 2 will be OFF.

if you press 5 – Device 3 will be ON.

if you press 6 – Device 3 will be FF.

if you press 7 – Device 4 will be ON.

if you press 8 – Device 4 will be OFF.

if you press 9 – All devices will be OFF.

This is how this kit works.

Note: Please read the ratings of relays, attached devices should be with in the limits of relay rating.

6. Resources:

Detailed DTMF Tutorial.

If you have any query please write us at support@roboindia.com

Thanks and Regards
Content Development Team 
Robo India
http://roboindia.com


Leave a Reply