Go Down

Topic: reading sms (Read 15749 times) previous topic - next topic

uttampal19

Hi,

The code was working properly in my case of Arduino Duemilanove and SIM 900 gsm module.  Which one are you using?

Your can verify the below points.
1. See that you close the serial console, when you are messaging to the gsm module.  The arduino should be connected to the laptop only for power supply.

2. See that you connection properly Rx of arduino to Tx of gsm, Tx of arduino to Rx of gsm. Connect both the ground together and DONT connect the Vin of arduino and gsm module together, otherwise there are high chances of damaging the arduino as gsm module is using lot of power to send/receive messages.

I will look try to run your code on my arduino and let you know its outcome.  But keep on trying...

dhruvit

#31
Apr 22, 2013, 11:05 am Last Edit: Apr 22, 2013, 11:10 am by dhruvit Reason: 1
hi

thanks for the instant reply

i am using  arduino freeduino(ATMEGA 328) and  sim 900(which i bought from rhydolabs)


i am using pin2 as rx and pin3 as tx is it correct????

here are my connections

Rx of arduino(pin no-2)to Tx of gsm sim900
Tx of arduino(pin no-3)to Rx of gsm sim900
Vinterface  of sim900   to 3.3v of arduino  
i am using USB cable for arduino supply so i don't require any external power supply
i am using  arduino 5v supply for powering up the sim900
i have also connected ground together

but unfortunately stilll didnt work????????? :~

have you tried this code in your laptop??

thanks again for your intrest in my post


uttampal19

Ok,

According to this image of freeduino: http://www.freeduino.org/images/freeduino_serial2.jpg
The Rx is pin 0(the first pin from right on digital side) and Tx is pin 1(second pin from right) on the digital side.

The GSM module will require another power supply from an adapter of 12Vdc , 2amps (you need to buy on).  The power supply from USB is not enough to power the GSM module.  Once you give the power supply to GSM module, DONT connect the Vinterface of sim900 to 3.3v of arduino (as the arduino may get damaged).  The power supply from USB is enough for arduino.

So now you have only three connection, Rx, Tx and ground.  I will try your code in the coming days.  It should work.

P.S.:
The gsm module from rhydolabs
eg. http://www.rhydolabz.com/index.php?main_page=product_info&cPath=122&products_id=1088
tells that it would require input voltage of 12V.  Confirm yours.

dhruvit

#33
Apr 22, 2013, 04:16 pm Last Edit: Apr 22, 2013, 04:21 pm by dhruvit Reason: 1
ok
thanks but  my GSM module is this

http://www.rhydolabz.com/index.php?main_page=product_info&products_id=1080

and my freeduino is this
http://www.embeddedmarket.com/products/Arduino-Compatible-Freeduino-DU/

it can work on 5v and it is working well  for me  as i can send ths sms and also can recive them by above connections
which i have mentioned in my earlier post

i am keep trying......... and also waiting for your reply




uttampal19

Hey I tried your code.
Its working fine in Duemilanove and SIM900 gsm module. Led 13 is switching on.

Possible changes to your system would be.
1. Trying out with 12Vdc, 2amp power supply for GSM module.
2. According to this figure: http://www.embeddedmarket.com/products/Arduino-Compatible-Freeduino-DU/Datasheet.asp
Pin 0 is Tx and Pin 1 is Rx.  Normally Rx and Tx are written on the pin numbers.  So try changing pin if it works.
3. Switch on/off and delete all the messages in GSM module and try again.

Let me know if it still doesn't work.

dhruvit

#35
Apr 23, 2013, 06:47 am Last Edit: Apr 23, 2013, 06:51 am by dhruvit Reason: 1
hey man  thanks for your keen interest in my posts

i tried all the things
but its still not working  :~

its really frustrating

ok i know this is stupid question but still i want to ask you what message
you are sending when you are running my code
its looking like i am doing something wrong in sending message i belive
this could be the one reason
and will you please mail me the code which you have run
i belive i am becoming  superstitious now!!!
sorry for troubling you

once again i am trying..... and waiting for your reply

my email address is shahdhruvit111@yahoo.com

uttampal19

No probs,

1. The message I send is : 0#1 to switch on the led and 0#0 to switch off.

The code:
Code: [Select]
char inchar; //Will hold the incoming character from the Serial Port.


