Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[MOVED] Playing Recorded Voice Fle Using SIM900

Status
Not open for further replies.

tinku n

Newbie level 4
Joined
Jan 20, 2015
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
42
can anyone plz help me with the AT command to be used to play a recorded file through sim900A module?
I am madly in search of it, bt m unable to get the exact working one.
kindly do help me out with this asap...
 

Recording and playing sound

You can select the place to store the sound clip: the local storage or a SD card. Once saved the sound can be sent to an FTP or FTPS as you'll see later.
Code:
/*
 *  Description: This example shows how to record sound from the microphone
 *  and then play the file with the sound recorded.
 *  This example shows the AT commands (and the answers of the module) used
 *  to work with audio commands. For more information about the AT commands, 
 *  refer to the AT command manual.
 *
 *  Copyright (C) 2013 Libelium Comunicaciones Distribuidas S.L.
 *  http://www.libelium.com
 *
 *  This program is free software: you can redistribute it and/or modify 
 *  it under the terms of the GNU General Public License as published by 
 *  the Free Software Foundation, either version 3 of the License, or 
 *  (at your option) any later version. 
 *  
 *  This program is distributed in the hope that it will be useful, 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 *  GNU General Public License for more details. 
 *  
 *  You should have received a copy of the GNU General Public License 
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>. 
 *
 *  Version 0.2
 *  Author: Alejandro Gallego 
 */


int8_t answer, counter;
int onModulePin = 2;
char clip_name[20];
char aux_str[50];

void setup(){

    pinMode(onModulePin, OUTPUT);
    Serial.begin(115200);   

    Serial.println("Starting...");
    power_on();
    delay(5000);

    // Takes a picture, but not saved it
    answer = sendATcommand2("AT+CQCPREC=0,amr", "C:/Audio/", "ERROR", 5000);
    if (answer == 1)
    {
        counter = 0;
        while(Serial.available()==0);
        do{
            clip_name[counter] = Serial.read();
            counter++;
            while(Serial.available()==0);
        }
        while (clip_name[counter-1] != 0x0D);

        clip_name[counter-1] = '\0';

        Serial.print("Clip name: ");                
        Serial.println(clip_name);
        delay(5000);
        sendATcommand2("AT+CQCPPAUSE", "OK", "ERROR", 2000);
        delay(5000);            
        sendATcommand2("AT+CQCPRESUME", "OK", "ERROR", 2000);
        delay(5000);            
        sendATcommand2("AT+CQCPSTOP", "OK", "ERROR", 2000);

        sendATcommand2("AT+FSCD=C:/Audio", "OK", "ERROR", 2000);
        sprintf(aux_str, "AT+CCMXPLAY=\"%s\",0", clip_name);
        answer = sendATcommand2(aux_str, "OK", "ERROR", 2000);
        if (answer == 1)
        {            
            delay(5000);
            sendATcommand2("AT+CCMXPAUSE", "OK", "ERROR", 2000);
            delay(5000);            
            sendATcommand2("AT+CCMXRESUME", "OK", "ERROR", 2000);
            delay(5000);            
            sendATcommand2("AT+CCMXSTOP", "OK", "ERROR", 2000);
        }
        else
        {
            Serial.println("Error playing");    
        }
    }
    else
    {
        Serial.println("Error recording");    
    }


}
void loop(){

}

void power_on(){

    uint8_t answer=0;

    // checks if the module is started
    answer = sendATcommand("AT", "OK", 2000);
    if (answer == 0)
    {
        // power on pulse
        digitalWrite(onModulePin,HIGH);
        delay(3000);
        digitalWrite(onModulePin,LOW);

        // waits for an answer from the module
        while(answer == 0){     // Send AT every two seconds and wait for the answer
            answer = sendATcommand("AT", "OK", 2000);    
        }
    }

}

int8_t sendATcommand(char* ATcommand, char* expected_answer1, unsigned int timeout){

    return sendATcommand2(ATcommand, expected_answer1, "", timeout);
}



int8_t sendATcommand2(char* ATcommand, char* expected_answer1, char* expected_answer2,
    unsigned int timeout){

    uint8_t x=0,  answer=0;
    char response[100];
    unsigned long previous;

    memset(response, '\0', 100);    // Initialize the string

    delay(100);

    while( Serial.available() > 0) Serial.read();    // Clean the input buffer

    Serial.println(ATcommand);    // Send the AT command 

    x = 0;
    previous = millis();

    // this loop waits for the answer
    do{
        // if there are data in the UART input buffer, reads it and checks for the asnwer
        if(Serial.available() != 0){    
            response[x] = Serial.read();
            x++;
            // check if the desired answer 1 is in the response of the module
            if (strstr(response, expected_answer1) != NULL)    
            {
                answer = 1;
            }
            // check if the desired answer 2 is in the response of the module
            if (strstr(response, expected_answer2) != NULL)    
            {
                answer = 2;
            }
        }
        // Waits for the asnwer with time out
    }while((answer == 0) && ((millis() - previous) < timeout));    

    return answer;
}

AT+CQCPREC=*,&&& --> Starts recording sound clips . Answers with the path and the name of the clip. * is the path and &&& is the format.
AT+CQCPPAUSE --> Pauses record sound.
AT+CQCPRESUME --> Resumes record sound.
AT+CQCPSTOP --> Stops record sound.
AT+CCMXPLAY=”*****” --> Plays an audio file . ***** is the name of the file.
AT+CCMXPAUSE --> Pauses playing audio file.
AT+CCMXRESUME --> Resumes playing audio file.
AT+CCMXSTOP --> Stops playing audio file.
 

Thank u.
I had tried dese AT commands but dis doesnt work, shows ERROR. Though d same commands are available in d AT_command pdfs bt is nt supportd by d sim900 module i hav(of RhydoLabs). Some posts here also mentnd dat we ned to connect ICs wid d module for voice playback like apr9600 or apr3a33. I am searching 4 d interface ckt connectn but havnt found yet. If u hav any info regarding dis or hav any suggestn , do rply.
 

**broken link removed**
 
Thank you, ud23. It is indeed helpful.
I would like to discuss on this matter further until I get the work done. So if anyone can share any of your ideas or suggestions, I'll be glad.

Problem statement: Call is made to the user whose number is mentioned in the program. Only when he receives the call, a recorded voice needs to be played. I am working with SIM900 module and Raspberry Pi(python language).
Solution till date: SIM900 doesn't support voice playback. So needs to be interfaced with ICs APR33A3 since APR9600 is no more available.

Any related program codes or circuit connections will be appreciated.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top