Salut !

Je teste actuellement le module GSM SIM900 dans le cadre de mon projet de stage.

Voici le tuto que j'ai suivi :

https://lastminuteengineers.com/sim9...uino-tutorial/ 1

Pour m'aider, mon maître de stage m'a envoyé le même module, et j'ai également acheté une carte SIM Things.mobile compatible avec plusieurs opérateurs pour mon projet. J'ai ensuite créé un compte sur Thingsmobile.com afin d'activer le forfait de ma carte.

https://aws1.discourse-cdn.com/ardui...992bd61c72.png

De plus, je me suis assuré de désactiver la carte SIM en l'intégrant dans mon téléphone portable, afin que le programme du module GSM puisse le réactiver par la suite une fois insérée.

Du coup, je l'ai placée dans le support de la carte SIM, puis j'ai reproduit le montage ci-dessous avec 3 fils et une carte Arduino UNO, et fourni le module avec un adaptateur 5V.

https://aws1.discourse-cdn.com/ardui...e523154db8.png

Tout d'abord, j'ai testé le programme "Arduino Code - Testing AT Commands" du tutoriel en question:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <SoftwareSerial.h>
 
//Create software serial object to communicate with SIM900
SoftwareSerial mySerial(7, 8); //SIM900 Tx & Rx is connected to Arduino #7 & #8
 
void setup()
{
 
  //Begin serial communication with Arduino and Arduino IDE (Serial Monitor)
  Serial.begin(9600);
 
  //Begin serial communication with Arduino and SIM900
  mySerial.begin(9600);
 
  Serial.println("Initializing...");
  delay(1000);
 
  mySerial.println("AT"); //Handshaking with SIM900
  updateSerial();
  mySerial.println("AT+CSQ"); //Signal quality test, value range is 0-31 , 31 is the best
  updateSerial();
  mySerial.println("AT+CCID"); //Read SIM information to confirm whether the SIM is plugged
  updateSerial();
  mySerial.println("AT+CREG?"); //Check whether it has registered in the network
  updateSerial();
}
 
void loop()
{
  updateSerial();
}
 
void updateSerial()
{
  delay(500);
  while (Serial.available()) 
  {
    mySerial.write(Serial.read());//Forward what Serial received to Software Serial Port
  }
  while(mySerial.available()) 
  {
    Serial.write(mySerial.read());//Forward what Software Serial received to Serial Port
  }
}
Pour activer la carte SIM, il faut appuyer sur ce bouton pour faire fonctionner le code :

https://aws1.discourse-cdn.com/ardui...a536b8d91.jpeg

Et puis, voici ce que je reçois lorsque je téléverse ce programme sur la carte et ouvre le moniteur série :

https://aws1.discourse-cdn.com/ardui...c4edc50c1d.png

Pour AT+CSQ, le premier chiffre de sortie est la force en dB, et il est supérieur à 5, ce qui est bien.

Et pour AT+CREG, le deuxième chiffre de sortie est 5, ce qui indique que je suis enregistré sur le "roaming network".