int led1 = 13;
void setup()
{
// prepare the digital output pins
pinMode(led1, OUTPUT);

// initially all are off
digitalWrite(led1, LOW);
//Initialize GSM module serial port for communication.
Serial.begin(9600);
delay(3000); // give time for GSM module to register on network etc.
Serial.println("AT+CMGF=1\r"); // set SMS mode to text
delay(200);
Serial.println("AT+CSMS=1\r");
delay(200);

//Serial.println("AT+CNMI=3,3,0,0"); // set module to send SMS data to serial out upon receipt
Serial.println("AT+CNMI=2,2,0,0,0"); // set module to send SMS data to serial out upon receipt
//Serial.println("AT+CSMP=17,167,0,0");
delay(200);
}
void loop()
{
//If a character comes in from the Serialular module...
if(Serial.available() >0)


delay(10);
inchar=Serial.read();
if (inchar=='0')   // to catch the 1st 0 in our string 0#101#101#101
{     
      // digitalWrite(led1, HIGH);
       // for #101________________
       inchar=Serial.read(); // read next char i.e '#'
       if (inchar=='#')
       {
             inchar=Serial.read(); //read next char i.e 1
             if (inchar=='0')
             {
                 digitalWrite(led1, LOW);
             }
             else if (inchar=='1')
             {
                 digitalWrite(led1, HIGH);
             }
                  } //end of 3rd 'if char==#' loop
       
       } // "ckeck 0 in front of string" wala loop close

//Serial.println("AT+CMGD=1,4"); // delete all SMS
  } // serial available condition close

//   Serial.println("AT+CMGR=1\r");
//   delay(4000);
} // LOOP function close

dhruvit

still not working man!!!!!!!!!!!!

but still trying...........

any suggestions?????

dhruvit

hey man thanks

i just tried with sim300 module and it worked!!!!!!!!!!!!!! :)

thanks again
but why it is not working with sim900???

still confused??

albert_ep

Sir,

i tried your code, and the result is my arduino cant turn off the LED after i send 0#0.
Whats the problem?


No probs,

1. The message I send is : 0#1 to switch on the led and 0#0 to switch off.

The code:
Code: [Select]
char inchar; //Will hold the incoming character from the Serial Port.


 int led1 = 13;
void setup()
 {
 // prepare the digital output pins
 pinMode(led1, OUTPUT);

 // initially all are off
 digitalWrite(led1, LOW);
//Initialize GSM module serial port for communication.
 Serial.begin(9600);
 delay(3000); // give time for GSM module to register on network etc.
 Serial.println("AT+CMGF=1\r"); // set SMS mode to text
 delay(200);
 Serial.println("AT+CSMS=1\r");
 delay(200);
 
//Serial.println("AT+CNMI=3,3,0,0"); // set module to send SMS data to serial out upon receipt
 Serial.println("AT+CNMI=2,2,0,0,0"); // set module to send SMS data to serial out upon receipt
//Serial.println("AT+CSMP=17,167,0,0");
 delay(200);
 }
void loop()
 {
 //If a character comes in from the Serialular module...
if(Serial.available() >0)
 { 

 delay(10);
 inchar=Serial.read();
 if (inchar=='0')   // to catch the 1st 0 in our string 0#101#101#101
 {     
      // digitalWrite(led1, HIGH);
       // for #101________________
       inchar=Serial.read(); // read next char i.e '#'
       if (inchar=='#')
       {
             inchar=Serial.read(); //read next char i.e 1
             if (inchar=='0')
             {
                 digitalWrite(led1, LOW);
             }
             else if (inchar=='1')
             {
                 digitalWrite(led1, HIGH);
             }
                  } //end of 3rd 'if char==#' loop
       
       } // "ckeck 0 in front of string" wala loop close

 //Serial.println("AT+CMGD=1,4"); // delete all SMS
  } // serial available condition close
 
 //   Serial.println("AT+CMGR=1\r");
//   delay(4000);
 } // LOOP function close


PaulS

Code: [Select]
if(Serial.available() >0)
 {

 delay(10);
 inchar=Serial.read();
 if (inchar=='0')   // to catch the 1st 0 in our string 0#101#101#101
 {     
      // digitalWrite(led1, HIGH);
       // for #101________________
       inchar=Serial.read(); // read next char i.e '#'

If there is one byte of serial data to be read, it is NOT okay to read two of them.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy