How to use Simcom SIM900 Modem and GPRS...

Status
Not open for further replies.

sa4250mnpo70

Newbie level 6
Hello...

I am new to this forum and this is my first post.
I recently bought Simcom SIM900 Modem and was successful in using most of the AT Commands to make calls and send SMS or search phonebook etc.

I have never used this or any similar module before and am not too familiar with all the AT commands listed in the manual.
I need help regarding GPRS and FTP. Basically I want to send some data to a remote IP address using either FTP or GPRS.
GPRS is preferred.

I would be greatly thankful if anyone points out hot to achieve so. Kindly write (or paste a link) for easy understanding of the AT commands used to achieve this. Any information about similar work will be highly appreciated.

Thank you. :smile:

ckshivaram

A search in this forum will definetely yield you many discussions.......

namlooc

Junior Member level 3
Best working way to connect two modems knowing their ip address is:

SERVER:
Code:
AT+CGATT=1
AT+CSNS=4
AT+CSTT="Internet","",""
AT+CIICR
AT+CIFSR
AT+CLPORT="TCP","8080"
AT+CIPSERVER
AT+CIPSEND
AT+CIPCLOSE
AT+CIPSHUT

CLIENT:
Code:
AT+CGATT?
AT+CSNS=4
AT+CSTT="Internet","",""
AT+CIICR
AT+CIFSR
AT+CIPSTART=”TCP”,”188.33.176.204”,”8080”
AT+CIPSEND
AT+CIPCLOSE
AT+CIPSHUT

Try it. Works for me on my sim300/548

Points: 2

Amalinda

Points: 2

sa4250mnpo70

Newbie level 6
Thank you namlooc. :roll:

I will surely try it and hope it works for me too.
By the way :?: could you please refer me to a site or book where I can get more knowledge about GSM Modems and their practical uses?
For example some GSM and Microcontroller based example codes for beginners to advanced users, specially on GPRS, TCP/IP, FTP 8-O communications etc.
I would be greatly thankful to you.:grin:

namlooc

Junior Member level 3
Book or a site containing everything about GMS modems do not exist

Sim900 at commands set:

SIM900 command example - Szukaj w Google

Microcontroller based example codes about sim900 do not exist too
Recipe is simple:
- take atmega,
- connect USART TXD RXD pins to the modem
- send AT command and wait for OK reply..and another command.. and another
Simple ?

For example atmega664p (2xusart):

Code C - [expand]1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#define baud ((F_CPU/(baud_*16UL))-1)
#define baud_ 9600
#define F_CPU 16000000UL
volatile char bufor[100];
volatile int i=0;

void usart_init(void)                     //PD2->RXD   PD3->TXD   USART_1 GSM
{
UBRR1H = (unsigned char) (baud>>8);  // ustawiamy predkosc transmisji
UBRR1L = (unsigned char) baud;
UCSR1B = (1<<RXEN1) | (1<<TXEN1) | (1<<RXCIE1);
UCSR1C = (0<<USBS1) | (3<<UCSZ10);
}

void usart_transmit(char data)
{
while (!(UCSR1A & (1<<UDRE1)));
UDR1=data;
}

void send(char *data0)
{
int j;
int x=strlen(data0);
for(j=0;j<x;j++)
{
usart_transmit(data0[j]);
}
}

ISR(USART0_RX_vect) // recive interrupt
{
bufor[i]=UDR1  //write to buffor
i++;
}

int main (void)
{
sei();
usart_init();
while(1)
{
send("at /r");
Try_to_search_in_recive_buffor_for _OK _or _ERROR;
if(search_result=="ok") {}
if (search_result=="error"){}
if (search_result=="ring"){ send("ath0"); }  //send hang up command
}

}

Last edited:

andres90125

Member level 2
for FTP server .!

SIM900 ("AT+CGEREP=0,0"); SIN STOK DE MENSAGES

SIM900 ("AT+CIPMUX=1"); /// PORT MULTI ACTIVE <<

SIM900 ("AT+CREG?"); /// SYSTEM IS OK?

SIM900 ("AT+CGATT?"); /// CONNECTIVITY IS OK?

SIM900 ("AT+CSTT=\"claro.com.br\",\"claro \",\"claro\""); ///APN, USER, KEY

SIM900 ("AT+CIPSRIP=1"); // IP created an instance

SIM900 ("AT+CIICR"); // THROUGH APN Network Attached

SIM900 ("AT+CIFSR"); // RECOVER MY IP "CHANGE EVERY CONNECTION"