Ensuite, j'ai essayé l'autre programme pour envoyer des SMS (sans oublier d'appuyer sur le bouton du module GSM) :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <SoftwareSerial.h>
 
//Create software serial object to communicate with SIM900
SoftwareSerial mySerial(7, 8); //SIM900 Tx & Rx is connected to Arduino #7 & #8
 
void setup()
{
  digitalWrite(9, HIGH);
  delay(1000);
  digitalWrite(9, LOW);
  delay(5000);
  //Begin serial communication with Arduino and Arduino IDE (Serial Monitor)
  Serial.begin(9600);
 
  //Begin serial communication with Arduino and SIM900
  mySerial.begin(9600);
 
  Serial.println("Initializing..."); 
  delay(1000);
 
  mySerial.println("AT"); //Handshaking with SIM900
  updateSerial();
 
  mySerial.println("AT+CMGF=1"); // Configuring TEXT mode
  updateSerial();
  mySerial.println("AT+CMGS=\"+33686920417\"");//change ZZ with country code and xxxxxxxxxxx with phone number to sms
  updateSerial();
  mySerial.print("YO"); //text content
  updateSerial();
  mySerial.write(26);
}
 
void loop()
{
}
 
void updateSerial()
{
  delay(500);
  while (Serial.available()) 
  {
    mySerial.write(Serial.read());//Forward what Serial received to Software Serial Port
  }
  while(mySerial.available()) 
  {
    Serial.write(mySerial.read());//Forward what Software Serial received to Serial Port
  }
}
J'ai essayé le programme, et ça a marché !

Cependant, je viens d'essayer la version hardware du programme (en appuyant sur le bouton), maintenant je veux activer la carte SIM avec le programme à la place (version software).

Pour cela, j'ai suivi ce montage :

https://aws1.discourse-cdn.com/ardui...cdb2e01e2d.png

https://aws1.discourse-cdn.com/ardui...c5003af68.jpeg

D'après le tutoriel, pour activer la carte SIM avec le programme, nous devons ajouter ces extraits de code dans le setup() :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
void SIM900power()
{
  pinMode(9, OUTPUT); 
  digitalWrite(9,LOW);
  delay(1000);
  digitalWrite(9,HIGH);
  delay(2000);
  digitalWrite(9,LOW);
  delay(3000);
}
Ensuite, j'ai testé à nouveau le programme "Arduino Code - Testing AT Commands" en ajoutant ces lignes de codes.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <SoftwareSerial.h>
 
//Create software serial object to communicate with SIM900
SoftwareSerial mySerial(7, 8); //SIM900 Tx & Rx is connected to Arduino #7 & #8
 
void setup()
{
  SIM900power();
 
  //Begin serial communication with Arduino and Arduino IDE (Serial Monitor)
  Serial.begin(9600);
 
  //Begin serial communication with Arduino and SIM900
  mySerial.begin(9600);
 
  Serial.println("Initializing...");
  delay(1000);
 
  mySerial.println("AT"); //Handshaking with SIM900
  updateSerial();
  mySerial.println("AT+CSQ"); //Signal quality test, value range is 0-31 , 31 is the best
  updateSerial();
  mySerial.println("AT+CCID"); //Read SIM information to confirm whether the SIM is plugged
  updateSerial();
  mySerial.println("AT+CREG?"); //Check whether it has registered in the network
  updateSerial();
}
 
void loop()
{
  updateSerial();
}
 
void updateSerial()
{
  delay(500);
  while (Serial.available()) 
  {
    mySerial.write(Serial.read());//Forward what Serial received to Software Serial Port
  }
  while(mySerial.available()) 
  {
    Serial.write(mySerial.read());//Forward what Software Serial received to Serial Port
  }
}
 
void SIM900power()
{
  pinMode(9, OUTPUT); 
  digitalWrite(9,LOW);
  delay(1000);
  digitalWrite(9,HIGH);
  delay(2000);
  digitalWrite(9,LOW);
  delay(3000);
}
Mais voici ce que je reçois en téléversant le programme et en ouvrant le moniteur série :

https://aws1.discourse-cdn.com/ardui...6e4fabf42d.png

Eh bien, ce n'est pas bon.

Pour la ligne AT + CSQ, la force du signal correspond à 0dB et concernant la ligne AT + CREG, je reçois 2 réponses.

-La première réponse affiche 2 comme deuxième chiffre, ce qui signifie que je ne suis enregistré sur aucun réseau malgré le clignotement de la LED toutes les 3 secondes.
-Le second n'affiche que le chiffre "5". Est-ce à dire que je suis connecté à un réseau étranger (j'habite en France d'ailleurs) ?

Quoi qu'il en soit, j'ai essayé plusieurs fois d'envoyer un sms en ajoutant ces extraits de code au programme d'envoi des sms, mais cela n'a toujours pas fonctionné.

Je pense que ces extraits de code supplémentaires avec la fonction SIM900power() pourraient être responsables du dysfonctionnement.

J'ai également découvert que nous devions souder le cavalier R13 SMD sur le shield (regardez la partie nommée Software trigger dans le tutoriel) et faire un "pont de soudure selon d'autres tutos.

Le module GSM que j'ai utilisé a été envoyé à l'origine par mon tuteur de stage avec beaucoup d'autres choses pour mon projet. J'ai alors pris une photo de l'emplacement R13.

https://aws1.discourse-cdn.com/ardui...2a3299f7d.jpeg

On pourrait voir un composant ici, mais je ne sais pas s'il est bien soudé comme indiqué sur le tuto ou non.
Si ce n'est pas le cas, quel genre d'outils me conseilleriez-vous pour le faire ?

Aussi, pour les cavaliers TX RX, dois-je les déplacer pour utiliser D1 et D0 au lieu de D7 et D8 ?

https://aws1.discourse-cdn.com/ardui...71f24558bc.png

J'ai utilisé D7 et D8 pour activer la carte SIM avec le bouton, et cela a bien fonctionné.

Merci d'avance si quelqu'un a une réponse.