Monday, June 17, 2013

DTMF BASED BOT CONTROL


Most of the time we get a call from the mobile call center , and the have been asking "if you need this song press 5 , or some other key". Have you have imagined that you are there in your home and they are at some remote location , how they will know that you have pressed 5 .

This is done DTMF (Dual tone multi frequency) technology.

When ever you are pressing any key in your mobile you will observe a sound , each key have different sound , but we are unable to differentiate between them.

As you can see from the above diagram , that each key have different frequency .
For example : if i press 1 i will get pair of frequency (1209,697).

So each time when you are pressing any key , the mobile center guys will be receiving the set of frequency and they will came to know that which key have been pressed.

Let move out of the theory and complete our practical.

Hardware Preparation:
Step 1: First we have to make the circuit that will receive the DMTF tone .For this we will use MT8870 IC (DTMF Decoder) IC. This will decode the corresponding frequency and will give me eqivalent binary data.
that can be read through the microcontroller .

Above is the circuit diagram ,that will receive the DTMF signals.
The next that comes to our mind is how to provide the dtmf signals to the above  circuit.
The answer is very easy either you can cut the head phone wires , then you will get 2 wires inside , connect the one wire to the DTMF input pin and other to the ground.
If you don,t want to cut the head phone wires , then buy the jack (generally 3.5mm jack for ph) from the market and connect the one wire of jack to the input and other to the circuit ground.

 Step 2:
Here we will prepare the ATmega 16 to be interfaced with the dtmf ckt.
As you can see from the above diagram , Q1,Q2,Q3 and Q4 are the output for the Decoder IC.
I will connect this output to the Microcontroller PIN where i want to read the data.

Step 3:
People will ask what is that data that is coming when we are pressing any key , the answer is given in the MT8870 datasheet , there you can see the corresponding binary data for the pressed key from the mobile.

Step 4:
There is shortcut , that i am gona tell you , if you presses 1 the equivalent will be binary eqivalent of 1 in
Q1,Q2,Q3 and Q4. Same is true for the others also.

Step :5
Suppose i have connected Q1,Q2,Q3 and Q4 to the PORTA.

Step:6
Code for Dtmf is very easy.

#define F_CPU 1000000UL
#include<avr/io.h>
#include<util/delay.h>   
int main()
{     
    DDRA = 0X00;
    DDRB = 0xFF;
   
    while(1)
    {
    if((PINA&0x0f)==2)
    {
    PORTB = 0B00001010;  // move bot forward
    }
    if((PINA&0x0f)==8)
    {
    PORTB = 0B00000101;  // move bot backward
    }
    if((PINA&0x0f)==4)
    {
    PORTB = 0B00000110;  // move bot left
    }
    if((PINA&0x0f)==6)
    {
    PORTB = 0B00001001;  // move bot right
    }
    }
  return 0;
}



Once everything is done , now you can control your bot from your mobile phone though you are anywhere in the world.

If you like my post please join us as a member to this blog.
Thanks a lot........




No comments:

Post a Comment