>>>>>>>>>>>>>> Connected!

SIM900(sprintf(Set_TC_IP,"AT+CIPSTART=0,\"TCP\",\"ftp.xpg.com.br\",\"21\"\r\n"));
CONECTO SEVER FTP

FTP_COMMAND_0("USER vwvwvwvw");

do{
{Salir_del_modo(); return; }

if(CLOSED_0) // NAME OR CONNECTION ERROR?
{SHUT_DOWN(); return; }

}while(!PASS_REQ); // RECOGNIZED?

FTP_COMMAND_0("PASS mwmwmw");

do{
{SHUT_DOWN(); return; }

OK WE ARE IN THE SERVER! ASK SECOND DOOR FOR DATA TRANSFER NOW" VIA PASSIVE COMMAND

FTP_COMMAND_0("PASV");
while(!pasive){}; // AWAITS ANSWERS PASV command FROM> (FTP SERVER)

FTP_01X_IP (Set_TCF_IPP); // Configure and send RESPONSE RECEIVED

" AT THIS POINT, I'M DOING A SECOND CONNECTION WITH THE PORT OF DISCHARGE assigned by the server in passive mode ORDER ">>

do{
if(CONNECT_FAILF) // CONCCION FAILURE?
{ Salir_del_modo();return;}
}while(!CONNECT); // CONNECTED?

<My options>

* / AWAITING CONFIRMATION ...
Logoff AUTOMATIC MODE RETURN AT FULL COMMAND. * /
.........................................................................................................................................................

{
FTP_COMMAND_0 ("RETR /ABC.TXT"); //ASK A FILE
do{
if (Not_Alowed) // DIRECTORY DOES NOT EXIST OR WRONG?
{ Salir_del_modo();
return ;}
}while(!TRANSMITIR_PEMITIDO || !COMMAND_OK); // OK?
return;
}

void FILE_UPLOAD (char *nombre_archivo, char *content)
{
FTP_COMMAND_0 ("STOR /ABC.TXT"); //
do{
if (Not_Alowed) // Operation not permitted?
{ Salir_del_modo();
return ;}
}while(!TRANSMITIR_PEMITIDO || !COMMAND_OK); OK?
FTP_STORE_DATA (*content); //GO TO SEND>>
return;
}

TREATY OF RESPONSE COMMAND PASS>"

,H1,H2,H3,H4, = IP ASIGNADO POR SERVIDOR EN MODO PASSSIVE ;
(P1 x 256)+P2= ASSIGNED IP DOOR

int PA = atoi(P1);
int PB = atoi(P2);
int PORTi = (PA * 256)+ PB;

extern char Set_TCF_IPP[50];
sprintf(Set_TCF_IPP,"AT+CIPSTART=1,\"TCP\",\"%s.%s.%s.%s\",\"%i\"\r\n",H1,H2,H3,H4,PORTi);

Last edited:

sa4250mnpo70

Newbie level 6
Thank you namlooc

Actually I have read through those PDF you suggested. I need something for beginners which can explain me everything about TCP/IP, GPRS, FTP communication etc. in relatively simple English.
I do not belong to Computer Science. My field of studies is Electronics so am little not upto date on these topics. :roll:

Also, I know that we need to interface MCU USART with GSM Modem and send AT commands.
But I do not understand properly what the AT commands for GPRS, TCP/IP and FTP are doing.
Actually it is that part which keeps me worrying.

Anyways thanks for your help. If you find anything more elementary... codes that has good comments... please do let me know.

========================================================================================================

Thank you andres90125

I can read your code but I do not understand what the comments say. It is not in English.
It would be more helpful if you could translate it to English...

Thank you

sa4250mnpo70

Newbie level 6

Please tell me what package type is SIM900. By Package type I mean... TQFP68, PDIP40 etc.
I know it is (0.94 inches x 0.94 inches x 0.12 inches) with L-shaped contacts on four sides so that they can be soldered both on the side and at the bottom.
Please help... need this information fast because I am making a PCB layout and want to use SIM900.

salmanliaquat

Full Member level 2

Please tell me what package type is SIM900. By Package type I mean... TQFP68, PDIP40 etc.
I know it is (0.94 inches x 0.94 inches x 0.12 inches) with L-shaped contacts on four sides so that they can be soldered both on the side and at the bottom.
Please help... need this information fast because I am making a PCB layout and want to use SIM900.

Its not any standard Package that can be found in PCB decal libraries of most of the PCB design tools. You will have to make its PCB decale yourself. For module dimensions and decal making tips, refer to SIM900 hardware Manual.

www.mt-system.ru/documents/sim900_hd_v1.06.pdf

andres90125

Member level 2
GPRS Shield - Garden

on this site, you will find a plane, where is the library for use with Eagle.

Last edited:

AnujaM

Newbie level 5
Hey,

I'm trying to upload images from my cellphone(which is used as a GSM modem) to a server over GPRS using AT commands. Can anyone guide me about that??

sa4250mnpo70

Newbie level 6
Hey,

I'm trying to upload images from my cellphone(which is used as a GSM modem) to a server over GPRS using AT commands. Can anyone guide me about that??

Hey,

I'm trying to upload images from my cellphone(which is used as a GSM modem) to a server over GPRS using AT commands. Can anyone guide me about that??

I have solved the GPRS connectivity problem that I was facing and the reason for my initial post... I am able to connect using GPRS and send data to my web server...
Till now I have only send data.. or text... to a server... but probably the same can be done for an image...
you need to convert the image into some stream of data and then send it...

AnujaM

Newbie level 5
Hi,

I have a set of images in my ARM MCU. I want to upload those images to a server over GPRS using AT commands.
I can activate GPRS and PDP context using AT commands. But what are the commands to connect to a server, transfer images ?
I'm using Samsung phone as a GPRS modem.
What are the steps to achieve this?

sa4250mnpo70

Newbie level 6
Hi,

I have a set of images in my ARM MCU. I want to upload those images to a server over GPRS using AT commands.
I can activate GPRS and PDP context using AT commands. But what are the commands to connect to a server, transfer images ?
I'm using Samsung phone as a GPRS modem.
What are the steps to achieve this?

Do let me know how you did it, once you are able to do it.

ckshivaram

Hi,

I have a set of images in my ARM MCU. I want to upload those images to a server over GPRS using AT commands.
I can activate GPRS and PDP context using AT commands. But what are the commands to connect to a server, transfer images ?
I'm using Samsung phone as a GPRS modem.
What are the steps to achieve this?

what is the encoding techniques you want to use? what type of image compression you are planning. there are lot of things you need to consider for this. how do you wish to go.

blackphantom

Newbie level 1
I have solved the GPRS connectivity problem that I was facing and the reason for my initial post... I am able to connect using GPRS and send data to my web server...
Till now I have only send data.. or text... to a server... but probably the same can be done for an image...
you need to convert the image into some stream of data and then send it...

hi there i am working on a gprs / sms project can u please help me out on the project i am totally new to the gsm / gprs can u share with me how you sent data to remote site using gprs. if possible please post the code for the same so that i can under stand the how actually code works
HTML:
void setup(){
Serial.begin(9600);
Serial.println("AT+CGATT?");
delay(1000);
Serial.println("AT+CSNS=4");
delay(1000);
Serial.println("AT+CSTT=\"TATA.DOCOMO.INTERNET\",\"\",\"\"");
delay(1000);
Serial.println("AT+CIICR");
delay(1000);
Serial.println("AT+CIFSR");
delay(1000);
delay(1000);
Serial.println("AT+CIPSEND");
delay(1000);
Serial.println("AT+CIPCLOSE");
delay(1000);
Serial.println("AT+CIPSHUT");

}
void loop(){
Serial.print(dat);
delay(1000);
}
above is the code i can get so far. i dont know how to fetch the results of the commands executed in code. like i want to see if after returning the command i am getting OK. and like when "AT+CGATT?" command is executed it dispalyes "+CGATT : 1" and in next line it says "OK" how should i determin the result fetched for each commnad executed and move forward to the next commnad. please help.

Last edited:

Rick2047

Newbie level 1
o o
I tried the same code.
Now my SIM900 doesn't respond. It doesn't send the "ready" on power on.
I mistakenly kept the setup code for TCP connection in loop and it continuously kept on running.
Any then the SIM900 did not respond till now.
I can make call to it. But nothing else. Anything related to baud rate could have happened?
Need help here.

myid123456

Member level 1
I have solved the GPRS connectivity problem that I was facing and the reason for my initial post... I am able to connect using GPRS and send data to my web server...
Till now I have only send data.. or text... to a server... but probably the same can be done for an image...
you need to convert the image into some stream of data and then send it...

hello sir
I have some raw data that I want to send via sim900 and receive with another sim900. as long as you did this will you please tell me how should I do that? :razz:

Status
Not open for further replies.