Make phone dialer with arduino

For the discussion of Arduino related topics.

Moderators: vaico, sunzhanshan

Make phone dialer with arduino

Postby admin » 2012-12-05 23:36

How to call telephone? Maybe it's very simple: pick up the phone and dial the numbers on the phone's keyboard.
If we can make a phone call when pick up the phone without touching the phone's keyboard? Yes, we can.
Now introduce how to generate Dual-tone multi-frequency signaling using arduino.

When use this, we pick up the phone and put the speaker close to the microphone. Send the telephone number needs to be dialed through the serial port, then wait for a moment, the phone will be dialed successfully.
Extended usage:
Drivable switch simulates phone off-hook event. Dial using this circuit, then control voice module (WT588D ect.) according to the event by arduino. It can complete a whole automatic dialing machine, which can be used for making alarm or telephone reminder.

Material list:
1.arduino board *1;
2.speaker *1;
3.100 ohm resistance *1 (100 ohm ~ 1 Kohm optional);
4.1uF capacitance *2 (0.1uF~10uF optional).
Image

Code:
1. Down "Tone" library, then decompress to "arduino-0022\libraries" folder.
Tone.zip
Tone library
(10.09 KiB) Downloaded 922 times

The characteristic of this "Tone" library compared with its own is that it can output different frequency waveforms through more than one pin at the same time, but its own only through one pin in a period of time.

2. Download the code below into arduino 0022.
Code: Select all
#include <Tone.h>

String Phone_Number = "";
int i = 0, mark = 0;

//Define freq1 and freq2 for Tone's example, define the Dual-tone multi-frequency signaling.
//DTMF keypad frequencies, see: http://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling
Tone freq1;
Tone freq2;
const int DTMF_freq1[] = {1336, 1209, 1336, 1477, 1209, 1336, 1477, 1209, 1336, 1477};
const int DTMF_freq2[] = {941,  697,  697,  697,  770,  770,  770,  852,  852,  852};

void setup()
{
    Serial.begin(9600);
    //define D11 and D12 pin
    freq1.begin(11);
    freq2.begin(12);
}

void loop()
{
    //read the datas of serial port, which make Phone_Number string.
    while (Serial.available() > 0)
    {
        Phone_Number += char(Serial.read());
        delay(2);
        mark = 1;
    }
    //display DTMF audio, the phone number is based on Phone_Number, continuous time is 200ms, Interval time is 300ms.
    PlayDTMF(Phone_Number, 200, 300);
       
        //If get the phone number, clear the Phone_Number and reset mark.
    if(mark == 1)
    {
        Phone_Number = "";
        Serial.println();
        mark = 0;
    }
}

/*
DTMF function
Call format: playDTMF(digital(0~9), continuous time)。
*/
void PlayDTMF(String Number, long duration, long pause)
{
        //If the input number is empty or the continuous time is not positive or the pause time is not positive,
        //stop implement and return to main program.
    if(Number.length() == 0 || duration <= 0 || pause <= 0) return;
    //Separate the Number
    for(i = 0; i < Number.length(); i++)
    {
        //If Number is 0~9 digital character,
        if(Number[i] >= '0' && Number[i] <= '9')
        {
            //its ASCII minus '0', get true digital.
            Number[i] -= '0';
            //output through serial port
            Serial.print(Number[i], DEC);
           
            freq1.play(DTMF_freq1[Number[i]], duration);
           
            freq2.play(DTMF_freq2[Number[i]], duration);
            delay(pause);
        }
    }
}


Physical diagram:
Image
Image
Image
admin
Site Admin
 
Posts: 12
Joined: 2011-09-29 10:01

Concert tickets of your favorite singer

Postby Crispy » 2013-03-13 7:26

buy concert tickets of your favorite theatricals [url="http://www.getadates.com/AdeleConcertToursDates/summer-tours"]Summer Tours[/url]
Crispy
 
Posts: 1
Joined: 2012-07-24 2:02
Location: USA


Return to Arduino DIY

Who is online

Users browsing this forum: No registered users and 1 guest

cron