Pages: [1]   Go Down
Author Topic: Arduino + GSM Problem. Need help  (Read 1083 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#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;");
    
    
}
}
}
« Last Edit: February 03, 2012, 08:18:56 am by dpkgpl » Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 208
Posts: 8855
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 208
Posts: 8855
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No problem.  We all make mistakes.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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  smiley !
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sure....I found out that the GSM modem and arduino did not share common ground  smiley-razz. 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.
« Last Edit: February 03, 2012, 11:41:31 pm by dpkgpl » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you =) !
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

smiley-cry

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

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley-cry ..i just have simple project which is to send sms by pushing the button
Logged

Pages: [1]   Go Up
Jump to: