Show Posts
Pages: 1 ... 22 23 [24] 25 26 27
346  International / Français / Re: Je n'arrive pas à envoyer d'SMSs on: January 14, 2013, 04:16:41 pm
Tu es extra. Je l'ai aussi trouvé. Ca fait 2 jour que je cherche............
347  International / Français / Re: Je n'arrive pas à envoyer d'SMSs on: January 14, 2013, 03:29:05 pm
Je te remercie, c'est ce tuto qui m'a permis de démarrer...  smiley-confuse
je sais plus quoi faire...............

Ecoute, je vais passer sur un autre problème. J'en ai encire un de fou. Si jamais tu veux regarder...

En tout cas merci pour ton aide!!!!! J'apprécie.
348  International / Français / Re: Je n'arrive pas à envoyer d'SMSs on: January 14, 2013, 03:09:27 pm
Ben je te remercie, mais j'avais deja essaye et je viens de le refaire.....
349  International / Français / Re: Je n'arrive pas à envoyer d'SMSs on: January 14, 2013, 02:33:04 pm
Haaaaaa!!!!!
tu veux dire ca?
https://www.sparkfun.com/products/9607?
Attends alors je suis à l'ouest  smiley

J'ai pensé que peut etre j'ai mis une mauvaise antenne, mais j'arrive appeler mon module depuis mon portable donc, je ne crois pas.

Aussi, j'ai remplacé
Code:
cell.print(34,BYTE);
par
Code:
cell.write(34);
car le premier me génèrait un message d'erreur du genre "The byte keyword is not supported, please use Serial.write().
350  International / Français / Re: Je n'arrive pas à envoyer d'SMSs on: January 14, 2013, 02:27:29 pm
Ha, mais qu'entend tu par type de carte?
C'est une carte SIM, prepay.
N'es-ce pas la réponse que tu attends.
Je vais copier ton code, mais je crois que

Code:
cell.println(34,BYTE);
me génère une erreur.
351  International / Français / Re: Je n'arrive pas à envoyer d'SMSs on: January 14, 2013, 02:01:30 pm
Bon ben chais plus quoi faire. J'ai fait un petit fichier séparé et voci mon réaultat final
Code:
#include <SoftwareSerial.h>
SoftwareSerial cell(2,3);
void setup(){
   Serial.begin(9600);
    cell.begin(9600);
 
  //Let's get started!

  Serial.println("Starting SM5100B Communication...");

  delay(3000);
}
void loop(){
 
    //Send SMS
    const char* message ="Alarm";
    const char* numero ="+41761112233";
 
//cell.print("AT+SBAND=4");
    cell.println("ATZ");
    cell.println("AT+CMGF=1"); // set SMS mode to text
    cell.print("AT+CSCA=+41765980000");
    cell.print("AT+CMGS=");  // now send message...
    cell.print("\"");
    cell.print(numero);
    cell.print("\"");
    cell.print("\r");
    delay(500); // give the module some thinking time
    cell.print(message);   // our message to send
    //cell.write("0x1A");
    cell.println("0x1A");  // ASCII equivalent of Ctrl-Z 0x1A,10
    //delay(15000); // the SMS module needs time to return to OK status
   
    Serial.print("SMS Sent");

delay(15000);
}
Chais pas il doir manquer un truc, un chioua.
Peut etre c'est mon harware qui embete
352  International / Français / Re: Je n'arrive pas à envoyer d'SMSs on: January 14, 2013, 01:50:57 pm
Oui j'avais trouvé ce tuto, mais je n'avais pas le téléphone du service center, maintenant c'est fait

J'ai aussi essayé d'utiliser GoGprs, mais sans succès, il me retourne toujours

Not registered on Network
Not registered on Network

Pourtant j'ai mis la carte dans un téléphone et ca marche.

J'ai en fait essayer un des exemple fourni avec la librairie
353  Using Arduino / Programming Questions / Re: Can not connect to the server and send a SMS on: January 14, 2013, 11:04:40 am
I am still around my problem and I look around the web.
Until now, I only powered my module with USB cable. May it be a cause? Should I power with 7-9V?

@johnwasser
Could you let me know a bit more about your function. I think I did not fully understand what you state, May be my english is not good enouhg ?

I supposed that an empty line is not good, but I did not understand where I should add code to consider the timeout?

How many delay should I considere between the command and the answer?

