Go Down

Topic: Arduino + GSM Problem. Need help (Read 1 time) previous topic - next topic

dpkgpl

Feb 03, 2012, 02:15 pm Last Edit: Feb 03, 2012, 02:18 pm by dpkgpl Reason: 1
Hi,

I recently bought a SIM900 based GSM modem for my project. It works fine when i use it with hyperterminal. However when i use it with arduino it is not working. What could be the problem? I have posted the code below. The circuit is supposed to do the following things:

1. Wait 25 seconds on start up and then lights up an LED.
2. Observe the SENSOR key. If it goes high a call is made to a fixed number, BEACON turns high and circuit gets locked in an infinite loop.
3. Observe the KEY key. If it goes low a call is placed to the fixed number.

Observed result:
1. After exactly 25 seconds LED turns on.
2. When SENSOR goes high BEACON goes high but no call is received.
3. When KEY goes high no call is received.

Basically everything except GSM modem is working when connected to the microcontroller. Please help me.

PS:

1.I built the arduino myself using ATmega8 and i have not added the TTL to USB converter. Hence it is not possible to observe the serial port of microcontroller in hyper terminal.

2.I use 16 Mhz crystal and 22pF decoupling capacitors.

3.I use an external programmer to burn my code into the ATmega8 in order to save Bootloader space.

Code: [Select]

#define LED 4
#define SENSOR 8
#define BEACON 9
#define KEY 12


int val1 = 0;
int val2 = 0;


void setup(){
 pinMode(LED,OUTPUT);
 pinMode(BEACON,OUTPUT);
 pinMode(SENSOR,INPUT);
 pinMode(KEY,INPUT);
 Serial.begin(9600);
 delay(25000);
 digitalWrite(LED,HIGH);
 digitalWrite(BEACON,LOW);
 Serial.println("ATS0=4"); //Auto answer
}

void loop(){
 
 digitalWrite(BEACON,LOW);
 val1 = digitalRead(SENSOR);
 if (val1 == HIGH)
 {
   Serial.println("ATD 9605432924;"); //Dial number
   while(1)
     {
       digitalWrite(BEACON,HIGH);
        val2 = digitalRead(KEY);
         if(val2 == LOW)
       {
           Serial.println("ATD 9605432924;");
        }
 }
 val2 = digitalRead(KEY);
 if(val2 == LOW){
   Serial.println("ATD 9605432924;");
   
   
}
}
}

johnwasser

If it works with the RS232 serial port on your PC and not the TTL serial port on your Arduino I would guess you need RS232 level shifters to talk to it.  The MAX232 chip is one example of an RS232-to-TTL level shifter.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

dpkgpl

Hi Sir,

The GSM modem has separate TTL and USB connectors. Here is the link to the product.

http://robokits.co.in/shop/index.php?main_page=product_info&cPath=69&products_id=303

Since the USB port is working fine i am guessing that TTL lines also must be fine as the product uses a PL2303 IC to convert the TTL lines from the SIM900 to USB.

When we enter an AT command in Hyperterminal we press enter at the end right? Does the Serial.println() function convey the effect of pressing enter at the end of the string? Could that be a problem?

dpkgpl

Problem solved. Faulty hardware connection was the culprit. I forgot to solder a ground connection. Sorry for wasting your time sir.

johnwasser

No problem.  We all make mistakes.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

foobar

Hello!

I was just writing because I'm having a similar problem with my GSM module. It's a different one, but it works with a terminal program and not my arduino, so I was wondering if you could tell me what your mistake ended up being (maybe i made the same one?)

Thank you  :) !

dpkgpl

#6
Feb 04, 2012, 05:36 am Last Edit: Feb 04, 2012, 05:41 am by dpkgpl Reason: 1
Sure....I found out that the GSM modem and arduino did not share common ground  :P. That is essential for proper communication. Try shorting the ground of your GSM modem and arduino. If that does not work try replacing the crystal(Assuming you built the arduino yourself). Baud rate errors could happen from a faulty crystal.


dpkgpl

@Foobar- Did it work? What was the problem?

foobar

=(

it hasn't worked yet but I will keep you posted when it does =) !

hazieqmanan

hello guys..can u guys share how to connect this gms sim900 shield to arduino uno.i dont really understand to configure this shield by the datasheet =( ..i just have simple project which is to send sms by pushing the button

Go Up