Pages

Monday, 25 May 2015

DTMF DECODER SHIELD FOR ARDUINO



INTRODUCTION

 This board decodes DTMF signal either from an audio source or phone line to 4 bit binary TTL(5V) level output. It also indicates outputs with LED. Suitable for use with microcontroller applications.


FEATURES

  • Decodes DTMF as 4 bit binary
  • TTL level output for direct connection to microcontrollers
  • Low power 5V DC operation
  • LED indication of outputs
  • Simple to use.
  • High quality PCB FR4 Grade with FPT Certified.


ARDUINO I/O CONNECTIONS

 

ARDUINO CODE

/*
 * Project name:
    DTMF Decoder shield 
 * Copyright
     (c) Researchdesignlab.com
 * Description:
   
 * Test configuration:
     MCU:             ATMEGA328
     Dev.Board:       Arduino uno
     Oscillator:      16 MHz
     Software:        Arduino

*/

const int analogInPin1 = A0;
// Analog input pin that the potentiometer is attached to x axis Joystick
const int analogInPin2 = A1;
// Analog input pin that the potentiometer is attached to y axis Joystick
const int buttonPin_A = 2;
// the number of the D0 pin 
const int buttonPin_B = 3;
// the number of the D1 B pin 
const int buttonPin_C = 4;
// the number of the D2 C pin 
const int buttonPin_D = 5;
// the number of the D3 D pin 
const int buttonPin_E = 6;
// the number of the STD pin

int sensorValue = 0; // value read from the pot
int D0,D1,D2,D3,STD;
// variable for reading the pushbutton status
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
 
Serial.println("DTMF Decoder shield ");
Serial.println(" " );
 

// initialize the pushbutton pin as an input:
pinMode(buttonPin_A, INPUT);
 
pinMode(buttonPin_B, INPUT);
 
pinMode(buttonPin_C, INPUT);
 
pinMode(buttonPin_D, INPUT);
 
pinMode(buttonPin_E, INPUT);

}
void loop() {

// read the state of the pushbutton A,B,C,D,E value:
D0 = digitalRead(buttonPin_A);
 
D1 = digitalRead(buttonPin_B);
 
D2 = digitalRead(buttonPin_C);
 
D3 = digitalRead(buttonPin_D);
 
STD = digitalRead(buttonPin_E);
 

if (STD == HIGH) {
 
delay(400);
 
if((D0==1)&&(D1==0)&&(D2==0)&&(D3==0))
{

Serial.print('1');
}
if((D0==0)&&(D1==1)&&(D2==0)&&(D3==0))
{

Serial.print('2');
}
if((D0==1)&&(D1==1)&&(D2==0)&&(D3==0))
{

Serial.print('3');
}
if((D0==0)&&(D1==0)&&(D2==1)&&(D3==0))
{

Serial.print('4');
}
if((D0==1)&&(D1==0)&&(D2==1)&&(D3==0))
{

Serial.print('5');
}
if((D0==0)&&(D1==1)&&(D2==1)&&(D3==0))
{

Serial.print('6');
}
if((D0==1)&&(D1==1)&&(D2==1)&&(D3==0))
{

Serial.print('7');
}
if((D0==0)&&(D1==0)&&(D2==0)&&(D3==1))
{
Serial.print('8');
}
if((D0==1)&&(D1==0)&&(D2==0)&&(D3==1))
{

Serial.print('9');
}
if((D0==0)&&(D1==1)&&(D2==0)&&(D3==1))
{
Serial.print('0');
}
if((D0==1)&&(D1==1)&&(D2==0)&&(D3==1))
{
Serial.print('*');
}
if((D0==0)&&(D1==0)&&(D2==1)&&(D3==1))
{

Serial.print('#');
}
while(STD!=LOW)
{
STD = digitalRead(buttonPin_E);
}
}