Boa noite gente, encontrei no forum já varios programas com o SIM 900, ja testei alguns mas n tive resultado satisfatorio pq nao estou conseguindo comunicaçao com meu shield....

Queria apenas enviar uma msg do meu celular para o arduino, e a palavra ou numero que eu enviar para o arduino teria que aparecer na porta serial dele...

Alguem tem como me ajudar a fazer essa comunicaçao e fazer esse programa

Obrigado

Exibições: 3115

Responder esta

Respostas a este tópico

Opa amigo, testei la com um exemplo de SMS mas n deu certo, fica aparecendo um monte de msg... Nao to conseguindo ter sucesso 

Cole aqui essas "monte de msg"

Vamos tentar descobrir do que se tratam

Esse é o codigo que eu to testando

#include "SIM900.h"
#include <SoftwareSerial.h>
//If not used, is better to exclude the HTTP library,
//for RAM saving.
//If your sketch reboots itself proprably you have finished,
//your memory available.
//#include "inetGSM.h"

//If you want to use the Arduino functions to manage SMS, uncomment the lines below.
#include "sms.h"
SMSGSM sms;

//To change pins for Software Serial, use the two lines in GSM.cpp.

//GSM Shield for Arduino
//www.open-electronics.org
//this code is based on the example of Arduino Labs.

//Simple sketch to send and receive SMS.

int numdata;
boolean started=false;
char smsbuffer[160];
char n[20];

void setup()
{
//Serial connection.
Serial.begin(9600);
Serial.println("GSM Shield testing.");
//Start configuration of shield with baudrate.
//For http uses is raccomanded to use 4800 or slower.
if (gsm.begin(2400)) {
Serial.println("\nstatus=READY");
started=true;
} else Serial.println("\nstatus=IDLE");

if(started) {
//Enable this two lines if you want to send an SMS.
if (sms.SendSMS("+555599xxxxxx", "Arduino SMS"))
Serial.println("\nSMS sent OK");
}

};

void loop()
{
if(started) {
//Read if there are messages on SIM card and print them.
if(gsm.readSMS(smsbuffer, 160, n, 20)) {
Serial.println(n);
Serial.println(smsbuffer);
}
delay(1000);
}
};

E dai quando eu vejo na porta serial aparece so isso e vai rolando pra baixo

ATT: SHUT OK
RIC:
ERROR

ATT: SHUT OK
RIC:
ERROR

ATT: SHUT OK
RIC:
ERROR


status=READY
DEBUG:SMS TEST
ATT: >
RIC:
ERROR


SMS sent OK
This method is deprecated! Please use GetSMS in the SMS class.
ATT: +CMGL
RIC:
ERROR

This method is deprecated! Please use GetSMS in the SMS class.
ATT: +CMGL
RIC:
ERROR

This method is deprecated! Please use GetSMS in the SMS class.
ATT: +CMGL
RIC:
ERROR

This method is deprecated! Please use GetSMS in the SMS class.
ATT: +CMGL
RIC:
ERROR

This method is deprecated! Please use GetSMS in the SMS class.
ATT: +CMGL
RIC:
ERROR

This method is deprecated! Please use GetSMS in the SMS class.
ATT: +CMGL
RIC:
ERROR

This method is deprecated! Please use GetSMS in the SMS class.
ATT: +CMGL

Esse sketch veio dos exemplos fornecidos pelo fabricante, correto?

E as bibliotecas disponibilizadas no arquivo zip, vc as instalou?

Se vc quiser usar sketches do fabricante, instale bibliotecas disponibilizadas pelo fabricante.

Se vc quiser usar sketch da própria IDE do arduino, não precisa instalar novas bibliotecas

Simm essa sketch veio da propria IDE do arduino eu baixei as bibliotecas e colei la, mas nao ta dando muito certo

Agora testei esse aqui que é da propria IDE tb, onde diz received SMS:

Segue o Codigo:

/*
SMS receiver

This sketch, for the Arduino GSM shield, waits for a SMS message
and displays it through the Serial port.

Circuit:
* GSM shield attached to and Arduino
* SIM card that can receive SMS messages

created 25 Feb 2012
by Javier Zorzano / TD

This example is in the public domain.

http://arduino.cc/en/Tutorial/GSMExamplesReceiveSMS

*/

// include the GSM library
#include <GSM.h>

// PIN Number for the SIM
#define PINNUMBER ""

// initialize the library instances
GSM gsmAccess;
GSM_SMS sms;

// Array to hold the number a SMS is retreived from
char senderNumber[20];

void setup()
{
// initialize serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}

Serial.println("SMS Messages Receiver");

// connection state
boolean notConnected = true;

// Start GSM connection
while (notConnected)
{
if (gsmAccess.begin(PINNUMBER) == GSM_READY)
notConnected = false;
else
{
Serial.println("Not connected");
delay(1000);
}
}

Serial.println("GSM initialized");
Serial.println("Waiting for messages");
}