The sample code given did not use a fixed delay - it waited (printing out any response it received) until it received an end-of-line character. If the modem always sends back a one line response every time you give it a command, this this approach will wait for the response to be received and show it to you which is what you want to debug the commands.

In an ideal world your sketch would also validate the response to each command to check whether the command succeeded. To do that, rather than just print the response to the serial port the code would need to buffer it until a complete response had been received and then process the response to find what the command status was.


Concerning my GPS podition display, when it does not display, the error come from that condition  "if (gps.encode(c)) {" which return false.
Code:
while(Serial.available()) { //or cell.available? I think it's the same?
      int c = Serial.read(); //or cell.available? I think it's the same?
    [b]  if (gps.encode(c)) {[/b]
        onLed(blueLedPin);
        float flat, flon, fspeed, falt;
        unsigned long fix_age;
        gps.f_get_position(&flat,&flon,&fix_age);

...

Thaousand thanks
354  International / Français / Re: Je n'arrive pas à envoyer d'SMSs on: January 14, 2013, 10:47:54 am
Je vous remets mon code:
Code:
const char* message ="Coucou";
const char* numero ="0762244555";
cell.println("ATZ");
    cell.println("AT+SBAND=6");
    cell.println("AT+CMGF=1"); // set SMS mode to text
    cell.println("AT+CMGS=");  // now send message...
    cell.println("\"");
    cell.println(numero);
    cell.println("\"");
    cell.println("\r");
    //delay(500); // give the module some thinking time
    cell.println(message);   // our message to send
    cell.println("0x1A");  // ASCII equivalent of Ctrl-Z 0x1A,10
    //delay(15000); // the SMS module needs time to return to OK status
   
    Serial.print("SMS Sent");

Au passage, c'est quoi le * après le char: char*?
355  International / Français / Re: Je n'arrive pas à envoyer d'SMSs on: January 14, 2013, 10:45:08 am
Hello,
Merci pour vos réponses.
MAis quand entendu pas un return dans la console?
J'ai essayé de le faire ca ne me donne rien.

Non, j'ai pensé à desactivé le code PIN et j'avais deja insérer la carte dans un téléphone. J'ai pu aller sur internet et recevboir des appels

Ce qui me préoccupe toujours c'est command configurer la band
Code:
cell.println("AT+SBAND=6");
J'ai aussi essayer de mettre 4.

Aussi une petite question, bête. Pour le moment mon arduino est allimenté pae mon port USB. Es-ce que ca pourrait etre un manque de Voltage?
je n'ai pas encore essayer de l'alimenter avec 9V.

J'ai aussi ajouté ceci
Code:
cell.println("ATZ");
je ne l'avais pas, mais apparement ca n'a rien changer.


Grrrrr, je comprend rien.
356  International / Français / Comment créer un buffer on: January 14, 2013, 03:00:58 am
Bonjour à tous,
Je suis un novice et j'ai encore du mal à comprendre un poit.
On m'a dit de plus utiliser la classe PString
Code:
PString myString(buffer,sizeof(buffer));

#define BUFFSIZ 180

char at_buffer[BUFFSIZ];
char gps_buffer[BUFFSIZ];
char index;
          myString.print("AT+SSTRSEND=1,\"");
          //gps_buffer[index++] = 'AT+SSTRSEND=1,"';
         
          myString.print(flat,DEC);
          //gps_buffer[index++] = flat;
         
          myString.print(",");
          //gps_buffer[index++] = ',';

          myString.print(flon,DEC);
          //gps_buffer[index++] = flon;
         
          myString.print(",");
          //gps_buffer[index++] = flon;
         
          myString.print(fspeed,2);
          //gps_buffer[index++] = fspeed;
         
          myString.print(",");
          //gps_buffer[index++] = ',';
         
          myString.print(falt,2);
          //gps_buffer[index++] = falt;
         
          //myString.print(",");
         
          //myString.print(fcourse,DEC);
         
          myString.print(",");
         
         
          myString.print(String(count));
          //gps_buffer[index++] = count;
         
          myString.print("\"");
          //gps_buffer[index++] ='"';
         
          //Serial.println(gps_buffer);
         
          //for (int i = 0; i < gps_buffer){
          //}
          Serial.println(myString);
          cell.print(myString);
          //cell.println(gps_buffer);

          myString.begin();

          offLed(blueLedPin);
         
          count++;
         
          delay(3000);
et d'utiliser un buffer.
S'implement, je n'ai pas réussi à faire grand chose.

Dans le code, ci-dessus, j'ai essyer de bufferiser les positions GPS afin de les envoyer. Ce qui est commnenter c'est mon essai du buffer.

Pourriez-vous m'aider, ou me montrer un exemple pour remplacer mon code en utilisant un buffer (gps_buffer)?

Milles mercis
357  International / Français / Je n'arrive pas à envoyer d'SMSs on: January 14, 2013, 02:57:05 am
Bonjour à tous,
Je planne depuis un long moment sur l'envoi d'SMS.
J'ai pourtant lu et relu la doc sans succès

Voici mon code.
Code:
SoftwareSerial cell(2,3);
 //Send SMS
    cell.println("AT+SBAND=6");
    cell.println("AT+CMGF=1"); // set SMS mode to text
    cell.println("AT+CMGS=");  // now send message...
    cell.println("\"");
    cell.println("+41760009988");//+41=Country code, 76= Area code
    cell.println("\"");
    cell.println("\r");
    delay(500); // give the module some thinking time
    cell.println("Bipme Alarm");   // our message to send
    cell.println("0x1A,10");  // ASCII equivalent of Ctrl-Z 0x1A,10
    delay(15000); // the SMS module needs time to return to OK status
   
    Serial.print("SMS Sent");
Je me demande si le problème vient pas de la ligne
Code:
cell.println("0x1A,10");  // ASCII equivalent of Ctrl-Z 0x1A,10
J'ai aussi d'essayé de mettre
Code:
cell.println("0x1A");
cell.println("Ctrl-Z");  // ASCII equivalent of Ctrl-Z 0x1A,10
mais sans succès.
Je vous serais très reconnaissant si vous pouviez corriger mon code.
Aussi l'autre doute que j'ai c'est
Code:
cell.println("AT+SBAND=6");
J'ai un peu totu essayer
Code:
cell.println("AT+SBAND=6");
cell.println("AT+SBAND=4");

Je suis en suisse et la frequence est 900/1800

je vous remercie
358  Using Arduino / Programming Questions / Re: Can not connect to the server and send a SMS on: January 14, 2013, 02:19:05 am
Definitively, it creasy. Yesterday evening, it was working, I switched all off, go to sleep, and this morning, the position are not display.
359  Using Arduino / Programming Questions / Re: Can not connect to the server and send a SMS on: January 13, 2013, 03:41:58 pm
Dear PaulS,

Thank for helping.
Really it really creasy. Now it work. I got the GPS position. I am totaly confused,  it's like if it only works on evening   smiley
Quote
//Create a 'fake' serial port. Pin 2 is the Rx pin, pin 3 is the Tx pin.
Ok I removed that comment
Quote
PString myString(buffer,sizeof(buffer));
For this, I am a bit confused. To resume, I should remove that line and replace all ma myString...
Code:
myString.print("AT+SSTRSEND=1,\"");
by something like this?
Code:
char index;
char gps_buffer[BUFFSIZ];
gps_buffer[index++] = 'AT+SSTRSEND=1,"';
gps_buffer[index++] = flat;
//myString.print(flat,DEC);
gps_buffer[index++] = ',';
gps_buffer[index++] = flon;

I am sorry if my question seams to be stupid, but I am not used to program with Sketch. I spend a lot of time to understand that code, specialy the readATString()

For the last point, I do not undertand what I should do.
Quote
You need to make it wait until a complete response has been received
OK, I understand that but Is not the case? The while loop run until to read a \r caracter. Is not?
Quote
The return code needs to reflect that timeout
Ok but where to definy the the timeout and how the know the amount of delay regarding the return code

Thank thank

360  Using Arduino / Programming Questions / Re: Can not connect to the server and send a SMS on: January 13, 2013, 02:25:48 pm
Dear PeterH and PaulS

Thank again for helping. Below you will find my full code.
I really thank you for your help because I am really lost in my understanding  smiley

Just a couple of Question.
PeterH, I do not undertand well your answer
Quote
If the modem always sends back a one line response every time you give it a command
Then we are agree that is not normal to have an empty line? We should have an ok or a message?

Initialy, it use the library NewSoftSerial.h but I use SoftwareSerial.h
Ma libraries are in Document/Arduiano/libraries/. I am on Mac
Code:
//Include the NewSoftSerial library to send serial commands to the cellular module.

#include <SoftwareSerial.h>
#include <TinyGPS.h>
#include <PString.h>

#define POWERPIN 4
#define GPSRATE 4800
#define BUFFSIZ 90

char at_buffer[BUFFSIZ];
char buffidx;

int firstTimeInLoop = 1;

int GPRS_registered;
int GPRS_AT_ready;
int count = 0;

//Will hold the incoming character from the Serial Port.

char incoming_char=0;     
char buffer[60];

PString myString(buffer,sizeof(buffer));

//Create a 'fake' serial port. Pin 2 is the Rx pin, pin 3 is the Tx pin.

SoftwareSerial cell(2,3); 

TinyGPS gps;

int redLedPin  = 11;
int blueLedPin = 12;

// Function to Blink a LED
// Parameters: lPin   - Pin of the LED
//             nBlink - Number of Times to Blink
//             msec   - Time in milliseconds between each blink

void blinkLed(int lPin, int nBlink, int msec) {
  if (nBlink) {
    for (int i = 0; i < nBlink; i++) {
      digitalWrite(lPin, HIGH);
      delay(msec);
      digitalWrite(lPin, LOW);
      delay(msec);
    }
  }
}

// Function to Switch on a LED
// Parameters: lPin - Pin of the LED

void onLed (int lPin) {
  digitalWrite(lPin, HIGH);
}

// Function to Switch off a LED
// Parameters: lPin - Pin of the LED

void offLed (int lPin) {
  digitalWrite(lPin, LOW);
}

void check_result() {
    int character;
    while (character = cell.read()) {
       if (character == '\n') {
           Serial.write(character);
           return;  // Response complete
       }
      if (character != -1)
          Serial.write(character);
     }
}

void freeRam (){
  extern int __heap_start, *__brkval;
  int v;
  int free = (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval);
  Serial.println(free);
}

// Do system wide initialization here in this function
void setup(){

// LED Pin are outputs. Switch the mode
  pinMode(redLedPin, OUTPUT);
  pinMode(blueLedPin, OUTPUT);

  /* Blink the Power LED */

  blinkLed(redLedPin,3,500);
 
  //Initialize serial ports for communication.

    Serial.begin(4800);
    cell.begin(9600);
 
  //Let's get started!

  Serial.println(F("Starting SM5100B Communication..."));

  delay(5000);

  /* Currently GPRS is not registered and AT is not ready */

  GPRS_registered = 0;
  GPRS_AT_ready = 0;
}

/* Reads AT String from the SM5100B GSM/GPRS Module */

void readATString(void) {
  char c;
  buffidx= 0; // start at begninning
  while (1) {
    if(cell.available() > 0) {
      c=cell.read();
      if (c == -1) {
        at_buffer[buffidx] = '\0';
        return;
      }
     
      if (c == '\n') {
        continue;
      }

      if ((buffidx == BUFFSIZ - 1) || (c == '\r')){
        at_buffer[buffidx] = '\0';
        return;
      }

      at_buffer[buffidx++]= c;
    }
  }
}

/* Processes the AT String to determine if GPRS is registered and AT is ready */

void ProcessATString() {
  if( strstr(at_buffer, "+SIND: 8") != 0 ) {
    GPRS_registered = 0;
    Serial.println(F("GPRS Network Not Available (0)"));
  }
 
  if (strstr(at_buffer, "+SIND: 10,\"SM\",0,\"FD\",0,\"LD\",0,\"MC\",0,\"RC\",0,\"ME\",0") != 0
    || strstr(at_buffer, "+SIND: 0") != 0) {
     Serial.println(F("SIM removed +SIND: 10+0"));
  }
 
  if (strstr(at_buffer, "+SIND: 10,\"SM\",1,\"FD\",1,\"LD\",1,\"MC\",1,\"RC\",1,\"ME\",1") != 0) {
    Serial.println(F("SIM inserted +SIND:10+1"));
    //successLED();
  }
 
  if (strstr(at_buffer, "+CME ERROR: 29") != 0) {
    Serial.println(F("+CME ERROR: 2"));
    return;
  }

  if( strstr(at_buffer, "+SIND: 11") != 0 ) {
    GPRS_registered=1;
    Serial.println(F("GPRS Registered (11)"));
    //blinkLed(redLedPin,5,100);
  }
 
  if( strstr(at_buffer, "+SIND: 7") != 0 ) {
    Serial.println(F("Emergency call only (7)"));
  }
 
  if( strstr(at_buffer, "+SIND: 3") != 0 ) {
    GPRS_AT_ready=1;
    Serial.println(F("GPRS AT almost Ready (3)"));
  }
 
  if( strstr(at_buffer, "+SIND: 4") != 0 ) {
    GPRS_AT_ready=1;
    Serial.println(F("GPRS AT Ready (4)"));
  }
 
  if( strstr(at_buffer, "+SIND: 15") != 0 ) {
    GPRS_AT_ready=1;
    Serial.println(F("Host error (15)"));
  }
 
  if( strstr(at_buffer, "+SIND: 16") != 0 ) {
    GPRS_AT_ready=1;
    Serial.println(F("Unknow error (16)"));
  }
 
  if( strstr(at_buffer, "+SIND: 17") != 0 ) {
    GPRS_AT_ready=1;
    Serial.println(F("GSM Fail (17)"));
  }
}

void loop() {
  /* If called for the first time, loop until GPRS and AT is ready */
  if(firstTimeInLoop) {
    firstTimeInLoop = 0;
    while (GPRS_registered == 0 || GPRS_AT_ready == 0) {
      readATString();
      ProcessATString();
    }
   
    if(POWERPIN) {
      pinMode(POWERPIN, OUTPUT);
    }

    pinMode(13, OUTPUT);
   
    Serial.println("GPS Parser Initialized");
    digitalWrite(POWERPIN, LOW);
   
    //Serial.println("Setting Band for 1800 frenquency");
    //cell.println("AT+SBAND=4");
   
    delay(1000);

    Serial.println("Setting up APN Context");
    cell.println("AT+CGDCONT=1,\"IP\",\"internet\"");
    check_result();
    delay(1000);
   
    Serial.println("Activating PDP Context");
    cell.println("AT+CGACT=1,1");
check_result();
    delay(1000);

    Serial.println("Configuring TCP connection to TCP Server");
    cell.println("AT+SDATACONF=1,\"TCP\",\"xxx.xxx.xx.xxx\",81");
check_result();
    delay(1000);

    Serial.println("Starting TCP Connection\n");
    cell.println("AT+SDATASTART=1,1");
check_result();

    //Send SMS
    cell.println("AT+SBAND=4");
    cell.println("AT+CMGF=1"); // set SMS mode to text
    cell.println("AT+CMGS=");  // now send message...
    cell.write(34); // ASCII equivalent of "
    cell.println("0041761235465"); //0041=Country code, 76=Area code
    cell.write(34);  // ASCII equivalent of "
    delay(500); // give the module some thinking time
    cell.println("Bipme Alarm");   // our message to send
    cell.write(26);  // ASCII equivalent of Ctrl-Z
    delay(15000); // the SMS module needs time to return to OK status
   
   
    Serial.println("SMS sent");

    onLed(redLedPin);

  } else {
    while(Serial.available()) {
      int c = Serial.read();
      if (gps.encode(c)) {
        onLed(blueLedPin);
        float flat, flon, fspeed, falt;
        unsigned long fix_age;
        gps.f_get_position(&flat,&flon,&fix_age);
       
        fspeed = gps.f_speed_kmph();
        falt = gps.f_altitude();

        //fcourse = gps.f_course();

        if(fix_age == TinyGPS::GPS_INVALID_AGE)

          Serial.println("No fix detected");

        else if (fix_age > 5000)

          Serial.println("WARNING: Possible Stale Data!");

        else {

          myString.print("AT+SSTRSEND=1,\"");

          myString.print(flat,DEC);

          myString.print(",");

          myString.print(flon,DEC);
         
          myString.print(",");
         
          myString.print(fspeed,2);
         
          myString.print(",");
         
          myString.print(falt,2);
         
          //myString.print(",");
         
          //myString.print(fcourse,DEC);
         
          myString.print(",");
         
          myString.print(String(count));

          myString.print("\"");

          Serial.println(myString);

          cell.println(myString);

          myString.begin();

          offLed(blueLedPin);
         
          count++;
         
        }
      }
    }
  }
}
Pages: 1 ... 22 23 [24] 25 26 27