void loop()
{
char c;

// If there are any SMSs available()
if (sms.available())
{
Serial.println("Message received from:");

// Get remote number
sms.remoteNumber(senderNumber, 20);
Serial.println(senderNumber);

// An example of message disposal
// Any messages starting with # should be discarded
if (sms.peek() == '#')
{
Serial.println("Discarded SMS");
sms.flush();
}

// Read message bytes and print them
while (c = sms.read())
Serial.print(c);

Serial.println("\nEND OF MESSAGE");

// Delete message from modem memory
sms.flush();
Serial.println("MESSAGE DELETED");
}

delay(1000);

}

E dai no monitor serial aparece so isso

SMS Messages Receiver

Deixa eu te perguntar uma coisa: esse teu shield não possui uns botões que devem ser pressionados por alguns segundos para se conectar à rede de telefonia celular?

Geralmente esses shields tem leds que indicam estar ligados, conectados à rede de telefonia, etc...

Por exemplo, os meus shields ficam com um led azul piscando a cada 3 segundos para indicar que está tudo ok, isto é, conectado à rede de telefonia.

EDIT: dei uma rápida olhada no site do fabricante do shield e lá confirma o que eu disse. Veja essa parte que transcrevo abaixo.

LED Indicators

* RING: On when there is a incoming call
* NETWORK:
       Flash@inverval 800ms: SIM900 not registered to cell phone network.
       Flash@inverval 3000ms: SIM900 registered to cell phone network.
       Flash@inverval 300ms: GPRS communication is established.
       STATUS: On when SIM900 is powered on.

Quick Start Guide

* Download the Library and Example code. Do not unzip the downloaded library, leave it as is.


* In the Arduino IDE, navigate to Sketch > Import Library. At the top of the drop down list, select the option to “Add Library”.


*From the prompted window, navigate to the .zip file’s location and open it. The library and example should be ready for use1.


* Attach the shield onto the Arduino Board.


* Connect a DC power supply(7V-12V) to the barrel connector of the Arduino board.2


* Open an example sketch under File > Examples > GSMSHIELD.

* Available examples are:
       GSM_GPRSLibrary_AT
       GSM_GPRSLibrary_Call
       GSM_GPRSLibrary_Client
       GSM_GPRSLibrary_GPS
       GSM_GPRSLibrary_Server
       GSM_GPRSLibrary_SMS

* Upload the sketch to the Arduino board.

* Press and hold the S-POWER button on the shield until STATUS LED goes on in order to turn the SIM900 on.

* Press the A-RESET button to reset your Arduino in order to run the sketch.

Note1: The automatic installation of library described in Step 1-3 requires Arduino 1.0.5 and above. If earlier version of Arduino is used, manual installation of library may be required.

Note2: The peak current of the SIM900 module may reach up to 2A. External power supply via the barrel connector is recommended because it provides sufficient power to the shield. Without the external power supply, the SIM900 module may lock up or suffer from unexpected reset.

Sim, eu ja fiz isso, nesse caso tem um led vermelho e verde acesso e um led azul piscando sempre, 

esse led azul quando fica piscando, ele pisca a cada quantos segundos? 3 segundos ou menos?

É o led azul fica piscando de 2 a 3 segundos por ai.... 

amigo, vamos apelar, vamos fazer tudo na unha:

* lembra daquele sketch que te enviei ontem pra enviar comandos AT? Pois então, envie ele pro arduino

* depois abra o serial monitor e certifique-se que ele te responde OK assim que vc enviar o comando AT

* assim que vc tiver certeza que teu shield está respondendo ao comando AT, vamos tentar obter outras respostas do seu shield

* digite  AT+COPS? [ENTER]  (exemplo de resposta esperada: +COPS: 0,0,"TIM BRASIL")

* digite AT+CSPN? [ENTER] (exemplo de resposta esperada: +CSPN: "TIM", 0)

* digite  AT+CMGF=1 [ENTER] (resposta esperada: OK)

* e por fim digite AT+CMGL="ALL" [ENTER] (é pra digitar conforme eu escrevi, isto é, com aspas duplas ok?)

para esse último comando, a resposta esperada é algo como:

+CMGL: 1,"REC UNREAD","+XXxxxxxxxxx",,"11/01/09,10:26:26+04"  bla bla bla (corpo do torpedo sms recebido)

+CMGL: 2,"REC UNREAD","+31628870634",,"11/01/09,10:26:49+04" bla bla bla (corpo do torpedo sms recebido)
OK

Eu gostaria que vc me dissesse exatamente quais as respostas que vc obteve no serial monitor depois de cada comando enviado. Se houver alguma resposta, cole pra mim

Agora nem quando eu escrevo AT e dou enter ele respondeu, quando fiz isso, deu a seguinte mensagem

ajuste o serial monitor em CARRIAGE RETURN

RSS

© 2024   Criado por Marcelo Rodrigues.   Ativado por

Badges  |  Relatar um incidente  |  Termos de serviço